]> git.sesse.net Git - vlc/commitdiff
libvlc: add subtitle file (*.srt...) handling
authorTanguy Krotoff <tkrotoff@gmail.com>
Wed, 7 May 2008 01:52:51 +0000 (03:52 +0200)
committerJean-Paul Saman <jpsaman@videolan.org>
Sat, 10 May 2008 18:01:11 +0000 (20:01 +0200)
Signed-off-by: Jean-Paul Saman <jpsaman@videolan.org>
include/vlc/libvlc.h
src/control/video.c

index 18797ad0917f36543a7dcd430a11423523723ffd..87501a4842684c9bd737b5d85fcb39af514da58c 100644 (file)
@@ -516,6 +516,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.
  *
index ed49da730d1ff0de54c9a7a6fa7aa717f1b40a61..94902614166ce7f8ca50af990a72f05e225bf3c0 100644 (file)
@@ -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 )
 {