Go to the documentation of this file.
19 #ifndef AVCODEC_CBS_INTERNAL_H
20 #define AVCODEC_CBS_INTERNAL_H
155 const char *
name,
const int *subscripts,
156 const char *bitstring, int64_t
value);
164 const int *subscripts, uint32_t *write_to,
165 uint32_t range_min, uint32_t range_max);
169 const int *subscripts, uint32_t
value,
170 uint32_t range_min, uint32_t range_max);
174 const int *subscripts,
int32_t *write_to,
184 #define MAX_UINT_BITS(length) ((UINT64_C(1) << (length)) - 1)
188 #define MAX_INT_BITS(length) ((INT64_C(1) << ((length) - 1)) - 1)
192 #define MIN_INT_BITS(length) (-(INT64_C(1) << ((length) - 1)))
194 #define TYPE_LIST(...) { __VA_ARGS__ }
195 #define CBS_UNIT_TYPE_POD(type_, structure) { \
196 .nb_unit_types = 1, \
197 .unit_type.list = { type_ }, \
198 .content_type = CBS_CONTENT_TYPE_INTERNAL_REFS, \
199 .content_size = sizeof(structure), \
200 .type.ref = { .nb_offsets = 0 }, \
202 #define CBS_UNIT_RANGE_POD(range_start, range_end, structure) { \
203 .nb_unit_types = CBS_UNIT_TYPE_RANGE, \
204 .unit_type.range.start = range_start, \
205 .unit_type.range.end = range_end, \
206 .content_type = CBS_CONTENT_TYPE_INTERNAL_REFS, \
207 .content_size = sizeof(structure), \
208 .type.ref = { .nb_offsets = 0 }, \
211 #define CBS_UNIT_TYPES_INTERNAL_REF(types, structure, ref_field) { \
212 .nb_unit_types = FF_ARRAY_ELEMS((CodedBitstreamUnitType[])TYPE_LIST types), \
213 .unit_type.list = TYPE_LIST types, \
214 .content_type = CBS_CONTENT_TYPE_INTERNAL_REFS, \
215 .content_size = sizeof(structure), \
216 .type.ref = { .nb_offsets = 1, \
217 .offsets = { offsetof(structure, ref_field) } }, \
219 #define CBS_UNIT_TYPE_INTERNAL_REF(type, structure, ref_field) \
220 CBS_UNIT_TYPES_INTERNAL_REF((type), structure, ref_field)
222 #define CBS_UNIT_RANGE_INTERNAL_REF(range_start, range_end, structure, ref_field) { \
223 .nb_unit_types = CBS_UNIT_TYPE_RANGE, \
224 .unit_type.range.start = range_start, \
225 .unit_type.range.end = range_end, \
226 .content_type = CBS_CONTENT_TYPE_INTERNAL_REFS, \
227 .content_size = sizeof(structure), \
228 .type.ref = { .nb_offsets = 1, \
229 .offsets = { offsetof(structure, ref_field) } }, \
232 #define CBS_UNIT_TYPES_COMPLEX(types, structure, free_func) { \
233 .nb_unit_types = FF_ARRAY_ELEMS((CodedBitstreamUnitType[])TYPE_LIST types), \
234 .unit_type.list = TYPE_LIST types, \
235 .content_type = CBS_CONTENT_TYPE_COMPLEX, \
236 .content_size = sizeof(structure), \
237 .type.complex = { .content_free = free_func }, \
239 #define CBS_UNIT_TYPE_COMPLEX(type, structure, free_func) \
240 CBS_UNIT_TYPES_COMPLEX((type), structure, free_func)
242 #define CBS_UNIT_TYPE_END_OF_LIST { .nb_unit_types = 0 }
CodedBitstreamUnitType start
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
void(* close)(CodedBitstreamContext *ctx)
const AVClass * priv_class
enum CBSContentType content_type
const CodedBitstreamType ff_cbs_type_vp9
Context structure for coded bitstream operations.
void(* content_free)(void *opaque, uint8_t *data)
int ff_cbs_read_signed(CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, const int *subscripts, int32_t *write_to, int32_t range_min, int32_t range_max)
CodedBitstreamUnitType end
Coded bitstream unit structure.
int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, const int *subscripts, uint32_t value, uint32_t range_min, uint32_t range_max)
@ CBS_CONTENT_TYPE_INTERNAL_REFS
void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position, const char *name, const int *subscripts, const char *bitstring, int64_t value)
CodedBitstreamUnitType list[CBS_MAX_LIST_UNIT_TYPES]
@ CBS_MAX_LIST_UNIT_TYPES
const CodedBitstreamType ff_cbs_type_mpeg2
Coded bitstream fragment structure, combining one or more units.
struct CodedBitstreamUnitTypeDescriptor::@34::@37 complex
int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, const int *subscripts, uint32_t *write_to, uint32_t range_min, uint32_t range_max)
int(* read_unit)(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
struct CodedBitstreamUnitTypeDescriptor::@34::@36 ref
Describe the class of an AVClass context structure.
int(* content_clone)(AVBufferRef **ref, CodedBitstreamUnit *unit)
size_t offsets[CBS_MAX_REF_OFFSETS]
void ff_cbs_trace_header(CodedBitstreamContext *ctx, const char *name)
AVCodecID
Identify the syntax and semantics of the bitstream.
const CodedBitstreamType ff_cbs_type_jpeg
const CodedBitstreamUnitTypeDescriptor * unit_types
@ CBS_CONTENT_TYPE_COMPLEX
static const uint8_t header[24]
struct CodedBitstreamUnitTypeDescriptor::@33::@35 range
const CodedBitstreamType ff_cbs_type_av1
union CodedBitstreamUnitTypeDescriptor::@33 unit_type
int(* write_unit)(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
int ff_cbs_write_signed(CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, const int *subscripts, int32_t value, int32_t range_min, int32_t range_max)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
union CodedBitstreamUnitTypeDescriptor::@34 type
uint32_t CodedBitstreamUnitType
The codec-specific type of a bitstream unit.
const CodedBitstreamType ff_cbs_type_h265
void(* flush)(CodedBitstreamContext *ctx)
A reference to a data buffer.
int(* assemble_fragment)(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
int(* split_fragment)(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
const CodedBitstreamType ff_cbs_type_h264