diff options
Diffstat (limited to 'avmedia/source')
83 files changed, 1057 insertions, 3501 deletions
diff --git a/avmedia/source/framework/makefile.mk b/avmedia/source/framework/makefile.mk index 4185f3cbfc49..4c814c534844 100644..100755 --- a/avmedia/source/framework/makefile.mk +++ b/avmedia/source/framework/makefile.mk @@ -42,14 +42,13 @@ SRC1FILES =\ # --- Files ------------------------------------- SLOFILES= \ + $(EXCEPTIONSFILES) \ $(SLO)$/mediaitem.obj \ - $(SLO)$/mediamisc.obj \ - $(SLO)$/mediacontrol.obj \ - $(SLO)$/mediatoolbox.obj \ - $(SLO)$/mediaplayer.obj \ - $(SLO)$/soundhandler.obj EXCEPTIONSFILES = \ + $(SLO)$/mediacontrol.obj \ + $(SLO)$/mediamisc.obj \ + $(SLO)$/mediaplayer.obj \ $(SLO)$/mediatoolbox.obj \ $(SLO)$/soundhandler.obj diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx index 701b7c6cf238..e69d4d3b93a0 100644 --- a/avmedia/source/framework/mediacontrol.cxx +++ b/avmedia/source/framework/mediacontrol.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -629,3 +630,5 @@ IMPL_LINK( MediaControl, implTimeoutHdl, Timer*, EMPTYARG ) } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/framework/mediacontrol.hrc b/avmedia/source/framework/mediacontrol.hrc index 081958ccd42c..f69ab937f5f5 100644..100755 --- a/avmedia/source/framework/mediacontrol.hrc +++ b/avmedia/source/framework/mediacontrol.hrc @@ -48,6 +48,4 @@ #define AVMEDIA_IMG_MUTE 2054 #define AVMEDIA_IMGLST 3072 -#define AVMEDIA_IMGLST_HC 3073 #define AVMEDIA_IMGLST_L 3074 -#define AVMEDIA_IMGLST_L_HC 3075 diff --git a/avmedia/source/framework/mediacontrol.src b/avmedia/source/framework/mediacontrol.src index 2ad203e2c34f..22ddc29b3550 100644 --- a/avmedia/source/framework/mediacontrol.src +++ b/avmedia/source/framework/mediacontrol.src @@ -32,92 +32,66 @@ String AVMEDIA_STR_OPEN Text[en-US] = "Open"; }; -// ------------------------------------------------------------------------------ - String AVMEDIA_STR_INSERT { Text [ en-US ] = "Apply" ; }; -// ------------------------------------------------------------------------------ - String AVMEDIA_STR_PLAY { Text[en-US] = "Play"; }; -// ------------------------------------------------------------------------------ - String AVMEDIA_STR_PAUSE { Text[en-US] = "Pause"; }; -// ------------------------------------------------------------------------------ - String AVMEDIA_STR_STOP { Text[en-US] = "Stop"; }; -// ------------------------------------------------------------------------------ - String AVMEDIA_STR_ENDLESS { Text[en-US] = "Repeat"; }; -// ------------------------------------------------------------------------------ - String AVMEDIA_STR_MUTE { Text[en-US] = "Mute"; }; -// ------------------------------------------------------------------------------ - String AVMEDIA_STR_ZOOM { Text[en-US] = "View"; }; -// ------------------------------------------------------------------------------ - String AVMEDIA_STR_ZOOM_50 { Text[en-US] = "50%"; }; -// ------------------------------------------------------------------------------ - String AVMEDIA_STR_ZOOM_100 { Text[en-US] = "100%"; }; -// ------------------------------------------------------------------------------ - String AVMEDIA_STR_ZOOM_200 { Text[en-US] = "200%"; }; -// ------------------------------------------------------------------------------ - String AVMEDIA_STR_ZOOM_FIT { Text[en-US] = "Scaled"; }; -// ------------------------------------------------------------------------------ - String AVMEDIA_STR_MEDIAPLAYER { Text[en-US] = "Media Player"; }; -// ------------------------------------------------------------------------------ - ImageList AVMEDIA_IMGLST { Prefix = "av"; @@ -135,8 +109,6 @@ ImageList AVMEDIA_IMGLST IdCount = 7; }; -// ------------------------------------------------------------------------------ - ImageList AVMEDIA_IMGLST_L { Prefix = "avl"; @@ -153,41 +125,3 @@ ImageList AVMEDIA_IMGLST_L }; IdCount = 7; }; - -// ------------------------------------------------------------------------------ - -ImageList AVMEDIA_IMGLST_HC -{ - Prefix = "avh"; - MaskColor = Color{ Red = 0xff00; Green = 0x0000; Blue = 0xff00; }; - IdList = - { - AVMEDIA_IMG_OPEN; - AVMEDIA_IMG_PLAY; - AVMEDIA_IMG_PAUSE; - AVMEDIA_IMG_STOP; - AVMEDIA_IMG_ENDLESS; - AVMEDIA_IMG_INSERT; - AVMEDIA_IMG_MUTE; - }; - IdCount = 7; -}; - -// ------------------------------------------------------------------------------ - -ImageList AVMEDIA_IMGLST_L_HC -{ - Prefix = "avlh"; - MaskColor = Color{ Red = 0xff00; Green = 0x0000; Blue = 0xff00; }; - IdList = - { - AVMEDIA_IMG_OPEN; - AVMEDIA_IMG_PLAY; - AVMEDIA_IMG_PAUSE; - AVMEDIA_IMG_STOP; - AVMEDIA_IMG_ENDLESS; - AVMEDIA_IMG_INSERT; - AVMEDIA_IMG_MUTE; - }; - IdCount = 7; -}; diff --git a/avmedia/source/framework/mediaitem.cxx b/avmedia/source/framework/mediaitem.cxx index f75fafa0509e..babaa39b427c 100644 --- a/avmedia/source/framework/mediaitem.cxx +++ b/avmedia/source/framework/mediaitem.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -122,7 +123,7 @@ SfxItemPresentation MediaItem::GetPresentation( SfxItemPresentation, //------------------------------------------------------------------------ -sal_Bool MediaItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 ) const +bool MediaItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 ) const { uno::Sequence< uno::Any > aSeq( 9 ); @@ -143,10 +144,10 @@ sal_Bool MediaItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 ) cons //------------------------------------------------------------------------ -sal_Bool MediaItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 ) +bool MediaItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 ) { uno::Sequence< uno::Any > aSeq; - sal_Bool bRet = false; + bool bRet = false; if( ( rVal >>= aSeq ) && ( aSeq.getLength() == 9 ) ) { @@ -327,3 +328,5 @@ void MediaItem::setZoom( ::com::sun::star::media::ZoomLevel eZoom ) } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/framework/mediamisc.cxx b/avmedia/source/framework/mediamisc.cxx index b7807e767c6d..882f5db55d9c 100644 --- a/avmedia/source/framework/mediamisc.cxx +++ b/avmedia/source/framework/mediamisc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,3 +47,5 @@ ResMgr* GetResMgr() } } // namespace avemdia + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/framework/mediaplayer.cxx b/avmedia/source/framework/mediaplayer.cxx index b476f9a2ef41..350e4e92bbe2 100644 --- a/avmedia/source/framework/mediaplayer.cxx +++ b/avmedia/source/framework/mediaplayer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -164,3 +165,5 @@ void MediaFloater::dispatchCurrentURL() } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/framework/mediatoolbox.cxx b/avmedia/source/framework/mediatoolbox.cxx index 74bacb3861f0..cb795692011b 100644 --- a/avmedia/source/framework/mediatoolbox.cxx +++ b/avmedia/source/framework/mediatoolbox.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -166,3 +167,5 @@ void MediaToolBoxControl::implExecuteMediaControl( const MediaItem& rItem ) } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/framework/soundhandler.cxx b/avmedia/source/framework/soundhandler.cxx index a1fed18a0f68..83ea7b8a6316 100644 --- a/avmedia/source/framework/soundhandler.cxx +++ b/avmedia/source/framework/soundhandler.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,13 +30,9 @@ // my own includes //_________________________________________________________________________________________________________________ -#ifndef __FRAMEWORK_DISPATCH_SOUNDHANDLER_HXX_ #include "soundhandler.hxx" -#endif -#ifndef __COMPHELPER_MEDIADESCRIPTOR_HXX_ #include <comphelper/mediadescriptor.hxx> -#endif //_________________________________________________________________________________________________________________ // interface includes @@ -259,7 +256,6 @@ void SAL_CALL SoundHandler::impl_initService() { } - /*-************************************************************************************************************//** @short standard ctor @descr These initialize a new instance of this class with needed informations for work. @@ -333,7 +329,7 @@ void SAL_CALL SoundHandler::dispatchWithNotification(const css::util::URL& const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) throw(css::uno::RuntimeException) { // SAFE { - const ::vos::OGuard aLock( m_aLock ); + const ::osl::MutexGuard aLock( m_aLock ); { //close streams otherwise on windows we can't reopen the file in the @@ -427,7 +423,7 @@ void SAL_CALL SoundHandler::dispatch( const css::util::URL& // I think we can the following ones: // a) look for given extension of url to map our type decision HARD CODED!!! // b) return preferred type every time... it's easy :-) - sTypeName = ::rtl::OUString::createFromAscii("wav_Wave_Audio_File"); + sTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("wav_Wave_Audio_File")); aDescriptor[::comphelper::MediaDescriptor::PROP_TYPENAME()] <<= sTypeName; aDescriptor >> lDescriptor; } @@ -452,7 +448,7 @@ void SAL_CALL SoundHandler::dispatch( const css::util::URL& IMPL_LINK( SoundHandler, implts_PlayerNotify, void*, EMPTYARG ) { // SAFE { - ::vos::OClearableGuard aLock( m_aLock ); + ::osl::ClearableMutexGuard aLock( m_aLock ); if (m_xPlayer.is() && m_xPlayer->isPlaying() && m_xPlayer->getMediaTime() < m_xPlayer->getDuration()) { @@ -492,7 +488,7 @@ IMPL_LINK( SoundHandler, implts_PlayerNotify, void*, EMPTYARG ) // - component_getImplementationEnvironment - // ------------------------------------------ -extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } @@ -501,7 +497,7 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char // - component_getFactory - // ------------------------ -extern "C" void* SAL_CALL component_getFactory(const sal_Char* pImplementationName, void* pServiceManager, void* /*pRegistryKey*/ ) +extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(const sal_Char* pImplementationName, void* pServiceManager, void* /*pRegistryKey*/ ) { void* pReturn = NULL; if (pServiceManager != NULL ) @@ -523,3 +519,5 @@ extern "C" void* SAL_CALL component_getFactory(const sal_Char* pImplementationNa /* Return with result of this operation. */ return pReturn; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/framework/soundhandler.hxx b/avmedia/source/framework/soundhandler.hxx index 55d30536d8ce..d76bd13df5b7 100644 --- a/avmedia/source/framework/soundhandler.hxx +++ b/avmedia/source/framework/soundhandler.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -53,7 +54,7 @@ #include <vcl/timer.hxx> #include <tools/link.hxx> #include <avmedia/mediawindow.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> namespace css = ::com::sun::star; @@ -74,7 +75,7 @@ namespace avmedia{ struct ThreadHelpBase { public: - mutable ::vos::OMutex m_aLock; + mutable ::osl::Mutex m_aLock; }; /*-************************************************************************************************************//** @@ -118,7 +119,6 @@ class SoundHandler : // interfaces virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes () throw( css::uno::RuntimeException ); virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw( css::uno::RuntimeException ); - /* interface XServiceInfo */ virtual ::rtl::OUString SAL_CALL getImplementationName ( ) throw( css::uno::RuntimeException ); virtual sal_Bool SAL_CALL supportsService ( const ::rtl::OUString& sServiceName ) throw( css::uno::RuntimeException ); @@ -185,3 +185,5 @@ class SoundHandler : // interfaces } // namespace avmedia #endif // #ifndef __FRAMEWORK_HANDLER_SOUNDHANDLER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/framework/soundhandler.xml b/avmedia/source/framework/soundhandler.xml index fceeffbde0e3..065b31a2c402 100644..100755 --- a/avmedia/source/framework/soundhandler.xml +++ b/avmedia/source/framework/soundhandler.xml @@ -20,7 +20,6 @@ <project-build-dependency> cppu </project-build-dependency> <project-build-dependency> cppuhelper </project-build-dependency> - <project-build-dependency> vos </project-build-dependency> <project-build-dependency> sal </project-build-dependency> <project-build-dependency> tools </project-build-dependency> <project-build-dependency> svtools </project-build-dependency> @@ -34,7 +33,6 @@ <runtime-module-dependency> cppu2 </runtime-module-dependency> <runtime-module-dependency> cppuhelper </runtime-module-dependency> - <runtime-module-dependency> vos2$(COM) </runtime-module-dependency> <runtime-module-dependency> sal2 </runtime-module-dependency> <runtime-module-dependency> tl </runtime-module-dependency> <runtime-module-dependency> svt </runtime-module-dependency> diff --git a/avmedia/source/gstreamer/avmediagst.component b/avmedia/source/gstreamer/avmediagst.component deleted file mode 100644 index 75d39d275f5c..000000000000 --- a/avmedia/source/gstreamer/avmediagst.component +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!--********************************************************************** -* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* Copyright 2000, 2010 Oracle and/or its affiliates. -* -* 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. -* -**********************************************************************--> - -<component loader="com.sun.star.loader.SharedLibrary" - xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.avmedia.Manager_GStreamer"> - <service name="com.sun.star.media.Manager_GStreamer"/> - </implementation> -</component> 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 index f0e1c69934bc..f0e1c69934bc 100644..100755 --- a/avmedia/source/gstreamer/exports.dxp +++ b/avmedia/source/gstreamer/exports.dxp diff --git a/avmedia/source/gstreamer/gstcommon.hxx b/avmedia/source/gstreamer/gstcommon.hxx index 83bb818aefdc..1d9b5caaff96 100644 --- a/avmedia/source/gstreamer/gstcommon.hxx +++ b/avmedia/source/gstreamer/gstcommon.hxx @@ -1,8 +1,9 @@ +/* -*- 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 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Novell, Inc. * * OpenOffice.org - a multi-platform office productivity suite * @@ -28,14 +29,15 @@ #ifndef _GSTCOMMON_HXX #define _GSTCOMMON_HXX +#include <gst/gst.h> + #include <osl/mutex.hxx> -#include <rtl/ustring.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/implbase3.hxx> #include <cppuhelper/weak.hxx> #include <cppuhelper/factory.hxx> @@ -51,18 +53,8 @@ #include <com/sun/star/awt/MouseButton.hpp> #include <com/sun/star/media/XManager.hpp> -#include <memory> - -#define AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Manager_GStreamer" -#define AVMEDIA_GSTREAMER_MANAGER_SERVICENAME "com.sun.star.media.Manager_GStreamer" - -#define AVMEDIA_GSTREAMER_PLAYER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Player_GStreamer" -#define AVMEDIA_GSTREAMER_PLAYER_SERVICENAME "com.sun.star.media.Player_GStreamer" - -#define AVMEDIA_GSTREAMER_WINDOW_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Window_GStreamer" -#define AVMEDIA_GSTREAMER_WINDOW_SERVICENAME "com.sun.star.media.Window_GStreamer" - -#define AVMEDIA_GSTREAMER_FRAMEGRABBER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.FrameGrabber_GStreamer" -#define AVMEDIA_GSTREAMER_FRAMEGRABBER_SERVICENAME "com.sun.star.media.FrameGrabber_GStreamer" +#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 index 49a6d9695fbc..fc775fe01287 100644 --- a/avmedia/source/gstreamer/gstframegrabber.cxx +++ b/avmedia/source/gstreamer/gstframegrabber.cxx @@ -1,8 +1,9 @@ +/* -*- 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 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Novell, Inc. * * OpenOffice.org - a multi-platform office productivity suite * @@ -25,153 +26,83 @@ * ************************************************************************/ -#include "gstframegrabber.hxx" -#include "gstplayer.hxx" +#include <objbase.h> +#include <strmif.h> +#include <Amvideo.h> +#include <Qedit.h> +#include <uuids.h> -#include <vcl/graph.hxx> -#include <vcl/bmpacc.hxx> +#include "framegrabber.hxx" +#include "player.hxx" -#include <string> +#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 gst { - -const gulong GRAB_TIMEOUT = 10000000; +namespace avmedia { namespace gstreamer { // ---------------- // - FrameGrabber - // ---------------- -FrameGrabber::FrameGrabber( GString* pURI ) : - Player( pURI ), - mpFrameMutex( g_mutex_new() ), - mpFrameCond( g_cond_new() ), - mpLastPixbuf( NULL ), - mbIsInGrabMode( false ) +FrameGrabber::FrameGrabber( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) : + mxMgr( rxMgr ) { + ::CoInitialize( NULL ); } // ------------------------------------------------------------------------------ FrameGrabber::~FrameGrabber() { - if( g_atomic_pointer_get( &mpPlayer ) ) - { - implQuitThread(); - } - - // thread has ended, so that no more synchronization is necessary - if( mpLastPixbuf ) - { - g_object_unref( mpLastPixbuf ); - mpLastPixbuf = NULL; - } - - g_cond_free( mpFrameCond ); - g_mutex_free( mpFrameMutex ); + ::CoUninitialize(); } // ------------------------------------------------------------------------------ -FrameGrabber* FrameGrabber::create( const GString* pURI ) +IMediaDet* FrameGrabber::implCreateMediaDet( const ::rtl::OUString& rURL ) const { - FrameGrabber* pFrameGrabber = NULL; + IMediaDet* pDet = NULL; - if( pURI && pURI->len ) + if( SUCCEEDED( CoCreateInstance( CLSID_MediaDet, NULL, CLSCTX_INPROC_SERVER, IID_IMediaDet, (void**) &pDet ) ) ) { - // safely initialize GLib threading framework - try - { - if( !g_thread_supported() ) - { - g_thread_init( NULL ); - } - } - catch( ... ) - {} + String aLocalStr; - if( g_thread_supported() ) + if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( rURL, aLocalStr ) && aLocalStr.Len() ) { - pFrameGrabber = new FrameGrabber( g_string_new( pURI->str ) ); - - // wait until thread signals that it has finished initialization - if( pFrameGrabber->mpThread ) + if( !SUCCEEDED( pDet->put_Filename( ::SysAllocString( aLocalStr.GetBuffer() ) ) ) ) { - g_mutex_lock( pFrameGrabber->mpMutex ); - - while( !pFrameGrabber->implIsInitialized() ) - { - g_cond_wait( pFrameGrabber->mpCond, pFrameGrabber->mpMutex ); - } - - g_mutex_unlock( pFrameGrabber->mpMutex ); - } - - GstElement* pPixbufSink = gst_element_factory_make( "gdkpixbufsink", NULL ); - - // check if player pipeline and GdkPixbufSink could be initialized - if( !pFrameGrabber->mpPlayer || !pPixbufSink ) - { - delete pFrameGrabber; - pFrameGrabber = NULL; - } - else - { - g_object_set( pFrameGrabber->mpPlayer, "audio-sink", gst_element_factory_make( "fakesink", NULL ), NULL ); - g_object_set( pFrameGrabber->mpPlayer, "video-sink", pPixbufSink, NULL ); + pDet->Release(); + pDet = NULL; } } } - return( pFrameGrabber ); + return pDet; } // ------------------------------------------------------------------------------ -gboolean FrameGrabber::busCallback( GstBus* pBus, GstMessage* pMsg ) +bool FrameGrabber::create( const ::rtl::OUString& rURL ) { - bool bDone = false; + // just check if a MediaDet interface can be created with the given URL + IMediaDet* pDet = implCreateMediaDet( rURL ); - if( pMsg && pMsg->structure ) + if( pDet ) { - GstStructure* pStruct = pMsg->structure; - const gchar* pStructName = gst_structure_get_name( pStruct ); - - if( ( ::std::string( pStructName ).find( "pixbuf" ) != ::std::string::npos ) && - gst_structure_has_field ( pStruct, "pixbuf") ) - { - bool bFrameGrabbed = false; - - g_mutex_lock( mpFrameMutex ); - - if( mbIsInGrabMode && ( getMediaTime() >= mfGrabTime ) ) - { - OSL_TRACE( "Grabbing frame at %fs", getMediaTime() ); - - if( mpLastPixbuf ) - { - g_object_unref( mpLastPixbuf ); - mpLastPixbuf = NULL; - } - - mpLastPixbuf = GDK_PIXBUF( g_value_dup_object( gst_structure_get_value( pStruct, "pixbuf" ) ) ); - bFrameGrabbed = true; - } - - g_mutex_unlock( mpFrameMutex ); - - if( bFrameGrabbed ) - { - g_cond_signal( mpFrameCond ); - } - - bDone = true; - } + maURL = rURL; + pDet->Release(); + pDet = NULL; } + else + maURL = ::rtl::OUString(); - return( bDone || Player::busCallback( pBus, pMsg ) ); + return( maURL.getLength() > 0 ); } // ------------------------------------------------------------------------------ @@ -180,100 +111,93 @@ uno::Reference< graphic::XGraphic > SAL_CALL FrameGrabber::grabFrame( double fMe throw (uno::RuntimeException) { uno::Reference< graphic::XGraphic > xRet; + IMediaDet* pDet = implCreateMediaDet( maURL ); - if( implInitPlayer() ) + if( pDet ) { - OSL_TRACE( "Trying to grab frame at %fs", fMediaTime ); - - GTimeVal aTimeoutTime; + double fLength; + long nStreamCount; + bool bFound = false; - g_get_current_time( &aTimeoutTime ); - g_time_val_add( &aTimeoutTime, GRAB_TIMEOUT ); - setMediaTime( fMediaTime ); - start(); - - if( isPlaying() ) + if( SUCCEEDED( pDet->get_OutputStreams( &nStreamCount ) ) ) { - g_mutex_lock( mpFrameMutex ); + for( long n = 0; ( n < nStreamCount ) && !bFound; ++n ) + { + GUID aMajorType; - mbIsInGrabMode = true; - mfGrabTime = fMediaTime; - g_cond_timed_wait( mpFrameCond, mpFrameMutex, &aTimeoutTime ); - mbIsInGrabMode = false; + if( SUCCEEDED( pDet->put_CurrentStream( n ) ) && + SUCCEEDED( pDet->get_StreamType( &aMajorType ) ) && + ( aMajorType == MEDIATYPE_Video ) ) + { + bFound = true; + } + } + } - g_mutex_unlock( mpFrameMutex ); + 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; - stop(); - } + if( SUCCEEDED( pDet->get_StreamMediaType( &aMediaType ) ) ) + { + if( ( aMediaType.formattype == FORMAT_VideoInfo ) && + ( aMediaType.cbFormat >= sizeof( VIDEOINFOHEADER ) ) ) + { + VIDEOINFOHEADER* pVih = reinterpret_cast< VIDEOINFOHEADER* >( aMediaType.pbFormat ); - OSL_ENSURE( g_atomic_pointer_get( &mpLastPixbuf ), "FrameGrabber timed out without receiving a Pixbuf" ); + nWidth = pVih->bmiHeader.biWidth; + nHeight = pVih->bmiHeader.biHeight; - if( g_atomic_pointer_get( &mpLastPixbuf ) ) - { - OSL_TRACE( "FrameGrabber received a GdkPixbuf"); + if( nHeight < 0 ) + nHeight *= -1; + } - g_mutex_lock( mpFrameMutex ); + if( aMediaType.cbFormat != 0 ) + { + ::CoTaskMemFree( (PVOID) aMediaType.pbFormat ); + aMediaType.cbFormat = 0; + aMediaType.pbFormat = NULL; + } - const int nWidth = gdk_pixbuf_get_width( mpLastPixbuf ); - const int nHeight = gdk_pixbuf_get_height( mpLastPixbuf ); - const int nChannels = gdk_pixbuf_get_n_channels( mpLastPixbuf ); - const guchar* pBuffer = gdk_pixbuf_get_pixels( mpLastPixbuf ); + if( aMediaType.pUnk != NULL ) + { + aMediaType.pUnk->Release(); + aMediaType.pUnk = NULL; + } + } - if( pBuffer && ( nWidth > 0 ) && ( nHeight > 0 ) ) + if( ( nWidth > 0 ) && ( nHeight > 0 ) && + SUCCEEDED( pDet->GetBitmapBits( 0, &nSize, NULL, nWidth, nHeight ) ) && + ( nSize > 0 ) ) { - Bitmap aFrame( Size( nWidth, nHeight), 24 ); - bool bInit = false; + char* pBuffer = new char[ nSize ]; - if( ( gdk_pixbuf_get_colorspace( mpLastPixbuf ) == GDK_COLORSPACE_RGB ) && - ( nChannels >= 3 ) && ( nChannels <= 4 ) && - ( gdk_pixbuf_get_bits_per_sample( mpLastPixbuf ) == 8 ) ) + try { - BitmapWriteAccess* pAcc = aFrame.AcquireWriteAccess(); - - if( pAcc ) + if( SUCCEEDED( pDet->GetBitmapBits( fMediaTime, NULL, pBuffer, nWidth, nHeight ) ) ) { - BitmapColor aPixel( 0, 0, 0 ); - const int nRowStride = gdk_pixbuf_get_rowstride( mpLastPixbuf ); - const bool bAlpha = ( nChannels == 4 ); + SvMemoryStream aMemStm( pBuffer, nSize, STREAM_READ | STREAM_WRITE ); + Bitmap aBmp; - for( int nRow = 0; nRow < nHeight; ++nRow ) + if( aBmp.Read( aMemStm, false ) && !aBmp.IsEmpty() ) { - guchar* pCur = const_cast< guchar* >( pBuffer + nRow * nRowStride ); - - for( int nCol = 0; nCol < nWidth; ++nCol ) - { - aPixel.SetRed( *pCur++ ); - aPixel.SetGreen( *pCur++ ); - aPixel.SetBlue( *pCur++ ); - - // ignore alpha channel - if( bAlpha ) - { - ++pCur; - } - - pAcc->SetPixel( nRow, nCol, aPixel ); - } + const Graphic aGraphic( aBmp ); + xRet = aGraphic.GetXGraphic(); } - - aFrame.ReleaseAccess( pAcc ); - bInit = true; } } - - if( !bInit ) + catch( ... ) { - aFrame.Erase( Color( COL_BLACK ) ); } - xRet = Graphic( aFrame ).GetXGraphic(); + delete [] pBuffer; } - - g_object_unref( mpLastPixbuf ); - mpLastPixbuf = NULL; - - g_mutex_unlock( mpFrameMutex ); } + + pDet->Release(); } return xRet; @@ -284,7 +208,7 @@ uno::Reference< graphic::XGraphic > SAL_CALL FrameGrabber::grabFrame( double fMe ::rtl::OUString SAL_CALL FrameGrabber::getImplementationName( ) throw (uno::RuntimeException) { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_FRAMEGRABBER_IMPLEMENTATIONNAME ) ); + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GST_FRAMEGRABBER_IMPLEMENTATIONNAME ) ); } // ------------------------------------------------------------------------------ @@ -292,7 +216,7 @@ uno::Reference< graphic::XGraphic > SAL_CALL FrameGrabber::grabFrame( double fMe sal_Bool SAL_CALL FrameGrabber::supportsService( const ::rtl::OUString& ServiceName ) throw (uno::RuntimeException) { - return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_GSTREAMER_FRAMEGRABBER_SERVICENAME ) ); + return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_GST_FRAMEGRABBER_SERVICENAME ) ); } // ------------------------------------------------------------------------------ @@ -301,10 +225,12 @@ 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_GSTREAMER_FRAMEGRABBER_SERVICENAME ) ); + aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_GST_FRAMEGRABBER_SERVICENAME ) ); return aRet; } -} // namespace win +} // 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 index 9a7ec1b74102..fc0795221a88 100644 --- a/avmedia/source/gstreamer/gstframegrabber.hxx +++ b/avmedia/source/gstreamer/gstframegrabber.hxx @@ -1,8 +1,9 @@ +/* -*- 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 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Novell, Inc. * * OpenOffice.org - a multi-platform office productivity suite * @@ -28,29 +29,25 @@ #ifndef _FRAMEGRABBER_HXX #define _FRAMEGRABBER_HXX -#include "gstplayer.hxx" -#include <gdk-pixbuf/gdk-pixbuf.h> +#include "gstcommon.hxx" -#ifndef _COM_SUN_STAR_MEDIA_XFRAMEGRABBER_HDL_ #include "com/sun/star/media/XFrameGrabber.hdl" -#endif -namespace avmedia { namespace gst { +namespace avmedia { namespace gstreamer { // ---------------- // - FrameGrabber - // ---------------- -class FrameGrabber : public Player, - public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XFrameGrabber, +class FrameGrabber : public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XFrameGrabber, ::com::sun::star::lang::XServiceInfo > { public: - // static create method instead of public Ctor - static FrameGrabber* create( const GString* pUri ); + FrameGrabber( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMgr ); + ~FrameGrabber(); - ~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); @@ -60,22 +57,15 @@ public: virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); -protected: FrameGrabber( GString* pURI = NULL ); +private: - virtual gboolean busCallback( GstBus* pBus, - GstMessage* pMsg ); - -private: FrameGrabber( const FrameGrabber& ); - FrameGrabber& operator=( const FrameGrabber& ); - - GMutex* mpFrameMutex; - GCond* mpFrameCond; - GdkPixbuf* mpLastPixbuf; - double mfGrabTime; - bool mbIsInGrabMode; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr; + ::rtl::OUString maURL; }; -} // namespace gst +} // 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 index 61ee4ce22cd8..e3b2c158c1b9 100644 --- a/avmedia/source/gstreamer/gstmanager.cxx +++ b/avmedia/source/gstreamer/gstmanager.cxx @@ -1,8 +1,9 @@ +/* -*- 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 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Novell, Inc. * * OpenOffice.org - a multi-platform office productivity suite * @@ -28,58 +29,81 @@ #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 gst -{ +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 ) + throw (uno::RuntimeException) { - return( ::avmedia::gst::Player::create( rURL ) ); + 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 ) +::rtl::OUString SAL_CALL Manager::getImplementationName( ) + throw (uno::RuntimeException) { - return( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME ) ) ); + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GST_MANAGER_IMPLEMENTATIONNAME ) ); } // ------------------------------------------------------------------------------ sal_Bool SAL_CALL Manager::supportsService( const ::rtl::OUString& ServiceName ) - throw( uno::RuntimeException ) + throw (uno::RuntimeException) { - return( ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( AVMEDIA_GSTREAMER_MANAGER_SERVICENAME ) ) ); + 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 > SAL_CALL Manager::getSupportedServiceNames( ) + throw (uno::RuntimeException) { - uno::Sequence< ::rtl::OUString > aRet( 1 ); - aRet[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_MANAGER_SERVICENAME ) ); + uno::Sequence< ::rtl::OUString > aRet(1); + aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_GST_MANAGER_SERVICENAME ) ); - return( aRet ); + return aRet; } -} // namespace gst + +} // 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 index 9f80e8c1a901..2d83215402df 100644 --- a/avmedia/source/gstreamer/gstmanager.hxx +++ b/avmedia/source/gstreamer/gstmanager.hxx @@ -1,8 +1,9 @@ +/* -*- 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 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Novell, Inc. * * OpenOffice.org - a multi-platform office productivity suite * @@ -25,50 +26,42 @@ * ************************************************************************/ -#ifndef _GSTMANAGER_HXX -#define _GSTMANAGER_HXX +#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 gst -{ -class Manager : public ::cppu::WeakImplHelper2< ::com::sun::star::media::XManager, - ::com::sun::star::lang::XServiceInfo > +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 ); +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 ); + 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 ); - - + 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 gst + +} // namespace gstreamer } // namespace avmedia -#endif // _GSTMANAGER_HXX +#endif // _MANAGER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx index 614ff80ce352..b7a68573c3da 100644 --- a/avmedia/source/gstreamer/gstplayer.cxx +++ b/avmedia/source/gstreamer/gstplayer.cxx @@ -1,8 +1,9 @@ +/* -*- 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 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Novell, Inc. * * OpenOffice.org - a multi-platform office productivity suite * @@ -25,924 +26,608 @@ * ************************************************************************/ +#include <math.h> + +#include <rtl/string.hxx> + +#include <vcl/syschild.hxx> +#include <vcl/sysdata.hxx> + + #include "gstplayer.hxx" -#include "gstwindow.hxx" #include "gstframegrabber.hxx" -#include <stdio.h> -#include <unistd.h> -#include <math.h> -#include <string> -#include <gst/gstelement.h> +#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" -// maximum timeout time in nanoseconds -#define GST_MAX_TIMEOUT (2500 * GST_MSECOND) +#if OSL_DEBUG_LEVEL > 2 +#define DBG OSL_TRACE +#else +#define DBG(...) +#endif using namespace ::com::sun::star; -namespace avmedia -{ -namespace gst -{ -const double NANO_TIME_FACTOR = 1000000000.0; - -const long VIDEO_DEFAULT_WIDTH = 256; -const long VIDEO_DEFAULT_HEIGHT = 192; +namespace avmedia { namespace gstreamer { // ---------------- -// - GstBusSource - +// - Player - // ---------------- -struct GstBusSource : public GSource +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 ) { - GstBus* mpBus; + // Initialize GStreamer library + int argc = 1; + char name[] = "libreoffice"; + char *arguments[] = { name }; + char** argv = arguments; + GError* pError = NULL; - GstBusSource() : - mpBus( NULL ) - {} + mbInitialized = gst_init_check( &argc, &argv, &pError ); - ~GstBusSource() - {} -}; + if (pError != NULL) + // TODO: thow an exception? + g_error_free (pError); +} +// ------------------------------------------------------------------------------ -// ----------------------------------------------------------------------- -extern "C" +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 ) ); -static gpointer -lcl_implThreadFunc( gpointer pData ) -{ - return( pData ? static_cast< Player* >( pData )->run() : NULL ); + mpPlaybin = NULL; + } + + if( mpXOverlay ) { + g_object_unref( G_OBJECT ( mpXOverlay ) ); + mpXOverlay = NULL; + } + } } -static gboolean -lcl_implBusCheck( GSource* pSource ) +// ------------------------------------------------------------------------------ + +static gboolean gst_pipeline_bus_callback( GstBus *, GstMessage *message, gpointer data ) { - GstBusSource* pBusSource = static_cast< GstBusSource* >( pSource ); + Player* pPlayer = (Player *) data; - return( pBusSource && - GST_IS_BUS( pBusSource->mpBus ) && - gst_bus_have_pending( GST_BUS_CAST( pBusSource->mpBus ) ) ); -} + pPlayer->processMessage( message ); + return TRUE; +} -static gboolean -lcl_implBusPrepare( GSource* pSource, gint* pTimeout ) +static GstBusSyncReply gst_pipeline_bus_sync_handler( GstBus *, GstMessage * message, gpointer data ) { - if (pTimeout) - { - *pTimeout = 0; - } + Player* pPlayer = (Player *) data; - return lcl_implBusCheck(pSource); + return pPlayer->processSyncMessage( message ); } -static gboolean -lcl_implBusDispatch( GSource* pSource, - GSourceFunc /*aCallback*/, - gpointer pData ) +void Player::processMessage( GstMessage *message ) { - GstBusSource* pBusSource = static_cast< GstBusSource* >( pSource ); - gboolean bRet = false; + 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; - if( pData && pBusSource && GST_IS_BUS( pBusSource->mpBus ) ) - { - GstMessage* pMsg = gst_bus_pop( pBusSource->mpBus ); + gst_message_parse_state_changed (message, NULL, &newstate, &pendingstate); - if( pMsg ) - { - bRet = static_cast< Player* >( pData )->busCallback( - pBusSource->mpBus, pMsg ); - gst_message_unref( pMsg ); + 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; } - - return( bRet ); } -static void -lcl_implBusFinalize( GSource* pSource ) +GstBusSyncReply Player::processSyncMessage( GstMessage *message ) { - GstBusSource* pBusSource = static_cast< GstBusSource* >( pSource ); + DBG( "%p processSyncMessage: %s", this, GST_MESSAGE_TYPE_NAME( message ) ); - if( pBusSource && pBusSource->mpBus ) +#if OSL_DEBUG_LEVEL > 0 + if ( GST_MESSAGE_TYPE( message ) == GST_MESSAGE_ERROR ) { - gst_object_unref( pBusSource->mpBus ); - pBusSource->mpBus = NULL; - } -} + GError* error; + gchar* error_debug; -static gboolean -lcl_implIdleFunc( gpointer pData ) -{ - return( pData ? static_cast< Player* >( pData )->idle() : true ); -} + gst_message_parse_error( message, &error, &error_debug ); + OSL_TRACE("gstreamer error: '%s' debug: '%s'", error->message, error_debug); + } +#endif -static GstBusSyncReply -lcl_implHandleCreateWindowFunc( GstBus* pBus, GstMessage* pMsg, gpointer pData ) -{ - return (pData) - ? static_cast< Player* >( pData )->handleCreateWindow( pBus, pMsg ) - : GST_BUS_PASS; -} + 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; + } + } -} // extern "C" + 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 ) { -// --------------- -// - Player - -// --------------- -Player::Player( GString* pURI ) : - mpMutex( g_mutex_new() ), - mpCond( g_cond_new() ), - mpThread( NULL ), - mpContext( NULL ), - mpLoop( NULL ), - mpPlayer( NULL ), - mpURI( pURI ), - mpPlayerWindow( NULL ), - mnIsVideoSource( 0 ), - mnVideoWidth( 0 ), - mnVideoHeight( 0 ), - mnInitialized( 0 ), - mnVolumeDB( 0 ), - mnLooping( 0 ), - mnQuit( 0 ), - mnVideoWindowSet( 0 ), - mnInitFail( 0 ) -{ - // initialize GStreamer framework only once - static bool bGstInitialized = false; + DBG( "%p change to paused received", this ); - if( !bGstInitialized ) - { - gst_init( NULL, NULL ); - bGstInitialized = true; - } + if( mnDuration == 0) { + GstFormat format = GST_FORMAT_TIME; + gint64 gst_duration = 0L; - if( pURI ) - { - OSL_TRACE( ">>> --------------------------------" ); - OSL_TRACE( ">>> Creating Player object with URL: %s", pURI->str ); + if( gst_element_query_duration( mpPlaybin, &format, &gst_duration) && format == GST_FORMAT_TIME && gst_duration > 0L ) + mnDuration = gst_duration; + } - mpThread = g_thread_create( &lcl_implThreadFunc, this, true, NULL ); - } -} + if( mnWidth == 0 ) { + GList *pStreamInfo = NULL; -// ------------------------------------------------------------------------------ + g_object_get( G_OBJECT( mpPlaybin ), "stream-info", &pStreamInfo, NULL ); -Player::~Player() -{ - if( g_atomic_pointer_get( &mpPlayer ) ) - { - implQuitThread(); - } + for ( ; pStreamInfo != NULL; pStreamInfo = pStreamInfo->next) { + GObject *pInfo = G_OBJECT( pStreamInfo->data ); - // cleanup - g_cond_free( mpCond ); - g_mutex_free( mpMutex ); - g_string_free( mpURI, false ); -} + if( !pInfo ) + continue; -// ------------------------------------------------------------------------------ -Player* Player::create( const ::rtl::OUString& rURL ) -{ - Player* pPlayer = NULL; + 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( rURL.getLength() ) - { - // safely initialize GLib threading framework - try - { - if( !g_thread_supported() ) - { - g_thread_init( NULL ); - } - } - catch( ... ) - {} + if( !g_strcasecmp( pValue->value_nick, "video" ) ) { + GstStructure *pStructure; + GstPad *pPad; - if( g_thread_supported() ) - { - const INetURLObject aURL( rURL ); - - if( aURL.GetProtocol() != INET_PROT_NOT_VALID ) - { - GString* pURI = g_string_new( ::rtl::OUStringToOString( - aURL.GetMainURL( INetURLObject::NO_DECODE ), - RTL_TEXTENCODING_UTF8 ).getStr() ); - - if( pURI->len ) - { - pPlayer = new Player( pURI ); - - // wait until thread signals that it has finished initialization - if( pPlayer->mpThread ) - { - g_mutex_lock( pPlayer->mpMutex ); - - while( !pPlayer->implIsInitialized() ) - { - g_cond_wait( pPlayer->mpCond, pPlayer->mpMutex ); + 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 ); + } } - - g_mutex_unlock( pPlayer->mpMutex ); } - // check if player pipeline could be initialized - if( !pPlayer->mpPlayer ) - { - delete pPlayer; - pPlayer = NULL; - } - } - else - { - g_string_free( pURI, false ); +#if OSL_DEBUG_LEVEL > 2 + sal_Bool aSuccess = +#endif + maSizeCondition.set(); + 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 + maSizeCondition.set(); + DBG( "%p set condition result: %d", this, aSuccess ); + } } - return( pPlayer ); -} - -// ------------------------------------------------------------------------------ -void SAL_CALL Player::start() - throw( uno::RuntimeException ) -{ - if( implInitPlayer() && !isPlaying() ) - { - gst_element_set_state( mpPlayer, GST_STATE_PLAYING ); - } -} - -// ------------------------------------------------------------------------------ -void SAL_CALL Player::stop() - throw( uno::RuntimeException ) -{ - if( implInitPlayer() && isPlaying() ) - { - gst_element_set_state( mpPlayer, GST_STATE_PAUSED ); - } + return GST_BUS_PASS; } -// ------------------------------------------------------------------------------ -sal_Bool SAL_CALL Player::isPlaying() - throw( uno::RuntimeException ) +void Player::preparePlaybin( const ::rtl::OUString& rURL, bool bFakeVideo ) { - GstState aState = GST_STATE_NULL; + GstBus *pBus; - if( mpPlayer ) - { - gst_element_get_state( mpPlayer, &aState, NULL, GST_MAX_TIMEOUT ); - } + if( mpPlaybin != NULL ) { + gst_element_set_state( mpPlaybin, GST_STATE_NULL ); + mbPlayPending = false; + g_object_unref( mpPlaybin ); + } - return( GST_STATE_PLAYING == aState ); -} + mpPlaybin = gst_element_factory_make( "playbin", NULL ); -// ------------------------------------------------------------------------------ -double SAL_CALL Player::getDuration() - throw( uno::RuntimeException ) -{ - gint64 nDuration = 0; + if( bFakeVideo ) + g_object_set( G_OBJECT( mpPlaybin ), "video-sink", gst_element_factory_make( "fakesink", NULL ), NULL ); - if( implInitPlayer() ) - { - GstFormat aFormat = GST_FORMAT_TIME; + mbFakeVideo = bFakeVideo; - if( !gst_element_query_duration( mpPlayer, &aFormat, &nDuration ) || - ( GST_FORMAT_TIME != aFormat ) || - ( nDuration < 0 ) ) - { - nDuration = 0; - } - } + rtl::OString ascURL = OUStringToOString( rURL, RTL_TEXTENCODING_ASCII_US ); + g_object_set( G_OBJECT( mpPlaybin ), "uri", ascURL.getStr() , NULL ); - return( static_cast< double >( nDuration ) / NANO_TIME_FACTOR ); + 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 ); } -// ------------------------------------------------------------------------------ -void SAL_CALL Player::setMediaTime( double fTime ) - throw( uno::RuntimeException ) +bool Player::create( const ::rtl::OUString& rURL ) { - if( implInitPlayer() ) - { - fTime = ::std::min( ::std::max( fTime, 0.0 ), getDuration() ); + bool bRet = false; - gst_element_seek_simple( mpPlayer, GST_FORMAT_TIME, - (GstSeekFlags) ( GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT ), - static_cast< gint64 >( fTime * NANO_TIME_FACTOR ) ); - } -} + // create all the elements and link them -// ------------------------------------------------------------------------------ -double SAL_CALL Player::getMediaTime() - throw( uno::RuntimeException ) -{ - double fRet = 0.0; + DBG("create player, URL: %s", OUStringToOString( rURL, RTL_TEXTENCODING_UTF8 ).getStr()); - if( implInitPlayer() ) + if( mbInitialized ) { - GstFormat aFormat = GST_FORMAT_TIME; - gint64 nCurTime = 0; + preparePlaybin( rURL, true ); - if( gst_element_query_position( mpPlayer, &aFormat, &nCurTime ) && - ( GST_FORMAT_TIME == aFormat ) && - ( nCurTime >= 0 ) ) - { - fRet = static_cast< double >( nCurTime ) / NANO_TIME_FACTOR; - } + gst_element_set_state( mpPlaybin, GST_STATE_PAUSED ); + mbPlayPending = false; + + bRet = true; } - return( fRet ); + if( bRet ) + maURL = rURL; + else + maURL = ::rtl::OUString(); + + return bRet; } // ------------------------------------------------------------------------------ -void SAL_CALL Player::setStopTime( double /* fTime */ ) - throw( uno::RuntimeException ) -{ - OSL_TRACE( "GStreamer method avmedia::gst::Player::setStopTime needs to be implemented" ); - /* Currently no need for implementation since higher levels of code don't use this method at all - !!! TODO: needs to be implemented if this functionality is needed at a later point of time - if( implInitPlayer() ) +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; } - - */ } // ------------------------------------------------------------------------------ -double SAL_CALL Player::getStopTime() - throw( uno::RuntimeException ) -{ - /* - Currently no need for implementation since higher levels of code don't set a stop time ATM - !!! TODO: needs to be fully implemented if this functionality is needed at a later point of time - */ - - return( getDuration() ); -} -// ------------------------------------------------------------------------------ -void SAL_CALL Player::setRate( double /* fRate */ ) - throw( uno::RuntimeException ) +void SAL_CALL Player::stop( ) + throw (uno::RuntimeException) { - OSL_TRACE( "GStreamer method avmedia::gst::Player::setRate needs to be implemented" ); + // set the pipeline in PAUSED STATE + if( mpPlaybin ) + gst_element_set_state( mpPlaybin, GST_STATE_PAUSED ); - /* Currently no need for implementation since higher levels of code don't use this method at all - !!! TODO: needs to be implemented if this functionality is needed at a later point of time - */ + mbPlayPending = false; + DBG( "stop %p", mpPlaybin ); } // ------------------------------------------------------------------------------ -double SAL_CALL Player::getRate() - throw( uno::RuntimeException ) -{ - /* - Currently no need for implementation since higher levels of code don't set a different rate than 1 ATM - !!! TODO: needs to be fully implemented if this functionality is needed at a later point of time - */ - - return( 1.0 ); -} -// ------------------------------------------------------------------------------ -void SAL_CALL Player::setPlaybackLoop( sal_Bool bSet ) - throw( uno::RuntimeException ) +sal_Bool SAL_CALL Player::isPlaying() + throw (uno::RuntimeException) { - if (bSet) - { - g_atomic_int_compare_and_exchange(&mnLooping, 0, 1); - } - else + bool bRet = mbPlayPending; + + // return whether the pipeline is in PLAYING STATE or not + if( !mbPlayPending && mbInitialized && mpPlaybin ) { - g_atomic_int_compare_and_exchange(&mnLooping, 1, 0); + bRet = GST_STATE_PLAYING == GST_STATE( mpPlaybin ); } -} -// ------------------------------------------------------------------------------ -sal_Bool SAL_CALL Player::isPlaybackLoop() - throw( uno::RuntimeException ) -{ - return( g_atomic_int_get( &mnLooping ) > 0 ); -} + DBG( "isPlaying %d", bRet ); -// ------------------------------------------------------------------------------ -void SAL_CALL Player::setMute( sal_Bool bSet ) - throw( uno::RuntimeException ) -{ - if( implInitPlayer() && ( bSet != isMute() ) ) - { - if( bSet ) - { - g_object_set( mpPlayer, "volume", 0.0, NULL ); - } - else - { - setVolumeDB( mnVolumeDB ); - } - } + return bRet; } // ------------------------------------------------------------------------------ -sal_Bool SAL_CALL Player::isMute() - throw( uno::RuntimeException ) + +double SAL_CALL Player::getDuration( ) + throw (uno::RuntimeException) { - gdouble fGstVolume = 1.0; + // slideshow checks for non-zero duration, so cheat here + double duration = 0.01; - if( implInitPlayer() ) - { - g_object_get( mpPlayer, "volume", &fGstVolume, NULL ); + if( mpPlaybin && mnDuration > 0 ) { + duration = mnDuration / 1E9; } - return( 0.0 == fGstVolume ); + return duration; } // ------------------------------------------------------------------------------ -void SAL_CALL Player::setVolumeDB( sal_Int16 nVolumeDB ) - throw( uno::RuntimeException ) + +void SAL_CALL Player::setMediaTime( double fTime ) + throw (uno::RuntimeException) { - if( implInitPlayer() ) - { - g_mutex_lock( mpMutex ); - mnVolumeDB = nVolumeDB; - g_mutex_unlock( mpMutex ); + if( mpPlaybin ) { + gint64 gst_position = llround (fTime * 1E9); - // maximum gain for gstreamer volume is 10 - double fGstVolume = pow( 10.0, static_cast< double >( ::std::min( - nVolumeDB, static_cast< sal_Int16 >( 20 ) ) / 20.0 ) ); + 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 ); - g_object_set( mpPlayer, "volume", fGstVolume, NULL ); + DBG( "seek to: %"SAL_PRIdINT64" ns original: %lf s", gst_position, fTime ); } } // ------------------------------------------------------------------------------ -sal_Int16 SAL_CALL Player::getVolumeDB() - throw( uno::RuntimeException ) -{ - return( static_cast< sal_Int16 >( g_atomic_int_get( &mnVolumeDB ) ) ); -} -// ------------------------------------------------------------------------------ -awt::Size SAL_CALL Player::getPreferredPlayerWindowSize() - throw( uno::RuntimeException ) +double SAL_CALL Player::getMediaTime( ) + throw (uno::RuntimeException) { - awt::Size aSize( 0, 0 ); + double position = 0.0; - if( implInitPlayer() && ( g_atomic_int_get( &mnIsVideoSource ) > 0 ) ) - { - aSize.Width = g_atomic_int_get( &mnVideoWidth ); - aSize.Height = g_atomic_int_get( &mnVideoHeight ); - - // if we have a video source, but no size is given => use default size - if( ( aSize.Width <= 0 ) || ( aSize.Height <= 0 ) ) - { - aSize.Width = VIDEO_DEFAULT_WIDTH; - aSize.Height = VIDEO_DEFAULT_HEIGHT; - } + 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; } - OSL_TRACE( ">>> Requested preferred video size is: %d x %d pixel", aSize.Width, aSize.Height ); - - return( aSize ); + return position; } // ------------------------------------------------------------------------------ -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() ); - - OSL_ENSURE( !g_atomic_pointer_get( &mpPlayerWindow ), "::avmedia::gst::Player already has a player window" ); - if( ( aSize.Width > 0 ) && ( aSize.Height > 0 ) ) - { - Window* pPlayerWindow = new Window( *this ); +void SAL_CALL Player::setStopTime( double /*fTime*/ ) + throw (uno::RuntimeException) +{ + // TODO implement +} - xRet = pPlayerWindow; +// ------------------------------------------------------------------------------ - if( !pPlayerWindow->create( rArguments ) ) - { - xRet.clear(); - } - else - { - // try to use gconf user configurable video sink first - GstElement* pVideoSink = gst_element_factory_make( "gconfvideosink", NULL ); - - if( ( NULL != pVideoSink ) || - ( NULL != ( pVideoSink = gst_element_factory_make( "autovideosink", NULL ) ) ) || - ( NULL != ( pVideoSink = gst_element_factory_make( "xvimagesink", NULL ) ) ) || - ( NULL != ( pVideoSink = gst_element_factory_make( "ximagesink", NULL ) ) ) ) - { - GstState aOldState = GST_STATE_NULL; - - mpPlayerWindow = pPlayerWindow; - gst_element_get_state( mpPlayer, &aOldState, NULL, GST_MAX_TIMEOUT ); - gst_element_set_state( mpPlayer, GST_STATE_READY ); - g_object_set( mpPlayer, "video-sink", pVideoSink, NULL ); - gst_element_set_state( mpPlayer, aOldState ); - } - } - } +double SAL_CALL Player::getStopTime( ) + throw (uno::RuntimeException) +{ + // Get the time at which to stop - return( xRet ); + return 0; } // ------------------------------------------------------------------------------ -uno::Reference< media::XFrameGrabber > SAL_CALL Player::createFrameGrabber() - throw( ::com::sun::star::uno::RuntimeException ) -{ - FrameGrabber* pFrameGrabber = NULL; - const awt::Size aPrefSize( getPreferredPlayerWindowSize() ); - - if( ( aPrefSize.Width > 0 ) && ( aPrefSize.Height > 0 ) ) - { - pFrameGrabber = FrameGrabber::create( mpURI ); - } - return( pFrameGrabber ); +void SAL_CALL Player::setRate( double /*fRate*/ ) + throw (uno::RuntimeException) +{ + // TODO set the window rate } // ------------------------------------------------------------------------------ -void SAL_CALL Player::dispose() - throw( uno::RuntimeException ) + +double SAL_CALL Player::getRate( ) + throw (uno::RuntimeException) { - if( mpPlayer ) + double rate = 0.0; + + // TODO get the window rate + if( mbInitialized ) { - stop(); - implQuitThread(); + } - OSL_ASSERT( NULL == mpPlayer ); + return rate; } // ------------------------------------------------------------------------------ -void SAL_CALL Player::addEventListener( const uno::Reference< lang::XEventListener >& /*rxListener*/ ) - throw( uno::RuntimeException ) -{} -// ------------------------------------------------------------------------------ -void SAL_CALL Player::removeEventListener( const uno::Reference< lang::XEventListener >& /*rxListener*/ ) - throw( uno::RuntimeException ) -{} - -// ------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL Player::getImplementationName() - throw( uno::RuntimeException ) +void SAL_CALL Player::setPlaybackLoop( sal_Bool bSet ) + throw (uno::RuntimeException) { - return( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_PLAYER_IMPLEMENTATIONNAME ) ) ); + // TODO check how to do with GST + mbLooping = bSet; } // ------------------------------------------------------------------------------ -sal_Bool SAL_CALL Player::supportsService( const ::rtl::OUString& ServiceName ) - throw( uno::RuntimeException ) -{ - return( ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( AVMEDIA_GSTREAMER_PLAYER_SERVICENAME ) ) ); -} -// ------------------------------------------------------------------------------ -uno::Sequence< ::rtl::OUString > SAL_CALL Player::getSupportedServiceNames() - throw( uno::RuntimeException ) +sal_Bool SAL_CALL Player::isPlaybackLoop( ) + throw (uno::RuntimeException) { - uno::Sequence< ::rtl::OUString > aRet( 1 ); - aRet[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_PLAYER_SERVICENAME ) ); - - return( aRet ); + // TODO check how to do with GST + return mbLooping; } // ------------------------------------------------------------------------------ -void Player::implQuitThread() -{ - if( mpThread ) - { - // set quit flag to 1 so that the main loop will be quit in idle - // handler the next time it is called from the thread's main loop - g_atomic_int_inc( &mnQuit ); - - // wait until loop and as such the thread has quit - g_thread_join( mpThread ); - mpThread = NULL; - } -} -// ------------------------------------------------------------------------------ -bool Player::implInitPlayer() +void SAL_CALL Player::setMute( sal_Bool bSet ) + throw (uno::RuntimeException) { - bool bRet = false; + DBG( "set mute: %d muted: %d unmuted volume: %lf", bSet, mbMuted, mnUnmutedVolume ); - if( mpPlayer && (mnInitFail < 3) ) + // change the volume to 0 or the unmuted volume + if( mpPlaybin && mbMuted != bSet ) { - GstState aState = GST_STATE_NULL; - - if( gst_element_get_state( mpPlayer, &aState, NULL, GST_MAX_TIMEOUT ) == GST_STATE_CHANGE_SUCCESS ) + double nVolume = mnUnmutedVolume; + if( bSet ) { - bRet = ( GST_STATE_PAUSED == aState ) || ( GST_STATE_PLAYING == aState ); - - if( !bRet ) - { - gst_element_set_state( mpPlayer, GST_STATE_PAUSED ); - bRet = ( gst_element_get_state( mpPlayer, &aState, NULL, - GST_MAX_TIMEOUT ) == GST_STATE_CHANGE_SUCCESS ) && - ( GST_STATE_PAUSED == aState ); - } + nVolume = 0.0; } - if( ! bRet ) - mnInitFail++; - } + g_object_set( G_OBJECT( mpPlaybin ), "volume", nVolume, NULL ); - return( bRet ); + mbMuted = bSet; + } } // ------------------------------------------------------------------------------ -gboolean Player::busCallback( GstBus* /*pBus*/, - GstMessage* pMsg ) -{ - if( pMsg && mpLoop ) - { - switch( GST_MESSAGE_TYPE( pMsg ) ) - { - case ( GST_MESSAGE_EOS ): - { - if( g_atomic_int_get( &mnLooping ) > 0 ) - { - setMediaTime( 0.0 ); - start(); - } - else - { - stop(); - } - } - break; - - case ( GST_MESSAGE_ERROR ): - { - gchar* pDebug; - GError* pErr; - - gst_message_parse_error( pMsg, &pErr, &pDebug ); - fprintf( stderr, "Error: %s\n", pErr->message ); - g_free( pDebug ); - g_error_free( pErr ); - } - break; - - default: - { - break; - } - } - } - - return( true ); +sal_Bool SAL_CALL Player::isMute( ) + throw (uno::RuntimeException) +{ + return mbMuted; } // ------------------------------------------------------------------------------ -void Player::implHandleNewElementFunc( GstBin* /* pBin */, - GstElement* pElement, - gpointer pData ) -{ - if( pElement ) - { -#ifdef DEBUG - gchar* pElementName = gst_element_get_name( pElement ); - if( pElementName ) - { - OSL_TRACE( ">>> Bin has element: %s", pElementName ); - g_free( pElementName ); - } -#endif +void SAL_CALL Player::setVolumeDB( sal_Int16 nVolumeDB ) + throw (uno::RuntimeException) +{ + mnUnmutedVolume = pow( 10.0, nVolumeDB / 20.0 ); - if( GST_IS_BIN( pElement ) ) - { - // set this handler in case we have a GstBin element - g_signal_connect( GST_BIN( pElement ), "element-added", - G_CALLBACK( Player::implHandleNewElementFunc ), pData ); - } + DBG( "set volume: %d gst volume: %lf", nVolumeDB, mnUnmutedVolume ); - // watch for all pads that are going to be added to this element; - g_signal_connect( pElement, "pad-added", - G_CALLBACK( Player::implHandleNewPadFunc ), pData ); - } + // change volume + if( !mbMuted && mpPlaybin ) + { + g_object_set( G_OBJECT( mpPlaybin ), "volume", (gdouble) mnUnmutedVolume, NULL ); + } } // ------------------------------------------------------------------------------ -void Player::implHandleNewPadFunc( GstElement* pElement, - GstPad* pPad, - gpointer pData ) + +sal_Int16 SAL_CALL Player::getVolumeDB( ) + throw (uno::RuntimeException) { - Player* pPlayer = static_cast< Player* >( pData ); + sal_Int16 nVolumeDB(0); - if( pPlayer && pElement && pPad ) - { -#ifdef DEBUG - gchar* pElementName = gst_element_get_name( pElement ); - gchar* pPadName = gst_pad_get_name( pPad ); + if( mpPlaybin ) { + double nGstVolume = 0.0; - OSL_TRACE( ">>> Element %s has pad: %s", pElementName, pPadName ); + g_object_get( G_OBJECT( mpPlaybin ), "volume", &nGstVolume, NULL ); - g_free( pPadName ); - g_free( pElementName ); -#endif + nVolumeDB = (sal_Int16) ( 20.0*log10 ( nGstVolume ) ); + } - GstCaps* pCaps = gst_pad_get_caps( pPad ); + return nVolumeDB; +} - // we are interested only in getting video properties - // width and height or if we have a video source at all - if( pCaps ) - { - for( gint i = 0, nSize = gst_caps_get_size( pCaps ); i < nSize; ++i ) - { - const GstStructure* pStruct = gst_caps_get_structure( pCaps, i ); +// ------------------------------------------------------------------------------ - if( pStruct ) - { - const gchar* pStructName = gst_structure_get_name( pStruct ); +awt::Size SAL_CALL Player::getPreferredPlayerWindowSize( ) + throw (uno::RuntimeException) +{ + awt::Size aSize( 0, 0 ); -#ifdef DEBUG - OSL_TRACE( "\t>>> Pad has structure: %s", pStructName ); + DBG( "%p Player::getPreferredPlayerWindowSize, member %d x %d", this, mnWidth, mnHeight ); - for( gint n = 0, nFields = gst_structure_n_fields( pStruct ); n < nFields; ++n ) - { - OSL_TRACE( "\t\t>>> Structure has field: %s", gst_structure_nth_field_name( pStruct, n ) ); - } + TimeValue aTimeout = { 10, 0 }; +#if OSL_DEBUG_LEVEL > 2 + oslConditionResult aResult = #endif + maSizeCondition.wait( &aTimeout ); - // just look for structures having 'video' in their names - if( ::std::string( pStructName ).find( "video" ) != ::std::string::npos ) - { - g_atomic_int_inc( &pPlayer->mnIsVideoSource ); - - for( gint n = 0, nFields = gst_structure_n_fields( pStruct ); n < nFields; ++n ) - { - const gchar* pFieldName = gst_structure_nth_field_name( pStruct, n ); - gint nValue; - - if( ( ::std::string( pFieldName ).find( "width" ) != ::std::string::npos ) && - gst_structure_get_int( pStruct, pFieldName, &nValue ) ) - { - const gint nDiff = nValue - g_atomic_int_get( &pPlayer->mnVideoWidth ); - g_atomic_int_add( &pPlayer->mnVideoWidth, ::std::max( nDiff, 0 ) ); - } - else if( ( ::std::string( pFieldName ).find( "height" ) != ::std::string::npos ) && - gst_structure_get_int( pStruct, pFieldName, &nValue ) ) - { - const gint nDiff = nValue - g_atomic_int_get( &pPlayer->mnVideoHeight ); - g_atomic_int_add( &pPlayer->mnVideoHeight, ::std::max( nDiff, 0 ) ); - } - } - } - } - } + if( mbFakeVideo ) { + mbFakeVideo = sal_False; - gst_caps_unref( pCaps ); - } + 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 ); } -} -// ------------------------------------------------------------------------------ -gboolean Player::idle() -{ - // test if main loop should quit by comparing with 1 - // and set flag mnQuit to 0 so we call g_main_loop_quit exactly once - bool const bQuit = g_atomic_int_compare_and_exchange( &mnQuit, 1, 0 ); + DBG( "%p Player::getPreferredPlayerWindowSize after waitCondition %d, member %d x %d", this, aResult, mnWidth, mnHeight ); - if( bQuit ) - { - g_main_loop_quit( mpLoop ); + if( mnWidth != 0 && mnHeight != 0 ) { + aSize.Width = mnWidth; + aSize.Height = mnHeight; } - // don't eat up all cpu time - usleep( 1000 ); - - return( true ); + return aSize; } // ------------------------------------------------------------------------------ -gpointer Player::run() + +uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( const uno::Sequence< uno::Any >& rArguments ) + throw (uno::RuntimeException) { - static GSourceFuncs aSourceFuncs = - { - &lcl_implBusPrepare, - &lcl_implBusCheck, - &lcl_implBusDispatch, - &lcl_implBusFinalize, - NULL, - NULL - }; - - if( NULL != ( mpPlayer = gst_element_factory_make( "playbin", NULL ) ) ) - { - // initialization - // no mutex necessary since initialization - // is synchronous until loop is started - mpContext = g_main_context_new(); - mpLoop = g_main_loop_new( mpContext, false ); - - // add idle callback - GSource* pIdleSource = g_idle_source_new(); - g_source_set_callback( pIdleSource, &lcl_implIdleFunc, this, NULL ); - g_source_attach( pIdleSource, mpContext ); - - // add bus callback - GSource* pBusSource = g_source_new( &aSourceFuncs, sizeof( GstBusSource ) ); - static_cast< GstBusSource* >( pBusSource )->mpBus = gst_pipeline_get_bus( GST_PIPELINE( mpPlayer ) ); - g_source_set_callback( pBusSource, NULL, this, NULL ); - g_source_attach( pBusSource, mpContext ); - - // add bus sync handler to intercept video window creation for setting our own window - gst_bus_set_sync_handler( static_cast< GstBusSource* >( pBusSource )->mpBus, - &lcl_implHandleCreateWindowFunc, this ); - - // watch for all elements (and pads) that will be added to the playbin, - // in order to retrieve properties like video width and height - g_signal_connect( GST_BIN( mpPlayer ), "element-added", - G_CALLBACK( Player::implHandleNewElementFunc ), this ); - - // set source URI for player - g_object_set( mpPlayer, "uri", mpURI->str, NULL ); - - // set video fake sink first, since we only create a player without window here - // and don't want to have the gstreamer default window appearing - g_object_set( mpPlayer, "video-sink", gst_element_factory_make( "fakesink", NULL ), NULL ); - - // set state of player to READY or destroy object in case of FAILURE - if( gst_element_set_state( mpPlayer, GST_STATE_READY ) == GST_STATE_CHANGE_FAILURE ) - { - gst_object_unref( mpPlayer ); - mpPlayer = NULL; - } + uno::Reference< ::media::XPlayerWindow > xRet; + awt::Size aSize( getPreferredPlayerWindowSize() ); + + DBG( "Player::createPlayerWindow %d %d length: %d", aSize.Width, aSize.Height, rArguments.getLength() ); - g_atomic_int_add( &mnInitialized, 1 ); - g_cond_signal( mpCond ); + if( aSize.Width > 0 && aSize.Height > 0 ) + { + ::avmedia::gstreamer::Window* pWindow = new ::avmedia::gstreamer::Window( mxMgr, *this ); - // run the main loop - g_main_loop_run( mpLoop ); + xRet = pWindow; - // clenanup - // no mutex necessary since other thread joined us (this thread) - // after setting the quit flag - if( mpPlayer ) + if( rArguments.getLength() > 2 ) { - gst_element_set_state( mpPlayer, GST_STATE_NULL ); - gst_object_unref( mpPlayer ); - mpPlayer = NULL; + 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; } + } - g_main_loop_unref( mpLoop ); - mpLoop = NULL; - - g_source_destroy( pBusSource ); - g_source_unref( pBusSource ); + return xRet; +} - g_source_destroy( pIdleSource ); - g_source_unref( pIdleSource ); +// ------------------------------------------------------------------------------ - g_main_context_unref( mpContext ); - mpContext = NULL; - } - else - { - g_atomic_int_add( &mnInitialized, 1 ); - g_cond_signal( mpCond ); - } +uno::Reference< media::XFrameGrabber > SAL_CALL Player::createFrameGrabber( ) + throw (uno::RuntimeException) +{ + uno::Reference< media::XFrameGrabber > xRet; - return( NULL ); + return xRet; } // ------------------------------------------------------------------------------ -GstBusSyncReply Player::handleCreateWindow( GstBus* /* pBus */, - GstMessage* pMsg ) + +::rtl::OUString SAL_CALL Player::getImplementationName( ) + throw (uno::RuntimeException) { - GstBusSyncReply eRet = GST_BUS_PASS; + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GST_PLAYER_IMPLEMENTATIONNAME ) ); +} - if( pMsg && - ( GST_MESSAGE_TYPE( pMsg ) == GST_MESSAGE_ELEMENT ) && - gst_structure_has_name( pMsg->structure, "prepare-xwindow-id" ) && - g_atomic_pointer_get( &mpPlayerWindow ) ) - { - OSL_TRACE( ">>> Got Request to create XOverlay" ); +// ------------------------------------------------------------------------------ - gst_x_overlay_set_xwindow_id( GST_X_OVERLAY( GST_MESSAGE_SRC( pMsg ) ), - static_cast< Window* >( g_atomic_pointer_get( - &mpPlayerWindow ) )->getXWindowHandle() ); +sal_Bool SAL_CALL Player::supportsService( const ::rtl::OUString& ServiceName ) + throw (uno::RuntimeException) +{ + return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_GST_PLAYER_SERVICENAME ) ); +} - gst_message_unref( pMsg ); - eRet = GST_BUS_DROP; - } +// ------------------------------------------------------------------------------ - return( eRet ); +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 gst + +} // 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 index 0793eaf8caf2..0e04d67d7f91 100644 --- a/avmedia/source/gstreamer/gstplayer.hxx +++ b/avmedia/source/gstreamer/gstplayer.hxx @@ -1,8 +1,9 @@ +/* -*- 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 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Novell, Inc. * * OpenOffice.org - a multi-platform office productivity suite * @@ -25,193 +26,89 @@ * ************************************************************************/ -#ifndef _GSTPLAYER_HXX -#define _GSTPLAYER_HXX +#ifndef _PLAYER_HXX +#define _PLAYER_HXX +#include <osl/conditn.hxx> #include "gstcommon.hxx" -#include <glib.h> -#include <glib/gatomic.h> - -// necessary for mixed environments with GStreamer-0.10 and GLib versions < 2.8 -#ifndef G_GNUC_NULL_TERMINATED -#if __GNUC__ >= 4 -#define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) -#else -#define G_GNUC_NULL_TERMINATED -#endif -#endif - -struct _GOptionGroup; -typedef struct _GOptionGroup GOptionGroup; - -#include <gst/gst.h> + #include "com/sun/star/media/XPlayer.hdl" -namespace avmedia -{ -namespace gst -{ -class Window; +typedef struct _GstXOverlay GstXOverlay; -// --------------- -// - Player_Impl - -// --------------- +namespace avmedia { namespace gstreamer { -class Player : public ::cppu::WeakImplHelper3< ::com::sun::star::media::XPlayer, - ::com::sun::star::lang::XComponent, +// ---------- +// - Player - +// ---------- + +class Player : public ::cppu::WeakImplHelper2< ::com::sun::star::media::XPlayer, ::com::sun::star::lang::XServiceInfo > { public: - // static create method instead of public Ctor - static Player* create( const ::rtl::OUString& rURL ); - + Player( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMgr ); ~Player(); - // 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 ); + void preparePlaybin( const ::rtl::OUString& rURL, bool bFakeVideo ); + bool create( const ::rtl::OUString& rURL ); + void processMessage( GstMessage *message ); + GstBusSyncReply processSyncMessage( GstMessage *message ); - 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 ); - - // 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 ); + // 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 ); - -// these are public because the C callbacks call them - virtual gboolean busCallback( GstBus* pBus, - GstMessage* pMsg ); - - virtual gboolean idle(); - - virtual gpointer run(); - - virtual GstBusSyncReply handleCreateWindow( GstBus* pBus, - GstMessage* pMsg ); - -protected: - - Player( GString* pURI = NULL ); - - void implQuitThread(); - - bool implInitPlayer(); - - bool implIsInitialized() const - { - return( g_atomic_int_get( &mnInitialized ) > 0 ); - } - + 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: - Player( const Player& ); + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr; - Player& operator=( const Player& ); + ::rtl::OUString maURL; - static void implHandleNewElementFunc( GstBin* pBin, - GstElement* pElement, - gpointer pData ); + // Add elements and pipeline here + GstElement* mpPlaybin; // the playbin is also a pipeline + sal_Bool mbFakeVideo; - static void implHandleNewPadFunc( GstElement* pElem, - GstPad* pPad, - gpointer pData ); + gdouble mnUnmutedVolume; + sal_Bool mbPlayPending; + sal_Bool mbMuted; + sal_Bool mbLooping; + sal_Bool mbInitialized; -protected: + long mnWindowID; + GstXOverlay* mpXOverlay; + gint64 mnDuration; + int mnWidth; + int mnHeight; - GMutex* mpMutex; - GCond* mpCond; - GThread* mpThread; - GMainContext* mpContext; - GMainLoop* mpLoop; - GstElement* mpPlayer; - GString* mpURI; - -private: - - ::avmedia::gst::Window* mpPlayerWindow; - gint mnIsVideoSource; - gint mnVideoWidth; - gint mnVideoHeight; - gint mnInitialized; - gint mnVolumeDB; - gint mnLooping; - gint mnQuit; - gint mnVideoWindowSet; - gint mnInitFail; + osl::Condition maSizeCondition; }; -} // namespace gst + +} // namespace gstreamer } // namespace avmedia -#endif // _GSTPLAYER_HXX +#endif // _PLAYER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/gstreamer/gstuno.cxx b/avmedia/source/gstreamer/gstuno.cxx index 26d13ffc938b..ff18652e79da 100644 --- a/avmedia/source/gstreamer/gstuno.cxx +++ b/avmedia/source/gstreamer/gstuno.cxx @@ -1,8 +1,9 @@ +/* -*- 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 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Novell, Inc. * * OpenOffice.org - a multi-platform office productivity suite * @@ -25,7 +26,6 @@ * ************************************************************************/ -#include "gstcommon.hxx" #include "gstmanager.hxx" using namespace ::com::sun::star; @@ -36,34 +36,26 @@ using namespace ::com::sun::star; static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const uno::Reference< lang::XMultiServiceFactory >& rxFact ) { - return uno::Reference< uno::XInterface >( *new ::avmedia::gst::Manager( 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 */ ) +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -// ------------------------ -// - component_getFactory - -// ------------------------ - -extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ ) +extern "C" SAL_DLLPUBLIC_EXPORT 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, AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME ) == 0 ) + if( rtl_str_compare( pImplName, "com.sun.star.comp.media.Manager_GStreamer" ) == 0 ) { - const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( AVMEDIA_GSTREAMER_MANAGER_SERVICENAME ) ); + 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::createFromAscii( AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.media.Manager_GStreamer" )), create_MediaPlayer, uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) ); } @@ -75,3 +67,5 @@ extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* return pRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/gstreamer/gstwindow.cxx b/avmedia/source/gstreamer/gstwindow.cxx index 12606ad5e88b..9228f9e6c9a0 100644 --- a/avmedia/source/gstreamer/gstwindow.cxx +++ b/avmedia/source/gstreamer/gstwindow.cxx @@ -1,8 +1,9 @@ +/* -*- 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 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Novell, Inc. * * OpenOffice.org - a multi-platform office productivity suite * @@ -25,414 +26,156 @@ * ************************************************************************/ -#include <tools/prex.h> -#include <tools/postx.h> - #include <com/sun/star/awt/SystemPointer.hdl> #include "gstwindow.hxx" #include "gstplayer.hxx" -#include <vcl/syschild.hxx> -#include <vcl/sysdata.hxx> - -using namespace ::com::sun::star; - -namespace avmedia -{ -namespace gst -{ -// --------------------- -// - PlayerChildWindow - -// --------------------- - -class PlayerChildWindow : public SystemChildWindow -{ -public: - - PlayerChildWindow( Window* pParent ); - ~PlayerChildWindow(); - -protected: - - virtual void MouseMove( const MouseEvent& rMEvt ); - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void MouseButtonUp( const MouseEvent& rMEvt ); - virtual void KeyInput( const KeyEvent& rKEvt ); - virtual void KeyUp( const KeyEvent& rKEvt ); - virtual void Command( const CommandEvent& rCEvt ); -}; - -// --------------------------------------------------------------------- - -PlayerChildWindow::PlayerChildWindow( Window* pParent ) : - SystemChildWindow( pParent, WB_CLIPCHILDREN ) -{ -} - -// --------------------------------------------------------------------- - -PlayerChildWindow::~PlayerChildWindow() -{ -} - -// --------------------------------------------------------------------- - -void PlayerChildWindow::MouseMove( const MouseEvent& rMEvt ) -{ - const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ), - rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() ); - - SystemChildWindow::MouseMove( rMEvt ); - GetParent()->MouseMove( aTransformedEvent ); -} - -// --------------------------------------------------------------------- - -void PlayerChildWindow::MouseButtonDown( const MouseEvent& rMEvt ) -{ - const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ), - rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() ); - - SystemChildWindow::MouseButtonDown( rMEvt ); - GetParent()->MouseButtonDown( aTransformedEvent ); -} -// --------------------------------------------------------------------- +#define AVMEDIA_GST_WINDOW_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Window_GStreamer" +#define AVMEDIA_GST_WINDOW_SERVICENAME "com.sun.star.media.Window_GStreamer" -void PlayerChildWindow::MouseButtonUp( const MouseEvent& rMEvt ) -{ - const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ), - rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() ); +using namespace ::com::sun::star; - SystemChildWindow::MouseButtonUp( rMEvt ); - GetParent()->MouseButtonUp( aTransformedEvent ); -} +namespace avmedia { namespace gstreamer { -// --------------------------------------------------------------------- +// ----------- +// - statics - +// ----------- -void PlayerChildWindow::KeyInput( const KeyEvent& rKEvt ) +static ::osl::Mutex& ImplGetOwnStaticMutex() { - SystemChildWindow::KeyInput( rKEvt ); - GetParent()->KeyInput( rKEvt ); -} - -// --------------------------------------------------------------------- + static ::osl::Mutex* pMutex = NULL; -void PlayerChildWindow::KeyUp( const KeyEvent& rKEvt ) -{ - SystemChildWindow::KeyUp( rKEvt ); - GetParent()->KeyUp( rKEvt ); -} - -// --------------------------------------------------------------------- + if( pMutex == NULL ) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); -void PlayerChildWindow::Command( const CommandEvent& rCEvt ) -{ - const CommandEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rCEvt.GetMousePosPixel() ) ), - rCEvt.GetCommand(), rCEvt.IsMouseEvent(), rCEvt.GetData() ); + if( pMutex == NULL ) + { + static ::osl::Mutex aMutex; + pMutex = &aMutex; + } + } - SystemChildWindow::Command( rCEvt ); - GetParent()->Command( aTransformedEvent ); + return *pMutex; } // --------------- // - Window - // --------------- -Window::Window( ::avmedia::gst::Player& rPlayer ) : - maListeners( maMutex ), - maWindowRect( 0, 0, 0, 0 ), - mrPlayer( rPlayer ), - mpPlayerWindow( NULL ), - meZoomLevel( media::ZoomLevel_NOT_AVAILABLE ), - mnPointerType( awt::SystemPointer::ARROW ) -{} // ------------------------------------------------------------------------------ -Window::~Window() -{ - dispose(); -} - -// ------------------------------------------------------------------------------ - -void Window::implLayoutVideoWindow() +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 ) { - if( mpPlayerWindow && ( media::ZoomLevel_NOT_AVAILABLE != meZoomLevel ) ) - { - awt::Size aPrefSize( mrPlayer.getPreferredPlayerWindowSize() ); - awt::Rectangle aRect = getPosSize(); - int nW = aRect.Width, nH = aRect.Height; - int nVideoW = nW, nVideoH = nH; - int nX = 0, nY = 0, nWidth = 0, nHeight = 0; - bool bDone = false, bZoom = false; - - if( media::ZoomLevel_ORIGINAL == meZoomLevel ) - { - bZoom = true; - } - else if( media::ZoomLevel_ZOOM_1_TO_4 == meZoomLevel ) - { - aPrefSize.Width >>= 2; - aPrefSize.Height >>= 2; - bZoom = true; - } - else if( media::ZoomLevel_ZOOM_1_TO_2 == meZoomLevel ) - { - aPrefSize.Width >>= 1; - aPrefSize.Height >>= 1; - bZoom = true; - } - else if( media::ZoomLevel_ZOOM_2_TO_1 == meZoomLevel ) - { - aPrefSize.Width <<= 1; - aPrefSize.Height <<= 1; - bZoom = true; - } - else if( media::ZoomLevel_ZOOM_4_TO_1 == meZoomLevel ) - { - aPrefSize.Width <<= 2; - aPrefSize.Height <<= 2; - bZoom = true; - } - else if( media::ZoomLevel_FIT_TO_WINDOW == meZoomLevel ) - { - nWidth = nVideoW; - nHeight = nVideoH; - bDone = true; - } + ::osl::MutexGuard aGuard( ImplGetOwnStaticMutex() ); - if( bZoom ) - { - if( ( aPrefSize.Width <= nVideoW ) && ( aPrefSize.Height <= nVideoH ) ) - { - nX = ( nVideoW - aPrefSize.Width ) >> 1; - nY = ( nVideoH - aPrefSize.Height ) >> 1; - nWidth = aPrefSize.Width; - nHeight = aPrefSize.Height; - bDone = true; - } - } - - if( !bDone ) - { - if( ( aPrefSize.Width > 0 ) && ( aPrefSize.Height > 0 ) && ( nVideoW > 0 ) && ( nVideoH > 0 ) ) - { - double fPrefWH = (double) aPrefSize.Width / aPrefSize.Height; - - if( fPrefWH < ( (double) nVideoW / nVideoH ) ) - { - nVideoW = (int) ( nVideoH * fPrefWH ); - } - else - { - nVideoH = (int) ( nVideoW / fPrefWH ); - } - - nX = ( nW - nVideoW ) >> 1; - nY = ( nH - nVideoH ) >> 1; - nWidth = nVideoW; - nHeight = nVideoH; - } - else - { - nX = nY = nWidth = nHeight = 0; - } - } - - mpPlayerWindow->SetPosSizePixel( Point( nX, nY ), Size( nWidth, nHeight ) ); - } } // ------------------------------------------------------------------------------ -bool Window::create( const uno::Sequence< uno::Any >& rArguments ) +Window::~Window() { - OSL_ASSERT( !mpPlayerWindow ); - OSL_ENSURE( rArguments.getLength() > 2, -"::avmedia::gst::Windiow::create: GStreamer backend needs \ -valid parent SystemChildWindow pointer (sal_IntPtr) as third Any \ -value in sequence of arguments" ); - - bool bRet = false; - - if( !mpPlayerWindow && ( rArguments.getLength() > 2 ) ) - { - SystemChildWindow* pParentWindow = NULL; - sal_IntPtr pIntPtr = 0; - - // we are not interested in the first argument, which is a pure X11 window handle; - // this backend relies on a SystemChildWindow as parent for the PlayerWindow, given - // as third Sal_IntPtr value within the argument Sequence - rArguments[ 1 ] >>= maWindowRect; - - rArguments[ 2 ] >>= pIntPtr; - pParentWindow = reinterpret_cast< SystemChildWindow* >( pIntPtr ); - - if( pParentWindow ) - { - meZoomLevel = media::ZoomLevel_ORIGINAL; - - mpPlayerWindow = new PlayerChildWindow( pParentWindow ); - mpPlayerWindow->SetBackground( Color( COL_BLACK ) ); - mpPlayerWindow->SetPosSizePixel( Point( maWindowRect.X, maWindowRect.Y ), - Size( maWindowRect.Width, maWindowRect.Height ) ); - mpPlayerWindow->Show(); - - bRet = true; - } - } - - return( bRet ); } +// XPlayerWindow // ------------------------------------------------------------------------------ -void SAL_CALL Window::update() - throw( uno::RuntimeException ) +void SAL_CALL Window::update( ) + throw (uno::RuntimeException) { - if( mpPlayerWindow ) - { - mpPlayerWindow->Invalidate( INVALIDATE_UPDATE ); - mpPlayerWindow->Sync(); - } } // ------------------------------------------------------------------------------ sal_Bool SAL_CALL Window::setZoomLevel( media::ZoomLevel eZoomLevel ) - throw(uno::RuntimeException) + throw (uno::RuntimeException) { - bool bRet = false; + sal_Bool bRet = false; - if( ( media::ZoomLevel_NOT_AVAILABLE != meZoomLevel ) && - ( media::ZoomLevel_NOT_AVAILABLE != eZoomLevel ) ) - { - if( eZoomLevel != meZoomLevel ) + if( media::ZoomLevel_NOT_AVAILABLE != meZoomLevel && + media::ZoomLevel_NOT_AVAILABLE != eZoomLevel ) { - meZoomLevel = eZoomLevel; - implLayoutVideoWindow(); - } + if( eZoomLevel != meZoomLevel ) + { + meZoomLevel = eZoomLevel; + } - bRet = true; - } + bRet = true; + } - return( bRet ); + return bRet; } // ------------------------------------------------------------------------------ -media::ZoomLevel SAL_CALL Window::getZoomLevel() - throw( uno::RuntimeException ) +media::ZoomLevel SAL_CALL Window::getZoomLevel( ) + throw (uno::RuntimeException) { - return( meZoomLevel ); + return meZoomLevel; } // ------------------------------------------------------------------------------ void SAL_CALL Window::setPointerType( sal_Int32 nPointerType ) - throw( uno::RuntimeException ) + throw (uno::RuntimeException) { - if( mpPlayerWindow ) - { - Pointer ePointer = POINTER_ARROW; - - switch( nPointerType ) - { - case (awt::SystemPointer::CROSS) : - { - ePointer = POINTER_CROSS; - } - break; - - case (awt::SystemPointer::HAND) : - { - ePointer = POINTER_HAND; - } - break; - - case (awt::SystemPointer::MOVE) : - { - ePointer = POINTER_MOVE; - } - break; - - case (awt::SystemPointer::WAIT) : - { - ePointer = POINTER_WAIT; - } - break; - - default: - break; - } - - mpPlayerWindow->SetPointer( ePointer ); - } + mnPointerType = nPointerType; } +// XWindow // ------------------------------------------------------------------------------ -void SAL_CALL Window::setPosSize( sal_Int32 nX, - sal_Int32 nY, - sal_Int32 nWidth, - sal_Int32 nHeight, - sal_Int16 /* Flags */ ) - throw( uno::RuntimeException ) +void SAL_CALL Window::setPosSize( sal_Int32 /*X*/, sal_Int32 /*Y*/, sal_Int32 /*Width*/, sal_Int32 /*Height*/, sal_Int16 /*Flags*/ ) + throw (uno::RuntimeException) { - maWindowRect.X = nX; - maWindowRect.Y = nY; - maWindowRect.Width = nWidth; - maWindowRect.Height = nHeight; - - implLayoutVideoWindow(); } // ------------------------------------------------------------------------------ awt::Rectangle SAL_CALL Window::getPosSize() - throw( uno::RuntimeException ) + throw (uno::RuntimeException) { - return( maWindowRect ); + 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::setVisible( sal_Bool /*bVisible*/ ) + throw (uno::RuntimeException) { - if( mpPlayerWindow ) - { - bVisible ? mpPlayerWindow->Show() : mpPlayerWindow->Hide(); - } + } // ------------------------------------------------------------------------------ -void SAL_CALL Window::setEnable( sal_Bool bEnable ) - throw( uno::RuntimeException ) +void SAL_CALL Window::setEnable( sal_Bool /*bEnable*/ ) + throw (uno::RuntimeException) { - if( mpPlayerWindow ) - { - mpPlayerWindow->Enable( bEnable ); - } } // ------------------------------------------------------------------------------ -void SAL_CALL Window::setFocus() - throw( uno::RuntimeException ) +void SAL_CALL Window::setFocus( ) + throw (uno::RuntimeException) { - if( mpPlayerWindow ) - { - mpPlayerWindow->GrabFocus(); - } } // ------------------------------------------------------------------------------ void SAL_CALL Window::addWindowListener( const uno::Reference< awt::XWindowListener >& xListener ) - throw( uno::RuntimeException ) + throw (uno::RuntimeException) { maListeners.addInterface( getCppuType( &xListener ), xListener ); } @@ -440,7 +183,7 @@ void SAL_CALL Window::addWindowListener( const uno::Reference< awt::XWindowListe // ------------------------------------------------------------------------------ void SAL_CALL Window::removeWindowListener( const uno::Reference< awt::XWindowListener >& xListener ) - throw( uno::RuntimeException ) + throw (uno::RuntimeException) { maListeners.removeInterface( getCppuType( &xListener ), xListener ); } @@ -448,7 +191,7 @@ void SAL_CALL Window::removeWindowListener( const uno::Reference< awt::XWindowLi // ------------------------------------------------------------------------------ void SAL_CALL Window::addFocusListener( const uno::Reference< awt::XFocusListener >& xListener ) - throw( uno::RuntimeException ) + throw (uno::RuntimeException) { maListeners.addInterface( getCppuType( &xListener ), xListener ); } @@ -456,7 +199,7 @@ void SAL_CALL Window::addFocusListener( const uno::Reference< awt::XFocusListene // ------------------------------------------------------------------------------ void SAL_CALL Window::removeFocusListener( const uno::Reference< awt::XFocusListener >& xListener ) - throw( uno::RuntimeException ) + throw (uno::RuntimeException) { maListeners.removeInterface( getCppuType( &xListener ), xListener ); } @@ -464,7 +207,7 @@ void SAL_CALL Window::removeFocusListener( const uno::Reference< awt::XFocusList // ------------------------------------------------------------------------------ void SAL_CALL Window::addKeyListener( const uno::Reference< awt::XKeyListener >& xListener ) - throw( uno::RuntimeException ) + throw (uno::RuntimeException) { maListeners.addInterface( getCppuType( &xListener ), xListener ); } @@ -472,7 +215,7 @@ void SAL_CALL Window::addKeyListener( const uno::Reference< awt::XKeyListener >& // ------------------------------------------------------------------------------ void SAL_CALL Window::removeKeyListener( const uno::Reference< awt::XKeyListener >& xListener ) - throw( uno::RuntimeException ) + throw (uno::RuntimeException) { maListeners.removeInterface( getCppuType( &xListener ), xListener ); } @@ -480,7 +223,7 @@ void SAL_CALL Window::removeKeyListener( const uno::Reference< awt::XKeyListener // ------------------------------------------------------------------------------ void SAL_CALL Window::addMouseListener( const uno::Reference< awt::XMouseListener >& xListener ) - throw( uno::RuntimeException ) + throw (uno::RuntimeException) { maListeners.addInterface( getCppuType( &xListener ), xListener ); } @@ -488,7 +231,7 @@ void SAL_CALL Window::addMouseListener( const uno::Reference< awt::XMouseListene // ------------------------------------------------------------------------------ void SAL_CALL Window::removeMouseListener( const uno::Reference< awt::XMouseListener >& xListener ) - throw( uno::RuntimeException ) + throw (uno::RuntimeException) { maListeners.removeInterface( getCppuType( &xListener ), xListener ); } @@ -496,7 +239,7 @@ void SAL_CALL Window::removeMouseListener( const uno::Reference< awt::XMouseList // ------------------------------------------------------------------------------ void SAL_CALL Window::addMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener ) - throw( uno::RuntimeException ) + throw (uno::RuntimeException) { maListeners.addInterface( getCppuType( &xListener ), xListener ); } @@ -504,7 +247,7 @@ void SAL_CALL Window::addMouseMotionListener( const uno::Reference< awt::XMouseM // ------------------------------------------------------------------------------ void SAL_CALL Window::removeMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener ) - throw( uno::RuntimeException ) + throw (uno::RuntimeException) { maListeners.removeInterface( getCppuType( &xListener ), xListener ); } @@ -512,7 +255,7 @@ void SAL_CALL Window::removeMouseMotionListener( const uno::Reference< awt::XMou // ------------------------------------------------------------------------------ void SAL_CALL Window::addPaintListener( const uno::Reference< awt::XPaintListener >& xListener ) - throw( uno::RuntimeException ) + throw (uno::RuntimeException) { maListeners.addInterface( getCppuType( &xListener ), xListener ); } @@ -520,149 +263,64 @@ void SAL_CALL Window::addPaintListener( const uno::Reference< awt::XPaintListene // ------------------------------------------------------------------------------ void SAL_CALL Window::removePaintListener( const uno::Reference< awt::XPaintListener >& xListener ) - throw( uno::RuntimeException ) + throw (uno::RuntimeException) { maListeners.removeInterface( getCppuType( &xListener ), xListener ); } +// XComponent // ------------------------------------------------------------------------------ -void SAL_CALL Window::dispose() - throw( uno::RuntimeException ) +void SAL_CALL Window::dispose( ) + throw (uno::RuntimeException) { - delete mpPlayerWindow; - mpPlayerWindow = NULL; } // ------------------------------------------------------------------------------ void SAL_CALL Window::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) - throw( uno::RuntimeException ) + throw (uno::RuntimeException) { maListeners.addInterface( getCppuType( &xListener ), xListener ); } // ------------------------------------------------------------------------------ -void SAL_CALL Window::removeEventListener( const uno::Reference< lang::XEventListener >& - xListener ) - throw( uno::RuntimeException ) +void SAL_CALL Window::removeEventListener( const uno::Reference< lang::XEventListener >& xListener ) + throw (uno::RuntimeException) { maListeners.removeInterface( getCppuType( &xListener ), xListener ); } +// XServiceInfo // ------------------------------------------------------------------------------ -void Window::fireMousePressedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ) +::rtl::OUString SAL_CALL Window::getImplementationName( ) + throw (uno::RuntimeException) { - ::cppu::OInterfaceContainerHelper* pContainer = - maListeners.getContainer( getCppuType( ( uno::Reference< awt::XMouseListener >* ) 0 ) ); - - if( pContainer ) - { - ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); - - while( aIter.hasMoreElements() ) - { - uno::Reference< awt::XMouseListener >( aIter.next(), - uno::UNO_QUERY )->mousePressed( rEvt ); - } - } -} - -// ----------------------------------------------------------------------------- - -void Window::fireMouseReleasedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ) -{ - ::cppu::OInterfaceContainerHelper* pContainer = - maListeners.getContainer( getCppuType( ( uno::Reference< awt::XMouseListener >* ) 0 ) ); - - if( pContainer ) - { - ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); - - while( aIter.hasMoreElements() ) - { - uno::Reference< awt::XMouseListener >( aIter.next(), - uno::UNO_QUERY )->mouseReleased( rEvt ); - } - } -} - -// ----------------------------------------------------------------------------- - -void Window::fireMouseMovedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ) -{ - ::cppu::OInterfaceContainerHelper* pContainer = - maListeners.getContainer( getCppuType( ( uno::Reference< awt::XMouseMotionListener >* ) - 0 ) ); - - if( pContainer ) - { - ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); - - while( aIter.hasMoreElements() ) - { - uno::Reference< awt::XMouseMotionListener >( aIter.next(), - uno::UNO_QUERY )->mouseMoved( rEvt ); - } - } -} - -// ----------------------------------------------------------------------------- - -void Window::fireSetFocusEvent( const ::com::sun::star::awt::FocusEvent& rEvt ) -{ - ::cppu::OInterfaceContainerHelper* pContainer = - maListeners.getContainer( getCppuType( ( uno::Reference< awt::XFocusListener >* ) 0 ) ); - - if( pContainer ) - { - ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); - - while( aIter.hasMoreElements() ) - { - uno::Reference< awt::XFocusListener >( aIter.next(), - uno::UNO_QUERY )->focusGained( rEvt ); - } - } -} - -// ------------------------------------------------------------------------------ - -long Window::getXWindowHandle() const -{ - return( mpPlayerWindow ? mpPlayerWindow->GetSystemData()->aWindow : 0 ); -} - - -// ------------------------------------------------------------------------------ - -::rtl::OUString SAL_CALL Window::getImplementationName() - throw( uno::RuntimeException ) -{ - return( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - AVMEDIA_GSTREAMER_WINDOW_IMPLEMENTATIONNAME ) ) ); + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GST_WINDOW_IMPLEMENTATIONNAME ) ); } // ------------------------------------------------------------------------------ sal_Bool SAL_CALL Window::supportsService( const ::rtl::OUString& ServiceName ) - throw( uno::RuntimeException ) + throw (uno::RuntimeException) { - return( ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( - AVMEDIA_GSTREAMER_WINDOW_SERVICENAME ) ) ); + 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 > SAL_CALL Window::getSupportedServiceNames( ) + throw (uno::RuntimeException) { - uno::Sequence< ::rtl::OUString > aRet( 1 ); - aRet[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_WINDOW_SERVICENAME ) ); + uno::Sequence< ::rtl::OUString > aRet(1); + aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_GST_WINDOW_SERVICENAME ) ); - return( aRet ); + return aRet; } -} // namespace gst + +} // 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 index 3a55fca9c8bf..18b9a7dbd0ae 100644 --- a/avmedia/source/gstreamer/gstwindow.hxx +++ b/avmedia/source/gstreamer/gstwindow.hxx @@ -1,8 +1,9 @@ +/* -*- 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 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Novell, Inc. * * OpenOffice.org - a multi-platform office productivity suite * @@ -25,22 +26,15 @@ * ************************************************************************/ -#ifndef _GSTWINDOW_HXX -#define _GSTWINDOW_HXX +#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 gst -{ - -class PlayerChildWindow; +namespace avmedia { namespace gstreamer { // --------------- // - Window - @@ -48,150 +42,70 @@ class PlayerChildWindow; class Player; -class Window : public ::cppu::WeakImplHelper2< ::com::sun::star::media::XPlayerWindow, - ::com::sun::star::lang::XServiceInfo > +class Window : public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XPlayerWindow, + ::com::sun::star::lang::XServiceInfo > { - friend class Player; +public: -public: Window( ::avmedia::gst::Player& rPlayer ); - ~Window(); + 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 ); + 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 ); + 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 ); + 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 ); + 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 ); - - -public: - - void fireMousePressedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ); - - void fireMouseReleasedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ); - - void fireMouseMovedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ); - - void fireKeyPressedEvent( const ::com::sun::star::awt::KeyEvent& rEvt ); - - void fireKeyReleasedEvent( const ::com::sun::star::awt::KeyEvent& rEvt ); - - void fireSetFocusEvent( const ::com::sun::star::awt::FocusEvent& rEvt ); - -protected: - - long getXWindowHandle() const; + 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: - ::osl::Mutex maMutex; - ::cppu::OMultiTypeInterfaceContainerHelper maListeners; - ::com::sun::star::awt::Rectangle maWindowRect; - Player& mrPlayer; - PlayerChildWindow* mpPlayerWindow; - ::com::sun::star::media::ZoomLevel meZoomLevel; - sal_Int32 mnPointerType; + ::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(); + void ImplLayoutVideoWindow(); }; -} // namespace gst + +} // namespace gstreamer } // namespace avmedia -#endif // _GSTWINDOW_HXX +#endif // _WINDOW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/gstreamer/makefile.mk b/avmedia/source/gstreamer/makefile.mk index 857c5914b094..c87d43afb24a 100644..100755 --- a/avmedia/source/gstreamer/makefile.mk +++ b/avmedia/source/gstreamer/makefile.mk @@ -1,64 +1,68 @@ #************************************************************************* # -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2000, 2010 Oracle and/or its affiliates. +# Copyright 2010 Novell, Inc. # -# OpenOffice.org - a multi-platform office productivity suite +# OpenOffice.org - a multi-platform office productivity suite # -# This file is part of OpenOffice.org. +# 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 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). +# 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. +# 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=avmediagst +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" && "$(GUIBASE)"!="aqua" && "$(ENABLE_GSTREAMER)" != "" +.IF "$(GUI)" == "UNX" || "$(GUI)" == "WNT" -PKGCONFIG_MODULES=gtk+-2.0 gstreamer-0.10 gstreamer-interfaces-0.10 -.INCLUDE : pkg_config.mk +.IF "$(GUI)" == "WNT" +CDEFS+= -DWINNT +.ENDIF SLOFILES= \ - $(SLO)$/gstuno.obj \ - $(SLO)$/gstmanager.obj \ - $(SLO)$/gstwindow.obj \ - $(SLO)$/gstplayer.obj \ - $(SLO)$/gstframegrabber.obj + $(SLO)$/gstuno.obj \ + $(SLO)$/gstmanager.obj \ + $(SLO)$/gstplayer.obj \ + $(SLO)$/gstwindow.obj + EXCEPTIONSFILES= \ - $(SLO)$/gstuno.obj \ - $(SLO)$/gstplayer.obj \ - $(SLO)$/gstframegrabber.obj + $(SLO)$/gstuno.obj \ SHL1TARGET=$(TARGET) -SHL1STDLIBS= $(CPPULIB) $(SALLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(TOOLSLIB) $(VCLLIB) -SHL1STDLIBS+=$(PKGCONFIG_LIBS) +SHL1STDLIBS= $(CPPULIB) $(SALLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(PKGCONFIG_LIBS) $(TOOLSLIB) $(VCLLIB) SHL1IMPLIB=i$(TARGET) SHL1LIBS=$(SLB)$/$(TARGET).lib SHL1DEF=$(MISC)$/$(SHL1TARGET).def @@ -68,14 +72,19 @@ SHL1NOCHECK=t DEF1NAME=$(SHL1TARGET) DEF1EXPORTFILE=exports.dxp -.ENDIF +.ENDIF # UNX / WNT +.ENDIF # ENABLE_GSTREAMER .INCLUDE : target.mk -ALLTAR : $(MISC)/avmediagst.component +.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 -$(MISC)/avmediagst.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - avmediagst.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt avmediagst.component +.ENDIF # UNX / WNT +.ENDIF # ENABLE_GSTREAMER diff --git a/avmedia/source/inc/mediamisc.hxx b/avmedia/source/inc/mediamisc.hxx index f33bd46568c8..f7bf8de83df1 100644 --- a/avmedia/source/inc/mediamisc.hxx +++ b/avmedia/source/inc/mediamisc.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,35 +30,29 @@ class ResMgr; #define AVMEDIA_RESID( nId ) ResId( nId, * ::avmedia::GetResMgr() ) +#ifdef GSTREAMER +#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.media.Manager_GStreamer" +#else #ifdef WNT #define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.comp.avmedia.Manager_DirectX" -#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED sal_False - -#define AVMEDIA_MANAGER_SERVICE_NAME_FALLBACK1 "" -#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED_FALLBACK1 sal_False #else #ifdef QUARTZ #define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.comp.avmedia.Manager_QuickTime" -#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED sal_False - -#define AVMEDIA_MANAGER_SERVICE_NAME_FALLBACK1 "" -#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED_FALLBACK1 sal_False #else #define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.comp.avmedia.Manager_GStreamer" -#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED sal_False - -#define AVMEDIA_MANAGER_SERVICE_NAME_FALLBACK1 "com.sun.star.comp.avmedia.Manager_Java" -#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED_FALLBACK1 sal_True #endif #endif +#endif namespace avmedia { ResMgr* GetResMgr(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/java/FrameGrabber.java b/avmedia/source/java/FrameGrabber.java index 1a0deda4ce57..1a0deda4ce57 100644..100755 --- a/avmedia/source/java/FrameGrabber.java +++ b/avmedia/source/java/FrameGrabber.java diff --git a/avmedia/source/java/Manager.java b/avmedia/source/java/Manager.java index 47707478fd5b..47707478fd5b 100644..100755 --- a/avmedia/source/java/Manager.java +++ b/avmedia/source/java/Manager.java diff --git a/avmedia/source/java/MediaUno.java b/avmedia/source/java/MediaUno.java index 3e4387840741..3e4387840741 100644..100755 --- a/avmedia/source/java/MediaUno.java +++ b/avmedia/source/java/MediaUno.java diff --git a/avmedia/source/java/Player.java b/avmedia/source/java/Player.java index be3b3d62d367..be3b3d62d367 100644..100755 --- a/avmedia/source/java/Player.java +++ b/avmedia/source/java/Player.java diff --git a/avmedia/source/java/PlayerWindow.java b/avmedia/source/java/PlayerWindow.java index 2229e4f1644b..2229e4f1644b 100644..100755 --- a/avmedia/source/java/PlayerWindow.java +++ b/avmedia/source/java/PlayerWindow.java diff --git a/avmedia/source/java/WindowAdapter.java b/avmedia/source/java/WindowAdapter.java index bd11aec5e738..e44d9e4c9c0b 100644..100755 --- a/avmedia/source/java/WindowAdapter.java +++ b/avmedia/source/java/WindowAdapter.java @@ -164,21 +164,9 @@ public class WindowAdapter case( java.awt.event.KeyEvent.VK_MULTIPLY ): nRet = com.sun.star.awt.Key.MULTIPLY; break; case( java.awt.event.KeyEvent.VK_DIVIDE ): nRet = com.sun.star.awt.Key.DIVIDE; break; case( java.awt.event.KeyEvent.VK_DECIMAL ): nRet = com.sun.star.awt.Key.POINT; break; - // case( java.awt.event.KeyEvent.VK_ COMMA; break; case( java.awt.event.KeyEvent.VK_LESS ): nRet = com.sun.star.awt.Key.LESS; break; case( java.awt.event.KeyEvent.VK_GREATER ): nRet = com.sun.star.awt.Key.GREATER; break; case( java.awt.event.KeyEvent.VK_EQUALS ): nRet = com.sun.star.awt.Key.EQUAL; break; - // case( java.awt.event.KeyEvent.VK_ OPEN; break; - // case( java.awt.event.KeyEvent.VK_ CUT; break; - // case( java.awt.event.KeyEvent.VK_ COPY; break; - // case( java.awt.event.KeyEvent.VK_ PASTE; break; - // case( java.awt.event.KeyEvent.VK_ UNDO; break; - // case( java.awt.event.KeyEvent.VK_ REPEAT; break; - // case( java.awt.event.KeyEvent.VK_ FIND; break; - // case( java.awt.event.KeyEvent.VK_ PROPERTIES; break; - // case( java.awt.event.KeyEvent.VK_ FRONT; break; - // case( java.awt.event.KeyEvent.VK_ CONTEXTMENU; break; - // case( java.awt.event.KeyEvent.VK_ HELP; break; default: break; diff --git a/avmedia/source/java/avmedia.jar b/avmedia/source/java/avmedia.jar Binary files differindex 85a98bbcf33c..85a98bbcf33c 100644..100755 --- a/avmedia/source/java/avmedia.jar +++ b/avmedia/source/java/avmedia.jar diff --git a/avmedia/source/java/avmedia.jar.component b/avmedia/source/java/avmedia.jar.component index d7cc160bd7d0..d7cc160bd7d0 100644..100755 --- a/avmedia/source/java/avmedia.jar.component +++ b/avmedia/source/java/avmedia.jar.component diff --git a/avmedia/source/java/makefile.mk b/avmedia/source/java/makefile.mk index 1fe771c117f2..1fe771c117f2 100644..100755 --- a/avmedia/source/java/makefile.mk +++ b/avmedia/source/java/makefile.mk diff --git a/avmedia/source/java/manifest b/avmedia/source/java/manifest index fa9c2500d385..fa9c2500d385 100644..100755 --- a/avmedia/source/java/manifest +++ b/avmedia/source/java/manifest diff --git a/avmedia/source/java/win/SystemWindowAdapter.java b/avmedia/source/java/win/SystemWindowAdapter.java index ebf3cac99307..ebf3cac99307 100644..100755 --- a/avmedia/source/java/win/SystemWindowAdapter.java +++ b/avmedia/source/java/win/SystemWindowAdapter.java diff --git a/avmedia/source/java/x11/SystemWindowAdapter.java b/avmedia/source/java/x11/SystemWindowAdapter.java index 4292dabe6775..4292dabe6775 100644..100755 --- a/avmedia/source/java/x11/SystemWindowAdapter.java +++ b/avmedia/source/java/x11/SystemWindowAdapter.java diff --git a/avmedia/source/quicktime/avmediaQuickTime.component b/avmedia/source/quicktime/avmediaQuickTime.component index aa0251d74c9d..aa0251d74c9d 100644..100755 --- a/avmedia/source/quicktime/avmediaQuickTime.component +++ b/avmedia/source/quicktime/avmediaQuickTime.component diff --git a/avmedia/source/quicktime/framegrabber.cxx b/avmedia/source/quicktime/framegrabber.cxx index 186820beaec3..5da2aa2f2836 100644 --- a/avmedia/source/quicktime/framegrabber.cxx +++ b/avmedia/source/quicktime/framegrabber.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -150,3 +151,5 @@ uno::Sequence< ::rtl::OUString > SAL_CALL FrameGrabber::getSupportedServiceNames } // namespace quicktime } // namespace avmedia + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/quicktime/framegrabber.hxx b/avmedia/source/quicktime/framegrabber.hxx index a5b004e0383e..8fa2b5b5fc95 100644 --- a/avmedia/source/quicktime/framegrabber.hxx +++ b/avmedia/source/quicktime/framegrabber.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,7 @@ #include "quicktimecommon.hxx" -#ifndef _COM_SUN_STAR_MEDIA_XFRAMEGRABBER_HDL_ #include "com/sun/star/media/XFrameGrabber.hdl" -#endif namespace avmedia { namespace quicktime { @@ -71,3 +70,5 @@ private: } // namespace avmedia #endif // _FRAMEGRABBER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/quicktime/makefile.mk b/avmedia/source/quicktime/makefile.mk index 358fce491847..358fce491847 100644..100755 --- a/avmedia/source/quicktime/makefile.mk +++ b/avmedia/source/quicktime/makefile.mk diff --git a/avmedia/source/quicktime/manager.cxx b/avmedia/source/quicktime/manager.cxx index 4970864c7e76..ca8da8e5d8b4 100644 --- a/avmedia/source/quicktime/manager.cxx +++ b/avmedia/source/quicktime/manager.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -94,3 +95,5 @@ uno::Sequence< ::rtl::OUString > SAL_CALL Manager::getSupportedServiceNames( ) } // namespace quicktime } // namespace avmedia + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/quicktime/manager.hxx b/avmedia/source/quicktime/manager.hxx index 07740a1a9259..8c8749683ce7 100644 --- a/avmedia/source/quicktime/manager.hxx +++ b/avmedia/source/quicktime/manager.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,7 @@ #include "quicktimecommon.hxx" -#ifndef _COM_SUN_STAR_MEDIA_XMANAGER_HDL_ #include "com/sun/star/media/XManager.hdl" -#endif // ----------- // - Manager - @@ -64,3 +63,5 @@ private: } // namespace avmedia #endif // _MANAGER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/quicktime/player.cxx b/avmedia/source/quicktime/player.cxx index 6c77f999e110..8b623e93c8ce 100644 --- a/avmedia/source/quicktime/player.cxx +++ b/avmedia/source/quicktime/player.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -139,7 +140,6 @@ bool Player::create( const ::rtl::OUString& rURL ) NSString* aNSStr = [[[NSString alloc] initWithCharacters: rURL.getStr() length: rURL.getLength()]stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] ; NSURL* aURL = [NSURL URLWithString:aNSStr ]; - NSError* pErr = nil; mpMovie = [QTMovie movieWithURL:aURL error:&pErr]; if(mpMovie) @@ -422,7 +422,6 @@ awt::Size SAL_CALL Player::getPreferredPlayerWindowSize( ) return aSize; } - // ------------------------------------------------------------------------------ uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( const uno::Sequence< uno::Any >& aArguments ) @@ -499,3 +498,5 @@ uno::Sequence< ::rtl::OUString > SAL_CALL Player::getSupportedServiceNames( ) } // namespace quicktime } // namespace avmedia + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/quicktime/player.hxx b/avmedia/source/quicktime/player.hxx index e85bbc5035db..da9bbfc8ec8b 100644 --- a/avmedia/source/quicktime/player.hxx +++ b/avmedia/source/quicktime/player.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,9 +32,7 @@ #include <osl/conditn.h> #include "quicktimecommon.hxx" -#ifndef _COM_SUN_STAR_MEDIA_XPLAYER_HDL_ #include "com/sun/star/media/XPlayer.hdl" -#endif namespace avmedia { namespace quicktime { @@ -53,8 +52,6 @@ public: bool create( const ::rtl::OUString& rURL ); -// void processMessage( 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); @@ -88,9 +85,7 @@ private: ::rtl::OUString maURL; QTMovie *mpMovie; // the Movie object - /* GST - sal_Bool mbFakeVideo; - */ + float mnUnmutedVolume; double mnStopTime; @@ -111,3 +106,5 @@ private: } // namespace avmedia #endif // _PLAYER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/quicktime/quicktimecommon.hxx b/avmedia/source/quicktime/quicktimecommon.hxx index 82ade238396c..1c22377efe9a 100644 --- a/avmedia/source/quicktime/quicktimecommon.hxx +++ b/avmedia/source/quicktime/quicktimecommon.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -77,5 +78,6 @@ // Quicktime 6.4+ in Mac OS X 10.3 #define QT64 0x06400000 - #endif // _QUICKTIMECOMMOM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/quicktime/quicktimeuno.cxx b/avmedia/source/quicktime/quicktimeuno.cxx index 9ecd77f4b9e0..df7d43f6a8e1 100644 --- a/avmedia/source/quicktime/quicktimeuno.cxx +++ b/avmedia/source/quicktime/quicktimeuno.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,7 +44,7 @@ static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const uno: // - component_getImplementationEnvironment - // ------------------------------------------ -extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ ) +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } @@ -52,18 +53,18 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char // - component_getFactory - // ------------------------ -extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ ) +extern "C" SAL_DLLPUBLIC_EXPORT 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, AVMEDIA_QUICKTIME_MANAGER_IMPLEMENTATIONNAME ) == 0 ) { - const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( AVMEDIA_QUICKTIME_MANAGER_SERVICENAME ) ); + const ::rtl::OUString aServiceName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_QUICKTIME_MANAGER_SERVICENAME )) ); xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), - ::rtl::OUString::createFromAscii( AVMEDIA_QUICKTIME_MANAGER_IMPLEMENTATIONNAME ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_QUICKTIME_MANAGER_IMPLEMENTATIONNAME )), create_MediaPlayer, uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) ); } @@ -75,3 +76,5 @@ extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* return pRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/quicktime/window.cxx b/avmedia/source/quicktime/window.cxx index e44acf4fbb67..9b9c14ae2622 100644 --- a/avmedia/source/quicktime/window.cxx +++ b/avmedia/source/quicktime/window.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -75,7 +76,6 @@ Window::Window( const uno::Reference< lang::XMultiServiceFactory >& i_rxMgr, Pla ::osl::MutexGuard aGuard( ImplGetOwnStaticMutex() ); - if( mpParentView ) // sanity check { @@ -296,7 +296,6 @@ void SAL_CALL Window::removePaintListener( const uno::Reference< awt::XPaintList maListeners.removeInterface( getCppuType( &xListener ), xListener ); } - // XComponent // ------------------------------------------------------------------------------ @@ -351,3 +350,5 @@ uno::Sequence< ::rtl::OUString > SAL_CALL Window::getSupportedServiceNames( ) } // namespace quicktime } // namespace avmedia + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/quicktime/window.hxx b/avmedia/source/quicktime/window.hxx index 4ca2e76ddc52..e782e6367af9 100644 --- a/avmedia/source/quicktime/window.hxx +++ b/avmedia/source/quicktime/window.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,9 +32,7 @@ #include "quicktimecommon.hxx" #include <cppuhelper/interfacecontainer.h> -#ifndef _COM_SUN_STAR_MEDIA_XPLAYERWINDOW_HDL_ #include "com/sun/star/media/XPlayerWindow.hdl" -#endif namespace avmedia { namespace quicktime { @@ -113,3 +112,5 @@ private: } // namespace avmedia #endif // _WINDOW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/viewer/makefile.mk b/avmedia/source/viewer/makefile.mk index 8d5d6a5df52d..7771d1eb0528 100644..100755 --- a/avmedia/source/viewer/makefile.mk +++ b/avmedia/source/viewer/makefile.mk @@ -42,15 +42,13 @@ SRC1FILES =\ # --- Files ------------------------------------- SLOFILES= \ - $(SLO)$/mediaevent_impl.obj \ - $(SLO)$/mediawindowbase_impl.obj \ - $(SLO)$/mediawindow_impl.obj \ - $(SLO)$/mediawindow.obj + $(EXCEPTIONSFILES) EXCEPTIONSFILES= \ + $(SLO)$/mediaevent_impl.obj \ $(SLO)$/mediawindow.obj \ + $(SLO)$/mediawindow_impl.obj \ $(SLO)$/mediawindowbase_impl.obj \ - $(SLO)$/mediawindow_impl.obj # --- Targets ---------------------------------- diff --git a/avmedia/source/viewer/mediaevent_impl.cxx b/avmedia/source/viewer/mediaevent_impl.cxx index 72941cd6a78e..f7cd33409cea 100644 --- a/avmedia/source/viewer/mediaevent_impl.cxx +++ b/avmedia/source/viewer/mediaevent_impl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #include "mediaevent_impl.hxx" #include "mediawindow_impl.hxx" #include <osl/mutex.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <vcl/event.hxx> @@ -73,7 +74,7 @@ void SAL_CALL MediaEventListenersImpl::keyPressed( const ::com::sun::star::awt:: throw (::com::sun::star::uno::RuntimeException) { const ::osl::MutexGuard aGuard( maMutex ); - const ::vos::OGuard aAppGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aAppGuard; if( mpNotifyWindow ) { @@ -93,7 +94,7 @@ void SAL_CALL MediaEventListenersImpl::keyReleased( const ::com::sun::star::awt: throw (::com::sun::star::uno::RuntimeException) { const ::osl::MutexGuard aGuard( maMutex ); - const ::vos::OGuard aAppGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aAppGuard; if( mpNotifyWindow ) { @@ -112,7 +113,7 @@ void SAL_CALL MediaEventListenersImpl::mousePressed( const ::com::sun::star::awt throw (::com::sun::star::uno::RuntimeException) { const ::osl::MutexGuard aGuard( maMutex ); - const ::vos::OGuard aAppGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aAppGuard; if( mpNotifyWindow ) { @@ -133,7 +134,7 @@ void SAL_CALL MediaEventListenersImpl::mouseReleased( const ::com::sun::star::aw throw (::com::sun::star::uno::RuntimeException) { const ::osl::MutexGuard aGuard( maMutex ); - const ::vos::OGuard aAppGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aAppGuard; if( mpNotifyWindow ) { @@ -154,7 +155,7 @@ void SAL_CALL MediaEventListenersImpl::mouseEntered( const ::com::sun::star::awt throw (::com::sun::star::uno::RuntimeException) { const ::osl::MutexGuard aGuard( maMutex ); - const ::vos::OGuard aAppGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aAppGuard; if( mpNotifyWindow ) { @@ -167,7 +168,7 @@ void SAL_CALL MediaEventListenersImpl::mouseExited( const ::com::sun::star::awt: throw (::com::sun::star::uno::RuntimeException) { const ::osl::MutexGuard aGuard( maMutex ); - const ::vos::OGuard aAppGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aAppGuard; if( mpNotifyWindow ) { @@ -180,7 +181,7 @@ void SAL_CALL MediaEventListenersImpl::mouseDragged( const ::com::sun::star::awt throw (::com::sun::star::uno::RuntimeException) { const ::osl::MutexGuard aGuard( maMutex ); - const ::vos::OGuard aAppGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aAppGuard; if( mpNotifyWindow ) { @@ -195,7 +196,7 @@ void SAL_CALL MediaEventListenersImpl::mouseMoved( const ::com::sun::star::awt:: throw (::com::sun::star::uno::RuntimeException) { const ::osl::MutexGuard aGuard( maMutex ); - const ::vos::OGuard aAppGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aAppGuard; if( mpNotifyWindow ) { @@ -221,3 +222,4 @@ void SAL_CALL MediaEventListenersImpl::focusLost( const ::com::sun::star::awt::F } // namespace priv } // namespace avemdia +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/viewer/mediaevent_impl.hxx b/avmedia/source/viewer/mediaevent_impl.hxx index b06ccd885fd6..9f282a90688f 100644 --- a/avmedia/source/viewer/mediaevent_impl.hxx +++ b/avmedia/source/viewer/mediaevent_impl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -87,3 +88,5 @@ namespace avmedia } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/viewer/mediawindow.cxx b/avmedia/source/viewer/mediawindow.cxx index 5005446633f4..415c1fa216dd 100644 --- a/avmedia/source/viewer/mediawindow.cxx +++ b/avmedia/source/viewer/mediawindow.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -366,25 +367,26 @@ Window* MediaWindow::getWindow() const void MediaWindow::getMediaFilters( FilterNameVector& rFilterNameVector ) { - static const char* pFilters[] = { "AIF Audio", "aif;aiff", - "AU Audio", "au", - "AVI", "avi", - "CD Audio", "cda", - "Matroska Media", "mkv", - "MIDI Audio", "mid;midi", - "MPEG Audio", "mp2;mp3;mpa", - "MPEG Video", "mpg;mpeg;mpv;mp4", - "Ogg bitstream", "ogg", - "Quicktime Video", "mov", - "Vivo Video", "viv", - "WAVE Audio", "wav" }; - - unsigned int i; - for( i = 0; i < ( sizeof( pFilters ) / sizeof( char* ) ); i += 2 ) + static const char* pFilters[] = { "AIF Audio", "aif;aiff", + "AU Audio", "au", + "AVI", "avi", + "CD Audio", "cda", + "FLAC Audio", "flac", + "Matroska Media", "mkv", + "MIDI Audio", "mid;midi", + "MPEG Audio", "mp2;mp3;mpa", + "MPEG Video", "mpg;mpeg;mpv;mp4", + "Ogg bitstream", "ogg", + "Quicktime Video", "mov", + "Vivo Video", "viv", + "WAVE Audio", "wav", + "WebM Video", "webm" }; + + for( size_t i = 0; i < SAL_N_ELEMENTS(pFilters); i += 2 ) { rFilterNameVector.push_back( ::std::make_pair< ::rtl::OUString, ::rtl::OUString >( - ::rtl::OUString::createFromAscii( pFilters[ i ] ), - ::rtl::OUString::createFromAscii( pFilters[ i + 1 ] ) ) ); + ::rtl::OUString::createFromAscii(pFilters[i]), + ::rtl::OUString::createFromAscii(pFilters[i+1]) ) ); } } @@ -469,10 +471,8 @@ bool MediaWindow::isMediaURL( const ::rtl::OUString& rURL, bool bDeep, Size* pPr { try { - sal_Bool bIsJavaBasedMediaWindow; uno::Reference< media::XPlayer > xPlayer( priv::MediaWindowImpl::createPlayer( - aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ), - bIsJavaBasedMediaWindow ) ); + aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ) ); if( xPlayer.is() ) { @@ -517,8 +517,7 @@ bool MediaWindow::isMediaURL( const ::rtl::OUString& rURL, bool bDeep, Size* pPr uno::Reference< media::XPlayer > MediaWindow::createPlayer( const ::rtl::OUString& rURL ) { - sal_Bool bJavaBased = sal_False; - return priv::MediaWindowImpl::createPlayer( rURL, bJavaBased ); + return priv::MediaWindowImpl::createPlayer( rURL ); } // ------------------------------------------------------------------------- @@ -571,3 +570,5 @@ uno::Reference< graphic::XGraphic > MediaWindow::grabFrame( const ::rtl::OUStrin } } // namespace avemdia + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/viewer/mediawindow.hrc b/avmedia/source/viewer/mediawindow.hrc index 67036e300c13..67036e300c13 100644..100755 --- a/avmedia/source/viewer/mediawindow.hrc +++ b/avmedia/source/viewer/mediawindow.hrc diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx index 15c830cb97a6..c79fea8c033f 100644 --- a/avmedia/source/viewer/mediawindow_impl.cxx +++ b/avmedia/source/viewer/mediawindow_impl.cxx @@ -1,4 +1,5 @@ -/************************************************************************ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -36,13 +37,12 @@ #include <osl/mutex.hxx> #include <tools/time.hxx> #include <vcl/svapp.hxx> +#ifdef UNX +#include <vcl/sysdata.hxx> +#endif -#ifndef _COM_SUN_STAR_AWT_SYSTEMPOINTER_HDL_ #include <com/sun/star/awt/SystemPointer.hdl> -#endif -#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HDL_ #include <com/sun/star/lang/XComponent.hdl> -#endif #define AVMEDIA_TOOLBOXITEM_PREV 0x0001 #define AVMEDIA_TOOLBOXITEM_PLAY 0x0002 @@ -230,24 +230,19 @@ void MediaWindowImpl::onURLChanged() { if( getPlayer().is() ) { + uno::Sequence< uno::Any > aArgs( 3 ); uno::Reference< media::XPlayerWindow > xPlayerWindow; + const Point aPoint; + const Size aSize( maChildWindow.GetSizePixel() ); + const sal_Int32 nWndHandle = 0; - const Point aPoint; - const Size aSize( maChildWindow.GetSizePixel() ); - const sal_IntPtr nWndHandle = (sal_IntPtr) maChildWindow.GetParentWindowHandle( isMediaWindowJavaBased() ); + aArgs[ 0 ] = uno::makeAny( nWndHandle ); + aArgs[ 1 ] = uno::makeAny( awt::Rectangle( aPoint.X(), aPoint.Y(), aSize.Width(), aSize.Height() ) ); + aArgs[ 2 ] = uno::makeAny( reinterpret_cast< sal_IntPtr >( &maChildWindow ) ); try { - if( nWndHandle != 0 ) - { - uno::Sequence< uno::Any > aArgs( 3 ); - - aArgs[ 0 ] = uno::makeAny( nWndHandle ); - aArgs[ 1 ] = uno::makeAny( awt::Rectangle( aPoint.X(), aPoint.Y(), aSize.Width(), aSize.Height() ) ); - aArgs[ 2 ] = uno::makeAny( reinterpret_cast< sal_IntPtr >( &maChildWindow ) ); - - xPlayerWindow = getPlayer()->createPlayerWindow( aArgs ); - } + xPlayerWindow = getPlayer()->createPlayerWindow( aArgs ); } catch( uno::RuntimeException ) { @@ -279,6 +274,8 @@ void MediaWindowImpl::onURLChanged() updateMediaItem( aItem ); mpMediaWindowControl->setState( aItem ); } + + Invalidate(); } // --------------------------------------------------------------------- @@ -545,3 +542,5 @@ void MediaWindowImpl::StartDrag( sal_Int8 nAction, const Point& rPosPixel ) } // namespace priv } // namespace avmedia + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/viewer/mediawindow_impl.hxx b/avmedia/source/viewer/mediawindow_impl.hxx index 9008e499647d..fa44d2158863 100644 --- a/avmedia/source/viewer/mediawindow_impl.hxx +++ b/avmedia/source/viewer/mediawindow_impl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -146,3 +147,5 @@ namespace avmedia } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/viewer/mediawindowbase_impl.cxx b/avmedia/source/viewer/mediawindowbase_impl.cxx index 94a6c36ed064..6c2db96b16a3 100644 --- a/avmedia/source/viewer/mediawindowbase_impl.cxx +++ b/avmedia/source/viewer/mediawindowbase_impl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,9 +34,7 @@ #include <comphelper/processfactory.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/media/XManager.hpp> -#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HDL_ #include <com/sun/star/lang/XComponent.hdl> -#endif #define MEDIA_TIMER_TIMEOUT 100 @@ -47,18 +46,9 @@ namespace avmedia { namespace priv { // - MediaWindowBaseImpl - // ----------------------- -struct ServiceManager -{ - const char* pServiceName; - sal_Bool bIsJavaBased; -}; - -// --------------------------------------------------------------------- - MediaWindowBaseImpl::MediaWindowBaseImpl( MediaWindow* pMediaWindow ) : - mpMediaWindow( pMediaWindow ), - mbIsMediaWindowJavaBased( sal_False ) + mpMediaWindow( pMediaWindow ) { } @@ -71,48 +61,29 @@ MediaWindowBaseImpl::~MediaWindowBaseImpl() // ------------------------------------------------------------------------- -uno::Reference< media::XPlayer > MediaWindowBaseImpl::createPlayer( const ::rtl::OUString& rURL, sal_Bool& rbJavaBased ) +uno::Reference< media::XPlayer > MediaWindowBaseImpl::createPlayer( const ::rtl::OUString& rURL ) { uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); uno::Reference< media::XPlayer > xPlayer; - rbJavaBased = sal_False; - if( xFactory.is() ) { - static const ServiceManager aServiceManagers[] = + try { - { AVMEDIA_MANAGER_SERVICE_NAME, AVMEDIA_MANAGER_SERVICE_IS_JAVABASED }, - { AVMEDIA_MANAGER_SERVICE_NAME_FALLBACK1, AVMEDIA_MANAGER_SERVICE_IS_JAVABASED_FALLBACK1 } - }; - - for( sal_uInt32 i = 0; !xPlayer.is() && ( i < ( sizeof( aServiceManagers ) / sizeof( ServiceManager ) ) ); ++i ) - { - const String aServiceName( aServiceManagers[ i ].pServiceName, RTL_TEXTENCODING_ASCII_US ); - - if( aServiceName.Len() ) - { - OSL_TRACE( "Trying to create media manager service %s", aServiceManagers[ i ].pServiceName ); - try - { - uno::Reference< media::XManager > xManager( xFactory->createInstance( aServiceName ), uno::UNO_QUERY ); + uno::Reference< ::com::sun::star::media::XManager > xManager( + xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_MANAGER_SERVICE_NAME )) ), + uno::UNO_QUERY ); - if( xManager.is() ) - { - xPlayer = uno::Reference< media::XPlayer >( xManager->createPlayer( rURL ), uno::UNO_QUERY ); - } - } - catch( ... ) - { - } - } - - if( xPlayer.is() ) + if( xManager.is() ) { - rbJavaBased = aServiceManagers[ i ].bIsJavaBased; + xPlayer = uno::Reference< ::com::sun::star::media::XPlayer >( + xManager->createPlayer( rURL ), uno::UNO_QUERY ); } } + catch( ... ) + { + } } return xPlayer; @@ -140,7 +111,7 @@ void MediaWindowBaseImpl::setURL( const ::rtl::OUString& rURL ) if( aURL.GetProtocol() != INET_PROT_NOT_VALID ) maFileURL = aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ); - mxPlayer = createPlayer( maFileURL, mbIsMediaWindowJavaBased ); + mxPlayer = createPlayer( maFileURL ); onURLChanged(); } } @@ -431,12 +402,7 @@ void MediaWindowBaseImpl::executeMediaItem( const MediaItem& rItem ) case( MEDIASTATE_PLAY ): case( MEDIASTATE_PLAYFFW ): { -/* - const double fNewRate = ( ( MEDIASTATE_PLAYFFW == rItem.getState() ) ? AVMEDIA_FFW_PLAYRATE : 1.0 ); - if( getRate() != fNewRate ) - setRate( fNewRate ); -*/ if( !isPlaying() ) start(); } @@ -465,3 +431,5 @@ void MediaWindowBaseImpl::executeMediaItem( const MediaItem& rItem ) } // namespace priv } // namespace avemdia + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/viewer/mediawindowbase_impl.hxx b/avmedia/source/viewer/mediawindowbase_impl.hxx index 028b7c6ed079..1aa615a5986f 100644 --- a/avmedia/source/viewer/mediawindowbase_impl.hxx +++ b/avmedia/source/viewer/mediawindowbase_impl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -61,8 +62,7 @@ namespace avmedia virtual void cleanUp(); virtual void onURLChanged(); - static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const ::rtl::OUString& rURL, - sal_Bool& rbJavaBased ); + static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const ::rtl::OUString& rURL); public: @@ -132,3 +132,5 @@ namespace avmedia } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/win/avmediawin.component b/avmedia/source/win/avmediawin.component index c80c19bff0d9..c80c19bff0d9 100644..100755 --- a/avmedia/source/win/avmediawin.component +++ b/avmedia/source/win/avmediawin.component diff --git a/avmedia/source/win/exports.dxp b/avmedia/source/win/exports.dxp index 926e49f5f1a5..926e49f5f1a5 100644..100755 --- a/avmedia/source/win/exports.dxp +++ b/avmedia/source/win/exports.dxp diff --git a/avmedia/source/win/framegrabber.cxx b/avmedia/source/win/framegrabber.cxx index dc4a5dbeeb74..9743d1230e62 100644 --- a/avmedia/source/win/framegrabber.cxx +++ b/avmedia/source/win/framegrabber.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -25,12 +26,12 @@ * ************************************************************************/ -#include <tools/prewin.h> #if defined _MSC_VER #pragma warning(push, 1) #pragma warning(disable: 4917) #endif -#include <windows.h> +#include <prewin.h> +#include <postwin.h> #include <objbase.h> #include <strmif.h> #include <Amvideo.h> @@ -43,7 +44,6 @@ #if defined _MSC_VER #pragma warning(pop) #endif -#include <tools/postwin.h> #include "framegrabber.hxx" #include "player.hxx" @@ -245,3 +245,5 @@ uno::Sequence< ::rtl::OUString > SAL_CALL FrameGrabber::getSupportedServiceNames } // namespace win } // namespace avmedia + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/win/framegrabber.hxx b/avmedia/source/win/framegrabber.hxx index 17085571feea..0499a5086e49 100644 --- a/avmedia/source/win/framegrabber.hxx +++ b/avmedia/source/win/framegrabber.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,7 @@ #include "wincommon.hxx" -#ifndef _COM_SUN_STAR_MEDIA_XFRAMEGRABBER_HDL_ #include "com/sun/star/media/XFrameGrabber.hdl" -#endif struct IMediaDet; @@ -72,3 +71,5 @@ private: } // namespace avmedia #endif // _FRAMEGRABBER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/win/interface.hxx b/avmedia/source/win/interface.hxx index cf45bb40ab9a..314a9356c9f0 100644 --- a/avmedia/source/win/interface.hxx +++ b/avmedia/source/win/interface.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -121,3 +122,4 @@ public: }; +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/win/makefile.mk b/avmedia/source/win/makefile.mk index 37db25b6a8b7..7c6c9e14da6e 100644..100755 --- a/avmedia/source/win/makefile.mk +++ b/avmedia/source/win/makefile.mk @@ -48,8 +48,7 @@ SLOFILES= \ $(SLO)$/manager.obj \ $(SLO)$/window.obj \ $(SLO)$/player.obj \ - $(SLO)$/framegrabber.obj - + $(SLO)$/framegrabber.obj EXCEPTIONSFILES= \ $(SLO)$/winuno.obj \ @@ -67,7 +66,6 @@ DEF1EXPORTFILE=exports.dxp SHL1STDLIBS += $(OLE32LIB) SHL1STDLIBS += $(OLEAUT32LIB) SHL1STDLIBS += $(GDI32LIB) -SHL1STDLIBS += $(DDRAWLIB) .IF "$(COM)"=="GCC" SHL1STDLIBS += $(PSDK_HOME)$/lib$/strmiids.lib diff --git a/avmedia/source/win/manager.cxx b/avmedia/source/win/manager.cxx index 13bc1e4fe593..c10a96233766 100644 --- a/avmedia/source/win/manager.cxx +++ b/avmedia/source/win/manager.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -95,3 +96,5 @@ uno::Sequence< ::rtl::OUString > SAL_CALL Manager::getSupportedServiceNames( ) } // namespace win } // namespace avmedia + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/win/manager.hxx b/avmedia/source/win/manager.hxx index 1bb3e530c016..0dd52627641b 100644 --- a/avmedia/source/win/manager.hxx +++ b/avmedia/source/win/manager.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,7 @@ #include "wincommon.hxx" -#ifndef _COM_SUN_STAR_MEDIA_XMANAGER_HDL_ #include "com/sun/star/media/XManager.hdl" -#endif // ----------- // - Manager - @@ -64,3 +63,5 @@ private: } // namespace avmedia #endif // _MANAGER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/win/player.cxx b/avmedia/source/win/player.cxx index d27b2b55ff93..c2dea25f22c0 100644 --- a/avmedia/source/win/player.cxx +++ b/avmedia/source/win/player.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -25,12 +26,10 @@ * ************************************************************************/ -#include <tools/prewin.h> #if defined _MSC_VER #pragma warning(push, 1) #pragma warning(disable: 4917) #endif -#include <windows.h> #include <objbase.h> #include <strmif.h> #include <control.h> @@ -39,7 +38,6 @@ #if defined _MSC_VER #pragma warning(pop) #endif -#include <tools/postwin.h> #include "player.hxx" #include "framegrabber.hxx" @@ -206,7 +204,8 @@ void Player::setDDrawParams( IDirectDraw* pDDraw, IDirectDrawSurface* pDDrawSurf long Player::processEvent() { - long nCode, nParam1, nParam2; + long nCode; + LONG_PTR nParam1, nParam2; if( mpME && SUCCEEDED( mpME->GetEvent( &nCode, &nParam1, &nParam2, 0 ) ) ) { @@ -492,3 +491,5 @@ uno::Sequence< ::rtl::OUString > SAL_CALL Player::getSupportedServiceNames( ) } // namespace win } // namespace avmedia + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/win/player.hxx b/avmedia/source/win/player.hxx index 34a567750b74..7f87511209bd 100644 --- a/avmedia/source/win/player.hxx +++ b/avmedia/source/win/player.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,7 @@ #include "wincommon.hxx" -#ifndef _COM_SUN_STAR_MEDIA_XPLAYER_HDL_ #include "com/sun/star/media/XPlayer.hdl" -#endif struct IGraphBuilder; struct IBaseFilter; @@ -121,3 +120,5 @@ private: } // namespace avmedia #endif // _PLAYER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/win/wincommon.hxx b/avmedia/source/win/wincommon.hxx index 502f4300273a..0dd7cae023d3 100644 --- a/avmedia/source/win/wincommon.hxx +++ b/avmedia/source/win/wincommon.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -54,3 +55,5 @@ #define WM_GRAPHNOTIFY (WM_USER + 567) #endif // _WINCOMMOM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/win/window.cxx b/avmedia/source/win/window.cxx index 1170505b440b..c1b543d2a9a3 100644 --- a/avmedia/source/win/window.cxx +++ b/avmedia/source/win/window.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -25,12 +26,10 @@ * ************************************************************************/ -#include <tools/prewin.h> #if defined _MSC_VER #pragma warning(push, 1) #pragma warning(disable: 4917) #endif -#include <windows.h> #include <objbase.h> #include <strmif.h> #include <control.h> @@ -38,7 +37,6 @@ #if defined _MSC_VER #pragma warning(pop) #endif -#include <tools/postwin.h> #include <com/sun/star/awt/SystemPointer.hdl> #include "window.hxx" @@ -341,33 +339,6 @@ bool Window::create( const uno::Sequence< uno::Any >& rArguments ) { ::SetWindowLong( (HWND) mnFrameWnd, 0, (DWORD) this ); -#ifdef DDRAW_TEST_OUTPUT - IDirectDraw7* pDDraw; - IDirectDrawSurface7* pDDSurface; - IDirectDrawClipper* pDDClipper; - - if( DD_OK == DirectDrawCreateEx( NULL, (void**) &pDDraw, IID_IDirectDraw7, NULL ) ) - { - if( DD_OK == pDDraw->SetCooperativeLevel( (HWND) mnParentWnd, DDSCL_NORMAL ) ) - { - DDSURFACEDESC2 aDDDesc; - - memset( &aDDDesc, 0, sizeof( aDDDesc ) ); - aDDDesc.dwSize = sizeof( aDDDesc ); - aDDDesc.dwFlags = DDSD_CAPS; - aDDDesc.ddsCaps.dwCaps |= DDSCAPS_PRIMARYSURFACE; - - if( DD_OK == pDDraw->CreateSurface( &aDDDesc, &pDDSurface, NULL ) ) - { - if( DD_OK == pDDraw->CreateClipper( 0, &pDDClipper, NULL ) ) - { - pDDClipper->SetHWnd( 0, (HWND) mnFrameWnd ); - pDDSurface->SetClipper( pDDClipper ); - } - - mrPlayer.setDDrawParams( (IDirectDraw*) pDDraw, (IDirectDrawSurface*) pDDSurface ); -#endif - pVideoWindow->put_Owner( (OAHWND) mnFrameWnd ); pVideoWindow->put_MessageDrain( (OAHWND) mnFrameWnd ); pVideoWindow->put_WindowStyle( WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN ); @@ -376,11 +347,6 @@ bool Window::create( const uno::Sequence< uno::Any >& rArguments ) meZoomLevel = media::ZoomLevel_ORIGINAL; ImplLayoutVideoWindow(); -#ifdef DDRAW_TEST_OUTPUT - } - } - } -#endif } } @@ -403,7 +369,6 @@ void Window::updatePointer() switch( mnPointerType ) { case( awt::SystemPointer::CROSS ): pCursorName = IDC_CROSS; break; - //case( awt::SystemPointer::HAND ): pCursorName = IDC_HAND; break; case( awt::SystemPointer::MOVE ): pCursorName = IDC_SIZEALL; break; case( awt::SystemPointer::WAIT ): pCursorName = IDC_WAIT; break; @@ -738,3 +703,5 @@ uno::Sequence< ::rtl::OUString > SAL_CALL Window::getSupportedServiceNames( ) } // namespace win } // namespace avmedia + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/win/window.hxx b/avmedia/source/win/window.hxx index 36cff49a742a..22a6c295f8d3 100644 --- a/avmedia/source/win/window.hxx +++ b/avmedia/source/win/window.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,9 +32,7 @@ #include "wincommon.hxx" #include <cppuhelper/interfacecontainer.h> -#ifndef _COM_SUN_STAR_MEDIA_XPLAYERWINDOW_HDL_ #include "com/sun/star/media/XPlayerWindow.hdl" -#endif struct IVideoWindow; @@ -123,3 +122,5 @@ private: } // namespace avmedia #endif // _WINDOW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/win/winuno.cxx b/avmedia/source/win/winuno.cxx index 8b71f10b3f29..43c4382b67d4 100644 --- a/avmedia/source/win/winuno.cxx +++ b/avmedia/source/win/winuno.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,7 +44,7 @@ static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const uno: // - component_getImplementationEnvironment - // ------------------------------------------ -extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ) +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } @@ -52,18 +53,18 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char // - component_getFactory - // ------------------------ -extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* ) +extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* ) { uno::Reference< lang::XSingleServiceFactory > xFactory; void* pRet = 0; if( rtl_str_compare( pImplName, "com.sun.star.comp.avmedia.Manager_DirectX" ) == 0 ) { - const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( "com.sun.star.media.Manager_DirectX" ) ); + const ::rtl::OUString aServiceName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.media.Manager_DirectX" )) ); xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), - ::rtl::OUString::createFromAscii( "com.sun.star.comp.avmedia.Manager_DirectX" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.avmedia.Manager_DirectX" )), create_MediaPlayer, uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) ); } @@ -75,3 +76,5 @@ extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* return pRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/xine/exports.dxp b/avmedia/source/xine/exports.dxp deleted file mode 100644 index 926e49f5f1a5..000000000000 --- a/avmedia/source/xine/exports.dxp +++ /dev/null @@ -1,3 +0,0 @@ -component_getImplementationEnvironment -component_getFactory - diff --git a/avmedia/source/xine/makefile.mk b/avmedia/source/xine/makefile.mk deleted file mode 100644 index 3ba341c0d32b..000000000000 --- a/avmedia/source/xine/makefile.mk +++ /dev/null @@ -1,64 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# 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=avmediaxine -TARGET=avmediaxine - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk - -.IF "$(verbose)"!="" || "$(VERBOSE)"!="" -CDEFS+= -DVERBOSE -.ENDIF - -# --- Files ---------------------------------- - -.IF "$(GUI)" == "UNX" && "$(GUIBASE)"!="aqua" - -SLOFILES= \ - $(SLO)$/xineuno.obj \ - $(SLO)$/manager.obj \ - $(SLO)$/window.obj \ - $(SLO)$/player.obj - -EXCEPTIONSFILES= \ - $(SLO)$/xineuno.obj - -SHL1TARGET=$(TARGET) -SHL1STDLIBS= $(CPPULIB) $(SALLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) -SHL1IMPLIB=i$(TARGET) -SHL1LIBS=$(SLB)$/$(TARGET).lib -SHL1DEF=$(MISC)$/$(SHL1TARGET).def - -DEF1NAME=$(SHL1TARGET) -DEF1EXPORTFILE=exports.dxp - -.ENDIF - -.INCLUDE : target.mk diff --git a/avmedia/source/xine/manager.cxx b/avmedia/source/xine/manager.cxx deleted file mode 100644 index 8fa1f27129b9..000000000000 --- a/avmedia/source/xine/manager.cxx +++ /dev/null @@ -1,91 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * 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 "manager.hxx" -#include "player.hxx" - -using namespace ::com::sun::star; - -namespace avmedia { namespace xine { -// ---------------- -// - Manager - -// ---------------- - -Manager::Manager( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) : - mxMgr( rxMgr ) -{ -} - -// ------------------------------------------------------------------------------ - -Manager::~Manager() -{ -} - -// ------------------------------------------------------------------------------ - -uno::Reference< media::XPlayer > SAL_CALL Manager::createPlayer( const ::rtl::OUString& aURL ) - throw (uno::RuntimeException) -{ - Player* pPlayer( new Player ); - uno::Reference< media::XPlayer > xRet( pPlayer ); - - if( !pPlayer->create( aURL ) ) - xRet = uno::Reference< media::XPlayer >(); - - return xRet; -} - -// ------------------------------------------------------------------------------ - -::rtl::OUString SAL_CALL Manager::getImplementationName( ) - throw (uno::RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_XINE_MANAGER_IMPLEMENTATIONNAME ) ); -} - -// ------------------------------------------------------------------------------ - -sal_Bool SAL_CALL Manager::supportsService( const ::rtl::OUString& ServiceName ) - throw (uno::RuntimeException) -{ - return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_XINE_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_XINE_MANAGER_SERVICENAME ) ); - - return aRet; -} - -} // namespace xine -} // namespace avmedia diff --git a/avmedia/source/xine/manager.hxx b/avmedia/source/xine/manager.hxx deleted file mode 100644 index b8faf2774f73..000000000000 --- a/avmedia/source/xine/manager.hxx +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * 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 "xinecommon.hxx" - -#ifndef _COM_SUN_STAR_MEDIA_XMANAGER_HDL_ -#include "com/sun/star/media/XManager.hdl" -#endif - -// ----------- -// - Manager - -// ----------- - -namespace avmedia { namespace xine { - -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 xine -} // namespace avmedia - -#endif // _MANAGER_HXX diff --git a/avmedia/source/xine/player.cxx b/avmedia/source/xine/player.cxx deleted file mode 100644 index e343bf2c0dcf..000000000000 --- a/avmedia/source/xine/player.cxx +++ /dev/null @@ -1,262 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * 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 "player.hxx" -#include "window.hxx" - -using namespace ::com::sun::star; - -namespace avmedia { namespace xine { - -// ---------------- -// - Player - -// ---------------- - -Player::Player() -{ -} - -// ------------------------------------------------------------------------------ - -Player::~Player() -{ -} - -// ------------------------------------------------------------------------------ - -bool Player::create( const ::rtl::OUString& /* rURL */ ) -{ - bool bRet = false; - - - return bRet; -} - -// ------------------------------------------------------------------------------ - -void SAL_CALL Player::start( ) - throw (uno::RuntimeException) -{ -} - -// ------------------------------------------------------------------------------ - -void SAL_CALL Player::stop( ) - throw (uno::RuntimeException) -{ -} - -// ------------------------------------------------------------------------------ - -sal_Bool SAL_CALL Player::isPlaying() - throw (uno::RuntimeException) -{ - bool bRet = false; - - return bRet; -} - -// ------------------------------------------------------------------------------ - -double SAL_CALL Player::getDuration( ) - throw (uno::RuntimeException) -{ - double fRet = 0.0; - - return fRet; -} - -// ------------------------------------------------------------------------------ - -void SAL_CALL Player::setMediaTime( double /* fTime */ ) - throw (uno::RuntimeException) -{ -} - -// ------------------------------------------------------------------------------ - -double SAL_CALL Player::getMediaTime( ) - throw (uno::RuntimeException) -{ - double fRet = 0.0; - - return fRet; -} - -// ------------------------------------------------------------------------------ - -void SAL_CALL Player::setStopTime( double /* fTime */ ) - throw (uno::RuntimeException) -{ -} - -// ------------------------------------------------------------------------------ - -double SAL_CALL Player::getStopTime( ) - throw (uno::RuntimeException) -{ - double fRet = 0.0; - - return fRet; -} - -// ------------------------------------------------------------------------------ - -void SAL_CALL Player::setRate( double /* fRate */ ) - throw (uno::RuntimeException) -{ -} - -// ------------------------------------------------------------------------------ - -double SAL_CALL Player::getRate( ) - throw (uno::RuntimeException) -{ - double fRet = 0.0; - - return fRet; -} - -// ------------------------------------------------------------------------------ - -void SAL_CALL Player::setPlaybackLoop( sal_Bool /* bSet */ ) - throw (uno::RuntimeException) -{ -} - -// ------------------------------------------------------------------------------ - -sal_Bool SAL_CALL Player::isPlaybackLoop( ) - throw (uno::RuntimeException) -{ - bool bRet = false; - - return bRet; -} - -// ------------------------------------------------------------------------------ - -void SAL_CALL Player::setMute( sal_Bool /* bSet */ ) - throw (uno::RuntimeException) -{ -} - -// ------------------------------------------------------------------------------ - -sal_Bool SAL_CALL Player::isMute( ) - throw (uno::RuntimeException) -{ - bool bRet = false; - - return bRet; -} - -// ------------------------------------------------------------------------------ - -void SAL_CALL Player::setVolumeDB( sal_Int16 /* nVolumeDB */ ) - throw (uno::RuntimeException) -{ -} - -// ------------------------------------------------------------------------------ - -sal_Int16 SAL_CALL Player::getVolumeDB( ) - throw (uno::RuntimeException) -{ - sal_Int16 nRet = 0; - - return nRet; -} - -// ------------------------------------------------------------------------------ - -awt::Size SAL_CALL Player::getPreferredPlayerWindowSize( ) - throw (uno::RuntimeException) -{ - awt::Size aSize( 0, 0 ); - - return aSize; -} - -// ------------------------------------------------------------------------------ - -uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( const uno::Sequence< uno::Any >& aArguments ) - throw (uno::RuntimeException) -{ - uno::Reference< ::media::XPlayerWindow > xRet; - awt::Size aSize( getPreferredPlayerWindowSize() ); - - if( aSize.Width > 0 && aSize.Height > 0 ) - { - ::avmedia::xine::Window* pWindow = new ::avmedia::xine::Window( *this ); - - xRet = pWindow; - - if( !pWindow->create( aArguments ) ) - xRet = uno::Reference< ::media::XPlayerWindow >(); - } - - return xRet; -} - -// ------------------------------------------------------------------------------ - -uno::Reference< media::XFrameGrabber > SAL_CALL Player::createFrameGrabber( ) - throw (::com::sun::star::uno::RuntimeException) -{ - return NULL; -} - -// ------------------------------------------------------------------------------ - -::rtl::OUString SAL_CALL Player::getImplementationName( ) - throw (uno::RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_XINE_PLAYER_IMPLEMENTATIONNAME ) ); -} - -// ------------------------------------------------------------------------------ - -sal_Bool SAL_CALL Player::supportsService( const ::rtl::OUString& ServiceName ) - throw (uno::RuntimeException) -{ - return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_XINE_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_XINE_PLAYER_SERVICENAME ) ); - - return aRet; -} - -} // namespace xine -} // namespace avmedia diff --git a/avmedia/source/xine/player.hxx b/avmedia/source/xine/player.hxx deleted file mode 100644 index b1e18613fbeb..000000000000 --- a/avmedia/source/xine/player.hxx +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * 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 "xinecommon.hxx" - -#ifndef _COM_SUN_STAR_MEDIA_XPLAYER_HDL_ -#include "com/sun/star/media/XPlayer.hdl" -#endif - -namespace avmedia { namespace xine { - -// ---------- -// - Player - -// ---------- - -class Player : public ::cppu::WeakImplHelper2< ::com::sun::star::media::XPlayer, - ::com::sun::star::lang::XServiceInfo > -{ -public: - - Player(); - ~Player(); - - bool create( const ::rtl::OUString& rURL ); - - // 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: -}; - -} // namespace xine -} // namespace avmedia - -#endif // _PLAYER_HXX diff --git a/avmedia/source/xine/window.cxx b/avmedia/source/xine/window.cxx deleted file mode 100644 index fb4f428c65fd..000000000000 --- a/avmedia/source/xine/window.cxx +++ /dev/null @@ -1,571 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * 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 "window.hxx" -#include "player.hxx" - -using namespace ::com::sun::star; - -namespace avmedia { namespace xine { - -// ----------- -// - 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; -} - -// ----------- -// - WndProc - -// ----------- - -/* -LRESULT CALLBACK MediaPlayerWndProc( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM nPar2 ) -{ - Window* pWindow = (Window*) ::GetWindowLong( hWnd, 0 ); - bool bProcessed = true; - - if( pWindow ) - { - switch( nMsg ) - { - case( WM_SETCURSOR ): - pWindow->updatePointer(); - break; - - case( WM_GRAPHNOTIFY ): - pWindow->processGraphEvent(); - break; - - case( WM_MOUSEMOVE ): - case( WM_LBUTTONDOWN ): - case( WM_MBUTTONDOWN ): - case( WM_RBUTTONDOWN ): - case( WM_LBUTTONUP ): - case( WM_MBUTTONUP ): - case( WM_RBUTTONUP ): - { - awt::MouseEvent aUNOEvt; - POINT aWinPoint; - - if( !::GetCursorPos( &aWinPoint ) || !::ScreenToClient( hWnd, &aWinPoint ) ) - { - aWinPoint.x = GET_X_LPARAM( nPar2 ); - aWinPoint.y = GET_Y_LPARAM( nPar2 ); - } - aUNOEvt.Modifiers = 0; - aUNOEvt.Buttons = 0; - aUNOEvt.X = aWinPoint.x; - aUNOEvt.Y = aWinPoint.y; - aUNOEvt.PopupTrigger = false; - - // Modifiers - if( nPar1 & MK_SHIFT ) - aUNOEvt.Modifiers |= awt::KeyModifier::SHIFT; - - if( nPar1 & MK_CONTROL ) - aUNOEvt.Modifiers |= awt::KeyModifier::MOD1; - - // Buttons - if( WM_LBUTTONDOWN == nMsg || WM_LBUTTONUP == nMsg ) - aUNOEvt.Buttons |= awt::MouseButton::LEFT; - - if( WM_MBUTTONDOWN == nMsg || WM_MBUTTONUP == nMsg ) - aUNOEvt.Buttons |= awt::MouseButton::MIDDLE; - - if( WM_RBUTTONDOWN == nMsg || WM_RBUTTONUP == nMsg ) - aUNOEvt.Buttons |= awt::MouseButton::RIGHT; - - // event type - if( WM_LBUTTONDOWN == nMsg || - WM_MBUTTONDOWN == nMsg || - WM_RBUTTONDOWN == nMsg ) - { - aUNOEvt.ClickCount = 1; - pWindow->fireMousePressedEvent( aUNOEvt ); - } - else if( WM_LBUTTONUP == nMsg || - WM_MBUTTONUP == nMsg || - WM_RBUTTONUP == nMsg ) - { - aUNOEvt.ClickCount = 1; - pWindow->fireMouseReleasedEvent( aUNOEvt ); - } - else if( WM_MOUSEMOVE == nMsg ) - { - aUNOEvt.ClickCount = 0; - pWindow->fireMouseMovedEvent( aUNOEvt ); - pWindow->updatePointer(); - } - } - break; - - case( WM_SETFOCUS ): - { - const awt::FocusEvent aUNOEvt; - pWindow->fireSetFocusEvent( aUNOEvt ); - } - break; - - default: - bProcessed = false; - break; - } - } - else - bProcessed = false; - - return( bProcessed ? 0 : DefWindowProc( hWnd, nMsg, nPar1, nPar2 ) ); -} -*/ - -// --------------- -// - Window - -// --------------- - -Window::Window( Player& rPlayer ) : - mrPlayer( rPlayer ), - maListeners( maMutex ), - meZoomLevel( media::ZoomLevel_NOT_AVAILABLE ), - mnPointerType( awt::SystemPointer::ARROW ) -{ - ::osl::MutexGuard aGuard( ImplGetOwnStaticMutex() ); -} - -// ------------------------------------------------------------------------------ - -Window::~Window() -{ -} - -// ------------------------------------------------------------------------------ - -void Window::implLayoutVideoWindow() -{ - if( media::ZoomLevel_NOT_AVAILABLE != meZoomLevel ) - { - awt::Size aPrefSize( mrPlayer.getPreferredPlayerWindowSize() ); - awt::Rectangle aRect = getPosSize(); - int nW = aRect.Width, nH = aRect.Height; - int nVideoW = nW, nVideoH = nH; - int nX = 0, nY = 0, nWidth = 0, nHeight = 0; - bool bDone = false, bZoom = false; - - if( media::ZoomLevel_ORIGINAL == meZoomLevel ) - { - bZoom = true; - } - else if( media::ZoomLevel_ZOOM_1_TO_4 == meZoomLevel ) - { - aPrefSize.Width >>= 2; - aPrefSize.Height >>= 2; - bZoom = true; - } - else if( media::ZoomLevel_ZOOM_1_TO_2 == meZoomLevel ) - { - aPrefSize.Width >>= 1; - aPrefSize.Height >>= 1; - bZoom = true; - } - else if( media::ZoomLevel_ZOOM_2_TO_1 == meZoomLevel ) - { - aPrefSize.Width <<= 1; - aPrefSize.Height <<= 1; - bZoom = true; - } - else if( media::ZoomLevel_ZOOM_4_TO_1 == meZoomLevel ) - { - aPrefSize.Width <<= 2; - aPrefSize.Height <<= 2; - bZoom = true; - } - else if( media::ZoomLevel_FIT_TO_WINDOW == meZoomLevel ) - { - nWidth = nVideoW; - nHeight = nVideoH; - bDone = true; - } - - if( bZoom ) - { - if( ( aPrefSize.Width <= nVideoW ) && ( aPrefSize.Height <= nVideoH ) ) - { - nX = ( nVideoW - aPrefSize.Width ) >> 1; - nY = ( nVideoH - aPrefSize.Height ) >> 1; - nWidth = aPrefSize.Width; - nHeight = aPrefSize.Height; - bDone = true; - } - } - - if( !bDone ) - { - if( aPrefSize.Width > 0 && aPrefSize.Height > 0 && nVideoW > 0 && nVideoH > 0 ) - { - double fPrefWH = (double) aPrefSize.Width / aPrefSize.Height; - - if( fPrefWH < ( (double) nVideoW / nVideoH ) ) - nVideoW = (int)( nVideoH * fPrefWH ); - else - nVideoH = (int)( nVideoW / fPrefWH ); - - nX = ( nW - nVideoW ) >> 1; - nY = ( nH - nVideoH ) >> 1; - nWidth = nVideoW; - nHeight = nVideoH; - } - else - nX = nY = nWidth = nHeight = 0; - } - - /* - IVideoWindow* pVideoWindow = const_cast< IVideoWindow* >( mrPlayer.getVideoWindow() ); - - if( pVideoWindow ) - pVideoWindow->SetWindowPosition( nX, nY, nWidth, nHeight ); - */ - } -} - -// ------------------------------------------------------------------------------ - -bool Window::create( const uno::Sequence< uno::Any >& /*rArguments*/ ) -{ - bool bRet = false; - - return bRet; -} - -// ------------------------------------------------------------------------------ - -void SAL_CALL Window::update( ) - throw (uno::RuntimeException) -{ -} - -// ------------------------------------------------------------------------------ - -sal_Bool SAL_CALL Window::setZoomLevel( media::ZoomLevel eZoomLevel ) - throw (uno::RuntimeException) -{ - 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; -} - -// ------------------------------------------------------------------------------ - -void SAL_CALL Window::setPosSize( sal_Int32 /*X*/, sal_Int32 /*Y*/, sal_Int32 /*Width*/, sal_Int32 /*Height*/, sal_Int16 /*Flags*/ ) - throw (uno::RuntimeException) -{ - implLayoutVideoWindow(); -} - -// ------------------------------------------------------------------------------ - -awt::Rectangle SAL_CALL Window::getPosSize() - throw (uno::RuntimeException) -{ - awt::Rectangle aRet; - - 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 ); -} - -// ------------------------------------------------------------------------------ - -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 ); -} - -// ------------------------------------------------------------------------------ - -void Window::fireMousePressedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ) -{ - ::cppu::OInterfaceContainerHelper* pContainer = maListeners.getContainer( getCppuType( (uno::Reference< awt::XMouseListener >*) 0 ) ); - - if( pContainer ) - { - ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); - - while( aIter.hasMoreElements() ) - uno::Reference< awt::XMouseListener >( aIter.next(), uno::UNO_QUERY )->mousePressed( rEvt ); - } -} - -// ----------------------------------------------------------------------------- - -void Window::fireMouseReleasedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ) -{ - ::cppu::OInterfaceContainerHelper* pContainer = maListeners.getContainer( getCppuType( (uno::Reference< awt::XMouseListener >*) 0 ) ); - - if( pContainer ) - { - ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); - - while( aIter.hasMoreElements() ) - uno::Reference< awt::XMouseListener >( aIter.next(), uno::UNO_QUERY )->mouseReleased( rEvt ); - } -} - -// ----------------------------------------------------------------------------- - -void Window::fireMouseMovedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ) -{ - ::cppu::OInterfaceContainerHelper* pContainer = maListeners.getContainer( getCppuType( (uno::Reference< awt::XMouseMotionListener >*) 0 ) ); - - if( pContainer ) - { - ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); - - while( aIter.hasMoreElements() ) - uno::Reference< awt::XMouseMotionListener >( aIter.next(), uno::UNO_QUERY )->mouseMoved( rEvt ); - } -} - -// ----------------------------------------------------------------------------- - -void Window::fireSetFocusEvent( const ::com::sun::star::awt::FocusEvent& rEvt ) -{ - ::cppu::OInterfaceContainerHelper* pContainer = maListeners.getContainer( getCppuType( (uno::Reference< awt::XFocusListener >*) 0 ) ); - - if( pContainer ) - { - ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); - - while( aIter.hasMoreElements() ) - uno::Reference< awt::XFocusListener >( aIter.next(), uno::UNO_QUERY )->focusGained( rEvt ); - } -} - -// ------------------------------------------------------------------------------ - -::rtl::OUString SAL_CALL Window::getImplementationName( ) - throw (uno::RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_XINE_WINDOW_IMPLEMENTATIONNAME ) ); -} - -// ------------------------------------------------------------------------------ - -sal_Bool SAL_CALL Window::supportsService( const ::rtl::OUString& ServiceName ) - throw (uno::RuntimeException) -{ - return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_XINE_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_XINE_WINDOW_SERVICENAME ) ); - - return aRet; -} - -} // namespace xine -} // namespace avmedia diff --git a/avmedia/source/xine/window.hxx b/avmedia/source/xine/window.hxx deleted file mode 100644 index 014d349acfac..000000000000 --- a/avmedia/source/xine/window.hxx +++ /dev/null @@ -1,114 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * 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 "xinecommon.hxx" -#include <cppuhelper/interfacecontainer.h> - -#ifndef _COM_SUN_STAR_MEDIA_XPLAYERWINDOW_HDL_ -#include "com/sun/star/media/XPlayerWindow.hdl" -#endif - -namespace avmedia { namespace xine { - -// --------------- -// - Window - -// --------------- - -class Player; - -class Window : public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XPlayerWindow, - ::com::sun::star::lang::XServiceInfo > -{ -public: - - Window( Player& rPlayer ); - ~Window(); - - bool create( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ); - - // 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); - -public: - - void fireMousePressedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ); - void fireMouseReleasedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ); - void fireMouseMovedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ); - void fireKeyPressedEvent( const ::com::sun::star::awt::KeyEvent& rEvt ); - void fireKeyReleasedEvent( const ::com::sun::star::awt::KeyEvent& rEvt ); - void fireSetFocusEvent( const ::com::sun::star::awt::FocusEvent& rEvt ); - -private: - - ::osl::Mutex maMutex; - Player& mrPlayer; - ::cppu::OMultiTypeInterfaceContainerHelper maListeners; - ::com::sun::star::media::ZoomLevel meZoomLevel; - sal_Int32 mnPointerType; - - void implLayoutVideoWindow(); -}; - -} // namespace xine -} // namespace avmedia - -#endif // _WINDOW_HXX diff --git a/avmedia/source/xine/xinecommon.hxx b/avmedia/source/xine/xinecommon.hxx deleted file mode 100644 index fe80a75370b6..000000000000 --- a/avmedia/source/xine/xinecommon.hxx +++ /dev/null @@ -1,65 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * 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 _XINECOMMON_HXX -#define _XINECOMMON_HXX - -#include <osl/mutex.hxx> -#ifndef __RTL_USTRING_ -#include <rtl/ustring.hxx> -#endif -#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 AVMEDIA_XINE_MANAGER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Manager_Xine" -#define AVMEDIA_XINE_MANAGER_SERVICENAME "com.sun.star.media.Manager_Xine" - -#define AVMEDIA_XINE_PLAYER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Player_Xine" -#define AVMEDIA_XINE_PLAYER_SERVICENAME "com.sun.star.media.Player_Xine" - -#define AVMEDIA_XINE_WINDOW_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Window_Xine" -#define AVMEDIA_XINE_WINDOW_SERVICENAME "com.sun.star.media.Window_Xine" - -#endif // _XINECOMMOM_HXX diff --git a/avmedia/source/xine/xineuno.cxx b/avmedia/source/xine/xineuno.cxx deleted file mode 100644 index 2efe57b2472c..000000000000 --- a/avmedia/source/xine/xineuno.cxx +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * 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 "xinecommon.hxx" -#include "manager.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::xine::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_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, AVMEDIA_XINE_MANAGER_IMPLEMENTATIONNAME ) == 0 ) - { - const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( AVMEDIA_XINE_MANAGER_SERVICENAME ) ); - - xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory( - reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), - ::rtl::OUString::createFromAscii( AVMEDIA_XINE_MANAGER_IMPLEMENTATIONNAME ), - create_MediaPlayer, uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) ); - } - - if( xFactory.is() ) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - - return pRet; -} |