Go to the documentation of this file.
351 void (*free)(
void *opaque,
uint8_t *content));
int ff_cbs_alloc_unit_content(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, size_t size, void(*free)(void *opaque, uint8_t *content))
Allocate a new internal content buffer of the given size in the unit.
void * priv_data
Internal codec-specific data.
This struct describes the properties of an encoded stream.
const struct CodedBitstreamType * codec
Internal codec-specific hooks.
void * content
Pointer to the decomposed form of this unit.
int ff_cbs_init(CodedBitstreamContext **ctx, enum AVCodecID codec_id, void *log_ctx)
Create and initialise a new context for the given codec.
uint8_t * write_buffer
Write buffer.
Context structure for coded bitstream operations.
CodedBitstreamUnitType type
Codec-specific type of this unit.
int ff_cbs_read_packet(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const AVPacket *pkt)
Read the data bitstream from a packet into a fragment, then split into units and decompose.
Coded bitstream unit structure.
int ff_cbs_write_packet(CodedBitstreamContext *ctx, AVPacket *pkt, CodedBitstreamFragment *frag)
Write the bitstream of a fragment to a packet.
void * log_ctx
Logging context to be passed to all av_log() calls associated with this context.
void ff_cbs_fragment_reset(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
Free the units contained in a fragment as well as the fragment's own data buffer, but not the units a...
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 type
uint8_t * data
Pointer to the directly-parsable bitstream form of this unit.
void ff_cbs_fragment_free(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
Free the units array of a fragment in addition to what ff_cbs_fragment_reset does.
int trace_level
Log level to use for trace output.
CodedBitstreamUnit * units
Pointer to an array of units of length nb_units_allocated.
Coded bitstream fragment structure, combining one or more units.
size_t data_size
The number of bytes in the bitstream.
int ff_cbs_read(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const uint8_t *data, size_t size)
Read a bitstream from a memory region into a fragment, then split into units and decompose.
size_t data_bit_padding
The number of bits which should be ignored in the final byte.
void ff_cbs_delete_unit(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int position)
Delete a unit from a fragment and free all memory it uses.
int ff_cbs_alloc_unit_data(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, size_t size)
Allocate a new internal data buffer of the given size in the unit.
int ff_cbs_insert_unit_content(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int position, CodedBitstreamUnitType type, void *content, AVBufferRef *content_buf)
Insert a new unit into a fragment with the given content.
size_t data_size
The number of bytes in the bitstream (including any padding bits in the final byte).
AVCodecID
Identify the syntax and semantics of the bitstream.
uint8_t * data
Pointer to the bitstream form of this fragment.
size_t data_bit_padding
The number of bits which should be ignored in the final byte.
int ff_cbs_write_extradata(CodedBitstreamContext *ctx, AVCodecParameters *par, CodedBitstreamFragment *frag)
Write the bitstream of a fragment to the extradata in codec parameters.
int ff_cbs_read_extradata(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const AVCodecParameters *par)
Read the extradata bitstream found in codec parameters into a fragment, then split into units and dec...
void ff_cbs_close(CodedBitstreamContext **ctx)
Close a context and free all internal state.
AVBufferRef * data_ref
A reference to the buffer containing data.
enum AVCodecID ff_cbs_all_codec_ids[]
Table of all supported codec IDs.
int nb_units_allocated
Number of allocated units.
AVBufferRef * content_ref
If content is reference counted, a reference to the buffer containing content.
int ff_cbs_insert_unit_data(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int position, CodedBitstreamUnitType type, uint8_t *data, size_t data_size, AVBufferRef *data_buf)
Insert a new unit into a fragment with the given data bitstream.
uint32_t CodedBitstreamUnitType
The codec-specific type of a bitstream unit.
int trace_enable
Enable trace output during read/write operations.
A reference to a data buffer.
This structure stores compressed data.
int nb_decompose_unit_types
Length of the decompose_unit_types array.
AVBufferRef * data_ref
A reference to the buffer containing data.
int ff_cbs_write_fragment_data(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
Write the content of the fragment to its own internal buffer.
int nb_units
Number of units in this fragment.
CodedBitstreamUnitType * decompose_unit_types
Array of unit types which should be decomposed when reading.