[FFmpeg-devel] [PATCH] libavformat/cdg: unset duration on packets

Guillaume Desmottes guillaume.desmottes at collabora.com
Tue Feb 19 18:43:38 EET 2019


Hi James,

On 19/02/2019 17:14, James Almer wrote:
> On 2/11/2019 1:59 PM, Guillaume Desmottes wrote:
>> CDG doesn't ensure a constant framerate as we can have holes in the CDG
>> stream. So there is no guarantee of the duration of a single frame, it
>> will be displayed until a new packet with CDG instruction arrives in the
>> stream.
>>
>> Signed-off-by: Guillaume Desmottes <guillaume.desmottes at collabora.com>
>> ---
>>   libavformat/cdg.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/libavformat/cdg.c b/libavformat/cdg.c
>> index 05cac6e528..078e985223 100644
>> --- a/libavformat/cdg.c
>> +++ b/libavformat/cdg.c
>> @@ -74,6 +74,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
>>       pkt->stream_index = 0;
>>       pkt->dts=
>>       pkt->pts= pkt->pos / CDG_PACKET_SIZE;
>> +    pkt->duration = AV_NOPTS_VALUE;
> The doxy says "0 if unknown", so AV_NOPTS_VALUE is not correct.

Just tried that, but by setting it to 0, compute_pkt_fields() set it 
back to an actual value
which is exactly what I'm trying to avoid.
See https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/utils.c#L1303



More information about the ffmpeg-devel mailing list