[vlc-devel] commit: libvlc: add subtitle file (*.srt...) handling (Tanguy Krotoff )

git version control git at videolan.org
Sat May 10 20:21:40 CEST 2008


vlc | branch: master | Tanguy Krotoff <tkrotoff at gmail.com> | Wed May  7 03:52:51 2008 +0200| [594e6e22ceafa46b99baa2b2bfdc4012680d4f13]

libvlc: add subtitle file (*.srt...) handling

Signed-off-by: Jean-Paul Saman <jpsaman at videolan.org>

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

 include/vlc/libvlc.h |   10 ++++++++++
 src/control/video.c  |   16 ++++++++++++++++
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/include/vlc/libvlc.h b/include/vlc/libvlc.h
index 18797ad..87501a4 100644
--- a/include/vlc/libvlc.h
+++ b/include/vlc/libvlc.h
@@ -517,6 +517,16 @@ VLC_PUBLIC_API int libvlc_video_get_spu( libvlc_media_player_t *, libvlc_excepti
 VLC_PUBLIC_API void libvlc_video_set_spu( libvlc_media_player_t *, int , libvlc_exception_t * );
 
 /**
+ * Set new video subtitle file.
+ *
+ * \param p_mediaplayer the media player
+ * \param psz_subtitle new video subtitle file
+ * \param p_e an initialized exception pointer
+ * \return the success status (boolean)
+ */
+VLC_PUBLIC_API int libvlc_video_set_subtitle_file( libvlc_media_player_t *, char *, libvlc_exception_t * );
+
+/**
  * Get current crop filter geometry.
  *
  * \param p_mediaplayer the media player
diff --git a/src/control/video.c b/src/control/video.c
index ed49da7..9490261 100644
--- a/src/control/video.c
+++ b/src/control/video.c
@@ -450,6 +450,22 @@ void libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu,
     vlc_object_release( p_input_thread );
 }
 
+int libvlc_video_set_subtitle_file( libvlc_media_player_t *p_mi,
+                                    char *psz_subtitle,
+                                    libvlc_exception_t *p_e )
+{
+    input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
+    bool b_ret = false;
+
+    if( p_input_thread )
+    {
+        if( input_AddSubtitles( p_input_thread, psz_subtitle, true ) )
+            b_ret = true;
+        vlc_object_release( p_input_thread );
+    }
+    return b_ret;
+}
+
 char *libvlc_video_get_crop_geometry( libvlc_media_player_t *p_mi,
                                    libvlc_exception_t *p_e )
 {




More information about the vlc-devel mailing list