[MPlayer-dev-eng] [PATCH] Read normal duration when demuxing subtitles through lavf

Philip Langdale philipl at overt.org
Fri Jul 27 18:20:42 CEST 2012


On 27.07.2012 02:14, Alexander Strasser wrote:
>
>   It is a bit messy, but as this is the state of things in
> FFmpeg there is not much else we can do about it now.

Yeah. We still need to sort out the desired semantics on the ffmpeg
side, and then make sure everything is consistent.

>> Index: libmpdemux/demux_lavf.c
>> ===================================================================
>> --- libmpdemux/demux_lavf.c	(revision 35050)
>> +++ libmpdemux/demux_lavf.c	(working copy)
>> @@ -653,9 +653,14 @@
>>          priv->last_pts= dp->pts * AV_TIME_BASE;
>>          // always set endpts for subtitles, even if AV_PKT_FLAG_KEY 
>> is not set,
>>          // otherwise they will stay on screen to long if e.g. ASS 
>> is demuxed from mkv
>> -        if((ds == demux->sub || (pkt.flags & AV_PKT_FLAG_KEY)) &&
>> -           pkt.convergence_duration > 0)
>> -            dp->endpts = dp->pts + pkt.convergence_duration * 
>> av_q2d(priv->avfc->streams[id]->time_base);
>> +        if (ds == demux->sub || (pkt.flags & AV_PKT_FLAG_KEY)) {
>> +            uint64_t duration = 0;
>> +            if (pkt.convergence_duration > 0)
>> +                duration = pkt.convergence_duration;
>> +            else if (pkt.duration > 0)
>> +                duration = pkt.duration;
>> +            dp->endpts = dp->pts + duration * 
>> av_q2d(priv->avfc->streams[id]->time_base);
>> +        }
>>      }
>
>   Why do you use uint64_t here? The fields seem to be int64_t and int
> in FFmpeg.

That's just a mistake. I forgot to change it to int64_t.

>   I assume the demuxers that use pkt.convergence_duration set it
> exclusively and that there is no common code that would attempt to 
> set
> pkt.duration, as that would alter the meaning of the code.

Correct.

>   Looks good to me otherwise.

Thanks, I'll post an update.

--phil


More information about the MPlayer-dev-eng mailing list