#include "libavutil/avassert.h"
#include "libavutil/buffer.h"
#include "libavutil/common.h"
+#include "libavutil/opt.h"
#include "cbs.h"
#include "cbs_internal.h"
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;
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);
}
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.