summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--avmedia/source/gstreamer/ChangeLog112
-rw-r--r--avmedia/source/gstreamer/exports.dxp3
-rw-r--r--avmedia/source/gstreamer/gstcommon.hxx75
-rw-r--r--avmedia/source/gstreamer/gstframegrabber.cxx236
-rw-r--r--avmedia/source/gstreamer/gstframegrabber.hxx70
-rw-r--r--avmedia/source/gstreamer/gstmanager.cxx106
-rw-r--r--avmedia/source/gstreamer/gstmanager.hxx66
-rw-r--r--avmedia/source/gstreamer/gstplayer.cxx620
-rw-r--r--avmedia/source/gstreamer/gstplayer.hxx112
-rw-r--r--avmedia/source/gstreamer/gstuno.cxx103
-rw-r--r--avmedia/source/gstreamer/gstwindow.cxx357
-rw-r--r--avmedia/source/gstreamer/gstwindow.hxx111
-rw-r--r--avmedia/source/gstreamer/makefile.mk77
13 files changed, 2048 insertions, 0 deletions
diff --git a/avmedia/source/gstreamer/ChangeLog b/avmedia/source/gstreamer/ChangeLog
new file mode 100644
index 0000000000..8671b11a97
--- /dev/null
+++ b/avmedia/source/gstreamer/ChangeLog
@@ -0,0 +1,112 @@
+2006-09-22 Radek Doulik <rodo@novell.com>
+
+ * gstplayer.cxx (processSyncMessage): remember GstXOverlay
+ (processMessage): explicit expose when we reach paused state -
+ this mean that now once stream is loaded/video inserted, the 1st
+ frame is rendered
+ (setMediaTime): if not playing set PAUSED state again, seems like
+ seek is changing state to PLAYING. this fixes problem when stop
+ seeked to begin and started playing again
+
+2006-09-21 Radek Doulik <rodo@novell.com>
+
+ * gstplayer.cxx (processSyncMessage): when error occurs, set the
+ condition so that OOo does'n waste time waiting for us to finish
+ reaching PAUSED state
+
+2006-09-19 Radek Doulik <rodo@novell.com>
+
+ * gstplayer.cxx (processSyncMessage): set condition even if we
+ weren't able to get video size - might be audio only stream
+ (getPreferredPlayerWindowSize): init size to 0, 0 - in case we
+ don't have video size, it will fallback to system media window
+ content (some icon)
+
+2006-08-31 Radek Doulik <rodo@novell.com>
+
+ * gstplayer.cxx (processSyncMessage): when we get to paused state,
+ get stream-info from playbin and look for video size. set
+ condition when done
+ (Player): added width, height, size condition
+ (preparePlaybin): new helper method, extracted from create
+ method. use fake video sink in the beggining so that we don't get
+ xwindow-id message too early
+ (getPreferredPlayerWindowSize): wait for size condition to be sure
+ we know video size (if possible). reset video sink to default one
+ (NULL) and set state to READY and immediatelly to PAUSE so that
+ the default sink is relinked
+
+2006-08-16 Radek Doulik <rodo@novell.com>
+
+ * gstplayer.cxx (create): set state to PAUSED so that we can query
+ duration ASAP
+ (processMessage): watch for state changed and query duration when
+ going to PAUSED state
+
+2006-08-15 Radek Doulik <rodo@novell.com>
+
+ * makefile.mk: require gstreamer-plugins-base-0.10 and link with
+ gst interfaces library
+
+ * gstwindow.cxx: make it build
+
+ * gstplayer.cxx: removed WINNT ifdefs (relict from time when I
+ thought Cedric develops on win architecture)
+ (gst_pipeline_bus_callback): added sync handler for setting
+ xwindow id to to video sink
+ (processSyncMessage): new metrhod, process message from sync
+ handler
+ (create): set playbin state to READY so that playback start is
+ faster
+ (createPlayerWindow): implemented, we pass xwindow id in 3rd
+ argument
+
+2006-08-04 Radek Doulik <rodo@novell.com>
+
+ * gstplayer.cxx (create): add bus watch, watch for EOS in
+ processMessage method (called from watch callback)
+
+2006-08-02 Radek Doulik <rodo@novell.com>
+
+ * gstplayer.cxx: test for mpPlaybin != NULL before using it,
+ initialize it in constructor to NULL and also reset it to NULL
+ after unrefing
+ (getDuration): check for sucessful query and the right format
+ (getMediaTime): ditto,
+ (setMediaTime): implemented
+
+2006-08-01 Radek Doulik <rodo@novell.com>
+
+ * gstwindow.hxx: removed mpWndClass for now, so that the rest
+ compiles
+
+ * gstuno.cxx (component_getFactory): s/DirectX/GStreamer so that
+ component is loaded
+
+ * gstplayer.cxx (Player::Player): do not create gerror object, it
+ is noit needed, free the error object only if created during
+ initialization of gstremer
+ (Player::create, start, stop): use g_main_loop only on windows
+ (create): fixed ascURL declaration, added rtl namespace prefix
+ (setMute): set mbMuted
+ (setVolumeDB): convert avmedia volume to gstreamer volume, added
+ missing NULL to the end of g_object_set call
+ (getVolumeDB): convert gstreamer volume back to avmedia volume
+
+ * gstplayer.hxx: keep g_main_loop only on win platform. make
+ mnUnmutedVolume double, moved mbInitialized to the end to quiet
+ compiler warning
+
+ * gstcommon.hxx: removed wrong #include <rtl/ustring>
+
+ * renamed source files, prefixed the names with gst so that obj
+ file names do not clash with xine object files
+
+ * makefile.mk: changed PRJNAME and TARGET to reflect
+ gstreamer. enabled build on unix as well. removed win library
+ references. removed source files which are not yet ported from
+ SLOFILES list.
+
+2006-08-31 Radek Doulik <rodo@novell.com>
+
+ * imported initial sources from Cedric Bosdonnat \ No newline at end of file
diff --git a/avmedia/source/gstreamer/exports.dxp b/avmedia/source/gstreamer/exports.dxp
new file mode 100644
index 0000000000..9630d7e067
--- /dev/null
+++ b/avmedia/source/gstreamer/exports.dxp
@@ -0,0 +1,3 @@
+component_getImplementationEnvironment
+component_writeInfo
+component_getFactory
diff --git a/avmedia/source/gstreamer/gstcommon.hxx b/avmedia/source/gstreamer/gstcommon.hxx
new file mode 100644
index 0000000000..d3e1f2419b
--- /dev/null
+++ b/avmedia/source/gstreamer/gstcommon.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2010 Novell, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _GSTCOMMON_HXX
+#define _GSTCOMMON_HXX
+
+#include <gst/gst.h>
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+#ifndef _URLOBJ_HXX
+#include <tools/urlobj.hxx>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE1_HXX_
+#include <cppuhelper/implbase1.hxx>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE2_HXX_
+#include <cppuhelper/implbase2.hxx>
+#endif
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _CPPUHELPER_FACTORY_HXX_
+#include <cppuhelper/factory.hxx>
+#endif
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/awt/KeyModifier.hpp>
+#include <com/sun/star/awt/MouseButton.hpp>
+#include <com/sun/star/media/XManager.hpp>
+
+#define WM_GRAPHNOTIFY (WM_USER + 567)
+
+#endif // _GSTCOMMOM_HXX
diff --git a/avmedia/source/gstreamer/gstframegrabber.cxx b/avmedia/source/gstreamer/gstframegrabber.cxx
new file mode 100644
index 0000000000..513a2c2a2d
--- /dev/null
+++ b/avmedia/source/gstreamer/gstframegrabber.cxx
@@ -0,0 +1,236 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2010 Novell, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <tools/prewin.h>
+#include <windows.h>
+#include <objbase.h>
+#include <strmif.h>
+#include <Amvideo.h>
+#include <Qedit.h>
+#include <uuids.h>
+#include <tools/postwin.h>
+
+#include "framegrabber.hxx"
+#include "player.hxx"
+
+#include <tools/stream.hxx>
+#include <vcl/graph.hxx>
+#include <unotools/localfilehelper.hxx>
+
+#define AVMEDIA_GST_FRAMEGRABBER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.FrameGrabber_GStreamer"
+#define AVMEDIA_GST_FRAMEGRABBER_SERVICENAME "com.sun.star.media.FrameGrabber_GStreamer"
+
+using namespace ::com::sun::star;
+
+namespace avmedia { namespace gstreamer {
+
+// ----------------
+// - FrameGrabber -
+// ----------------
+
+FrameGrabber::FrameGrabber( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
+ mxMgr( rxMgr )
+{
+ ::CoInitialize( NULL );
+}
+
+// ------------------------------------------------------------------------------
+
+FrameGrabber::~FrameGrabber()
+{
+ ::CoUninitialize();
+}
+
+// ------------------------------------------------------------------------------
+
+IMediaDet* FrameGrabber::implCreateMediaDet( const ::rtl::OUString& rURL ) const
+{
+ IMediaDet* pDet = NULL;
+
+ if( SUCCEEDED( CoCreateInstance( CLSID_MediaDet, NULL, CLSCTX_INPROC_SERVER, IID_IMediaDet, (void**) &pDet ) ) )
+ {
+ String aLocalStr;
+
+ if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( rURL, aLocalStr ) && aLocalStr.Len() )
+ {
+ if( !SUCCEEDED( pDet->put_Filename( ::SysAllocString( aLocalStr.GetBuffer() ) ) ) )
+ {
+ pDet->Release();
+ pDet = NULL;
+ }
+ }
+ }
+
+ return pDet;
+}
+
+// ------------------------------------------------------------------------------
+
+bool FrameGrabber::create( const ::rtl::OUString& rURL )
+{
+ // just check if a MediaDet interface can be created with the given URL
+ IMediaDet* pDet = implCreateMediaDet( rURL );
+
+ if( pDet )
+ {
+ maURL = rURL;
+ pDet->Release();
+ pDet = NULL;
+ }
+ else
+ maURL = ::rtl::OUString();
+
+ return( maURL.getLength() > 0 );
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Reference< graphic::XGraphic > SAL_CALL FrameGrabber::grabFrame( double fMediaTime )
+ throw (uno::RuntimeException)
+{
+ uno::Reference< graphic::XGraphic > xRet;
+ IMediaDet* pDet = implCreateMediaDet( maURL );
+
+ if( pDet )
+ {
+ double fLength;
+ long nStreamCount;
+ bool bFound = false;
+
+ if( SUCCEEDED( pDet->get_OutputStreams( &nStreamCount ) ) )
+ {
+ for( long n = 0; ( n < nStreamCount ) && !bFound; ++n )
+ {
+ GUID aMajorType;
+
+ if( SUCCEEDED( pDet->put_CurrentStream( n ) ) &&
+ SUCCEEDED( pDet->get_StreamType( &aMajorType ) ) &&
+ ( aMajorType == MEDIATYPE_Video ) )
+ {
+ bFound = true;
+ }
+ }
+ }
+
+ if( bFound &&
+ ( S_OK == pDet->get_StreamLength( &fLength ) ) &&
+ ( fLength > 0.0 ) && ( fMediaTime >= 0.0 ) && ( fMediaTime <= fLength ) )
+ {
+ AM_MEDIA_TYPE aMediaType;
+ long nWidth = 0, nHeight = 0, nSize = 0;
+
+ if( SUCCEEDED( pDet->get_StreamMediaType( &aMediaType ) ) )
+ {
+ if( ( aMediaType.formattype == FORMAT_VideoInfo ) &&
+ ( aMediaType.cbFormat >= sizeof( VIDEOINFOHEADER ) ) )
+ {
+ VIDEOINFOHEADER* pVih = reinterpret_cast< VIDEOINFOHEADER* >( aMediaType.pbFormat );
+
+ nWidth = pVih->bmiHeader.biWidth;
+ nHeight = pVih->bmiHeader.biHeight;
+
+ if( nHeight < 0 )
+ nHeight *= -1;
+ }
+
+ if( aMediaType.cbFormat != 0 )
+ {
+ ::CoTaskMemFree( (PVOID) aMediaType.pbFormat );
+ aMediaType.cbFormat = 0;
+ aMediaType.pbFormat = NULL;
+ }
+
+ if( aMediaType.pUnk != NULL )
+ {
+ aMediaType.pUnk->Release();
+ aMediaType.pUnk = NULL;
+ }
+ }
+
+ if( ( nWidth > 0 ) && ( nHeight > 0 ) &&
+ SUCCEEDED( pDet->GetBitmapBits( 0, &nSize, NULL, nWidth, nHeight ) ) &&
+ ( nSize > 0 ) )
+ {
+ char* pBuffer = new char[ nSize ];
+
+ try
+ {
+ if( SUCCEEDED( pDet->GetBitmapBits( fMediaTime, NULL, pBuffer, nWidth, nHeight ) ) )
+ {
+ SvMemoryStream aMemStm( pBuffer, nSize, STREAM_READ | STREAM_WRITE );
+ Bitmap aBmp;
+
+ if( aBmp.Read( aMemStm, false ) && !aBmp.IsEmpty() )
+ {
+ const Graphic aGraphic( aBmp );
+ xRet = aGraphic.GetXGraphic();
+ }
+ }
+ }
+ catch( ... )
+ {
+ }
+
+ delete [] pBuffer;
+ }
+ }
+
+ pDet->Release();
+ }
+
+ return xRet;
+}
+
+// ------------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL FrameGrabber::getImplementationName( )
+ throw (uno::RuntimeException)
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GST_FRAMEGRABBER_IMPLEMENTATIONNAME ) );
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL FrameGrabber::supportsService( const ::rtl::OUString& ServiceName )
+ throw (uno::RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_GST_FRAMEGRABBER_SERVICENAME ) );
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Sequence< ::rtl::OUString > SAL_CALL FrameGrabber::getSupportedServiceNames( )
+ throw (uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aRet(1);
+ aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_GST_FRAMEGRABBER_SERVICENAME ) );
+
+ return aRet;
+}
+
+} // namespace gstreamer
+} // namespace avmedia
diff --git a/avmedia/source/gstreamer/gstframegrabber.hxx b/avmedia/source/gstreamer/gstframegrabber.hxx
new file mode 100644
index 0000000000..11f6b6f8b2
--- /dev/null
+++ b/avmedia/source/gstreamer/gstframegrabber.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2010 Novell, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _FRAMEGRABBER_HXX
+#define _FRAMEGRABBER_HXX
+
+#include "gstcommon.hxx"
+
+#ifndef _COM_SUN_STAR_MEDIA_XFRAMEGRABBER_HDL_
+#include "com/sun/star/media/XFrameGrabber.hdl"
+#endif
+
+namespace avmedia { namespace gstreamer {
+
+// ----------------
+// - FrameGrabber -
+// ----------------
+
+class FrameGrabber : public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XFrameGrabber,
+ ::com::sun::star::lang::XServiceInfo >
+{
+public:
+
+ FrameGrabber( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMgr );
+ ~FrameGrabber();
+
+ bool create( const ::rtl::OUString& rURL );
+
+ // XFrameGrabber
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > SAL_CALL grabFrame( double fMediaTime ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ 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);
+
+private:
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr;
+ ::rtl::OUString maURL;
+};
+
+} // namespace gstreamer
+} // namespace avmedia
+
+#endif // _FRAMEGRABBER_HXX
diff --git a/avmedia/source/gstreamer/gstmanager.cxx b/avmedia/source/gstreamer/gstmanager.cxx
new file mode 100644
index 0000000000..bfb077b253
--- /dev/null
+++ b/avmedia/source/gstreamer/gstmanager.cxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2010 Novell, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "gstmanager.hxx"
+#include "gstplayer.hxx"
+
+#include <tools/urlobj.hxx>
+
+#define AVMEDIA_GST_MANAGER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Manager_GStreamer"
+#define AVMEDIA_GST_MANAGER_SERVICENAME "com.sun.star.media.Manager"
+
+#if DEBUG
+#define DBG OSL_TRACE
+#else
+#define DBG(...)
+#endif
+
+using namespace ::com::sun::star;
+
+namespace avmedia { namespace gstreamer {
+// ----------------
+// - Manager -
+// ----------------
+
+Manager::Manager( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
+ mxMgr( rxMgr )
+{
+ DBG( "avmediagst: Manager::Manager" );
+}
+
+// ------------------------------------------------------------------------------
+
+Manager::~Manager()
+{
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Reference< media::XPlayer > SAL_CALL Manager::createPlayer( const ::rtl::OUString& rURL )
+ throw (uno::RuntimeException)
+{
+ Player* pPlayer( new Player( mxMgr ) );
+ uno::Reference< media::XPlayer > xRet( pPlayer );
+ const INetURLObject aURL( rURL );
+
+ DBG( "avmediagst: Manager::createPlayer" );
+
+ if( !pPlayer->create( aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ) )
+ xRet = uno::Reference< media::XPlayer >();
+
+ return xRet;
+}
+
+// ------------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL Manager::getImplementationName( )
+ throw (uno::RuntimeException)
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GST_MANAGER_IMPLEMENTATIONNAME ) );
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL Manager::supportsService( const ::rtl::OUString& ServiceName )
+ throw (uno::RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_GST_MANAGER_SERVICENAME ) );
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Sequence< ::rtl::OUString > SAL_CALL Manager::getSupportedServiceNames( )
+ throw (uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aRet(1);
+ aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_GST_MANAGER_SERVICENAME ) );
+
+ return aRet;
+}
+
+} // namespace gstreamer
+} // namespace avmedia
diff --git a/avmedia/source/gstreamer/gstmanager.hxx b/avmedia/source/gstreamer/gstmanager.hxx
new file mode 100644
index 0000000000..eebf4edd73
--- /dev/null
+++ b/avmedia/source/gstreamer/gstmanager.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2010 Novell, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _MANAGER_HXX
+#define _MANAGER_HXX
+
+#include "gstcommon.hxx"
+
+#ifndef _COM_SUN_STAR_MEDIA_XMANAGER_HDL_
+#include "com/sun/star/media/XManager.hdl"
+#endif
+
+// -----------
+// - Manager -
+// -----------
+
+namespace avmedia { namespace gstreamer {
+
+class Manager : public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XManager,
+ ::com::sun::star::lang::XServiceInfo >
+{
+public:
+
+ Manager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMgr );
+ ~Manager();
+
+ // XManager
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > SAL_CALL createPlayer( const ::rtl::OUString& aURL ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ 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);
+private:
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr;
+};
+
+} // namespace gstreamer
+} // namespace avmedia
+
+#endif // _MANAGER_HXX
diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx
new file mode 100644
index 0000000000..1bb8246cc4
--- /dev/null
+++ b/avmedia/source/gstreamer/gstplayer.cxx
@@ -0,0 +1,620 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2010 Novell, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <math.h>
+
+#ifndef __RTL_USTRING_
+#include <rtl/string.hxx>
+#endif
+
+#include "gstplayer.hxx"
+#include "gstframegrabber.hxx"
+#include "gstwindow.hxx"
+
+#include <gst/interfaces/xoverlay.h>
+
+#define AVMEDIA_GST_PLAYER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Player_GStreamer"
+#define AVMEDIA_GST_PLAYER_SERVICENAME "com.sun.star.media.Player_GStreamer"
+
+#if DEBUG
+#define DBG OSL_TRACE
+#else
+#define DBG(...)
+#endif
+
+using namespace ::com::sun::star;
+
+namespace avmedia { namespace gstreamer {
+
+// ----------------
+// - Player -
+// ----------------
+
+Player::Player( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
+ mxMgr( rxMgr ),
+ mpPlaybin( NULL ),
+ mbFakeVideo (sal_False ),
+ mnUnmutedVolume( 0 ),
+ mbMuted( false ),
+ mbLooping( false ),
+ mbInitialized( false ),
+ mnWindowID( 0 ),
+ mpXOverlay( NULL ),
+ mnDuration( 0 ),
+ mnWidth( 0 ),
+ mnHeight( 0 ),
+ maSizeCondition( osl_createCondition() )
+{
+ // Initialize GStreamer library
+ int argc = 1;
+ char *arguments[] = { "openoffice.org" };
+ char** argv = arguments;
+ GError* pError = NULL;
+
+ mbInitialized = gst_init_check( &argc, &argv, &pError );
+
+ if (pError != NULL)
+ // TODO: thow an exception?
+ g_error_free (pError);
+}
+
+// ------------------------------------------------------------------------------
+
+Player::~Player()
+{
+ // Release the elements and pipeline
+ if( mbInitialized )
+ {
+ if( mpPlaybin )
+ {
+ gst_element_set_state( mpPlaybin, GST_STATE_NULL );
+ gst_object_unref( GST_OBJECT( mpPlaybin ) );
+
+ mpPlaybin = NULL;
+ }
+
+ if( mpXOverlay ) {
+ g_object_unref( G_OBJECT ( mpXOverlay ) );
+ mpXOverlay = NULL;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+static gboolean gst_pipeline_bus_callback( GstBus *, GstMessage *message, gpointer data )
+{
+ Player* pPlayer = (Player *) data;
+
+ pPlayer->processMessage( message );
+
+ return TRUE;
+}
+
+static GstBusSyncReply gst_pipeline_bus_sync_handler( GstBus *, GstMessage * message, gpointer data )
+{
+ Player* pPlayer = (Player *) data;
+
+ return pPlayer->processSyncMessage( message );
+}
+
+void Player::processMessage( GstMessage *message )
+{
+ //DBG ( "gst message received: src name: %s structure type: %s",
+ // gst_object_get_name (message->src),
+ // message->structure ? gst_structure_get_name (message->structure) : "<none>");
+
+ switch( GST_MESSAGE_TYPE( message ) ) {
+ case GST_MESSAGE_EOS:
+ //DBG( "EOS, reset state to NULL" );
+ gst_element_set_state( mpPlaybin, GST_STATE_READY );
+ break;
+ case GST_MESSAGE_STATE_CHANGED:
+ if( message->src == GST_OBJECT( mpPlaybin ) ) {
+ GstState newstate, pendingstate;
+
+ gst_message_parse_state_changed (message, NULL, &newstate, &pendingstate);
+
+ if( newstate == GST_STATE_PAUSED &&
+ pendingstate == GST_STATE_VOID_PENDING &&
+ mpXOverlay )
+ gst_x_overlay_expose( mpXOverlay );
+ }
+ default:
+ break;
+ }
+}
+
+GstBusSyncReply Player::processSyncMessage( GstMessage *message )
+{
+ DBG( "%p processSyncMessage", this );
+ //DBG ( "gst message received: src name: %s structure type: %s",
+ // gst_object_get_name (message->src),
+ // message->structure ? gst_structure_get_name (message->structure) : "<none>");
+
+ if (message->structure) {
+ if( !strcmp( gst_structure_get_name( message->structure ), "prepare-xwindow-id" ) && mnWindowID != 0 ) {
+ if( mpXOverlay )
+ g_object_unref( G_OBJECT ( mpXOverlay ) );
+ mpXOverlay = GST_X_OVERLAY( GST_MESSAGE_SRC( message ) );
+ g_object_ref( G_OBJECT ( mpXOverlay ) );
+ gst_x_overlay_set_xwindow_id( mpXOverlay, mnWindowID );
+ return GST_BUS_DROP;
+ }
+ }
+
+ if( GST_MESSAGE_TYPE( message ) == GST_MESSAGE_STATE_CHANGED ) {
+ if( message->src == GST_OBJECT( mpPlaybin ) ) {
+ GstState newstate, pendingstate;
+
+ gst_message_parse_state_changed (message, NULL, &newstate, &pendingstate);
+
+ DBG( "%p state change received, new state %d", this, newstate );
+ if( newstate == GST_STATE_PAUSED &&
+ pendingstate == GST_STATE_VOID_PENDING ) {
+
+ DBG( "%p change to paused received", this );
+
+ if( mnDuration == 0) {
+ GstFormat format = GST_FORMAT_TIME;
+ gint64 gst_duration = 0L;
+
+ if( gst_element_query_duration( mpPlaybin, &format, &gst_duration) && format == GST_FORMAT_TIME && gst_duration > 0L )
+ mnDuration = gst_duration;
+ }
+
+ if( mnWidth == 0 ) {
+ GList *pStreamInfo = NULL;
+
+ g_object_get( G_OBJECT( mpPlaybin ), "stream-info", &pStreamInfo, NULL );
+
+ for ( ; pStreamInfo != NULL; pStreamInfo = pStreamInfo->next) {
+ GObject *pInfo = G_OBJECT( pStreamInfo->data );
+
+ if( !pInfo )
+ continue;
+
+ int nType;
+ g_object_get( pInfo, "type", &nType, NULL );
+ GEnumValue *pValue = g_enum_get_value( G_PARAM_SPEC_ENUM( g_object_class_find_property( G_OBJECT_GET_CLASS( pInfo ), "type" ) )->enum_class,
+ nType );
+
+ if( !g_strcasecmp( pValue->value_nick, "video" ) ) {
+ GstStructure *pStructure;
+ GstPad *pPad;
+
+ g_object_get( pInfo, "object", &pPad, NULL );
+ pStructure = gst_caps_get_structure( GST_PAD_CAPS( pPad ), 0 );
+ if( pStructure ) {
+ gst_structure_get_int( pStructure, "width", &mnWidth );
+ gst_structure_get_int( pStructure, "height", &mnHeight );
+ DBG( "queried size: %d x %d", mnWidth, mnHeight );
+ }
+ }
+ }
+
+ sal_Bool aSuccess = osl_setCondition( maSizeCondition );
+ DBG( "%p set condition result: %d", this, aSuccess );
+ }
+ }
+ }
+ } else if( GST_MESSAGE_TYPE( message ) == GST_MESSAGE_ERROR ) {
+ if( mnWidth == 0 ) {
+ // an error occured, set condition so that OOo thread doesn't wait for us
+ sal_Bool aSuccess = osl_setCondition( maSizeCondition );
+ DBG( "%p set condition result: %d", this, aSuccess );
+ }
+ }
+
+ return GST_BUS_PASS;
+}
+
+void Player::preparePlaybin( const ::rtl::OUString& rURL, bool bFakeVideo )
+{
+ GstBus *pBus;
+
+ //sal_Bool aSuccess = osl_setCondition( maSizeCondition );
+ //DBG( "%p set condition result: %d", this, aSuccess );
+
+ if( mpPlaybin != NULL ) {
+ gst_element_set_state( mpPlaybin, GST_STATE_NULL );
+ g_object_unref( mpPlaybin );
+ }
+
+ mpPlaybin = gst_element_factory_make( "playbin", NULL );
+
+ if( bFakeVideo )
+ g_object_set( G_OBJECT( mpPlaybin ), "video-sink", gst_element_factory_make( "fakesink", NULL ), NULL );
+
+ mbFakeVideo = bFakeVideo;
+
+ rtl::OString ascURL = OUStringToOString( rURL, RTL_TEXTENCODING_ASCII_US );
+ g_object_set( G_OBJECT( mpPlaybin ), "uri", ascURL.getStr() , NULL );
+
+ pBus = gst_element_get_bus( mpPlaybin );
+ gst_bus_add_watch( pBus, gst_pipeline_bus_callback, this );
+ DBG( "%p set sync handler", this );
+ gst_bus_set_sync_handler( pBus, gst_pipeline_bus_sync_handler, this );
+ g_object_unref( pBus );
+}
+
+bool Player::create( const ::rtl::OUString& rURL )
+{
+ bool bRet = false;
+
+ // create all the elements and link them
+
+ if( mbInitialized )
+ {
+ preparePlaybin( rURL, true );
+
+ gst_element_set_state( mpPlaybin, GST_STATE_PAUSED );
+
+ bRet = true;
+ }
+
+
+ if( bRet )
+ maURL = rURL;
+ else
+ maURL = ::rtl::OUString();
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Player::start( )
+ throw (uno::RuntimeException)
+{
+ //DBG ("Player::start");
+
+ // set the pipeline state to READY and run the loop
+ if( mbInitialized && NULL != mpPlaybin )
+ {
+ gst_element_set_state( mpPlaybin, GST_STATE_PLAYING );
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Player::stop( )
+ throw (uno::RuntimeException)
+{
+ // set the pipeline in PAUSED STATE
+ if( mpPlaybin )
+ gst_element_set_state( mpPlaybin, GST_STATE_PAUSED );
+
+ DBG( "stop %p", mpPlaybin );
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL Player::isPlaying()
+ throw (uno::RuntimeException)
+{
+ bool bRet = false;
+
+ // return whether the pipeline is in PLAYING STATE or not
+ if( mbInitialized && mpPlaybin )
+ {
+ bRet = GST_STATE_PLAYING == GST_STATE( mpPlaybin );
+ }
+
+ DBG( "isPlaying %d", bRet );
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------------
+
+double SAL_CALL Player::getDuration( )
+ throw (uno::RuntimeException)
+{
+ // slideshow checks for non-zero duration, so cheat here
+ double duration = 0.01;
+
+ if( mpPlaybin && mnDuration > 0 ) {
+ duration = mnDuration / 1E9;
+
+ //DBG( "gst duration: %lld ns duration: %lf s", gst_duration, duration );
+ }
+
+ return duration;
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Player::setMediaTime( double fTime )
+ throw (uno::RuntimeException)
+{
+ if( mpPlaybin ) {
+ gint64 gst_position = llround (fTime * 1E9);
+
+ gst_element_seek( mpPlaybin, 1.0,
+ GST_FORMAT_TIME,
+ GST_SEEK_FLAG_FLUSH,
+ GST_SEEK_TYPE_SET, gst_position,
+ GST_SEEK_TYPE_NONE, 0 );
+ if( !isPlaying() )
+ gst_element_set_state( mpPlaybin, GST_STATE_PAUSED );
+
+ DBG( "seek to: %lld ns original: %lf s", gst_position, fTime );
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+double SAL_CALL Player::getMediaTime( )
+ throw (uno::RuntimeException)
+{
+ double position = 0.0;
+
+ if( mpPlaybin ) {
+ // get current position in the stream
+ GstFormat format = GST_FORMAT_TIME;
+ gint64 gst_position;
+ if( gst_element_query_position( mpPlaybin, &format, &gst_position ) && format == GST_FORMAT_TIME && gst_position > 0L )
+ position = gst_position / 1E9;
+ }
+
+ return position;
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Player::setStopTime( double fTime )
+ throw (uno::RuntimeException)
+{
+ // TODO implement
+}
+
+// ------------------------------------------------------------------------------
+
+double SAL_CALL Player::getStopTime( )
+ throw (uno::RuntimeException)
+{
+ // Get the time at which to stop
+
+ return 0;
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Player::setRate( double fRate )
+ throw (uno::RuntimeException)
+{
+ // TODO set the window rate
+}
+
+// ------------------------------------------------------------------------------
+
+double SAL_CALL Player::getRate( )
+ throw (uno::RuntimeException)
+{
+ double rate = 0.0;
+
+ // TODO get the window rate
+ if( mbInitialized )
+ {
+
+ }
+
+ return rate;
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Player::setPlaybackLoop( sal_Bool bSet )
+ throw (uno::RuntimeException)
+{
+ // TODO check how to do with GST
+ mbLooping = bSet;
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL Player::isPlaybackLoop( )
+ throw (uno::RuntimeException)
+{
+ // TODO check how to do with GST
+ return mbLooping;
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Player::setMute( sal_Bool bSet )
+ throw (uno::RuntimeException)
+{
+ DBG( "set mute: %d muted: %d unmuted volume: %lf", bSet, mbMuted, mnUnmutedVolume );
+
+ // change the volume to 0 or the unmuted volume
+ if( mpPlaybin && mbMuted != bSet )
+ {
+ double nVolume = mnUnmutedVolume;
+ if( bSet )
+ {
+ nVolume = 0.0;
+ }
+
+ g_object_set( G_OBJECT( mpPlaybin ), "volume", nVolume, NULL );
+
+ mbMuted = bSet;
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL Player::isMute( )
+ throw (uno::RuntimeException)
+{
+ return mbMuted;
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Player::setVolumeDB( sal_Int16 nVolumeDB )
+ throw (uno::RuntimeException)
+{
+ mnUnmutedVolume = pow( 10.0, nVolumeDB / 20.0 );
+
+ DBG( "set volume: %d gst volume: %lf", nVolumeDB, mnUnmutedVolume );
+
+ // change volume
+ if( !mbMuted && mpPlaybin )
+ {
+ g_object_set( G_OBJECT( mpPlaybin ), "volume", (gdouble) mnUnmutedVolume, NULL );
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Int16 SAL_CALL Player::getVolumeDB( )
+ throw (uno::RuntimeException)
+{
+ sal_Int16 nVolumeDB;
+
+ if( mpPlaybin ) {
+ double nGstVolume = 0.0;
+
+ g_object_get( G_OBJECT( mpPlaybin ), "volume", &nGstVolume, NULL );
+
+ nVolumeDB = (sal_Int16) ( 20.0*log10 ( nGstVolume ) );
+
+ //DBG( "get volume: %d gst volume: %lf", nVolumeDB, nGstVolume );
+ }
+
+ return nVolumeDB;
+}
+
+// ------------------------------------------------------------------------------
+
+awt::Size SAL_CALL Player::getPreferredPlayerWindowSize( )
+ throw (uno::RuntimeException)
+{
+ awt::Size aSize( 0, 0 );
+
+ DBG( "%p Player::getPreferredPlayerWindowSize, member %d x %d", this, mnWidth, mnHeight );
+
+ TimeValue aTimeout = { 10, 0 };
+ oslConditionResult aResult = osl_waitCondition( maSizeCondition, &aTimeout );
+
+ if( mbFakeVideo ) {
+ mbFakeVideo = sal_False;
+
+ g_object_set( G_OBJECT( mpPlaybin ), "video-sink", NULL, NULL );
+ gst_element_set_state( mpPlaybin, GST_STATE_READY );
+ gst_element_set_state( mpPlaybin, GST_STATE_PAUSED );
+ }
+
+ DBG( "%p Player::getPreferredPlayerWindowSize after waitCondition %d, member %d x %d", this, aResult, mnWidth, mnHeight );
+
+ if( mnWidth != 0 && mnHeight != 0 ) {
+ aSize.Width = mnWidth;
+ aSize.Height = mnHeight;
+ }
+
+ return aSize;
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( const uno::Sequence< uno::Any >& rArguments )
+ throw (uno::RuntimeException)
+{
+ uno::Reference< ::media::XPlayerWindow > xRet;
+ awt::Size aSize( getPreferredPlayerWindowSize() );
+
+ DBG( "Player::createPlayerWindow %d %d length: %d", aSize.Width, aSize.Height, rArguments.getLength() );
+
+ if( aSize.Width > 0 && aSize.Height > 0 )
+ {
+ ::avmedia::gstreamer::Window* pWindow = new ::avmedia::gstreamer::Window( mxMgr, *this );
+
+ xRet = pWindow;
+
+ if( rArguments.getLength() > 2 ) {
+ rArguments[ 2 ] >>= mnWindowID;
+ DBG( "window ID: %ld", mnWindowID );
+ }
+
+ //if( !pWindow->create( aArguments ) )
+ //xRet = uno::Reference< ::media::XPlayerWindow >();
+ }
+
+ return xRet;
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Reference< media::XFrameGrabber > SAL_CALL Player::createFrameGrabber( )
+ throw (uno::RuntimeException)
+{
+ uno::Reference< media::XFrameGrabber > xRet;
+
+ /*if( maURL.getLength() > 0 )
+ {
+ FrameGrabber* pGrabber = new FrameGrabber( mxMgr );
+
+ xRet = pGrabber;
+
+ if( !pGrabber->create( maURL ) )
+ xRet.clear();
+ }*/
+
+ return xRet;
+}
+
+// ------------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL Player::getImplementationName( )
+ throw (uno::RuntimeException)
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GST_PLAYER_IMPLEMENTATIONNAME ) );
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL Player::supportsService( const ::rtl::OUString& ServiceName )
+ throw (uno::RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_GST_PLAYER_SERVICENAME ) );
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Sequence< ::rtl::OUString > SAL_CALL Player::getSupportedServiceNames( )
+ throw (uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aRet(1);
+ aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_GST_PLAYER_SERVICENAME ) );
+
+ return aRet;
+}
+
+} // namespace gstreamer
+} // namespace avmedia
diff --git a/avmedia/source/gstreamer/gstplayer.hxx b/avmedia/source/gstreamer/gstplayer.hxx
new file mode 100644
index 0000000000..62ba473f9e
--- /dev/null
+++ b/avmedia/source/gstreamer/gstplayer.hxx
@@ -0,0 +1,112 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2010 Novell, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _PLAYER_HXX
+#define _PLAYER_HXX
+
+#include <osl/conditn.h>
+#include "gstcommon.hxx"
+
+#ifndef _COM_SUN_STAR_MEDIA_XPLAYER_HDL_
+#include "com/sun/star/media/XPlayer.hdl"
+#endif
+
+typedef struct _GstXOverlay GstXOverlay;
+
+namespace avmedia { namespace gstreamer {
+
+// ----------
+// - Player -
+// ----------
+
+class Player : public ::cppu::WeakImplHelper2< ::com::sun::star::media::XPlayer,
+ ::com::sun::star::lang::XServiceInfo >
+{
+public:
+
+ Player( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMgr );
+ ~Player();
+
+ void preparePlaybin( const ::rtl::OUString& rURL, bool bFakeVideo );
+ bool create( const ::rtl::OUString& rURL );
+ void processMessage( GstMessage *message );
+ GstBusSyncReply processSyncMessage( GstMessage *message );
+
+ // XPlayer
+ virtual void SAL_CALL start( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL stop( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isPlaying( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getDuration( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMediaTime( double fTime ) throw (::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getMediaTime( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setStopTime( double fTime ) throw (::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getStopTime( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setRate( double fRate ) throw (::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getRate( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPlaybackLoop( sal_Bool bSet ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isPlaybackLoop( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMute( sal_Bool bSet ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isMute( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setVolumeDB( sal_Int16 nVolumeDB ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getVolumeDB( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getPreferredPlayerWindowSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayerWindow > SAL_CALL createPlayerWindow( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::media::XFrameGrabber > SAL_CALL createFrameGrabber( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ 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);
+
+private:
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr;
+
+ ::rtl::OUString maURL;
+
+ // Add elements and pipeline here
+ GstElement* mpPlaybin; // the playbin is also a pipeline
+ sal_Bool mbFakeVideo;
+
+ gdouble mnUnmutedVolume;
+ sal_Bool mbMuted;
+ sal_Bool mbLooping;
+ sal_Bool mbInitialized;
+
+ long mnWindowID;
+ GstXOverlay* mpXOverlay;
+ gint64 mnDuration;
+ int mnWidth;
+ int mnHeight;
+
+ oslCondition maSizeCondition;
+};
+
+} // namespace gstreamer
+} // namespace avmedia
+
+#endif // _PLAYER_HXX
diff --git a/avmedia/source/gstreamer/gstuno.cxx b/avmedia/source/gstreamer/gstuno.cxx
new file mode 100644
index 0000000000..cb19aaf448
--- /dev/null
+++ b/avmedia/source/gstreamer/gstuno.cxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2010 Novell, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "gstmanager.hxx"
+
+using namespace ::com::sun::star;
+
+// -------------------
+// - factory methods -
+// -------------------
+
+static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const uno::Reference< lang::XMultiServiceFactory >& rxFact )
+{
+ return uno::Reference< uno::XInterface >( *new ::avmedia::gstreamer::Manager( rxFact ) );
+}
+
+// ------------------------------------------
+// - component_getImplementationEnvironment -
+// ------------------------------------------
+
+extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+// -----------------------
+// - component_writeInfo -
+// -----------------------
+
+extern "C" sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pRegistryKey )
+{
+ sal_Bool bRet = sal_False;
+
+ if( pRegistryKey )
+ {
+ try
+ {
+ uno::Reference< registry::XRegistryKey > xNewKey1(
+ static_cast< registry::XRegistryKey* >( pRegistryKey )->createKey(
+ ::rtl::OUString::createFromAscii( "/com.sun.star.comp.media.Manager_GStreamer/UNO/SERVICES/com.sun.star.media.Manager_GStreamer" ) ) );
+
+ bRet = sal_True;
+ }
+ catch( registry::InvalidRegistryException& )
+ {
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------
+// - component_getFactory -
+// ------------------------
+
+extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* pRegistryKey )
+{
+ uno::Reference< lang::XSingleServiceFactory > xFactory;
+ void* pRet = 0;
+
+ if( rtl_str_compare( pImplName, "com.sun.star.comp.media.Manager_GStreamer" ) == 0 )
+ {
+ const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( "com.sun.star.media.Manager_GStreamer" ) );
+
+ xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory(
+ reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ),
+ ::rtl::OUString::createFromAscii( "com.sun.star.comp.media.Manager_GStreamer" ),
+ create_MediaPlayer, uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) );
+ }
+
+ if( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+
+ return pRet;
+}
diff --git a/avmedia/source/gstreamer/gstwindow.cxx b/avmedia/source/gstreamer/gstwindow.cxx
new file mode 100644
index 0000000000..1eca6b4590
--- /dev/null
+++ b/avmedia/source/gstreamer/gstwindow.cxx
@@ -0,0 +1,357 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2010 Novell, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <com/sun/star/awt/SystemPointer.hdl>
+
+#include "gstwindow.hxx"
+#include "gstplayer.hxx"
+
+#define AVMEDIA_GST_WINDOW_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Window_GStreamer"
+#define AVMEDIA_GST_WINDOW_SERVICENAME "com.sun.star.media.Window_GStreamer"
+
+using namespace ::com::sun::star;
+
+namespace avmedia { namespace gstreamer {
+
+// -----------
+// - statics -
+// -----------
+
+static ::osl::Mutex& ImplGetOwnStaticMutex()
+{
+ static ::osl::Mutex* pMutex = NULL;
+
+ if( pMutex == NULL )
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+
+ if( pMutex == NULL )
+ {
+ static ::osl::Mutex aMutex;
+ pMutex = &aMutex;
+ }
+ }
+
+ return *pMutex;
+}
+
+// ---------------
+// - Window -
+// ---------------
+
+// ------------------------------------------------------------------------------
+
+Window::Window( const uno::Reference< lang::XMultiServiceFactory >& rxMgr, Player& rPlayer ) :
+ mxMgr( rxMgr ),
+ maListeners( maMutex ),
+ meZoomLevel( media::ZoomLevel_NOT_AVAILABLE ),
+ mrPlayer( rPlayer ),
+ mnPointerType( awt::SystemPointer::ARROW )
+{
+ ::osl::MutexGuard aGuard( ImplGetOwnStaticMutex() );
+
+}
+
+// ------------------------------------------------------------------------------
+
+Window::~Window()
+{
+}
+
+// XPlayerWindow
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::update( )
+ throw (uno::RuntimeException)
+{
+ //::RedrawWindow( (HWND) mnFrameWnd, NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE );
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL Window::setZoomLevel( media::ZoomLevel eZoomLevel )
+ throw (uno::RuntimeException)
+{
+ sal_Bool bRet = false;
+
+ if( media::ZoomLevel_NOT_AVAILABLE != meZoomLevel &&
+ media::ZoomLevel_NOT_AVAILABLE != eZoomLevel )
+ {
+ if( eZoomLevel != meZoomLevel )
+ {
+ meZoomLevel = eZoomLevel;
+ //ImplLayoutVideoWindow();
+ }
+
+ bRet = true;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------------
+
+media::ZoomLevel SAL_CALL Window::getZoomLevel( )
+ throw (uno::RuntimeException)
+{
+ return meZoomLevel;
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::setPointerType( sal_Int32 nPointerType )
+ throw (uno::RuntimeException)
+{
+ mnPointerType = nPointerType;
+}
+
+// XWindow
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags )
+ throw (uno::RuntimeException)
+{
+// if( mnFrameWnd )
+// {
+// ::SetWindowPos( (HWND) mnFrameWnd, HWND_TOP, X, Y, Width, Height, 0 );
+// ImplLayoutVideoWindow();
+// }
+}
+
+// ------------------------------------------------------------------------------
+
+awt::Rectangle SAL_CALL Window::getPosSize()
+ throw (uno::RuntimeException)
+{
+ awt::Rectangle aRet;
+
+ aRet.X = aRet.Y = 0;
+ aRet.Width = 320;
+ aRet.Height = 240;
+
+// if( mnFrameWnd )
+// {
+// ::RECT aWndRect;
+// long nX = 0, nY = 0, nWidth = 0, nHeight = 0;
+
+// if( ::GetClientRect( (HWND) mnFrameWnd, &aWndRect ) )
+// {
+// aRet.X = aWndRect.left;
+// aRet.Y = aWndRect.top;
+// aRet.Width = aWndRect.right - aWndRect.left + 1;
+// aRet.Height = aWndRect.bottom - aWndRect.top + 1;
+// }
+// }
+
+ return aRet;
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::setVisible( sal_Bool bVisible )
+ throw (uno::RuntimeException)
+{
+// if( mnFrameWnd )
+// {
+// IVideoWindow* pVideoWindow = const_cast< IVideoWindow* >( mrPlayer.getVideoWindow() );
+
+// if( pVideoWindow )
+// pVideoWindow->put_Visible( bVisible ? OATRUE : OAFALSE );
+
+// ::ShowWindow( (HWND) mnFrameWnd, bVisible ? SW_SHOW : SW_HIDE );
+// }
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::setEnable( sal_Bool bEnable )
+ throw (uno::RuntimeException)
+{
+// if( mnFrameWnd )
+// ::EnableWindow( (HWND) mnFrameWnd, bEnable );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::setFocus( )
+ throw (uno::RuntimeException)
+{
+// if( mnFrameWnd )
+// ::SetFocus( (HWND) mnFrameWnd );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::addWindowListener( const uno::Reference< awt::XWindowListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ maListeners.addInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::removeWindowListener( const uno::Reference< awt::XWindowListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ maListeners.removeInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::addFocusListener( const uno::Reference< awt::XFocusListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ maListeners.addInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::removeFocusListener( const uno::Reference< awt::XFocusListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ maListeners.removeInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::addKeyListener( const uno::Reference< awt::XKeyListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ maListeners.addInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::removeKeyListener( const uno::Reference< awt::XKeyListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ maListeners.removeInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::addMouseListener( const uno::Reference< awt::XMouseListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ maListeners.addInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::removeMouseListener( const uno::Reference< awt::XMouseListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ maListeners.removeInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::addMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ maListeners.addInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::removeMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ maListeners.removeInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::addPaintListener( const uno::Reference< awt::XPaintListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ maListeners.addInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::removePaintListener( const uno::Reference< awt::XPaintListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ maListeners.removeInterface( getCppuType( &xListener ), xListener );
+}
+
+
+// XComponent
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::dispose( )
+ throw (uno::RuntimeException)
+{
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ maListeners.addInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::removeEventListener( const uno::Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ maListeners.removeInterface( getCppuType( &xListener ), xListener );
+}
+
+// XServiceInfo
+// ------------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL Window::getImplementationName( )
+ throw (uno::RuntimeException)
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GST_WINDOW_IMPLEMENTATIONNAME ) );
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL Window::supportsService( const ::rtl::OUString& ServiceName )
+ throw (uno::RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_GST_WINDOW_SERVICENAME ) );
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Sequence< ::rtl::OUString > SAL_CALL Window::getSupportedServiceNames( )
+ throw (uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aRet(1);
+ aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_GST_WINDOW_SERVICENAME ) );
+
+ return aRet;
+}
+
+} // namespace gstreamer
+} // namespace avmedia
diff --git a/avmedia/source/gstreamer/gstwindow.hxx b/avmedia/source/gstreamer/gstwindow.hxx
new file mode 100644
index 0000000000..4a7b84e4bb
--- /dev/null
+++ b/avmedia/source/gstreamer/gstwindow.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2010 Novell, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _WINDOW_HXX
+#define _WINDOW_HXX
+
+#include "gstcommon.hxx"
+#include <cppuhelper/interfacecontainer.h>
+
+#ifndef _COM_SUN_STAR_MEDIA_XPLAYERWINDOW_HDL_
+#include "com/sun/star/media/XPlayerWindow.hdl"
+#endif
+
+namespace avmedia { namespace gstreamer {
+
+// ---------------
+// - Window -
+// ---------------
+
+class Player;
+
+class Window : public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XPlayerWindow,
+ ::com::sun::star::lang::XServiceInfo >
+{
+public:
+
+ Window( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMgr,
+ Player& rPlayer );
+ ~Window();
+
+ bool create( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments );
+ void processGraphEvent();
+ void updatePointer();
+
+ // XPlayerWindow
+ virtual void SAL_CALL update( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setZoomLevel( ::com::sun::star::media::ZoomLevel ZoomLevel ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::media::ZoomLevel SAL_CALL getZoomLevel( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPointerType( sal_Int32 nPointerType ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XWindow
+ virtual void SAL_CALL setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getPosSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setVisible( sal_Bool Visible ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setEnable( sal_Bool Enable ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) 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);
+ 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);
+
+
+private:
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr;
+
+ ::osl::Mutex maMutex;
+ ::cppu::OMultiTypeInterfaceContainerHelper maListeners;
+ ::com::sun::star::media::ZoomLevel meZoomLevel;
+ Player& mrPlayer;
+ int mnPointerType;
+
+ void ImplLayoutVideoWindow();
+};
+
+} // namespace gstreamer
+} // namespace avmedia
+
+#endif // _WINDOW_HXX
diff --git a/avmedia/source/gstreamer/makefile.mk b/avmedia/source/gstreamer/makefile.mk
new file mode 100644
index 0000000000..2f52b9cc47
--- /dev/null
+++ b/avmedia/source/gstreamer/makefile.mk
@@ -0,0 +1,77 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2010 Novell, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJNAME=avmedia
+TARGET=avmediagst
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+.IF "$(ENABLE_GSTREAMER)" == "TRUE"
+
+.IF "$(verbose)"!="" || "$(VERBOSE)"!=""
+CDEFS+= -DVERBOSE
+.ENDIF
+
+PKGCONFIG_MODULES=gstreamer-0.10, gstreamer-plugins-base-0.10
+.INCLUDE: pkg_config.mk
+PKGCONFIG_LIBS+=-lgstinterfaces-0.10
+
+# --- Files ----------------------------------
+
+.IF "$(GUI)" == "UNX" || "$(GUI)" == "WNT"
+
+.IF "$(GUI)" == "WNT"
+CDEFS+= -DWINNT
+.ENDIF
+
+SLOFILES= \
+ $(SLO)$/gstuno.obj \
+ $(SLO)$/gstmanager.obj \
+ $(SLO)$/gstplayer.obj \
+ $(SLO)$/gstwindow.obj
+
+
+EXCEPTIONSFILES= \
+ $(SLO)$/gstuno.obj \
+
+SHL1TARGET=$(TARGET)
+SHL1STDLIBS= $(CPPULIB) $(SALLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(PKGCONFIG_LIBS) $(TOOLSLIB)
+SHL1IMPLIB=i$(TARGET)
+SHL1LIBS=$(SLB)$/$(TARGET).lib
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+DEF1EXPORTFILE=exports.dxp
+
+.ENDIF
+
+.ENDIF
+
+.INCLUDE : target.mk