summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorMinh Ngo <nlminhtl@gmail.com>2013-08-19 23:42:00 +0300
committerMichael Meeks <michael.meeks@suse.com>2013-08-21 10:54:54 +0100
commitd71f56e413caf6616688d76a020b4ef4804c7714 (patch)
treeb642d7f2f6a10a60c14df30e0a2314a07dec9e3d /avmedia
parent46575e931479a4e967f2ad6a056b5f4d5490146c (diff)
Fixing copy constructors/operators= for VLC wrapper instances.
Change-Id: I9860b738bbb3a8a85e07555b97203bb63b80b9de
Diffstat (limited to 'avmedia')
-rw-r--r--avmedia/source/vlc/vlcframegrabber.cxx2
-rw-r--r--avmedia/source/vlc/wrapper/Instance.cxx15
-rw-r--r--avmedia/source/vlc/wrapper/Instance.hxx2
-rw-r--r--avmedia/source/vlc/wrapper/Media.cxx20
-rw-r--r--avmedia/source/vlc/wrapper/Media.hxx3
-rw-r--r--avmedia/source/vlc/wrapper/Player.cxx17
-rw-r--r--avmedia/source/vlc/wrapper/Player.hxx4
7 files changed, 56 insertions, 7 deletions
diff --git a/avmedia/source/vlc/vlcframegrabber.cxx b/avmedia/source/vlc/vlcframegrabber.cxx
index adc59b71df3b..8e75eb335a5f 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 301d97b8d34b..4260836c77e5 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 8358a942c8e6..6111262e69d5 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 851a4f5af49a..6b7e77ed7ed9 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 b513943610bc..483e60b331ff 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 a64b7471bab1..d4a25258b7d0 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 ed52062fcba0..a2b17e84d30a 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();