[Libreoffice-commits] core.git: 4 commits - avmedia/source

Minh Ngo nlminhtl at gmail.com
Wed Aug 21 22:07:21 PDT 2013


 avmedia/source/vlc/vlcplayer.cxx            |   29 +++++++++++++++-------------
 avmedia/source/vlc/vlcplayer.hxx            |    2 -
 avmedia/source/vlc/wrapper/EventManager.cxx |    1 
 avmedia/source/vlc/wrapper/Instance.cxx     |    8 +++++--
 avmedia/source/vlc/wrapper/Instance.hxx     |    4 ++-
 avmedia/source/vlc/wrapper/Media.cxx        |    1 
 avmedia/source/vlc/wrapper/Player.cxx       |    1 
 avmedia/source/vlc/wrapper/SymbolLoader.hxx |   12 +++++++++--
 8 files changed, 38 insertions(+), 20 deletions(-)

New commits:
commit ba282259a9309f21f4019073299d7eb6e7f61d98
Author: Minh Ngo <nlminhtl at gmail.com>
Date:   Thu Aug 22 08:02:31 2013 +0300

    Fixing warnings and crash with the VLC::Instance.
    
    Change-Id: I0282b79e296d6fccafbf7d89f38ed2f50672ef08

diff --git a/avmedia/source/vlc/vlcplayer.cxx b/avmedia/source/vlc/vlcplayer.cxx
index a0887c2..08603c2 100644
--- a/avmedia/source/vlc/vlcplayer.cxx
+++ b/avmedia/source/vlc/vlcplayer.cxx
@@ -12,26 +12,29 @@ using namespace ::com::sun::star;
 namespace avmedia {
 namespace vlc {
 
-const ::rtl::OUString AVMEDIA_VLC_PLAYER_IMPLEMENTATIONNAME = "com.sun.star.comp.avmedia.Player_VLC";
-const ::rtl::OUString AVMEDIA_VLC_PLAYER_SERVICENAME = "com.sun.star.media.Player_VLC";
+namespace
+{
+    const ::rtl::OUString AVMEDIA_VLC_PLAYER_IMPLEMENTATIONNAME = "com.sun.star.comp.avmedia.Player_VLC";
+    const ::rtl::OUString AVMEDIA_VLC_PLAYER_SERVICENAME = "com.sun.star.media.Player_VLC";
 
-const char * const VLC_ARGS[] = {
-    "-Vdummy",
-    "--snapshot-format=png",
-    "--ffmpeg-threads",
-    "--verbose=2"
-};
+    const int MS_IN_SEC = 1000; // Millisec in sec
 
-const int MS_IN_SEC = 1000; // Millisec in sec
+    const char * const VLC_ARGS[] = {
+        "-Vdummy",
+        "--snapshot-format=png",
+        "--ffmpeg-threads",
+        "--verbose=2"
+    };
+}
 
-VLCPlayer::VLCPlayer( const rtl::OUString& url, boost::shared_ptr<VLC::EventHandler> eh )
+VLCPlayer::VLCPlayer( const rtl::OUString& iurl, boost::shared_ptr<VLC::EventHandler> eh )
     : VLC_Base(m_aMutex)
     , mEventHandler( eh )
-    , mInstance( VLC_ARGS )
-    , mMedia( url, mInstance )
+    , mInstance( sizeof( VLC_ARGS ) / sizeof( VLC_ARGS[0] ), VLC_ARGS )
+    , mMedia( iurl, mInstance )
     , mPlayer( mMedia )
     , mEventManager( mPlayer, mEventHandler )
-    , mUrl( url )
+    , mUrl( iurl )
     , mPlaybackLoop( false )
 {
     mPlayer.setMouseHandling(false);
diff --git a/avmedia/source/vlc/vlcplayer.hxx b/avmedia/source/vlc/vlcplayer.hxx
index 18e4e6f..831e4fe 100644
--- a/avmedia/source/vlc/vlcplayer.hxx
+++ b/avmedia/source/vlc/vlcplayer.hxx
@@ -49,7 +49,7 @@ class VLCPlayer : public ::cppu::BaseMutex,
     const rtl::OUString mUrl;
     bool mPlaybackLoop;
 public:
-    VLCPlayer( const rtl::OUString& url, boost::shared_ptr<VLC::EventHandler> eh );
+    VLCPlayer( const rtl::OUString& iurl, boost::shared_ptr<VLC::EventHandler> eh );
 
     const rtl::OUString& url() const;
 
diff --git a/avmedia/source/vlc/wrapper/Instance.cxx b/avmedia/source/vlc/wrapper/Instance.cxx
index ea6659a..39c2ce3 100644
--- a/avmedia/source/vlc/wrapper/Instance.cxx
+++ b/avmedia/source/vlc/wrapper/Instance.cxx
@@ -26,15 +26,18 @@ namespace VLC
         };
     }
 
-    Instance::Instance( const char * const argv[] )
+    Instance::Instance( int argc, const char * const argv[] )
     {
         InitApiMap( VLC_INSTANCE_API );
 
-        mInstance = libvlc_new( sizeof( argv ) / sizeof( argv[0] ), argv );
+        mInstance = libvlc_new( argc, argv );
     }
 
     Instance::Instance( const Instance& other )
     {
+        libvlc_release( mInstance );
+        mInstance = other.mInstance;
+        libvlc_retain( mInstance );
     }
 
     const Instance& Instance::operator=( const Instance& other )
@@ -42,6 +45,7 @@ namespace VLC
         libvlc_release( mInstance );
         mInstance = other.mInstance;
         libvlc_retain( mInstance );
+        return *this;
     }
 
     Instance::~Instance()
