summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Ngo <nlminhtl@gmail.com>2013-06-13 09:43:51 +0300
committerMinh Ngo <nlminhtl@gmail.com>2013-06-13 09:43:51 +0300
commit1bff858999cdb0aa03dd957fb556e64dbb6a0d62 (patch)
tree7e0b64dc7d2f5aeb64759b24444af6224548ac2f
parentfa7672235410e5ba83c4956bf634e8bec623b3bb (diff)
Initial player/manager patterns for the vlc module
Change-Id: I600c3b273343906fbaed18629f425ce5b590b92e
-rw-r--r--avmedia/source/vlc/vlcmanager.cxx47
-rw-r--r--avmedia/source/vlc/vlcmanager.hxx53
-rw-r--r--avmedia/source/vlc/vlcplayer.cxx84
-rw-r--r--avmedia/source/vlc/vlcplayer.hxx61
-rw-r--r--avmedia/source/vlc/vlcuno.cxx3
5 files changed, 247 insertions, 1 deletions
diff --git a/avmedia/source/vlc/vlcmanager.cxx b/avmedia/source/vlc/vlcmanager.cxx
new file mode 100644
index 000000000000..74f4111fd0cf
--- /dev/null
+++ b/avmedia/source/vlc/vlcmanager.cxx
@@ -0,0 +1,47 @@
+#include "vlcmanager.hxx"
+#include "vlcplayer.hxx"
+
+using namespace ::com::sun::star;
+
+namespace avmedia {
+namespace vlc {
+
+const rtl::OUString VLC_IMPLEMENTATION_NAME = "com.sun.star.comp.avmedia.Manager_VLC";
+
+Manager::Manager( const uno::Reference< lang::XMultiServiceFactory >& rxMgr )
+ : mxMgr( rxMgr )
+{
+}
+
+Manager::~Manager()
+{
+}
+
+uno::Reference< media::XPlayer > SAL_CALL Manager::createPlayer( const rtl::OUString& rURL )
+ throw (uno::RuntimeException)
+{
+ VLCPlayer* pPlayer( new VLCPlayer( mxMgr ) );
+ uno::Reference< media::XPlayer > xRet( pPlayer );
+
+ return xRet;
+}
+
+rtl::OUString SAL_CALL Manager::getImplementationName()
+ throw (uno::RuntimeException)
+{
+ return VLC_IMPLEMENTATION_NAME;
+}
+
+sal_Bool SAL_CALL Manager::supportsService( const rtl::OUString& ServiceName )
+ throw (uno::RuntimeException)
+{
+ return false;
+}
+
+uno::Sequence< rtl::OUString > SAL_CALL Manager::getSupportedServiceNames()
+ throw (uno::RuntimeException)
+{
+ return uno::Sequence< rtl::OUString >();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
diff --git a/avmedia/source/vlc/vlcmanager.hxx b/avmedia/source/vlc/vlcmanager.hxx
new file mode 100644
index 000000000000..2632161c28dd
--- /dev/null
+++ b/avmedia/source/vlc/vlcmanager.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _VLCMANAGER_HXX
+#define _VLCMANAGER_HXX
+
+#include "vlccommon.hxx"
+
+#include "com/sun/star/media/XManager.hpp"
+
+namespace avmedia {
+namespace vlc {
+
+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();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > SAL_CALL createPlayer( const rtl::OUString& aURL ) throw (::com::sun::star::uno::RuntimeException);
+
+ rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ ::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;
+};
+
+}
+}
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
diff --git a/avmedia/source/vlc/vlcplayer.cxx b/avmedia/source/vlc/vlcplayer.cxx
new file mode 100644
index 000000000000..e977de41d98f
--- /dev/null
+++ b/avmedia/source/vlc/vlcplayer.cxx
@@ -0,0 +1,84 @@
+#include "vlcplayer.hxx"
+
+using namespace ::com::sun::star;
+
+namespace avmedia {
+namespace vlc {
+
+void SAL_CALL VLCPlayer::start()
+{
+}
+
+void SAL_CALL VLCPlayer::stop()
+{
+}
+
+::sal_Bool SAL_CALL VLCPlayer::isPlaying()
+{
+ return false;
+}
+
+double SAL_CALL VLCPlayer::getDuration()
+{
+ return 0.f;
+}
+
+void SAL_CALL VLCPlayer::setMediaTime( double fTime )
+{
+}
+
+double SAL_CALL VLCPlayer::getMediaTime()
+{
+ return 0.f;
+}
+
+double SAL_CALL VLCPlayer::getRate()
+{
+ return 0.f;
+}
+
+void SAL_CALL VLCPlayer::setPlaybackLoop( ::sal_Bool bSet )
+{
+}
+
+::sal_Bool SAL_CALL VLCPlayer::isPlaybackLoop()
+{
+ return false;
+}
+
+void SAL_CALL VLCPlayer::setVolumeDB( ::sal_Int16 nDB )
+{
+}
+
+::sal_Int16 SAL_CALL VLCPlayer::getVolumeDB()
+{
+ return 1;
+}
+
+void SAL_CALL VLCPlayer::setMute( ::sal_Bool bSet )
+{
+}
+
+::sal_Bool SAL_CALL VLCPlayer::isMute()
+{
+ return false;
+}
+
+css::awt::Size SAL_CALL VLCPlayer::getPreferredPlayerWindowSize()
+{
+ return css::awt::Size( 1, 1 );
+}
+
+uno::Reference< css::media::XPlayerWindow > SAL_CALL VLCPlayer::createPlayerWindow( const uno::Sequence< uno::Any >& aArguments )
+{
+ return uno::Reference< css::media::XPlayerWindow >();
+}
+uno::Reference< css::media::XFrameGrabber > SAL_CALL VLCPlayer::createFrameGrabber()
+{
+ return uno::Reference< css::media::XFrameGrabber >();
+}
+
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
diff --git a/avmedia/source/vlc/vlcplayer.hxx b/avmedia/source/vlc/vlcplayer.hxx
new file mode 100644
index 000000000000..f82bd597fc01
--- /dev/null
+++ b/avmedia/source/vlc/vlcplayer.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _VLCPLAYER_HXX
+#define _VLCPLAYER_HXX
+
+#include "vlccommon.hxx"
+
+#include "com/sun/star/media/XPlayer.hpp"
+#include <cppuhelper/basemutex.hxx>
+
+namespace avmedia {
+namespace vlc {
+
+typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::media::XPlayer,
+ ::com::sun::star::lang::XServiceInfo > VLC_Base;
+
+class VLCPlayer : public ::cppu::BaseMutex,
+ public VLC_Base
+{
+public:
+ void SAL_CALL start();
+ void SAL_CALL stop();
+ ::sal_Bool SAL_CALL isPlaying();
+ double SAL_CALL getDuration();
+ void SAL_CALL setMediaTime( double fTime );
+ double SAL_CALL getMediaTime();
+ double SAL_CALL getRate();
+ void SAL_CALL setPlaybackLoop( ::sal_Bool bSet );
+ ::sal_Bool SAL_CALL isPlaybackLoop();
+ void SAL_CALL setVolumeDB( ::sal_Int16 nDB );
+ ::sal_Int16 SAL_CALL getVolumeDB();
+ void SAL_CALL setMute( ::sal_Bool bSet );
+ ::sal_Bool SAL_CALL isMute();
+ css::awt::Size SAL_CALL getPreferredPlayerWindowSize();
+ ::com::sun::star::uno::Reference< css::media::XPlayerWindow > SAL_CALL createPlayerWindow( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments );
+ ::com::sun::star::uno::Reference< css::media::XFrameGrabber > SAL_CALL createFrameGrabber();
+};
+
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
diff --git a/avmedia/source/vlc/vlcuno.cxx b/avmedia/source/vlc/vlcuno.cxx
index e907a1bbeb02..0c9690e81334 100644
--- a/avmedia/source/vlc/vlcuno.cxx
+++ b/avmedia/source/vlc/vlcuno.cxx
@@ -18,6 +18,7 @@
*/
#include "vlccommon.hxx"
+#include "vlcmanager.hxx"
using namespace ::com::sun::star;
@@ -28,7 +29,7 @@ static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const uno:
{
fprintf (stderr, "create VLC Media player !\n");
(void) rxFact;
- return uno::Reference< uno::XInterface >(); // *new ::avmedia::vlc::Manager( rxFact ) );
+ return uno::Reference< uno::XInterface >(*new ::avmedia::vlc::Manager( rxFact ) );
}
extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL avmediavlc_component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /*pRegistryKey*/ )