[FFmpeg-devel] [PATCH 22/30] lavc/adxenc: support AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Wed Jan 4 18:26:48 EET 2023
Anton Khirnov:
> ---
> libavcodec/adxenc.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/adxenc.c b/libavcodec/adxenc.c
> index e1bf344b01..9e0ceb61eb 100644
> --- a/libavcodec/adxenc.c
> +++ b/libavcodec/adxenc.c
> @@ -185,6 +185,18 @@ static int adx_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
>
> avpkt->pts = frame->pts;
> avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples);
> +
> + if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
> + avpkt->opaque = frame->opaque;
> + if (frame->opaque_ref) {
> + avpkt->opaque_ref = av_buffer_ref(frame->opaque_ref);
> + if (!avpkt->opaque_ref)
> + return AVERROR(ENOMEM);
> + }
> + }
> +
> + avctx->reordered_opaque = frame->reordered_opaque;
I don't like that you are adding this piece of code both here, in
encode.c, in ffv1enc.c, in pngenc.c and libtheoraenc.c. Why don't you
factor this out?
> +
> *got_packet_ptr = 1;
> return 0;
> }
> @@ -194,7 +206,8 @@ const FFCodec ff_adpcm_adx_encoder = {
> CODEC_LONG_NAME("SEGA CRI ADX ADPCM"),
> .p.type = AVMEDIA_TYPE_AUDIO,
> .p.id = AV_CODEC_ID_ADPCM_ADX,
> - .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
> + .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
> + AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
> .priv_data_size = sizeof(ADXContext),
> .init = adx_encode_init,
> FF_CODEC_ENCODE_CB(adx_encode_frame),
More information about the ffmpeg-devel
mailing list