[vlc-devel] Fwd: [PATCH] Using base subtitle filename instead of Track 'N'
Stuart McMahon
stuartlmcmahon at gmail.com
Sat Sep 28 12:12:36 CEST 2013
As a small step towards the feature request described in
http://forum.videolan.org/viewtopic.php?f=7&t=98342
this patch displays the base subtitle filename instead of
Track 'N' for each unidentified subtitle loaded from a file.
With this change users won't have to click on each Track 'N' then
scrub through the video to a speaking section to figure out which
subtitle file is actually being used.
Regards,
Stuart McMahon.
-------------- next part --------------
---
modules/demux/subtitle.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c
index 5b273c5..0b4aa92 100644
--- a/modules/demux/subtitle.c
+++ b/modules/demux/subtitle.c
@@ -535,7 +535,21 @@ static int Open ( vlc_object_t *p_this )
if( psz_description && *psz_description )
fmt.psz_description = psz_description;
else
+ {
free( psz_description );
+
+ /* Fall back on subtitle filename as the description */
+ if( p_demux->psz_file )
+ {
+ char *psz_last_sep = strrchr( p_demux->psz_file, DIR_SEP_CHAR );
+
+ if( psz_last_sep )
+ fmt.psz_description = strdup( psz_last_sep + 1 );
+ else
+ fmt.psz_description = strdup( p_demux->psz_file );
+ }
+ }
+
if( p_sys->psz_header != NULL )
{
fmt.i_extra = strlen( p_sys->psz_header ) + 1;
--
More information about the vlc-devel
mailing list