[FFmpeg-devel] [PATCH 2/3] avformat/dashenc: write a capture time Producer Reference Time element when none is provided by the encoder

James Almer jamrial at gmail.com
Wed Feb 19 15:34:35 EET 2020


On 2/19/2020 10:20 AM, Anton Khirnov wrote:
> Quoting James Almer (2020-02-18 17:13:35)
>> +static int dash_parse_prft(DASHContext *c, AVPacket *pkt)
>> +{
>> +    OutputStream *os = &c->streams[pkt->stream_index];
>> +    int side_data_size;
>> +    AVProducerReferenceTime *prft;
>> +
>> +    if (!c->write_prft)
>> +        return 0;
>> +
>> +    prft = (AVProducerReferenceTime *)av_packet_get_side_data(pkt, AV_PKT_DATA_PRFT, &side_data_size);
>> +    if (!prft || side_data_size != sizeof(AVProducerReferenceTime) || prft->flags) {
>> +        // No encoder generated AVProducerReferenceTime side data. Instead of letting the mov muxer
>> +        // generate a capture-time one for the first packet, do it here so we can also use it for the
>> +        // manifest.
>> +        prft = (AVProducerReferenceTime *)av_packet_new_side_data(pkt, AV_PKT_DATA_PRFT,
>> +                                                                  sizeof(AVProducerReferenceTime));
>> +        if (!prft)
>> +            return AVERROR(ENOMEM);
>> +        prft->wallclock = av_gettime();
>> +        prft->flags = 24;
> 
> It's pretty unclear what does this magic number mean.
> The flags field in AVProducerReferenceTime is also undocumented.

It's the flags field in the isobmff spec for the prft box. I can add a
comment mentioning that.

0 and 24 are the only values accepted by the dash-ll spec. The former
signals the time a frame was feed to an encoder, and the latter signals
an arbitrary but consistent time (in this case, the time a packet was
feed to a packetizer).


More information about the ffmpeg-devel mailing list