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/avcodec.h | |
parent | d0c8ca961d7d4a496f212283781ba74623bf8c3f (diff) |
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/avcodec.h')
-rw-r--r-- | libavcodec/avcodec.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 4874b443f9..832b9d9575 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -242,6 +242,32 @@ typedef struct RcOverride{ */ #define AV_CODEC_FLAG_RECON_FRAME (1 << 6) /** + * Request the encoder to propagate each frame's AVFrame.opaque and + * AVFrame.opaque_ref values to its corresponding output AVPacket. + * + * May only be set on encoders that have the + * @ref AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE capability flag. + * + * @note + * While in typical cases one input frame produces exactly one output packet + * (perhaps after a delay), in general the mapping of frames to packets is + * M-to-N, so + * - Any number of input frames may be associated with any given output packet. + * This includes zero - e.g. some encoders may output packets that carry only + * metadata about the whole stream. + * - A given input frame may be associated with any number of output packets. + * Again this includes zero - e.g. some encoders may drop frames under certain + * conditions. + * . + * This implies that when using this flag, the caller must NOT assume that + * - a given input frame's opaques will necessarily appear on some output packet; + * - every output packet will have some non-NULL opaque value. + * . + * When an output packet contains multiple frames, the opaque values will be + * taken from the first of those. + */ +#define AV_CODEC_FLAG_COPY_OPAQUE (1 << 7) +/** * Use internal 2pass ratecontrol in first pass mode. */ #define AV_CODEC_FLAG_PASS1 (1 << 9) |