[vlc-devel] commit: Added sub-description to override a subtitle track description. ( Laurent Aimar )

git version control git at videolan.org
Sat Jan 23 21:38:12 CET 2010


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Jan 23 20:17:25 2010 +0100| [0ad9871bddde7d3804c25070f98c476bbbb3b88e] | committer: Laurent Aimar 

Added sub-description to override a subtitle track description.

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

 modules/demux/subtitle.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c
index d461106..c319946 100644
--- a/modules/demux/subtitle.c
+++ b/modules/demux/subtitle.c
@@ -58,6 +58,8 @@ static void Close( vlc_object_t *p_this );
     "\"sami\", \"dvdsubtitle\", \"mpl2\", \"aqt\", \"pjs\", "\
     "\"mpsub\", \"jacosub\", \"psb\", \"realtext\", \"dks\", \"subviewer1\", " \
     " and \"auto\" (meaning autodetection, this should always work).")
+#define SUB_DESCRIPTION_LONGTEXT \
+    N_("Override the default track description.")
 
 static const char *const ppsz_sub_type[] =
 {
@@ -82,6 +84,8 @@ vlc_module_begin ()
     add_string( "sub-type", "auto", NULL, N_("Subtitles format"),
                 SUB_TYPE_LONGTEXT, true )
         change_string_list( ppsz_sub_type, NULL, NULL )
+    add_string( "sub-description", NULL, NULL, N_("Subtitles description"),
+                SUB_DESCRIPTION_LONGTEXT, true )
     set_callbacks( Open, Close )
 
     add_shortcut( "subtitle" )
@@ -520,12 +524,18 @@ static int Open ( vlc_object_t *p_this )
     {
         es_format_Init( &fmt, SPU_ES, VLC_CODEC_SUBT );
     }
+    char *psz_description = var_InheritString( p_demux, "sub-description" );
+    if( psz_description && *psz_description )
+        fmt.psz_description = psz_description;
+    else
+        free( psz_description );
     if( p_sys->psz_header != NULL )
     {
         fmt.i_extra = strlen( p_sys->psz_header ) + 1;
         fmt.p_extra = strdup( p_sys->psz_header );
     }
     p_sys->es = es_out_Add( p_demux->out, &fmt );
+    es_format_Clean( &fmt );
 
     return VLC_SUCCESS;
 }




More information about the vlc-devel mailing list