diff options
author | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-05-29 13:24:34 +0200 |
---|---|---|
committer | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-06-11 19:27:33 +0200 |
commit | cc9faa492d96cc1be308697ba56cc77a37a52191 (patch) | |
tree | 12983359d148916e0894569c6d6ce2bf13c16cd7 /avmedia | |
parent | 48513910e7abd2ebe1e7c5f5489fcb8e2daa28dc (diff) |
OGLPlayer: use more assertions
Change-Id: I0a224a90a3e99d12809d40612b1e66d7c023aebc
(cherry picked from commit c1e1576dc081876b39e6f70d13571521a61eeb64)
Diffstat (limited to 'avmedia')
-rw-r--r-- | avmedia/source/opengl/oglplayer.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx index 5aa87bd89ff8..c4741d455fc4 100644 --- a/avmedia/source/opengl/oglplayer.cxx +++ b/avmedia/source/opengl/oglplayer.cxx @@ -18,6 +18,8 @@ #include <tools/urlobj.hxx> #include <vcl/opengl/OpenGLHelper.hxx> +#include <cassert> + using namespace com::sun::star; namespace avmedia { namespace ogl { @@ -137,6 +139,7 @@ bool OGLPlayer::create( const OUString& rURL ) void SAL_CALL OGLPlayer::start() throw ( uno::RuntimeException, std::exception ) { osl::MutexGuard aGuard(m_aMutex); + assert(m_pHandle); gltf_animation_start(m_pHandle); m_aTimer.Start(); } @@ -144,6 +147,8 @@ void SAL_CALL OGLPlayer::start() throw ( uno::RuntimeException, std::exception ) void SAL_CALL OGLPlayer::stop() throw ( uno::RuntimeException, std::exception ) { osl::MutexGuard aGuard(m_aMutex); + assert(m_pHandle); + gltf_animation_stop(m_pHandle); m_aTimer.Stop(); gltf_animation_stop(m_pHandle); } @@ -151,12 +156,14 @@ void SAL_CALL OGLPlayer::stop() throw ( uno::RuntimeException, std::exception ) sal_Bool SAL_CALL OGLPlayer::isPlaying() throw ( uno::RuntimeException, std::exception ) { osl::MutexGuard aGuard(m_aMutex); + assert(m_pHandle); return (sal_Bool)gltf_animation_is_playing(m_pHandle); } double SAL_CALL OGLPlayer::getDuration() throw ( uno::RuntimeException, std::exception ) { osl::MutexGuard aGuard(m_aMutex); + assert(m_pHandle); return gltf_animation_get_duration(m_pHandle); } @@ -164,6 +171,7 @@ void SAL_CALL OGLPlayer::setMediaTime( double fTime ) throw ( uno::RuntimeExcept { // TODO: doesn't work, but cause problem in playing osl::MutexGuard aGuard(m_aMutex); + assert(m_pHandle); (void) fTime; //gltf_animation_set_time(m_pHandle, fTime); } @@ -171,6 +179,7 @@ void SAL_CALL OGLPlayer::setMediaTime( double fTime ) throw ( uno::RuntimeExcept double SAL_CALL OGLPlayer::getMediaTime() throw ( ::com::sun::star::uno::RuntimeException, std::exception ) { osl::MutexGuard aGuard(m_aMutex); + assert(m_pHandle); return 0.0; //gltf_animation_get_time(m_pHandle); } @@ -184,12 +193,14 @@ double SAL_CALL OGLPlayer::getRate() throw ( uno::RuntimeException, std::excepti void SAL_CALL OGLPlayer::setPlaybackLoop( sal_Bool bSet ) throw ( uno::RuntimeException, std::exception ) { osl::MutexGuard aGuard(m_aMutex); + assert(m_pHandle); gltf_animation_set_looping(m_pHandle, (int)bSet); } sal_Bool SAL_CALL OGLPlayer::isPlaybackLoop() throw ( uno::RuntimeException, std::exception ) { osl::MutexGuard aGuard(m_aMutex); + assert(m_pHandle); return (sal_Bool)gltf_animation_get_looping(m_pHandle); } @@ -226,11 +237,18 @@ uno::Reference< media::XPlayerWindow > SAL_CALL OGLPlayer::createPlayerWindow( c osl::MutexGuard aGuard( m_aMutex ); assert( rArguments.getLength() >= 3 ); + assert(m_pHandle); sal_IntPtr pIntPtr = 0; rArguments[ 2 ] >>= pIntPtr; SystemChildWindow *pChildWindow = reinterpret_cast< SystemChildWindow* >( pIntPtr ); + if( !pChildWindow ) + { + SAL_WARN("avmedia.opengl", "Failed to get the SystemChildWindow for rendering!"); + return uno::Reference< media::XPlayerWindow >(); + } + if( !m_aContext.init(pChildWindow) ) { SAL_WARN("avmedia.opengl", "Context initialization failed"); @@ -260,6 +278,7 @@ uno::Reference< media::XFrameGrabber > SAL_CALL OGLPlayer::createFrameGrabber() throw ( uno::RuntimeException, std::exception ) { osl::MutexGuard aGuard(m_aMutex); + assert(m_pHandle); if( !m_aContext.init() ) { @@ -307,6 +326,7 @@ IMPL_LINK(OGLPlayer,TimerHandler,Timer*,pTimer) if (pTimer == &m_aTimer) { osl::MutexGuard aGuard(m_aMutex); + assert(m_pOGLWindow); m_pOGLWindow->update(); } |