[FFmpeg-devel] [PATCH 1/2] avcodec: add null encoders

Anton Khirnov anton at khirnov.net
Tue Mar 15 10:47:22 EET 2022


Quoting Paul B Mahol (2022-03-14 12:56:01)
> +static int null_encoder(AVCodecContext *avctx, AVPacket *pkt,
> +                        const AVFrame *frame, int *got_packet)
> +{
> +    int ret;
> +
> +    pkt->pts = frame->pts;
> +    if (avctx->codec_type == AVMEDIA_TYPE_AUDIO)
> +        pkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples);
> +    pkt->flags |= AV_PKT_FLAG_KEY;
> +    if ((ret = ff_alloc_packet(avctx, pkt, 1)) < 0)
> +        return ret;
> +    *got_packet = 1;

Why return packets at all? Wouldn't it be simpler to just never return
any data?

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list