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

Anton Khirnov anton at khirnov.net
Wed Feb 19 15:20:47 EET 2020


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.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list