[Libreoffice-commits] core.git: Branch 'feature/vlc' - 2 commits - avmedia/Library_avmediavlc.mk avmedia/source

Minh Ngo nlminhtl at gmail.com
Mon Aug 5 13:58:29 PDT 2013


 avmedia/Library_avmediavlc.mk           |   37 ++++++++++++++++----------------
 avmedia/source/vlc/vlcplayer.cxx        |   17 ++------------
 avmedia/source/vlc/vlcplayer.hxx        |    3 +-
 avmedia/source/vlc/wrapper/Instance.cxx |   12 +++++-----
 avmedia/source/vlc/wrapper/Instance.hxx |    2 -
 5 files changed, 31 insertions(+), 40 deletions(-)

New commits:
commit 0d54e613436c6d1fbff3c6c20f07bba7eeaab09c
Author: Minh Ngo <nlminhtl at gmail.com>
Date:   Mon Aug 5 23:57:42 2013 +0300

    API interface for libvlc_media_t
    
    Change-Id: I5e1875dabc7bdf3717540343648a9212506faf1a

diff --git a/avmedia/Library_avmediavlc.mk b/avmedia/Library_avmediavlc.mk
index 1c317e3..a04237b 100644
--- a/avmedia/Library_avmediavlc.mk
+++ b/avmedia/Library_avmediavlc.mk
@@ -12,9 +12,9 @@ $(eval $(call gb_Library_Library,avmediavlc))
 $(eval $(call gb_Library_set_componentfile,avmediavlc,avmedia/source/vlc/avmediavlc))
 
 $(eval $(call gb_Library_set_include,avmediavlc,\
-	$$(INCLUDE) \
-	-I$(SRCDIR)/avmedia/source/inc \
-	$(VLC_CFLAGS) \
+    $$(INCLUDE) \
+    -I$(SRCDIR)/avmedia/source/inc \
+    $(VLC_CFLAGS) \
 ))
 $(eval $(call gb_Library_add_libs,avmediavlc,$(VLC_LIBS)))
 
