diff options
author | Anton Khirnov <anton@khirnov.net> | 2022-07-12 11:25:09 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2023-01-29 09:18:14 +0100 |
commit | 5c0348f3d61ce850fa33fe79b5d2bc49f7b52683 (patch) | |
tree | 95866baba0e6ced127e90c906d791cb60b8d02cc /libavcodec/encode.c | |
parent | d0c8ca961d7d4a496f212283781ba74623bf8c3f (diff) | |
download | ffmpeg-5c0348f3d61ce850fa33fe79b5d2bc49f7b52683.tar.gz |
lavc: add a codec flag for propagating opaque from frames to packets
This is intended to be a more convenient replacement for
reordered_opaque.
Add support for it in the two encoders that offer
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE: libx264 and libx265. Other
encoders will be supported in future commits.
Diffstat (limited to 'libavcodec/encode.c')
-rw-r--r-- | libavcodec/encode.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/encode.c b/libavcodec/encode.c index e0b3e43840..d6c73dc044 100644 --- a/libavcodec/encode.c +++ b/libavcodec/encode.c @@ -636,6 +636,13 @@ int ff_encode_preinit(AVCodecContext *avctx) return AVERROR(EINVAL); } + if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE && + !(avctx->codec->capabilities & AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE)) { + av_log(avctx, AV_LOG_ERROR, "The copy_opaque flag is set, but the " + "encoder does not support it.\n"); + return AVERROR(EINVAL); + } + switch (avctx->codec_type) { case AVMEDIA_TYPE_VIDEO: ret = encode_preinit_video(avctx); break; case AVMEDIA_TYPE_AUDIO: ret = encode_preinit_audio(avctx); break; |