Commit 46761435 authored by Rémi Duraffort's avatar Rémi Duraffort

libvlcpp: add a function to handle video.

parent 7beb3b35
...@@ -29,6 +29,7 @@ MediaPlayer::MediaPlayer( libVLC &libvlcInstance ) ...@@ -29,6 +29,7 @@ MediaPlayer::MediaPlayer( libVLC &libvlcInstance )
{ {
m_player = libvlc_media_player_new( libvlcInstance.m_instance ); m_player = libvlc_media_player_new( libvlcInstance.m_instance );
m_audio.setMediaPlayer( m_player ); m_audio.setMediaPlayer( m_player );
m_video.setMediaPlayer( m_player );
} }
MediaPlayer::MediaPlayer( Media &media ) MediaPlayer::MediaPlayer( Media &media )
...@@ -246,3 +247,8 @@ Audio &MediaPlayer::audio() ...@@ -246,3 +247,8 @@ Audio &MediaPlayer::audio()
{ {
return m_audio; return m_audio;
} }
Video &MediaPlayer::video()
{
return m_video;
}
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "libvlc.hpp" #include "libvlc.hpp"
#include "media.hpp" #include "media.hpp"
#include "audio.hpp" #include "audio.hpp"
#include "video.hpp"
namespace libvlc namespace libvlc
{ {
...@@ -311,12 +312,21 @@ public: ...@@ -311,12 +312,21 @@ public:
*/ */
Audio &audio(); Audio &audio();
/**
* Get the class that handle the Video
* @return the instance of the Video associated with this MediaPlayer
*/
Video &video();
private: private:
/** The media player instance of libvlc */ /** The media player instance of libvlc */
libvlc_media_player_t *m_player; libvlc_media_player_t *m_player;
/** The Audio part of the media player */ /** The Audio part of the media player */
Audio m_audio; Audio m_audio;
/** The Video part of the media player */
Video m_video;
}; };
}; };
......
...@@ -28,10 +28,8 @@ ...@@ -28,10 +28,8 @@
using namespace libvlc; using namespace libvlc;
Video::Video( libvlc_media_player_t *player ) Video::Video()
{ {
m_player = player;
libvlc_media_player_retain( m_player );
} }
Video::~Video() Video::~Video()
...@@ -111,3 +109,9 @@ void Video::deinterlace( int enable, const char *mode ) ...@@ -111,3 +109,9 @@ void Video::deinterlace( int enable, const char *mode )
else else
libvlc_video_set_deinterlace( m_player, NULL ); libvlc_video_set_deinterlace( m_player, NULL );
} }
void Video::setMediaPlayer( libvlc_media_player_t *player )
{
libvlc_media_player_retain( player );
m_player = player;
}
...@@ -36,15 +36,6 @@ namespace libvlc ...@@ -36,15 +36,6 @@ namespace libvlc
class Video class Video
{ {
public: public:
/**
* Constructor
* @param player: the player handling the video
*/
Video( libvlc_media_player_t *player );
/** Destructor */
~Video();
/** /**
* Get the height of the video * Get the height of the video
* @return the height of the video * @return the height of the video
...@@ -163,6 +154,24 @@ public: ...@@ -163,6 +154,24 @@ public:
private: private:
/** The media player instance of libvlc */ /** The media player instance of libvlc */
libvlc_media_player_t *m_player; libvlc_media_player_t *m_player;
/**
* The constructor is private so only the MediaPlayer can create an
* instance of this class
*/
Video();
/** Destructor only used by the MediaPlayer associated with this class */
~Video();
/**
* Set the media player. This function can only be used by the MediaPlayer class
* @param player: the media player
*/
void setMediaPlayer( libvlc_media_player_t *player);
/** Friend class */
friend class MediaPlayer;
}; };
}; };
......
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