[vlc-devel] [PATCH] libvlc: add subtitle file (*.srt...) handling
Jean-Paul Saman
jpsaman at videolan.org
Wed May 7 08:44:34 CEST 2008
Wouldn't it be better to use the name: libvlc_video_set_subtitle_file
and libvlc_video_get_subtitle_file to keep it distinct from subtitles
embedded in the stream.
Gtz
Jean-Paul Saman.
Tanguy Krotoff wrote:
> ---
> 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..be44aa7 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( 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..c61ad16 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( 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