Go to the documentation of this file.
366 void (*free)(
void *opaque,
uint8_t *content));
void * priv_data
Internal codec-specific data.
int ff_cbs_insert_unit_content(CodedBitstreamFragment *frag, int position, CodedBitstreamUnitType type, void *content, AVBufferRef *content_buf)
Insert a new unit into a fragment with the given content.
This struct describes the properties of an encoded stream.
int ff_cbs_make_unit_refcounted(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
Make the content of a unit refcounted.
const struct CodedBitstreamType * codec
Internal codec-specific hooks.
void * content
Pointer to the decomposed form of this unit.
int ff_cbs_alloc_unit_content2(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
Allocate a new internal content buffer matching the type of the 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_free(CodedBitstreamFragment *frag)
Free the units array of a fragment in addition to what ff_cbs_fragment_reset does.
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.
int trace_level
Log level to use for trace output.
CodedBitstreamUnit * units
Pointer to an array of units of length nb_units_allocated.
int ff_cbs_read_extradata_from_codec(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const AVCodecContext *avctx)
Read the extradata bitstream found in a codec context into a fragment, then split into units and deco...
Coded bitstream fragment structure, combining one or more units.
int ff_cbs_alloc_unit_content(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.
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_fragment_reset(CodedBitstreamFragment *frag)
Free the units contained in a fragment as well as the fragment's own data buffer, but not the units a...
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_flush(CodedBitstreamContext *ctx)
Reset all internal state in a context.
void ff_cbs_delete_unit(CodedBitstreamFragment *frag, int position)
Delete a unit from a fragment and free all memory it uses.
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.
main external API structure.
uint32_t CodedBitstreamUnitType
The codec-specific type of a bitstream unit.
int ff_cbs_alloc_unit_data(CodedBitstreamUnit *unit, size_t size)
Allocate a new internal data buffer of the given size in the unit.
int trace_enable
Enable trace output during read/write operations.
A reference to a data buffer.
int ff_cbs_make_unit_writable(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
Make the content of a unit writable so that internal fields can be modified.
This structure stores compressed data.
int nb_decompose_unit_types
Length of the decompose_unit_types array.
const CodedBitstreamUnitType * decompose_unit_types
Array of unit types which should be decomposed when reading.
int ff_cbs_insert_unit_data(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.
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.