So unit parsing may be configured with caller set options. Signed-off-by: James Almer <jamr...@gmail.com> --- libavcodec/cbs.c | 9 +++++++++ libavcodec/cbs_internal.h | 6 ++++++ 2 files changed, 15 insertions(+)
diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c index 7c1aa005c2..e73e18f398 100644 --- a/libavcodec/cbs.c +++ b/libavcodec/cbs.c @@ -23,6 +23,7 @@ #include "libavutil/avassert.h" #include "libavutil/buffer.h" #include "libavutil/common.h" +#include "libavutil/opt.h" #include "cbs.h" #include "cbs_internal.h" @@ -101,6 +102,10 @@ int ff_cbs_init(CodedBitstreamContext **ctx_ptr, av_freep(&ctx); return AVERROR(ENOMEM); } + if (type->priv_class) { + *(const AVClass **)ctx->priv_data = type->priv_class; + av_opt_set_defaults(ctx->priv_data); + } } ctx->decompose_unit_types = NULL; @@ -123,6 +128,10 @@ void ff_cbs_close(CodedBitstreamContext **ctx_ptr) ctx->codec->close(ctx); av_freep(&ctx->write_buffer); + + if (ctx->codec->priv_class && ctx->priv_data) + av_opt_free(ctx->priv_data); + av_freep(&ctx->priv_data); av_freep(ctx_ptr); } diff --git a/libavcodec/cbs_internal.h b/libavcodec/cbs_internal.h index d991e1eedf..10530af69f 100644 --- a/libavcodec/cbs_internal.h +++ b/libavcodec/cbs_internal.h @@ -86,6 +86,12 @@ typedef const struct CodedBitstreamUnitTypeDescriptor { typedef struct CodedBitstreamType { enum AVCodecID codec_id; + // A class for the private data, used to declare private AVOptions. + // This field is NULL for types that do not declare any options. + // If this field is non-NULL, the first member of the filter private data + // must be a pointer to AVClass. + const AVClass *priv_class; + size_t priv_data_size; // List of unit type descriptors for this codec. -- 2.27.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".