]> git.sesse.net Git - vlc/commitdiff
libvlcpp: add some functions for Video.
authorRémi Duraffort <ivoire@videolan.org>
Tue, 26 Jan 2010 20:43:25 +0000 (21:43 +0100)
committerRémi Duraffort <ivoire@videolan.org>
Tue, 26 Jan 2010 21:50:37 +0000 (22:50 +0100)
bindings/libvlcpp/src/Makefile.am
bindings/libvlcpp/src/media_player.cpp
bindings/libvlcpp/src/media_player.hpp
bindings/libvlcpp/src/video.cpp [new file with mode: 0644]
bindings/libvlcpp/src/video.hpp [new file with mode: 0644]

index 2fe2f57d20ae58cd7d6f59c5d3a401759a0192a0..e6df5dfbe7cadc12b0afef6dc55f5704b2696c8a 100644 (file)
@@ -8,12 +8,14 @@ libvlcpp_la_SOURCES =   \
     media.cpp           \
     media.hpp           \
     media_player.cpp    \
-    media_player.hpp
+    media_player.hpp    \
+    video.cpp           \
+    video.hpp
 
 libvlcpp_la_CXXFLAGS = @libvlc_CFLAGS@
 libvlcpp_la_LDFLAGS = @libvlc_LIBS@ -version-info 1:0:0
 library_includedir=$(includedir)/libvlcpp
-library_include_HEADERS = exception.hpp libvlc.hpp media.hpp media_player.hpp
+library_include_HEADERS = exception.hpp libvlc.hpp media.hpp media_player.hpp video.hpp
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libvlcpp.pc
index 7eab608114501026c659e038fff660afd95f147e..6aa3719dd779a768cfb9e347f07d9ddee73a8ea8 100644 (file)
@@ -245,3 +245,27 @@ void MediaPlayer::nextFrame()
     Exception ex;
     libvlc_media_player_next_frame( m_player, &ex.ex );
 }
+
+void MediaPlayer::toggleFullscreen()
+{
+    Exception ex;
+    libvlc_toggle_fullscreen( m_player, &ex.ex );
+}
+
+void MediaPlayer::enableFullscreen()
+{
+    Exception ex;
+    libvlc_set_fullscreen( m_player, 1, &ex.ex );
+}
+
+void MediaPlayer::disableFullscreen()
+{
+    Exception ex;
+    libvlc_set_fullscreen( m_player, 0, &ex.ex );
+}
+
+int MediaPlayer::fullscreen()
+{
+    Exception ex;
+    return libvlc_get_fullscreen( m_player, &ex.ex );
+}
index 42be220f638c63a47dbdc0f64713545fae6fd8ac..7a893254ff0bb8e03f9825a3abd55d83ebd328dc 100644 (file)
@@ -158,7 +158,7 @@ public:
 
     /**
       * Set the movie time (in ms)
-      * @param the movie time (in ms)
+      * @param new_time the movie time (in ms)
       */
     void setTime( int64_t new_time );
 
@@ -170,7 +170,7 @@ public:
 
     /**
       * Set the movie position (in percent)
-      * @param the movie position
+      * @param position the movie position
       */
     void setPosition( float position );
 
@@ -282,7 +282,30 @@ public:
      */
     void nextFrame();
 
-protected:
+
+    /**
+     * Toggle fullscreen status on a non-embedded video output
+     */
+    void toggleFullscreen();
+
+    /**
+     * Enable fullscreen on a non-embedded video output
+     */
+    void enableFullscreen();
+
+    /**
+     * Disable fullscreen on a non-embedded video output
+     */
+    void disableFullscreen();
+
+    /**
+     * Get the fullscreen status
+     * @return true if the fullscreen is enable, false overwise
+     */
+    int fullscreen();
+
+private:
+    /** The media player instance of libvlc */
     libvlc_media_player_t *m_player;
 };
 
