[Libreoffice-commits] core.git: Branch 'feature/vlc' - avmedia/source
Minh Ngo
nlminhtl at gmail.com
Mon Aug 19 13:42:58 PDT 2013
avmedia/source/vlc/vlcframegrabber.cxx | 2 --
avmedia/source/vlc/wrapper/Instance.cxx | 15 ++++++++++++++-
avmedia/source/vlc/wrapper/Instance.hxx | 2 ++
avmedia/source/vlc/wrapper/Media.cxx | 20 ++++++++++++++++++--
avmedia/source/vlc/wrapper/Media.hxx | 3 +++
avmedia/source/vlc/wrapper/Player.cxx | 17 ++++++++++++++++-
avmedia/source/vlc/wrapper/Player.hxx | 4 +++-
7 files changed, 56 insertions(+), 7 deletions(-)
New commits:
commit 503d7365de51ca1c12beed967795230b34e4c7c5
Author: Minh Ngo <nlminhtl at gmail.com>
Date: Mon Aug 19 23:42:00 2013 +0300
Fixing copy constructors/operators= for VLC wrapper instances.
Change-Id: I9860b738bbb3a8a85e07555b97203bb63b80b9de
diff --git a/avmedia/source/vlc/vlcframegrabber.cxx b/avmedia/source/vlc/vlcframegrabber.cxx
index adc59b7..8e75eb3 100644
--- a/avmedia/source/vlc/vlcframegrabber.cxx
+++ b/avmedia/source/vlc/vlcframegrabber.cxx
@@ -62,8 +62,6 @@ SAL_CALL VLCFrameGrabber::VLCFrameGrabber( VLC::Player& player, boost::shared_pt
return ::uno::Reference< css::graphic::XGraphic >();
}
-
-
mPlayer.takeSnapshot( fileName );
mPlayer.setMute( false );
diff --git a/avmedia/source/vlc/wrapper/Instance.cxx b/avmedia/source/vlc/wrapper/Instance.cxx
index 301d97b..4260836 100644
--- a/avmedia/source/vlc/wrapper/Instance.cxx
+++ b/avmedia/source/vlc/wrapper/Instance.cxx
@@ -8,11 +8,13 @@ namespace VLC
{
libvlc_instance_t* ( *libvlc_new ) ( int argc, const char * const *argv );
void ( *libvlc_release ) ( libvlc_instance_t *p_instance );
+ void ( *libvlc_retain ) ( libvlc_instance_t *p_instance );
ApiMap VLC_INSTANCE_API[] =
{
SYM_MAP( libvlc_new ),
- SYM_MAP( libvlc_release )
+ SYM_MAP( libvlc_release ),
+ SYM_MAP( libvlc_retain )
};
}
@@ -23,6 +25,17 @@ namespace VLC
mInstance = libvlc_new( sizeof( argv ) / sizeof( argv[0] ), argv );
}
+ Instance::Instance( const Instance& other )
+ {
+ }
+
+ const Instance& Instance::operator=( const Instance& other )
+ {
+ libvlc_release( mInstance );
+ mInstance = other.mInstance;
+ libvlc_retain( mInstance );
+ }
+
Instance::~Instance()
{
libvlc_release( mInstance );
diff --git a/avmedia/source/vlc/wrapper/Instance.hxx b/avmedia/source/vlc/wrapper/Instance.hxx
index 8358a94..6111262 100644
--- a/avmedia/source/vlc/wrapper/Instance.hxx
+++ b/avmedia/source/vlc/wrapper/Instance.hxx
@@ -27,6 +27,8 @@ namespace VLC
{
public:
Instance( const char * const argv[] );
+ Instance( const Instance& other );
+ const Instance& operator=( const Instance& other );
virtual ~Instance();
inline operator libvlc_instance_t*()
diff --git a/avmedia/source/vlc/wrapper/Media.cxx b/avmedia/source/vlc/wrapper/Media.cxx
index 851a4f5..6b7e77e 100644
--- a/avmedia/source/vlc/wrapper/Media.cxx
+++ b/avmedia/source/vlc/wrapper/Media.cxx
@@ -9,12 +9,14 @@ namespace VLC
namespace
{
libvlc_media_t* ( *libvlc_media_new_path ) ( libvlc_instance_t *p_instance, const char *path );
- void ( *libvlc_media_release )( libvlc_media_t *p_md );
+ void ( *libvlc_media_release ) ( libvlc_media_t *p_md );
+ void ( *libvlc_media_retain ) ( libvlc_media_t *p_md );
ApiMap VLC_MEDIA_API[] =
{
SYM_MAP( libvlc_media_new_path ),
- SYM_MAP( libvlc_media_release )
+ SYM_MAP( libvlc_media_release ),
+ SYM_MAP( libvlc_media_retain )
};
libvlc_media_t* InitMedia( const rtl::OUString& url, VLC::Instance& instance )
@@ -34,6 +36,20 @@ Media::Media( const rtl::OUString& url, Instance& instance )
mMedia = InitMedia( url, instance );
}
+Media::Media( const Media& other )
+ : mMedia( other.mMedia )
+{
+ libvlc_media_retain( mMedia );
+}
+
+const Media& Media::operator=( const Media& other )
+{
+ libvlc_media_release( mMedia );
+ mMedia = other.mMedia;
+
+ libvlc_media_retain( mMedia );
+}
+
Media::~Media()
{
libvlc_media_release( mMedia );
diff --git a/avmedia/source/vlc/wrapper/Media.hxx b/avmedia/source/vlc/wrapper/Media.hxx
index b513943..483e60b 100644
--- a/avmedia/source/vlc/wrapper/Media.hxx
+++ b/avmedia/source/vlc/wrapper/Media.hxx
@@ -33,6 +33,9 @@ namespace VLC
{
public:
Media( const rtl::OUString& url, Instance& instance );
+ Media( const Media& other );
+ const Media& operator=( const Media& other );
+
virtual ~Media();
inline operator libvlc_media_t*()
diff --git a/avmedia/source/vlc/wrapper/Player.cxx b/avmedia/source/vlc/wrapper/Player.cxx
index a64b747..d4a2525 100644
--- a/avmedia/source/vlc/wrapper/Player.cxx
+++ b/avmedia/source/vlc/wrapper/Player.cxx
@@ -11,6 +11,7 @@ namespace VLC
{
typedef int64_t libvlc_time_t;
+ void ( *libvlc_media_player_retain ) ( libvlc_media_player_t *p_mi );
libvlc_media_player_t * ( *libvlc_media_player_new_from_media ) ( libvlc_media_t *p_md );
void ( *libvlc_media_player_release ) ( libvlc_media_player_t *p_mi );
int ( *libvlc_media_player_play ) ( libvlc_media_player_t *p_mi );
@@ -51,7 +52,8 @@ namespace VLC
SYM_MAP( libvlc_video_take_snapshot ),
SYM_MAP( libvlc_media_player_set_xwindow ),
SYM_MAP( libvlc_media_player_has_vout ),
- SYM_MAP( libvlc_video_set_mouse_input )
+ SYM_MAP( libvlc_video_set_mouse_input ),
+ SYM_MAP( libvlc_media_player_retain )
};
}
@@ -61,6 +63,19 @@ namespace VLC
mPlayer = libvlc_media_player_new_from_media( media );
}
+ Player::Player( const Player& other )
+ : mPlayer( other.mPlayer )
+ {
+ libvlc_media_player_retain( mPlayer );
+ }
+
+ const Player& Player::operator=( const Player& other )
+ {
+ libvlc_media_player_release( mPlayer );
+ mPlayer = other.mPlayer;
+ libvlc_media_player_retain( mPlayer );
+ }
+
Player::~Player()
{
libvlc_media_player_release( mPlayer );
diff --git a/avmedia/source/vlc/wrapper/Player.hxx b/avmedia/source/vlc/wrapper/Player.hxx
index ed52062..a2b17e8 100644
--- a/avmedia/source/vlc/wrapper/Player.hxx
+++ b/avmedia/source/vlc/wrapper/Player.hxx
@@ -32,7 +32,9 @@ namespace VLC
class Player
{
public:
- Player(Media& media);
+ Player( Media& media );
+ Player( const Player& other );
+ const Player& operator=( const Player& other );
virtual ~Player();
bool play();
More information about the Libreoffice-commits
mailing list