diff options
Diffstat (limited to 'avmedia/source/gstreamer/gstplayer.cxx')
-rw-r--r-- | avmedia/source/gstreamer/gstplayer.cxx | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx index 614ff80ce352..a056b14b2b99 100644 --- a/avmedia/source/gstreamer/gstplayer.cxx +++ b/avmedia/source/gstreamer/gstplayer.cxx @@ -156,6 +156,7 @@ lcl_implHandleCreateWindowFunc( GstBus* pBus, GstMessage* pMsg, gpointer pData ) // - Player - // --------------- Player::Player( GString* pURI ) : + Player_BASE(m_aMutex), mpMutex( g_mutex_new() ), mpCond( g_cond_new() ), mpThread( NULL ), @@ -274,6 +275,7 @@ Player* Player::create( const ::rtl::OUString& rURL ) void SAL_CALL Player::start() throw( uno::RuntimeException ) { + ::osl::MutexGuard aGuard(m_aMutex); if( implInitPlayer() && !isPlaying() ) { gst_element_set_state( mpPlayer, GST_STATE_PLAYING ); @@ -284,6 +286,7 @@ void SAL_CALL Player::start() void SAL_CALL Player::stop() throw( uno::RuntimeException ) { + ::osl::MutexGuard aGuard(m_aMutex); if( implInitPlayer() && isPlaying() ) { gst_element_set_state( mpPlayer, GST_STATE_PAUSED ); @@ -295,7 +298,7 @@ sal_Bool SAL_CALL Player::isPlaying() throw( uno::RuntimeException ) { GstState aState = GST_STATE_NULL; - + ::osl::MutexGuard aGuard(m_aMutex); if( mpPlayer ) { gst_element_get_state( mpPlayer, &aState, NULL, GST_MAX_TIMEOUT ); @@ -308,6 +311,7 @@ sal_Bool SAL_CALL Player::isPlaying() double SAL_CALL Player::getDuration() throw( uno::RuntimeException ) { + ::osl::MutexGuard aGuard(m_aMutex); gint64 nDuration = 0; if( implInitPlayer() ) @@ -329,6 +333,7 @@ double SAL_CALL Player::getDuration() void SAL_CALL Player::setMediaTime( double fTime ) throw( uno::RuntimeException ) { + ::osl::MutexGuard aGuard(m_aMutex); if( implInitPlayer() ) { fTime = ::std::min( ::std::max( fTime, 0.0 ), getDuration() ); @@ -344,7 +349,7 @@ double SAL_CALL Player::getMediaTime() throw( uno::RuntimeException ) { double fRet = 0.0; - + ::osl::MutexGuard aGuard(m_aMutex); if( implInitPlayer() ) { GstFormat aFormat = GST_FORMAT_TIME; @@ -384,7 +389,7 @@ double SAL_CALL Player::getStopTime() Currently no need for implementation since higher levels of code don't set a stop time ATM !!! TODO: needs to be fully implemented if this functionality is needed at a later point of time */ - + ::osl::MutexGuard aGuard(m_aMutex); return( getDuration() ); } @@ -415,6 +420,7 @@ double SAL_CALL Player::getRate() void SAL_CALL Player::setPlaybackLoop( sal_Bool bSet ) throw( uno::RuntimeException ) { + ::osl::MutexGuard aGuard(m_aMutex); if (bSet) { g_atomic_int_compare_and_exchange(&mnLooping, 0, 1); @@ -429,6 +435,7 @@ void SAL_CALL Player::setPlaybackLoop( sal_Bool bSet ) sal_Bool SAL_CALL Player::isPlaybackLoop() throw( uno::RuntimeException ) { + ::osl::MutexGuard aGuard(m_aMutex); return( g_atomic_int_get( &mnLooping ) > 0 ); } @@ -436,6 +443,7 @@ sal_Bool SAL_CALL Player::isPlaybackLoop() void SAL_CALL Player::setMute( sal_Bool bSet ) throw( uno::RuntimeException ) { + ::osl::MutexGuard aGuard(m_aMutex); if( implInitPlayer() && ( bSet != isMute() ) ) { if( bSet ) @@ -454,6 +462,7 @@ sal_Bool SAL_CALL Player::isMute() throw( uno::RuntimeException ) { gdouble fGstVolume = 1.0; + ::osl::MutexGuard aGuard(m_aMutex); if( implInitPlayer() ) { @@ -467,6 +476,7 @@ sal_Bool SAL_CALL Player::isMute() void SAL_CALL Player::setVolumeDB( sal_Int16 nVolumeDB ) throw( uno::RuntimeException ) { + ::osl::MutexGuard aGuard(m_aMutex); if( implInitPlayer() ) { g_mutex_lock( mpMutex ); @@ -485,6 +495,7 @@ void SAL_CALL Player::setVolumeDB( sal_Int16 nVolumeDB ) sal_Int16 SAL_CALL Player::getVolumeDB() throw( uno::RuntimeException ) { + ::osl::MutexGuard aGuard(m_aMutex); return( static_cast< sal_Int16 >( g_atomic_int_get( &mnVolumeDB ) ) ); } @@ -493,6 +504,7 @@ awt::Size SAL_CALL Player::getPreferredPlayerWindowSize() throw( uno::RuntimeException ) { awt::Size aSize( 0, 0 ); + ::osl::MutexGuard aGuard(m_aMutex); if( implInitPlayer() && ( g_atomic_int_get( &mnIsVideoSource ) > 0 ) ) { @@ -517,6 +529,7 @@ uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( const uno::Sequence< uno::Any >& rArguments ) throw( uno::RuntimeException ) { + ::osl::MutexGuard aGuard(m_aMutex); uno::Reference< ::media::XPlayerWindow > xRet; awt::Size aSize( getPreferredPlayerWindowSize() ); @@ -560,6 +573,7 @@ uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( uno::Reference< media::XFrameGrabber > SAL_CALL Player::createFrameGrabber() throw( ::com::sun::star::uno::RuntimeException ) { + ::osl::MutexGuard aGuard(m_aMutex); FrameGrabber* pFrameGrabber = NULL; const awt::Size aPrefSize( getPreferredPlayerWindowSize() ); @@ -572,9 +586,9 @@ uno::Reference< media::XFrameGrabber > SAL_CALL Player::createFrameGrabber() } // ------------------------------------------------------------------------------ -void SAL_CALL Player::dispose() - throw( uno::RuntimeException ) +void SAL_CALL Player::disposing() { + ::osl::MutexGuard aGuard(m_aMutex); if( mpPlayer ) { stop(); @@ -585,16 +599,6 @@ void SAL_CALL Player::dispose() } // ------------------------------------------------------------------------------ -void SAL_CALL Player::addEventListener( const uno::Reference< lang::XEventListener >& /*rxListener*/ ) - throw( uno::RuntimeException ) -{} - -// ------------------------------------------------------------------------------ -void SAL_CALL Player::removeEventListener( const uno::Reference< lang::XEventListener >& /*rxListener*/ ) - throw( uno::RuntimeException ) -{} - -// ------------------------------------------------------------------------------ ::rtl::OUString SAL_CALL Player::getImplementationName() throw( uno::RuntimeException ) { |