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-05-29 13:24:34 +0200 |
commit | c1e1576dc081876b39e6f70d13571521a61eeb64 (patch) | |
tree | 9b6930bdd5cf9964fb0d6aa4a3f586fb93443526 | |
parent | 3453273086ef4c546c2a7dca41654627fd720cfa (diff) |
OGLPlayer: use more assertions
Change-Id: I0a224a90a3e99d12809d40612b1e66d7c023aebc
-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 88c93a6a0562..f37735af1c1c 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 { @@ -138,6 +140,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(); } @@ -145,6 +148,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); } @@ -152,12 +157,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); } @@ -165,6 +172,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); } @@ -172,18 +180,21 @@ 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); } 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); } @@ -220,11 +231,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"); @@ -254,6 +272,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() ) { @@ -301,6 +320,7 @@ IMPL_LINK(OGLPlayer,TimerHandler,Timer*,pTimer) if (pTimer == &m_aTimer) { osl::MutexGuard aGuard(m_aMutex); + assert(m_pOGLWindow); m_pOGLWindow->update(); } |