diff --git a/bindings/libvlcpp/src/video.cpp b/bindings/libvlcpp/src/video.cpp
new file mode 100644 (file)
index 0000000..eecadc8
--- /dev/null
@@ -0,0 +1,123 @@
+/*****************************************************************************
+ * video.cpp: video part of an media player
+ *****************************************************************************
+ * Copyright (C) 2010 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Rémi Duraffort <ivoire@videolan.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#include "video.hpp"
+#include "exception.hpp"
+
+
+using namespace libvlc;
+
+Video::Video( libvlc_media_player_t *player )
+{
+    m_player = player;
+    libvlc_media_player_retain( m_player );
+}
+
+Video::~Video()
+{
+    libvlc_media_player_release( m_player );
+}
+
+float Video::scale()
+{
+    Exception ex;
+    return libvlc_video_get_scale( m_player, &ex.ex );
+}
+
+char *Video::aspectRatio()
+{
+    Exception ex;
+    return libvlc_video_get_aspect_ratio( m_player, &ex.ex );
+}
+
+void Video::setAspectRatio( const char *aspect_ratio )
+{
+    Exception ex;
+    libvlc_video_set_aspect_ratio( m_player, aspect_ratio, &ex.ex );
+}
+
+int Video::spu()
+{
+    Exception ex;
+    return libvlc_video_get_spu( m_player, &ex.ex );
+}
+
+int Video::spuCount()
+{
+    Exception ex;
+    return libvlc_video_get_spu_count( m_player, &ex.ex );
+}
+
+void Video::setSpu( int spu )
+{
+    Exception ex;
+    libvlc_video_set_spu( m_player, spu, &ex.ex );
+}
+
+void Video::setSubtitleFile( const char *subtitle_file )
+{
+    Exception ex;
+    libvlc_video_set_subtitle_file( m_player, subtitle_file, &ex.ex );
+}
+
+char *Video::cropGeometry()
+{
+    Exception ex;
+    return libvlc_video_get_crop_geometry( m_player, &ex.ex );
+}
+
+void Video::setCropGeometry( const char *geometry )
+{
+    Exception ex;
+    libvlc_video_set_crop_geometry( m_player, geometry, &ex.ex );
+}
+
+int Video::track()
+{
+    Exception ex;
+    return libvlc_video_get_track( m_player, &ex.ex );
+}
+
+int Video::trackCount()
+{
+    Exception ex;
+    return libvlc_video_get_track_count( m_player, &ex.ex );
+}
+
+void Video::setTrack( int track )
+{
+    Exception ex;
+    libvlc_video_set_track( m_player, track, &ex.ex );
+}
+
+void Video::snapshot( const char *filepath, int with, int height )
+{
+    Exception ex;
+    libvlc_video_take_snapshot( m_player, filepath, with, height, &ex.ex );
+}
+
+void Video::deinterlace( int enable, const char *mode )
+{
+    Exception ex;
+    libvlc_video_set_deinterlace( m_player, enable, mode, &ex.ex );
+}
diff --git a/bindings/libvlcpp/src/video.hpp b/bindings/libvlcpp/src/video.hpp
new file mode 100644 (file)
index 0000000..1f7f15d
--- /dev/null
@@ -0,0 +1,169 @@
+/*****************************************************************************
+ * video.hpp: video part of an media player
+ *****************************************************************************
+ * Copyright (C) 2010 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Rémi Duraffort <ivoire@videolan.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef LIBVLCPP_VIDEO_HPP
+#define LIBVLCPP_VIDEO_HPP
+
+#include <vlc/libvlc.h>
+#include <vlc/libvlc_media.h>
+#include <vlc/libvlc_media_player.h>
+
+#include "libvlc.hpp"
+
+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
+     */
+    int height();
+
+    /**
+     * Get the width of the video
+     * @return the widht of the video
+     */
+    int width();
+
+    /**
+     * Get the current scaling factor of the video
+     * @return the current scaling factor or 0 if the video is set to fit to the output
+     */
+    float scale();
+
+    /**
+     * Set the scaling factor
+     * @param factor: the new scaling factor
+     */
+    void setScale( float factor );
+
+    /**
+     * Get the current video aspect ratio
+     * @return the aspect ratio
+     */
+    char *aspectRatio();
+
+    /**
+     * set the video aspect ratio
+     * @param aspect_ratio: the aspect ratio
+     */
+    void setAspectRatio( const char *aspect_ratio );
+
+    /**
+     * Get the current video subtitle
+     * @return the video subtitle
+     */
+    int spu();
+
+    /**
+     * Get the number of available video subtitles
+     * @return the number of subtitle
+     */
+    int spuCount();
+
+    /**
+     * Set the video subtitle index
+     * @param spu: the video subtitle
+     */
+    void setSpu( int spu );
+
+    /** Get informations about the current spu */
+
+    /**
+     * Set the subtitle file
+     * @param subtitle_file: the new subtitle file
+     */
+    void setSubtitleFile( const char *subtitle_file );
+
+    /** Get title description */
+
+    /** Get chapter description */
+
+    /**
+     * Get the current crop filter geometry
+     * @return the crop geonmetry
+     */
+    char *cropGeometry();
+
+    /**
+     * Set the crop geometry
+     * @param geometry: the new crop filter geometry
+     */
+    void setCropGeometry( const char *geometry );
+
+    /**
+     * Get the current video track
+     * @return the video track
+     */
+    int track();
+
+    /**
+     * Get the number of video tracks
+     * @return the number of video tracks
+     */
+    int trackCount();
+
+    /**
+     * Set the video track
+     * @param track: the video track
+     */
+    void setTrack( int track );
+
+    /** get track description */
+
+    /**
+     * Take a snapshot and save it to a file
+     * @param filepath: path where to save the file
+     * @param widht: widht of the snapshot
+     * @param height: height of the snapshot
+     */
+    void snapshot( const char *filepath, int widht, int height );
+
+    /**
+     * Enable or disable deinterlace filter and select the deinterlace filter to use
+     * @param enable: true to enable the deinterlace filter
+     * @param mode: the deinterlace filter to use
+     */
+    void deinterlace( int enable, const char *mode );
+
+private:
+    /** The media player instance of libvlc */
+    libvlc_media_player_t *m_player;
+};
+
+};
+
+#endif // LIBVLCPP_VIDEO_HPP
+