avmedia/source/vlc/vlcframegrabber.cxx | 19 +++++++++++++------ avmedia/source/vlc/vlcmanager.cxx | 12 +++++++++++- avmedia/source/vlc/vlcmanager.hxx | 2 +- avmedia/source/vlc/vlcuno.cxx | 4 ++-- 4 files changed, 27 insertions(+), 10 deletions(-)
New commits: commit 9f71d4e41aea338530ee297668b513645ae3d6b9 Author: Minh Ngo <nlmin...@gmail.com> Date: Sun Sep 8 16:26:19 2013 +0300 Creating one single Player manager. Change-Id: I2a56f38a0b28c828f365a24d744aea385436c2b5 diff --git a/avmedia/source/vlc/vlcframegrabber.cxx b/avmedia/source/vlc/vlcframegrabber.cxx index 5c01a2d..b7ef4a9 100644 --- a/avmedia/source/vlc/vlcframegrabber.cxx +++ b/avmedia/source/vlc/vlcframegrabber.cxx @@ -20,9 +20,12 @@ using namespace ::com::sun::star; namespace avmedia { namespace vlc { -const ::rtl::OUString AVMEDIA_VLC_GRABBER_IMPLEMENTATIONNAME = "com.sun.star.comp.avmedia.VLCFrameGrabber_VLC"; -const ::rtl::OUString AVMEDIA_VLC_GRABBER_SERVICENAME = "com.sun.star.media.VLCFrameGrabber_VLC"; -const int MSEC_IN_SEC = 1000; +namespace +{ + const ::rtl::OUString AVMEDIA_VLC_GRABBER_IMPLEMENTATIONNAME = "com.sun.star.comp.avmedia.VLCFrameGrabber_VLC"; + const ::rtl::OUString AVMEDIA_VLC_GRABBER_SERVICENAME = "com.sun.star.media.VLCFrameGrabber_VLC"; + const int MSEC_IN_SEC = 1000; +} VLCFrameGrabber::VLCFrameGrabber( VLC::Player& player, VLC::EventHandler& eh, const rtl::OUString& url ) : FrameGrabber_BASE() @@ -30,9 +33,11 @@ VLCFrameGrabber::VLCFrameGrabber( VLC::Player& player, VLC::EventHandler& eh, co , mUrl( url ) , mEventHandler( eh ) { + std::cout << "URL: " << url << std::endl; } -::uno::Reference< css::graphic::XGraphic > SAL_CALL VLCFrameGrabber::grabFrame( double fMediaTime ) throw ( ::com::sun::star::uno::RuntimeException ) +::uno::Reference< css::graphic::XGraphic > SAL_CALL VLCFrameGrabber::grabFrame( double fMediaTime ) + throw ( ::com::sun::star::uno::RuntimeException ) { osl::Condition condition; @@ -90,12 +95,14 @@ VLCFrameGrabber::VLCFrameGrabber( VLC::Player& player, VLC::EventHandler& eh, co return AVMEDIA_VLC_GRABBER_IMPLEMENTATIONNAME; } -::sal_Bool SAL_CALL VLCFrameGrabber::supportsService( const ::rtl::OUString& serviceName ) throw ( ::com::sun::star::uno::RuntimeException ) +::sal_Bool SAL_CALL VLCFrameGrabber::supportsService( const ::rtl::OUString& serviceName ) + throw ( ::com::sun::star::uno::RuntimeException ) { return AVMEDIA_VLC_GRABBER_SERVICENAME == serviceName; } -::uno::Sequence< ::rtl::OUString > SAL_CALL VLCFrameGrabber::getSupportedServiceNames() throw ( ::com::sun::star::uno::RuntimeException ) +::uno::Sequence< ::rtl::OUString > SAL_CALL VLCFrameGrabber::getSupportedServiceNames() + throw ( ::com::sun::star::uno::RuntimeException ) { ::uno::Sequence< OUString > aRet(1); aRet[0] = AVMEDIA_VLC_GRABBER_SERVICENAME; diff --git a/avmedia/source/vlc/vlcmanager.cxx b/avmedia/source/vlc/vlcmanager.cxx index ef536f4..4179ce2 100644 --- a/avmedia/source/vlc/vlcmanager.cxx +++ b/avmedia/source/vlc/vlcmanager.cxx @@ -71,7 +71,17 @@ uno::Reference< media::XPlayer > SAL_CALL Manager::createPlayer( const rtl::OUSt if ( !m_is_vlc_found ) return uno::Reference< media::XPlayer >(); - VLCPlayer* pPlayer( new VLCPlayer( rURL, + if ( !rURL.isEmpty() ) + { + if (mURL == rURL) + return mPlayer; + + mURL = rURL; + } + else + return mPlayer; + + VLCPlayer* pPlayer( new VLCPlayer( mURL, *mInstance, mEventHandler /*, mxMgr */ ) ); mPlayer = uno::Reference< media::XPlayer >( pPlayer ); diff --git a/avmedia/source/vlc/vlcmanager.hxx b/avmedia/source/vlc/vlcmanager.hxx index 92e0169..b8cb15c 100644 --- a/avmedia/source/vlc/vlcmanager.hxx +++ b/avmedia/source/vlc/vlcmanager.hxx @@ -45,7 +45,7 @@ public: private: ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr; ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > mPlayer; - + rtl::OUString mURL; bool m_is_vlc_found; }; diff --git a/avmedia/source/vlc/vlcuno.cxx b/avmedia/source/vlc/vlcuno.cxx index 5421f62..d41b2df 100644 --- a/avmedia/source/vlc/vlcuno.cxx +++ b/avmedia/source/vlc/vlcuno.cxx @@ -28,8 +28,8 @@ using namespace ::com::sun::star; static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const uno::Reference< lang::XMultiServiceFactory >& rxFact ) { fprintf (stderr, "create VLC Media player !\n"); - (void) rxFact; - return uno::Reference< uno::XInterface >(*new ::avmedia::vlc::Manager( rxFact ) ); + static uno::Reference< uno::XInterface > manager( *new ::avmedia::vlc::Manager( rxFact ) ); + return manager; } extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL avmediavlc_component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /*pRegistryKey*/ ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits