[vlc-devel] [PATCH 1/2] demux: subtitle: set length after subtitle reorder

Zhao Zhili quinkblack at foxmail.com
Mon Sep 24 11:43:25 CEST 2018



> On Sep 24, 2018, at 5:10 PM, Thomas Guillem <thomas at gllm.fr> wrote:
> 
> Why ?

p_sys->i_length = p_sys->subtitles.p_array[p_sys->subtitles.i_count-1].i_stop;

The i_length field is set according to the PTS of the last frame. The last frame may not have the largest PTS before reorder.

cf. https://mailman.videolan.org/pipermail/vlc-devel/2018-September/121233.html


> 
> On Thu, Sep 20, 2018, at 17:36, Zhao Zhili wrote:
>> ---
>> modules/demux/subtitle.c | 11 +++++------
>> 1 file changed, 5 insertions(+), 6 deletions(-)
>> 
>> diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c
>> index 3b9836587a..4b7eeefd59 100644
>> --- a/modules/demux/subtitle.c
>> +++ b/modules/demux/subtitle.c
>> @@ -676,12 +676,6 @@ static int Open ( vlc_object_t *p_this )
>> 
>>     msg_Dbg(p_demux, "loaded %zu subtitles", p_sys->subtitles.i_count );
>> 
>> -    /* Fix subtitle (order and time) *** */
>> -    p_sys->subtitles.i_current = 0;
>> -    p_sys->i_length = 0;
>> -    if( p_sys->subtitles.i_count > 0 )
>> -        p_sys->i_length = p_sys->subtitles.p_array[p_sys-
>>> subtitles.i_count-1].i_stop;
>> -
>>     /* *** add subtitle ES *** */
>>     if( p_sys->props.i_type == SUB_TYPE_SSA1 ||
>>              p_sys->props.i_type == SUB_TYPE_SSA2_4 ||
>> @@ -698,6 +692,11 @@ static int Open ( vlc_object_t *p_this )
>>     else
>>         es_format_Init( &fmt, SPU_ES, VLC_CODEC_SUBT );
>> 
>> +    p_sys->subtitles.i_current = 0;
>> +    p_sys->i_length = 0;
>> +    if( p_sys->subtitles.i_count > 0 )
>> +        p_sys->i_length = p_sys->subtitles.p_array[p_sys-
>>> subtitles.i_count-1].i_stop;
>> +
>>     /* Stupid language detection in the filename */
>>     char * psz_language = get_language_from_filename( p_demux-
>>> psz_filepath );
>> 
>> -- 
>> 2.19.0.rc1
>> 
>> 
>> 
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel



More information about the vlc-devel mailing list