Kaydet (Commit) ba282259 authored tarafından Minh Ngo's avatar Minh Ngo

Fixing warnings and crash with the VLC::Instance.

Change-Id: I0282b79e296d6fccafbf7d89f38ed2f50672ef08
üst 77d73276
...@@ -12,26 +12,29 @@ using namespace ::com::sun::star; ...@@ -12,26 +12,29 @@ using namespace ::com::sun::star;
namespace avmedia { namespace avmedia {
namespace vlc { namespace vlc {
const ::rtl::OUString AVMEDIA_VLC_PLAYER_IMPLEMENTATIONNAME = "com.sun.star.comp.avmedia.Player_VLC"; namespace
const ::rtl::OUString AVMEDIA_VLC_PLAYER_SERVICENAME = "com.sun.star.media.Player_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";
const char * const VLC_ARGS[] = { const int MS_IN_SEC = 1000; // Millisec in sec
"-Vdummy",
"--snapshot-format=png",
"--ffmpeg-threads",
"--verbose=2"
};
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) : VLC_Base(m_aMutex)
, mEventHandler( eh ) , mEventHandler( eh )
, mInstance( VLC_ARGS ) , mInstance( sizeof( VLC_ARGS ) / sizeof( VLC_ARGS[0] ), VLC_ARGS )
, mMedia( url, mInstance ) , mMedia( iurl, mInstance )
, mPlayer( mMedia ) , mPlayer( mMedia )
, mEventManager( mPlayer, mEventHandler ) , mEventManager( mPlayer, mEventHandler )
, mUrl( url ) , mUrl( iurl )
, mPlaybackLoop( false ) , mPlaybackLoop( false )
{ {
mPlayer.setMouseHandling(false); mPlayer.setMouseHandling(false);
......
...@@ -49,7 +49,7 @@ class VLCPlayer : public ::cppu::BaseMutex, ...@@ -49,7 +49,7 @@ class VLCPlayer : public ::cppu::BaseMutex,
const rtl::OUString mUrl; const rtl::OUString mUrl;
bool mPlaybackLoop; bool mPlaybackLoop;
public: 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; const rtl::OUString& url() const;
......
...@@ -26,15 +26,18 @@ namespace VLC ...@@ -26,15 +26,18 @@ namespace VLC
}; };
} }
Instance::Instance( const char * const argv[] ) Instance::Instance( int argc, const char * const argv[] )
{ {
InitApiMap( VLC_INSTANCE_API ); InitApiMap( VLC_INSTANCE_API );
mInstance = libvlc_new( sizeof( argv ) / sizeof( argv[0] ), argv ); mInstance = libvlc_new( argc, argv );
} }
Instance::Instance( const Instance& other ) Instance::Instance( const Instance& other )
{ {
libvlc_release( mInstance );
mInstance = other.mInstance;
libvlc_retain( mInstance );
} }
const Instance& Instance::operator=( const Instance& other ) const Instance& Instance::operator=( const Instance& other )
...@@ -42,6 +45,7 @@ namespace VLC ...@@ -42,6 +45,7 @@ namespace VLC
libvlc_release( mInstance ); libvlc_release( mInstance );
mInstance = other.mInstance; mInstance = other.mInstance;
libvlc_retain( mInstance ); libvlc_retain( mInstance );
return *this;
} }
Instance::~Instance() Instance::~Instance()
......
...@@ -14,10 +14,12 @@ struct libvlc_instance_t; ...@@ -14,10 +14,12 @@ struct libvlc_instance_t;
namespace VLC namespace VLC
{ {
class Instance class Instance
{ {
public: public:
Instance( const char * const argv[] ); Instance( int argc, const char * const argv[] );
Instance( const Instance& other ); Instance( const Instance& other );
const Instance& operator=( const Instance& other ); const Instance& operator=( const Instance& other );
virtual ~Instance(); virtual ~Instance();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment