[vlc-devel] [PATCH] Added libvlc_video_get_spu_delay and, libvlc_video_set_spu_delay.
John Hendrikx
hjohn at xs4all.nl
Tue Nov 29 15:45:01 CET 2011
Allows for controlling the subtitle delay through libvlc.
---
include/vlc/libvlc_media_player.h | 19 +++++++++++++++++++
lib/video.c | 32 ++++++++++++++++++++++++++++++++
2 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/include/vlc/libvlc_media_player.h
b/include/vlc/libvlc_media_player.h
index a2b5748..6cc4179 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -1039,6 +1039,25 @@ LIBVLC_API int libvlc_video_set_spu(
libvlc_media_player_t *p_mi, unsigned i_spu
LIBVLC_API int libvlc_video_set_subtitle_file( libvlc_media_player_t
*p_mi, const char *psz_subtitle );
/**
+ * Get current subtitle delay.
+ *
+ * \param p_mi media player
+ * \return the subtitle delay (microseconds)
+ * \version LibVLC 1.2.0 or later
+ */
+LIBVLC_API int64_t libvlc_video_get_spu_delay( libvlc_media_player_t
*p_mi );
+
+/**
+ * Set current subtitle delay. The subtitle delay will be reset to zero
each time the media changes.
+ *
+ * \param p_mi media player
+ * \param i_delay the subtitle delay (microseconds)
+ * \return 0 on success, -1 on error
+ * \version LibVLC 1.2.0 or later
+ */
+LIBVLC_API int libvlc_video_set_spu_delay( libvlc_media_player_t *p_mi,
int64_t i_delay );
+
+/**
* Get the description of available titles.
*
* \param p_mi the media player
diff --git a/lib/video.c b/lib/video.c
index 6e1ea06..604d473 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -365,6 +365,38 @@ int libvlc_video_set_subtitle_file(
libvlc_media_player_t *p_mi,
return b_ret;
}
+int64_t libvlc_video_get_spu_delay( libvlc_media_player_t *p_mi )
+{
+ input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi );
+ int64_t val = 0;
+
+ if( p_input_thread )
+ {
+ val = var_GetTime( p_input_thread, "spu-delay" );
+ vlc_object_release( p_input_thread );
+ }
+
+ return val;
+}
+
+int libvlc_video_set_spu_delay( libvlc_media_player_t *p_mi,
+ int64_t i_delay )
+{
+ input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi );
+ int ret = -1;
+
+ if( p_input_thread )
+ {
+ var_SetTime( p_input_thread, "spu-delay", i_delay );
+ vlc_object_release( p_input_thread );
+ ret = 0;
+ }
+
+ return ret;
+}
+
+
+
libvlc_track_description_t *
libvlc_video_get_title_description( libvlc_media_player_t *p_mi )
{
-- 1.7.4.1
More information about the vlc-devel
mailing list