summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorOcke Janssen [oj] <Ocke.Janssen@oracle.com>2011-03-15 11:46:34 +0100
committerOcke Janssen [oj] <Ocke.Janssen@oracle.com>2011-03-15 11:46:34 +0100
commit2112e06294b4cb08f97fc60d456a93c289c6ff2b (patch)
tree0aab619b1162cd2cc3afb9a630776b9dc9bf6a33 /avmedia
parentd07e4ca3fedf2c59bc4867ed4dd931dd35149cbb (diff)
parentadf931e2dc657c64dc74649849656d2bf2902c89 (diff)
Automated merge with http://hg-lan.germany.sun.com/ooo/DEV300
Diffstat (limited to 'avmedia')
-rw-r--r--avmedia/source/gstreamer/gstframegrabber.cxx8
-rw-r--r--avmedia/source/gstreamer/gstframegrabber.hxx6
-rw-r--r--avmedia/source/gstreamer/gstplayer.cxx34
-rw-r--r--avmedia/source/gstreamer/gstplayer.hxx29
-rw-r--r--avmedia/source/gstreamer/gstwindow.cxx2
-rw-r--r--avmedia/source/viewer/mediawindowbase_impl.cxx14
-rw-r--r--avmedia/source/win/player.cxx14
-rw-r--r--avmedia/source/win/player.hxx14
-rw-r--r--avmedia/source/win/window.cxx2
9 files changed, 66 insertions, 57 deletions
diff --git a/avmedia/source/gstreamer/gstframegrabber.cxx b/avmedia/source/gstreamer/gstframegrabber.cxx
index bd55e11f8afe..432054e95ae9 100644
--- a/avmedia/source/gstreamer/gstframegrabber.cxx
+++ b/avmedia/source/gstreamer/gstframegrabber.cxx
@@ -42,12 +42,18 @@ const gulong GRAB_TIMEOUT = 10000000;
// ----------------
FrameGrabber::FrameGrabber( GString* pURI ) :
- Player( pURI ),
mpFrameMutex( g_mutex_new() ),
mpFrameCond( g_cond_new() ),
mpLastPixbuf( NULL ),
mbIsInGrabMode( false )
{
+ if( pURI )
+ {
+ OSL_TRACE( ">>> --------------------------------" );
+ OSL_TRACE( ">>> Creating Player object with URL: %s", pURI->str );
+
+ mpThread = g_thread_create( Player::implThreadFunc, this, true, NULL );
+ }
}
// ------------------------------------------------------------------------------
diff --git a/avmedia/source/gstreamer/gstframegrabber.hxx b/avmedia/source/gstreamer/gstframegrabber.hxx
index 9a7ec1b74102..fac2e298fb2c 100644
--- a/avmedia/source/gstreamer/gstframegrabber.hxx
+++ b/avmedia/source/gstreamer/gstframegrabber.hxx
@@ -34,6 +34,7 @@
#ifndef _COM_SUN_STAR_MEDIA_XFRAMEGRABBER_HDL_
#include "com/sun/star/media/XFrameGrabber.hdl"
#endif
+#include <cppuhelper/implbase1.hxx>
namespace avmedia { namespace gst {
@@ -41,9 +42,8 @@ namespace avmedia { namespace gst {
// - FrameGrabber -
// ----------------
-class FrameGrabber : public Player,
- public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XFrameGrabber,
- ::com::sun::star::lang::XServiceInfo >
+class FrameGrabber :
+ public ::cppu::ImplInheritanceHelper1 < Player,::com::sun::star::media::XFrameGrabber >
{
public:
diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx
index f082cfc5c513..0e5ffcac0f01 100644
--- a/avmedia/source/gstreamer/gstplayer.cxx
+++ b/avmedia/source/gstreamer/gstplayer.cxx
@@ -70,6 +70,7 @@ struct GstBusSource : public GSource
// - Player -
// ---------------
Player::Player( GString* pURI ) :
+ Player_BASE(m_aMutex),
mpMutex( g_mutex_new() ),
mpCond( g_cond_new() ),
mpThread( NULL ),
@@ -188,6 +189,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 );
@@ -198,6 +200,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 );
@@ -209,7 +212,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 );
@@ -222,6 +225,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() )
@@ -243,6 +247,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() );
@@ -258,7 +263,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;
@@ -298,7 +303,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() );
}
@@ -329,6 +334,7 @@ double SAL_CALL Player::getRate()
void SAL_CALL Player::setPlaybackLoop( sal_Bool bSet )
throw( uno::RuntimeException )
{
+ ::osl::MutexGuard aGuard(m_aMutex);
if( bSet && !isPlaybackLoop() )
g_atomic_int_inc( &mnLooping );
else if( !bSet && isPlaybackLoop() )
@@ -339,6 +345,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 );
}
@@ -346,6 +353,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 )
@@ -364,6 +372,7 @@ sal_Bool SAL_CALL Player::isMute()
throw( uno::RuntimeException )
{
gdouble fGstVolume = 1.0;
+ ::osl::MutexGuard aGuard(m_aMutex);
if( implInitPlayer() )
{
@@ -377,6 +386,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 );
@@ -395,6 +405,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 ) ) );
}
@@ -403,6 +414,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 ) )
{
@@ -427,6 +439,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() );
@@ -470,6 +483,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() );
@@ -482,9 +496,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();
@@ -495,16 +509,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 )
{
diff --git a/avmedia/source/gstreamer/gstplayer.hxx b/avmedia/source/gstreamer/gstplayer.hxx
index d751e381258d..7d40728840a6 100644
--- a/avmedia/source/gstreamer/gstplayer.hxx
+++ b/avmedia/source/gstreamer/gstplayer.hxx
@@ -46,6 +46,8 @@ typedef struct _GOptionGroup GOptionGroup;
#include <gst/gst.h>
#include "com/sun/star/media/XPlayer.hdl"
+#include <cppuhelper/compbase2.hxx>
+#include <cppuhelper/basemutex.hxx>
namespace avmedia
{
@@ -56,10 +58,11 @@ class Window;
// ---------------
// - Player_Impl -
// ---------------
+typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::media::XPlayer,
+ ::com::sun::star::lang::XServiceInfo > Player_BASE;
-class Player : public ::cppu::WeakImplHelper3< ::com::sun::star::media::XPlayer,
- ::com::sun::star::lang::XComponent,
- ::com::sun::star::lang::XServiceInfo >
+class Player : public cppu::BaseMutex,
+ public Player_BASE
{
public:
@@ -67,7 +70,7 @@ public:
static Player* create( const ::rtl::OUString& rURL );
~Player();
-
+//protected:
// XPlayer
virtual void SAL_CALL start()
throw( ::com::sun::star::uno::RuntimeException );
@@ -127,18 +130,6 @@ public:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::media::XFrameGrabber > SAL_CALL createFrameGrabber()
throw( ::com::sun::star::uno::RuntimeException );
- // XComponent
- virtual void SAL_CALL dispose()
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL addEventListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL removeEventListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener )
- throw( ::com::sun::star::uno::RuntimeException );
-
// XServiceInfo
virtual ::rtl::OUString SAL_CALL getImplementationName()
throw( ::com::sun::star::uno::RuntimeException );
@@ -150,7 +141,9 @@ public:
throw( ::com::sun::star::uno::RuntimeException );
-protected:
+
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
Player( GString* pURI = NULL );
@@ -173,6 +166,7 @@ protected:
return( g_atomic_int_get( &mnInitialized ) > 0 );
}
+ static gpointer implThreadFunc( gpointer pData );
private:
@@ -193,7 +187,6 @@ private:
static gboolean implIdleFunc( gpointer pData );
- static gpointer implThreadFunc( gpointer pData );
static GstBusSyncReply implHandleCreateWindowFunc( GstBus* pBus,
GstMessage* pMsg,
diff --git a/avmedia/source/gstreamer/gstwindow.cxx b/avmedia/source/gstreamer/gstwindow.cxx
index 12606ad5e88b..417525c1946e 100644
--- a/avmedia/source/gstreamer/gstwindow.cxx
+++ b/avmedia/source/gstreamer/gstwindow.cxx
@@ -271,7 +271,7 @@ value in sequence of arguments" );
if( pParentWindow )
{
- meZoomLevel = media::ZoomLevel_ORIGINAL;
+ meZoomLevel = media::ZoomLevel_FIT_TO_WINDOW;
mpPlayerWindow = new PlayerChildWindow( pParentWindow );
mpPlayerWindow->SetBackground( Color( COL_BLACK ) );
diff --git a/avmedia/source/viewer/mediawindowbase_impl.cxx b/avmedia/source/viewer/mediawindowbase_impl.cxx
index 94a6c36ed064..cd9ac849132a 100644
--- a/avmedia/source/viewer/mediawindowbase_impl.cxx
+++ b/avmedia/source/viewer/mediawindowbase_impl.cxx
@@ -207,17 +207,11 @@ void MediaWindowBaseImpl::setPlayerWindow( const uno::Reference< media::XPlayerW
void MediaWindowBaseImpl::cleanUp()
{
- if( mxPlayer.is() )
- {
- mxPlayer->stop();
-
- uno::Reference< lang::XComponent > xComponent( mxPlayer, uno::UNO_QUERY );
+ uno::Reference< lang::XComponent > xComponent( mxPlayer, uno::UNO_QUERY );
+ if( xComponent.is() ) // this stops the player
+ xComponent->dispose();
- if( xComponent.is() )
- xComponent->dispose();
-
- mxPlayer.clear();
- }
+ mxPlayer.clear();
mpMediaWindow = NULL;
}
diff --git a/avmedia/source/win/player.cxx b/avmedia/source/win/player.cxx
index d27b2b55ff93..e5c010dc258a 100644
--- a/avmedia/source/win/player.cxx
+++ b/avmedia/source/win/player.cxx
@@ -70,6 +70,7 @@ bool isWindowsVistaOrHigher()
// ----------------
Player::Player( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
+ Player_BASE(m_aMutex),
mxMgr( rxMgr ),
mpGB( NULL ),
mpOMF( NULL ),
@@ -92,6 +93,15 @@ Player::Player( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
Player::~Player()
{
+ ::CoUninitialize();
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Player::disposing()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ stop();
if( mpBA )
mpBA->Release();
@@ -121,12 +131,8 @@ Player::~Player()
if( mpGB )
mpGB->Release();
-
- ::CoUninitialize();
}
-
// ------------------------------------------------------------------------------
-
bool Player::create( const ::rtl::OUString& rURL )
{
HRESULT hR;
diff --git a/avmedia/source/win/player.hxx b/avmedia/source/win/player.hxx
index 34a567750b74..d0c40e274f92 100644
--- a/avmedia/source/win/player.hxx
+++ b/avmedia/source/win/player.hxx
@@ -30,9 +30,10 @@
#include "wincommon.hxx"
-#ifndef _COM_SUN_STAR_MEDIA_XPLAYER_HDL_
#include "com/sun/star/media/XPlayer.hdl"
-#endif
+
+#include <cppuhelper/compbase2.hxx>
+#include <cppuhelper/basemutex.hxx>
struct IGraphBuilder;
struct IBaseFilter;
@@ -52,9 +53,11 @@ namespace avmedia { namespace win {
// ----------
// - Player -
// ----------
+typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::media::XPlayer,
+ ::com::sun::star::lang::XServiceInfo > Player_BASE;
-class Player : public ::cppu::WeakImplHelper2< ::com::sun::star::media::XPlayer,
- ::com::sun::star::lang::XServiceInfo >
+class Player : public cppu::BaseMutex,
+ public Player_BASE
{
public:
@@ -95,6 +98,9 @@ public:
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+
private:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr;
diff --git a/avmedia/source/win/window.cxx b/avmedia/source/win/window.cxx
index 1170505b440b..e077e097cc7b 100644
--- a/avmedia/source/win/window.cxx
+++ b/avmedia/source/win/window.cxx
@@ -374,7 +374,7 @@ bool Window::create( const uno::Sequence< uno::Any >& rArguments )
mrPlayer.setNotifyWnd( mnFrameWnd );
- meZoomLevel = media::ZoomLevel_ORIGINAL;
+ meZoomLevel = media::ZoomLevel_FIT_TO_WINDOW;
ImplLayoutVideoWindow();
#ifdef DDRAW_TEST_OUTPUT
}