[vlc-devel] [PATCH] libvlc: add API for the transform filter
Felix Paul Kühne
fkuehne at videolan.org
Sat Nov 29 14:50:54 CET 2014
---
include/vlc/libvlc_media_player.h | 36 ++++++++++++++++++++++++++++++++
lib/libvlc.sym | 4 ++++
lib/media_player.c | 1 +
lib/video.c | 43 +++++++++++++++++++++++++++++++++++++++
4 files changed, 84 insertions(+)
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 1c73cf2..1d0836a 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -1383,6 +1383,42 @@ LIBVLC_API float libvlc_video_get_adjust_float( libvlc_media_player_t *p_mi,
LIBVLC_API void libvlc_video_set_adjust_float( libvlc_media_player_t *p_mi,
unsigned option, float value );
+/**
+ * enable the transform filter
+ *
+ * \param p_mi libvlc media player instance
+ * \param value binary on / off
+ * \version LibVLC 3.0.0 and later.
+ */
+LIBVLC_API void libvlc_video_set_transform_enabled( libvlc_media_player_t *p_mi,
+ int value );
+
+/**
+ * get transform filter state
+ *
+ * \param p_mi libvlc media player instance
+ * \version LibVLC 3.0.0 and later
+ */
+LIBVLC_API int libvlc_video_get_transform_enabled( libvlc_media_player_t *p_mi );
+
+/**
+ * set transform filter option
+ *
+ * \param p_mi libvlc media player instance
+ * \param psz_value one of 90, 180, 270, hflip, vflip, transpose, antitranspose
+ * \version LibVLC 3.0.0 and later
+ */
+LIBVLC_API void libvlc_video_set_transform( libvlc_media_player_t *p_mi,
+ const char *psz_value );
+
+/**
+ * get transform filter option
+ *
+ * \param p_mi libvlc media player instance
+ * \version LibVLC 3.0.0 and later
+ */
+LIBVLC_API char *libvlc_video_get_transform( libvlc_media_player_t *p_mi );
+
/** @} video */
/** \defgroup libvlc_audio LibVLC audio controls
diff --git a/lib/libvlc.sym b/lib/libvlc.sym
index c0c66dd..98a9b98 100644
--- a/lib/libvlc.sym
+++ b/lib/libvlc.sym
@@ -221,6 +221,8 @@ libvlc_video_get_title_description
libvlc_video_get_track
libvlc_video_get_track_count
libvlc_video_get_track_description
+libvlc_video_get_transform
+libvlc_video_get_transform_enabled
libvlc_video_get_width
libvlc_video_set_adjust_float
libvlc_video_set_adjust_int
@@ -242,6 +244,8 @@ libvlc_video_set_spu_delay
libvlc_video_set_subtitle_file
libvlc_video_set_teletext
libvlc_video_set_track
+libvlc_video_set_transform
+libvlc_video_set_transform_enabled
libvlc_video_take_snapshot
libvlc_vlm_add_broadcast
libvlc_vlm_add_vod
diff --git a/lib/media_player.c b/lib/media_player.c
index 698f8d2..912bf21 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -528,6 +528,7 @@ libvlc_media_player_new( libvlc_instance_t *instance )
var_Create (mp, "crop", VLC_VAR_STRING);
var_Create (mp, "deinterlace", VLC_VAR_INTEGER);
var_Create (mp, "deinterlace-mode", VLC_VAR_STRING);
+ var_Create (mp, "transform-type", VLC_VAR_STRING);
var_Create (mp, "vbi-page", VLC_VAR_INTEGER);
diff --git a/lib/video.c b/lib/video.c
index 4abe36e..301ee6e 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -908,3 +908,46 @@ float libvlc_video_get_adjust_float( libvlc_media_player_t *p_mi,
{
return get_float( p_mi, "adjust", adjust_option_bynumber(option) );
}
+
+/* transform module support */
+
+void libvlc_video_set_transform_enabled( libvlc_media_player_t *p_mi,
+ int value )
+{
+ static const opt_t r = { "transform", 0 };
+ set_int( p_mi, "transform", &r, value );
+}
+
+int libvlc_video_get_transform_enabled( libvlc_media_player_t *p_mi )
+{
+ static const opt_t r = { "transform", 1 };
+ return get_int( p_mi, "transform", &r );
+}
+
+void libvlc_video_set_transform( libvlc_media_player_t *p_mi,
+ const char *psz_value )
+{
+ if (psz_value == NULL)
+ psz_value = "";
+ var_SetString (p_mi, "transform-type", psz_value);
+
+ size_t n;
+ vout_thread_t **pp_vouts = GetVouts (p_mi, &n);
+ for (size_t i = 0; i < n; i++)
+ {
+ vout_thread_t *p_vout = pp_vouts[i];
+
+ var_SetString (p_vout, "transform-type", psz_value);
+ vlc_object_release (p_vout);
+ }
+ free (pp_vouts);
+}
+
+char *libvlc_video_get_transform( libvlc_media_player_t *p_mi )
+{
+ static const opt_t r = { "type", VLC_VAR_STRING };
+
+ char *psz_value = get_string( p_mi, "transform-type", &r );
+
+ return psz_value;
+}
--
1.9.3 (Apple Git-50)
More information about the vlc-devel
mailing list