@@ -24,28 +24,29 @@ $(eval $(call gb_Library_use_sdk_api,avmediavlc))
 
 ifeq ($(OS),WNT)
 $(eval $(call gb_Library_add_defs,avmediavlc,\
-	-DWINNT
+    -DWINNT
 ))
 endif
 
 $(eval $(call gb_Library_use_libraries,avmediavlc,\
-	comphelper \
-	cppu \
-	cppuhelper \
-	sal \
-	tl \
-	vcl \
-	utl \
-	$(gb_UWINAPI) \
+    comphelper \
+    cppu \
+    cppuhelper \
+    sal \
+    tl \
+    vcl \
+    utl \
+    $(gb_UWINAPI) \
 ))
 
 $(eval $(call gb_Library_add_exception_objects,avmediavlc,\
-	avmedia/source/vlc/vlcmanager \
-	avmedia/source/vlc/vlcplayer \
-	avmedia/source/vlc/vlcuno \
-	avmedia/source/vlc/vlcwindow \
-	avmedia/source/vlc/vlcframegrabber \
-	avmedia/source/vlc/wrapper/Instance \
+    avmedia/source/vlc/vlcmanager \
+    avmedia/source/vlc/vlcplayer \
+    avmedia/source/vlc/vlcuno \
+    avmedia/source/vlc/vlcwindow \
+    avmedia/source/vlc/vlcframegrabber \
+    avmedia/source/vlc/wrapper/Instance \
+    avmedia/source/vlc/wrapper/Media \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/avmedia/source/vlc/vlcplayer.cxx b/avmedia/source/vlc/vlcplayer.cxx
index bcfc04f..f3e3f69 100644
--- a/avmedia/source/vlc/vlcplayer.cxx
+++ b/avmedia/source/vlc/vlcplayer.cxx
@@ -23,22 +23,11 @@ const char * const VLC_ARGS[] = {
 
 const int MS_IN_SEC = 1000; // Millisec in sec
 
-namespace
-{
-    libvlc_media_t* InitMedia( const rtl::OUString& url, VLC::Instance& instance )
-    {
-        rtl::OString dest;
-        url.convertToString(&dest, RTL_TEXTENCODING_UTF8, 0);
-
-        return libvlc_media_new_path(instance, dest.getStr());
-    }
-}
-
 VLCPlayer::VLCPlayer( const rtl::OUString& url )
     : VLC_Base(m_aMutex)
     , mInstance( VLC_ARGS )
-    , mMedia( InitMedia( url, mInstance ), libvlc_media_release )
-    , mPlayer( libvlc_media_player_new_from_media( mMedia.get() ), libvlc_media_player_release )
+    , mMedia( url, mInstance )
+    , mPlayer( libvlc_media_player_new_from_media( mMedia ), libvlc_media_player_release )
     , mUrl( url )
     , mPlaybackLoop( false )
 {
diff --git a/avmedia/source/vlc/vlcplayer.hxx b/avmedia/source/vlc/vlcplayer.hxx
index b7c4bed..e8d3fd0 100644
--- a/avmedia/source/vlc/vlcplayer.hxx
+++ b/avmedia/source/vlc/vlcplayer.hxx
@@ -28,6 +28,7 @@
 #include <cppuhelper/basemutex.hxx>
 
 #include "wrapper/Instance.hxx"
+#include "wrapper/Media.hxx"
 
 namespace avmedia {
 namespace vlc {
@@ -39,7 +40,7 @@ class VLCPlayer : public ::cppu::BaseMutex,
                   public VLC_Base
 {
     VLC::Instance mInstance;
-    boost::shared_ptr<libvlc_media_t> mMedia;
+    VLC::Media mMedia;
     boost::shared_ptr<libvlc_media_player_t> mPlayer;
     const rtl::OUString mUrl;
     bool mPlaybackLoop;
diff --git a/avmedia/source/vlc/wrapper/Instance.cxx b/avmedia/source/vlc/wrapper/Instance.cxx
index a150fef..301d97b 100644
--- a/avmedia/source/vlc/wrapper/Instance.cxx
+++ b/avmedia/source/vlc/wrapper/Instance.cxx
@@ -1,5 +1,4 @@
-#include <rtl/ustring.hxx>
-
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 #include "Instance.hxx"
 #include "SymbolLoader.hxx"
 
@@ -7,8 +6,8 @@ namespace VLC
 {
     namespace
     {
-        libvlc_instance_t *(*libvlc_new) (int argc, const char * const *argv);
-        void (*libvlc_release) (libvlc_instance_t *p_instance);
+        libvlc_instance_t* ( *libvlc_new ) ( int argc, const char * const *argv );
+        void ( *libvlc_release ) ( libvlc_instance_t *p_instance );
 
         ApiMap VLC_INSTANCE_API[] =
         {
@@ -30,3 +29,4 @@ namespace VLC
     }
 
 }
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 2efd0884df2a7160a2fec356874bc6089cedf3ed
Author: Minh Ngo <nlminhtl at gmail.com>
Date:   Mon Aug 5 23:27:40 2013 +0300

    Upd the instance API
    
    Change-Id: Iba79d423336f9914ded8a121ba8f99f52c16466f

diff --git a/avmedia/source/vlc/vlcplayer.cxx b/avmedia/source/vlc/vlcplayer.cxx
index 20ed327..bcfc04f 100644
--- a/avmedia/source/vlc/vlcplayer.cxx
+++ b/avmedia/source/vlc/vlcplayer.cxx
@@ -36,7 +36,7 @@ namespace
 
 VLCPlayer::VLCPlayer( const rtl::OUString& url )
     : VLC_Base(m_aMutex)
-    , mInstance( sizeof( VLC_ARGS ) / sizeof( VLC_ARGS[0] ), VLC_ARGS )
+    , mInstance( VLC_ARGS )
     , mMedia( InitMedia( url, mInstance ), libvlc_media_release )
     , mPlayer( libvlc_media_player_new_from_media( mMedia.get() ), libvlc_media_player_release )
     , mUrl( url )
diff --git a/avmedia/source/vlc/wrapper/Instance.cxx b/avmedia/source/vlc/wrapper/Instance.cxx
index bc231672..a150fef 100644
--- a/avmedia/source/vlc/wrapper/Instance.cxx
+++ b/avmedia/source/vlc/wrapper/Instance.cxx
@@ -17,11 +17,11 @@ namespace VLC
         };
     }
 
-    Instance::Instance( int argc, const char * const *argv )
+    Instance::Instance( const char * const argv[] )
     {
         InitApiMap( VLC_INSTANCE_API );
 
-        mInstance = libvlc_new( argc, argv );
+        mInstance = libvlc_new( sizeof( argv ) / sizeof( argv[0] ), argv );
     }
 
     Instance::~Instance()
diff --git a/avmedia/source/vlc/wrapper/Instance.hxx b/avmedia/source/vlc/wrapper/Instance.hxx
index 0cad705..8358a94 100644
--- a/avmedia/source/vlc/wrapper/Instance.hxx
+++ b/avmedia/source/vlc/wrapper/Instance.hxx
@@ -26,7 +26,7 @@ namespace VLC
     class Instance
     {
     public:
-        Instance( int argc, const char * const *argv );
+        Instance( const char * const argv[] );
         virtual ~Instance();
 
         inline operator libvlc_instance_t*()


More information about the Libreoffice-commits mailing list