[FFmpeg-devel] [PATCH 23/30] lavc/ffv1enc: handle frame durations and AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
Anton Khirnov
anton at khirnov.net
Sun Nov 27 19:03:44 EET 2022
---
libavcodec/ffv1enc.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 0237ac48eb..553abb558f 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -1233,7 +1233,20 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
pkt->size = buf_p - pkt->data;
pkt->pts =
pkt->dts = pict->pts;
+ pkt->duration = pict->duration;
pkt->flags |= AV_PKT_FLAG_KEY * f->key_frame;
+
+ if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
+ pkt->opaque = pict->opaque;
+ if (pict->opaque_ref) {
+ pkt->opaque_ref = av_buffer_ref(pict->opaque_ref);
+ if (!pkt->opaque_ref)
+ return AVERROR(ENOMEM);
+ }
+ }
+
+ avctx->reordered_opaque = pict->reordered_opaque;
+
*got_packet = 1;
return 0;
@@ -1272,7 +1285,8 @@ const FFCodec ff_ffv1_encoder = {
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_FFV1,
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
- AV_CODEC_CAP_SLICE_THREADS,
+ AV_CODEC_CAP_SLICE_THREADS |
+ AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.priv_data_size = sizeof(FFV1Context),
.init = encode_init,
FF_CODEC_ENCODE_CB(encode_frame),
--
2.35.1
More information about the ffmpeg-devel
mailing list