[vlc-devel] commit: libvlcpp: add a function to handle video. ( Rémi Duraffort )

git version control git at videolan.org
Tue Feb 2 23:17:05 CET 2010


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Tue Feb  2 21:28:09 2010 +0100| [46761435a82b978809e0e18e45df9b6ab9bf7d18] | committer: Rémi Duraffort 

libvlcpp: add a function to handle video.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=46761435a82b978809e0e18e45df9b6ab9bf7d18
---

 bindings/libvlcpp/src/media_player.cpp |    6 ++++++
 bindings/libvlcpp/src/media_player.hpp |   10 ++++++++++
 bindings/libvlcpp/src/video.cpp        |   10 +++++++---
 bindings/libvlcpp/src/video.hpp        |   27 ++++++++++++++++++---------
 4 files changed, 41 insertions(+), 12 deletions(-)

diff --git a/bindings/libvlcpp/src/media_player.cpp b/bindings/libvlcpp/src/media_player.cpp
index e635563..420c4ac 100644
--- a/bindings/libvlcpp/src/media_player.cpp
+++ b/bindings/libvlcpp/src/media_player.cpp
@@ -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;
+}
diff --git a/bindings/libvlcpp/src/media_player.hpp b/bindings/libvlcpp/src/media_player.hpp
index 1704bb6..a4c9bd4 100644
--- a/bindings/libvlcpp/src/media_player.hpp
+++ b/bindings/libvlcpp/src/media_player.hpp
@@ -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;
 };
 
 };
diff --git a/bindings/libvlcpp/src/video.cpp b/bindings/libvlcpp/src/video.cpp
index 58cc3cf..83fed52 100644
--- a/bindings/libvlcpp/src/video.cpp
+++ b/bindings/libvlcpp/src/video.cpp
@@ -28,10 +28,8 @@
 
 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;
+}
diff --git a/bindings/libvlcpp/src/video.hpp b/bindings/libvlcpp/src/video.hpp
index fb73103..72f4032 100644
--- a/bindings/libvlcpp/src/video.hpp
+++ b/bindings/libvlcpp/src/video.hpp
@@ -37,15 +37,6 @@ 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;
 };
 
 };




More information about the vlc-devel mailing list