]> git.sesse.net Git - vlc/commitdiff
libvlcpp: add a function to handle video.
authorRémi Duraffort <ivoire@videolan.org>
Tue, 2 Feb 2010 20:28:09 +0000 (21:28 +0100)
committerRémi Duraffort <ivoire@videolan.org>
Tue, 2 Feb 2010 22:07:47 +0000 (23:07 +0100)
bindings/libvlcpp/src/media_player.cpp
bindings/libvlcpp/src/media_player.hpp
bindings/libvlcpp/src/video.cpp
bindings/libvlcpp/src/video.hpp

index e6355630c86fac6d0f7d69bae02943d8b945ebbf..420c4ace0c3303baf780201548dd06cf82e483e8 100644 (file)
@@ -29,6 +29,7 @@ MediaPlayer::MediaPlayer( libVLC &libvlcInstance )
 {
     m_player = libvlc_media_player_new( libvlcInstance.m_instance );
     m_audio.setMediaPlayer( m_player );
+    m_video.setMediaPlayer( m_player );
 }
 
 MediaPlayer::MediaPlayer( Media &media )
@@ -246,3 +247,8 @@ Audio &MediaPlayer::audio()
 {
     return m_audio;
 }
+
+Video &MediaPlayer::video()
+{
+    return m_video;
+}
index 1704bb63233553887bffc5146ca1e771bb489e1e..a4c9bd47d199fad869b3e5d5420af98a6e972fe6 100644 (file)
@@ -31,6 +31,7 @@
 #include "libvlc.hpp"
 #include "media.hpp"
 #include "audio.hpp"
+#include "video.hpp"
 
 namespace libvlc
 {
@@ -311,12 +312,21 @@ public:
      */
     Audio &audio();
 
+    /**
+     * Get the class that handle the Video
+     * @return the instance of the Video associated with this MediaPlayer
+     */
+    Video &video();
+
 private:
     /** The media player instance of libvlc */
     libvlc_media_player_t *m_player;
 
     /** The Audio part of the media player */
     Audio m_audio;
+
+    /** The Video part of the media player */
+    Video m_video;
 };
 
 };
index 58cc3cfd2f9bc1d07c81a7dbf2569972c35213b9..83fed5243b76acbdfebc066d323548baf55a2062 100644 (file)
 
 using namespace libvlc;
 
-Video::Video( libvlc_media_player_t *player )
+Video::Video()
 {
-    m_player = player;
-    libvlc_media_player_retain( m_player );
 }
 
 Video::~Video()
@@ -111,3 +109,9 @@ void Video::deinterlace( int enable, const char *mode )
     else
         libvlc_video_set_deinterlace( m_player, NULL );
 }
+
+void Video::setMediaPlayer( libvlc_media_player_t *player )
+{
+    libvlc_media_player_retain( player );
+    m_player = player;
+}
index fb7310313f83d095ee0de4937fdf4011cd00bfe4..72f403265d0db8ae0dd695c742533a6c89d4aafe 100644 (file)
@@ -36,15 +36,6 @@ namespace libvlc
 class Video
 {
 public:
-    /**
-     * Constructor
-     * @param player: the player handling the video
-     */
-    Video( libvlc_media_player_t *player );
-
-    /** Destructor */
-    ~Video();
-
     /**
      * Get the height of the video
      * @return the height of the video
@@ -163,6 +154,24 @@ public:
 private:
     /** The media player instance of libvlc */
     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;
 };
 
 };