diff --git a/avmedia/source/vlc/wrapper/Instance.hxx b/avmedia/source/vlc/wrapper/Instance.hxx
index 15ac0ef..887baf1 100644
--- a/avmedia/source/vlc/wrapper/Instance.hxx
+++ b/avmedia/source/vlc/wrapper/Instance.hxx
@@ -14,10 +14,12 @@ struct libvlc_instance_t;
 
 namespace VLC
 {
+
+
     class Instance
     {
     public:
-        Instance( const char * const argv[] );
+        Instance( int argc, const char * const argv[] );
         Instance( const Instance& other );
         const Instance& operator=( const Instance& other );
         virtual ~Instance();
commit 77d732769abec345b9cf8dae415358fd866311e8
Author: Minh Ngo <nlminhtl at gmail.com>
Date:   Thu Aug 22 08:00:32 2013 +0300

    Returning an object reference in operators =.
    
    Change-Id: Ia10646789962b046bbb95ecaf74b9d248bb7e4e6

diff --git a/avmedia/source/vlc/wrapper/Media.cxx b/avmedia/source/vlc/wrapper/Media.cxx
index dd6c89d..825bb06 100644
--- a/avmedia/source/vlc/wrapper/Media.cxx
+++ b/avmedia/source/vlc/wrapper/Media.cxx
@@ -57,6 +57,7 @@ const Media& Media::operator=( const Media& other )
     mMedia = other.mMedia;
 
     libvlc_media_retain( mMedia );
+    return *this;
 }
 
 Media::~Media()
diff --git a/avmedia/source/vlc/wrapper/Player.cxx b/avmedia/source/vlc/wrapper/Player.cxx
index 804d41f..9c739bd 100644
--- a/avmedia/source/vlc/wrapper/Player.cxx
+++ b/avmedia/source/vlc/wrapper/Player.cxx
@@ -83,6 +83,7 @@ namespace VLC
         libvlc_media_player_release( mPlayer );
         mPlayer = other.mPlayer;
         libvlc_media_player_retain( mPlayer );
+        return *this;
     }
 
     Player::~Player()
commit ae22b3ea1e951e61679edbf56a280895b979279f
Author: Minh Ngo <nlminhtl at gmail.com>
Date:   Thu Aug 22 07:58:58 2013 +0300

    Removing a waste header
    
    Change-Id: I7609abadaa2d483617a3e80a1b08b06e63b0a69d

diff --git a/avmedia/source/vlc/wrapper/EventManager.cxx b/avmedia/source/vlc/wrapper/EventManager.cxx
index 22881b8..b8a194b 100644
--- a/avmedia/source/vlc/wrapper/EventManager.cxx
+++ b/avmedia/source/vlc/wrapper/EventManager.cxx
@@ -7,7 +7,6 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include <boost/thread.hpp>
 #include <vlc/libvlc.h>
 #include <vlc/libvlc_media.h>
 #include <vlc/libvlc_events.h>
commit aabbb535a7115d226413b6ba1bdf67c560886af3
Author: Minh Ngo <nlminhtl at gmail.com>
Date:   Thu Aug 22 07:57:20 2013 +0300

    Fixing symbol loader. Returns true if successful. false otherwise.
    
    Change-Id: I58a5dd39c005841a5680440a52905596ae8679b2

diff --git a/avmedia/source/vlc/wrapper/SymbolLoader.hxx b/avmedia/source/vlc/wrapper/SymbolLoader.hxx
index c7e66cf..8730e05 100644
--- a/avmedia/source/vlc/wrapper/SymbolLoader.hxx
+++ b/avmedia/source/vlc/wrapper/SymbolLoader.hxx
@@ -28,7 +28,6 @@ namespace
 {
     const char *libNames[] = {
         "libvlc.so.5",
-        "libvlccore.so.5",
         "libvlc.dll",
         "libvlc.dylib"
     };
@@ -41,7 +40,11 @@ namespace
             SymbolFunc aMethod = ( SymbolFunc )osl_getFunctionSymbol
                 ( aModule, OUString::createFromAscii( pMap[ i ].symName ).pData );
             if ( !aMethod )
+            {
+                std::cerr << "Cannot load method " << pMap[ i ].symName << std::endl;
+                *pMap[ i ].refValue = NULL;
                 return false;
+            }
 
             *pMap[ i ].refValue = aMethod;
         }
@@ -64,11 +67,16 @@ bool InitApiMap( const ApiMap ( &pMap )[N]  )
         if( aModule == NULL)
             continue;
 
-        tryLink( aModule, pMap );
+        if (tryLink( aModule, pMap ))
+        {
+            osl_unloadModule( aModule );
+            return true;
+        }
 
         osl_unloadModule( aModule );
     }
 
+    std::cerr << "Cannot load libvlc" << std::endl;
     return false;
 }
 


More information about the Libreoffice-commits mailing list