[vlc-devel] commit: libvlc API: Add Deinterlace Filter to libvlc in video.c ( Cyril Mathé )

git version control git at videolan.org
Wed Jun 3 23:44:44 CEST 2009


vlc | branch: master | Cyril Mathé <cmathe at actech-innovation.com> | Fri May 29 14:25:45 2009 +0200| [3f2f2e788242e8219c6ce9ab573b8cc2ebc71f9f] | committer: Laurent Aimar 

libvlc API: Add Deinterlace Filter to libvlc in video.c

  - libvlc_video_enable_deinterlace(libvlc_media_player_t *p_mi, int b_enable, const char *psz_mode, libvlc_exception_t *p_e)
      - b_enable: boolean to enable or disable deinterlace filter
      - psz_mode: char to define the deinterlace mode (blend, linear...)

Signed-off-by: Laurent Aimar <fenrir at videolan.org>

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

 include/vlc/libvlc_media_player.h |   12 +++++++++++
 src/control/video.c               |   39 +++++++++++++++++++++++++++++++++++++
 src/libvlc.sym                    |    1 +
 3 files changed, 52 insertions(+), 0 deletions(-)

diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 4694698..4b811a0 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -714,6 +714,18 @@ VLC_PUBLIC_API void libvlc_video_set_track( libvlc_media_player_t *, int, libvlc
  */
 VLC_PUBLIC_API void libvlc_video_take_snapshot( libvlc_media_player_t *, const char *,unsigned int, unsigned int, libvlc_exception_t * );
 
+/**
+ * Enable or disable deinterlace filter
+ *
+ * \param p_mi libvlc media player
+ * \param b_enable boolean to enable or disable deinterlace filter
+ * \param psz_mode type of deinterlace filter to use
+ * \param p_e an initialized exception pointer
+ */
+VLC_PUBLIC_API void libvlc_video_set_deinterlace( libvlc_media_player_t *,
+                                                  int , const char *,
+                                                  libvlc_exception_t *);
+
 /** @} video */
 
 /** \defgroup libvlc_audio libvlc_audio
diff --git a/src/control/video.c b/src/control/video.c
index 3b79f55..de7614e 100644
--- a/src/control/video.c
+++ b/src/control/video.c
@@ -589,3 +589,42 @@ end:
     var_FreeList( &val_list, NULL );
     vlc_object_release( p_input_thread );
 }
+
+/******************************************************************************
+ * libvlc_video_set_deinterlace : enable deinterlace
+ *****************************************************************************/
+void libvlc_video_set_deinterlace( libvlc_media_player_t *p_mi, int b_enable,
+                                   const char *psz_mode,
+                                   libvlc_exception_t *p_e )
+{
+    vout_thread_t *p_vout = GetVout( p_mi, p_e );
+
+    if( p_vout )
+    {
+        libvlc_exception_raise( p_e, "Unable to get video output" );
+        return;
+    }
+
+    if( b_enable )
+    {
+        /* be sure that the filter name given is supported */
+        if( !strcmp(psz_mode, "blend")   || !strcmp(psz_mode, "bob")
+         || !strcmp(psz_mode, "discard") || !strcmp(psz_mode, "linear")
+         || !strcmp(psz_mode, "mean")    || !strcmp(psz_mode, "x") )
+        {
+            /* set deinterlace filter chosen */
+            var_SetString( p_vout, "deinterlace", psz_mode );
+        }
+        else
+        {
+            libvlc_exception_raise( p_e, "Unsuported or bad deinterlace filter name" );
+        }
+    }
+    else
+    {
+        /* disable deinterlace filter */
+        var_SetString( p_vout, "deinterlace", "" );
+    }
+
+    vlc_object_release( p_vout );
+}
diff --git a/src/libvlc.sym b/src/libvlc.sym
index e652116..b8ae128 100644
--- a/src/libvlc.sym
+++ b/src/libvlc.sym
@@ -191,6 +191,7 @@ libvlc_video_get_track_description
 libvlc_video_get_width
 libvlc_video_set_aspect_ratio
 libvlc_video_set_crop_geometry
+libvlc_video_set_deinterlace
 libvlc_video_set_scale
 libvlc_video_set_spu
 libvlc_video_set_subtitle_file




More information about the vlc-devel mailing list