summaryrefslogtreecommitdiff
path: root/avmedia/source/gstreamer
diff options
context:
space:
mode:
Diffstat (limited to 'avmedia/source/gstreamer')
-rw-r--r--avmedia/source/gstreamer/avmediagstreamer.component6
-rwxr-xr-xavmedia/source/gstreamer/exports.dxp2
-rw-r--r--avmedia/source/gstreamer/gstcommon.hxx60
-rw-r--r--avmedia/source/gstreamer/gstframegrabber.cxx236
-rw-r--r--avmedia/source/gstreamer/gstframegrabber.hxx71
-rw-r--r--avmedia/source/gstreamer/gstmanager.cxx109
-rw-r--r--avmedia/source/gstreamer/gstmanager.hxx67
-rw-r--r--avmedia/source/gstreamer/gstplayer.cxx634
-rw-r--r--avmedia/source/gstreamer/gstplayer.hxx114
-rw-r--r--avmedia/source/gstreamer/gstuno.cxx71
-rw-r--r--avmedia/source/gstreamer/gstwindow.cxx326
-rw-r--r--avmedia/source/gstreamer/gstwindow.hxx111
-rwxr-xr-xavmedia/source/gstreamer/makefile.mk88
13 files changed, 1895 insertions, 0 deletions
diff --git a/avmedia/source/gstreamer/avmediagstreamer.component b/avmedia/source/gstreamer/avmediagstreamer.component
new file mode 100644
index 000000000000..cd25a6b0cc26
--- /dev/null
+++ b/avmedia/source/gstreamer/avmediagstreamer.component
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<component loader="com.sun.star.loader.SharedLibrary" xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.media.Manager_GStreamer">
+ <service name="com.sun.star.media.Manager_GStreamer"/>
+ </implementation>
+</component>
diff --git a/avmedia/source/gstreamer/exports.dxp b/avmedia/source/gstreamer/exports.dxp
new file mode 100755
index 000000000000..f0e1c69934bc
--- /dev/null
+++ b/avmedia/source/gstreamer/exports.dxp
@@ -0,0 +1,2 @@
+component_getImplementationEnvironment
+component_getFactory
diff --git a/avmedia/source/gstreamer/gstcommon.hxx b/avmedia/source/gstreamer/gstcommon.hxx
new file mode 100644
index 000000000000..1d9b5caaff96
--- /dev/null
+++ b/avmedia/source/gstreamer/gstcommon.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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>
+
+#include <osl/mutex.hxx>
+#include <tools/debug.hxx>
+#include <tools/stream.hxx>
+#include <tools/string.hxx>
+#include <tools/urlobj.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/factory.hxx>
+
+#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
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/gstreamer/gstframegrabber.cxx b/avmedia/source/gstreamer/gstframegrabber.cxx
new file mode 100644
index 000000000000..fc775fe01287
--- /dev/null
+++ b/avmedia/source/gstreamer/gstframegrabber.cxx
@@ -0,0 +1,236 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 <objbase.h>
+#include <strmif.h>
+#include <Amvideo.h>
+#include <Qedit.h>
+#include <uuids.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
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/gstreamer/gstframegrabber.hxx b/avmedia/source/gstreamer/gstframegrabber.hxx
new file mode 100644
index 000000000000..fc0795221a88
--- /dev/null
+++ b/avmedia/source/gstreamer/gstframegrabber.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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"
+
+#include "com/sun/star/media/XFrameGrabber.hdl"
+
+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
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/gstreamer/gstmanager.cxx b/avmedia/source/gstreamer/gstmanager.cxx
new file mode 100644
index 000000000000..e3b2c158c1b9
--- /dev/null
+++ b/avmedia/source/gstreamer/gstmanager.cxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 OSL_DEBUG_LEVEL > 2
+#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
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/gstreamer/gstmanager.hxx b/avmedia/source/gstreamer/gstmanager.hxx
new file mode 100644
index 000000000000..2d83215402df
--- /dev/null
+++ b/avmedia/source/gstreamer/gstmanager.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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"
+
+#include "com/sun/star/media/XManager.hdl"
+
+// -----------
+// - 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
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx
new file mode 100644
index 000000000000..1e2d0b70800e
--- /dev/null
+++ b/avmedia/source/gstreamer/gstplayer.cxx
@@ -0,0 +1,634 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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>
+
+#include <rtl/string.hxx>
+
+#include <vcl/syschild.hxx>
+#include <vcl/sysdata.hxx>
+
+
+#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 OSL_DEBUG_LEVEL > 2
+#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 ),
+ mbPlayPending ( false ),
+ 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 name[] = "libreoffice";
+ char *arguments[] = { name };
+ 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 )
+{
+ switch( GST_MESSAGE_TYPE( message ) ) {
+ case GST_MESSAGE_EOS:
+ gst_element_set_state( mpPlaybin, GST_STATE_READY );
+ mbPlayPending = false;
+ if (mbLooping)
+ start();
+ 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 );
+
+ if (mbPlayPending)
+ mbPlayPending = ((newstate == GST_STATE_READY) || (newstate == GST_STATE_PAUSED));
+ }
+ default:
+ break;
+ }
+}
+
+GstBusSyncReply Player::processSyncMessage( GstMessage *message )
+{
+ DBG( "%p processSyncMessage: %s", this, GST_MESSAGE_TYPE_NAME( message ) );
+
+#if OSL_DEBUG_LEVEL > 0
+ if ( GST_MESSAGE_TYPE( message ) == GST_MESSAGE_ERROR )
+ {
+ GError* error;
+ gchar* error_debug;
+
+ gst_message_parse_error( message, &error, &error_debug );
+ OSL_TRACE("gstreamer error: '%s' debug: '%s'", error->message, error_debug);
+ }
+#endif
+
+ 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 );
+ }
+ }
+ }
+
+#if OSL_DEBUG_LEVEL > 2
+ sal_Bool aSuccess =
+#endif
+ 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 occurred, set condition so that OOo thread doesn't wait for us
+#if OSL_DEBUG_LEVEL > 2
+ sal_Bool aSuccess =
+#endif
+ 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;
+
+ if( mpPlaybin != NULL ) {
+ gst_element_set_state( mpPlaybin, GST_STATE_NULL );
+ mbPlayPending = false;
+ 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
+
+ DBG("create player, URL: %s", OUStringToOString( rURL, RTL_TEXTENCODING_UTF8 ).getStr());
+
+ if( mbInitialized )
+ {
+ preparePlaybin( rURL, true );
+
+ gst_element_set_state( mpPlaybin, GST_STATE_PAUSED );
+ mbPlayPending = false;
+
+ bRet = true;
+ }
+
+ if( bRet )
+ maURL = rURL;
+ else
+ maURL = ::rtl::OUString();
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Player::start( )
+ throw (uno::RuntimeException)
+{
+ // set the pipeline state to READY and run the loop
+ if( mbInitialized && NULL != mpPlaybin )
+ {
+ gst_element_set_state( mpPlaybin, GST_STATE_PLAYING );
+ mbPlayPending = true;
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Player::stop( )
+ throw (uno::RuntimeException)
+{
+ // set the pipeline in PAUSED STATE
+ if( mpPlaybin )
+ gst_element_set_state( mpPlaybin, GST_STATE_PAUSED );
+
+ mbPlayPending = false;
+ DBG( "stop %p", mpPlaybin );
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL Player::isPlaying()
+ throw (uno::RuntimeException)
+{
+ bool bRet = mbPlayPending;
+
+ // return whether the pipeline is in PLAYING STATE or not
+ if( !mbPlayPending && 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;
+ }
+
+ 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: %"SAL_PRIdINT64" 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(0);
+
+ if( mpPlaybin ) {
+ double nGstVolume = 0.0;
+
+ g_object_get( G_OBJECT( mpPlaybin ), "volume", &nGstVolume, NULL );
+
+ nVolumeDB = (sal_Int16) ( 20.0*log10 ( 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 };
+#if OSL_DEBUG_LEVEL > 2
+ oslConditionResult aResult =
+#endif
+ 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 )
+ {
+ sal_IntPtr pIntPtr = 0;
+ rArguments[ 2 ] >>= pIntPtr;
+ SystemChildWindow *pParentWindow = reinterpret_cast< SystemChildWindow* >( pIntPtr );
+ const SystemEnvData* pEnvData = pParentWindow ? pParentWindow->GetSystemData() : NULL;
+ OSL_ASSERT(pEnvData);
+ if (pEnvData)
+ mnWindowID = pEnvData->aWindow;
+ }
+ }
+
+ return xRet;
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Reference< media::XFrameGrabber > SAL_CALL Player::createFrameGrabber( )
+ throw (uno::RuntimeException)
+{
+ uno::Reference< media::XFrameGrabber > xRet;
+
+ 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
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/gstreamer/gstplayer.hxx b/avmedia/source/gstreamer/gstplayer.hxx
new file mode 100644
index 000000000000..02839dc9b2bd
--- /dev/null
+++ b/avmedia/source/gstreamer/gstplayer.hxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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"
+
+#include "com/sun/star/media/XPlayer.hdl"
+
+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 mbPlayPending;
+ 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
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/gstreamer/gstuno.cxx b/avmedia/source/gstreamer/gstuno.cxx
new file mode 100644
index 000000000000..4695ba646a47
--- /dev/null
+++ b/avmedia/source/gstreamer/gstuno.cxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 ) );
+}
+
+extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+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(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.media.Manager_GStreamer" )) );
+
+ xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory(
+ reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "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;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/gstreamer/gstwindow.cxx b/avmedia/source/gstreamer/gstwindow.cxx
new file mode 100644
index 000000000000..9228f9e6c9a0
--- /dev/null
+++ b/avmedia/source/gstreamer/gstwindow.cxx
@@ -0,0 +1,326 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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)
+{
+}
+
+// ------------------------------------------------------------------------------
+
+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;
+ }
+
+ 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)
+{
+}
+
+// ------------------------------------------------------------------------------
+
+awt::Rectangle SAL_CALL Window::getPosSize()
+ throw (uno::RuntimeException)
+{
+ awt::Rectangle aRet;
+
+ aRet.X = aRet.Y = 0;
+ aRet.Width = 320;
+ aRet.Height = 240;
+
+ return aRet;
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::setVisible( sal_Bool /*bVisible*/ )
+ throw (uno::RuntimeException)
+{
+
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::setEnable( sal_Bool /*bEnable*/ )
+ throw (uno::RuntimeException)
+{
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::setFocus( )
+ throw (uno::RuntimeException)
+{
+}
+
+// ------------------------------------------------------------------------------
+
+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
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/gstreamer/gstwindow.hxx b/avmedia/source/gstreamer/gstwindow.hxx
new file mode 100644
index 000000000000..18b9a7dbd0ae
--- /dev/null
+++ b/avmedia/source/gstreamer/gstwindow.hxx
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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>
+
+#include "com/sun/star/media/XPlayerWindow.hdl"
+
+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
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/gstreamer/makefile.mk b/avmedia/source/gstreamer/makefile.mk
new file mode 100755
index 000000000000..0bea1330a099
--- /dev/null
+++ b/avmedia/source/gstreamer/makefile.mk
@@ -0,0 +1,88 @@
+#*************************************************************************
+#
+# 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) $(VCLLIB)
+SHL1IMPLIB=i$(TARGET)
+SHL1LIBS=$(SLB)$/$(TARGET).lib
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+DEF1EXPORTFILE=exports.dxp
+
+.ENDIF # UNX / WNT
+.ENDIF # ENABLE_GSTREAMER
+
+.INCLUDE : target.mk
+
+.IF "$(ENABLE_GSTREAMER)" == "TRUE"
+.IF "$(GUI)" == "UNX" || "$(GUI)" == "WNT"
+
+ALLTAR : $(MISC)/avmediagstreamer.component
+$(MISC)/avmediagstreamer.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt avmediagstreamer.component
+ $(XSLTPROC) --nonet \
+ --stringparam uri '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' \
+ -o $@ $(SOLARENV)/bin/createcomponent.xslt avmediagstreamer.component
+
+.ENDIF # UNX / WNT
+.ENDIF # ENABLE_GSTREAMER