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.
int ff_cbs_alloc_unit_content(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, size_t size, void(*free)(void *unit, uint8_t *content))
Allocate a new internal content buffer of the given size in the unit.
CodedBitstreamUnitType type
Codec-specific type of this unit.
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...
This struct describes the properties of an encoded stream.
int trace_enable
Enable trace output during read/write operations.
uint32_t CodedBitstreamUnitType
The codec-specific type of a bitstream unit.
size_t data_bit_padding
The number of bits which should be ignored in the final byte.
Coded bitstream unit structure.
void * content
Pointer to the decomposed form of this unit.
CodedBitstreamUnit * units
Pointer to an array of units of length nb_units.
uint8_t * data
Pointer to the directly-parsable bitstream form of this unit.
size_t data_size
The number of bytes in the bitstream.
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.
AVCodecID
Identify the syntax and semantics of the bitstream.
enum AVCodecID ff_cbs_all_codec_ids[]
Table of all supported codec IDs.
size_t data_bit_padding
The number of bits which should be ignored in the final byte.
void * log_ctx
Logging context to be passed to all av_log() calls associated with this context.
int ff_cbs_write_packet(CodedBitstreamContext *ctx, AVPacket *pkt, CodedBitstreamFragment *frag)
Write the bitstream of a fragment to a packet.
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.
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 * data
Pointer to the bitstream form of this fragment.
void ff_cbs_fragment_uninit(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
Free all allocated memory in a fragment.
Libavcodec external API header.
int nb_decompose_unit_types
Length of the decompose_unit_types array.
Coded bitstream fragment structure, combining one or more units.
int trace_level
Log level to use for trace output.
Context structure for coded bitstream operations.
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.
AVBufferRef * content_ref
If content is reference counted, a reference to the buffer containing content.
refcounted data buffer API
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.
void * priv_data
Internal codec-specific data.
A reference to a data buffer.
AVBufferRef * data_ref
If data is reference counted, a reference to the buffer containing data.
CodedBitstreamUnitType * decompose_unit_types
Array of unit types which should be decomposed when reading.
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_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.
const struct CodedBitstreamType * codec
Internal codec-specific hooks.
AVBufferRef * data_ref
If data is reference counted, a reference to the buffer containing data.
This structure stores compressed data.
int ff_cbs_delete_unit(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int position)
Delete a unit from a fragment and free all memory it uses.
size_t data_size
The number of bytes in the bitstream (including any padding bits in the final byte).
void ff_cbs_close(CodedBitstreamContext **ctx)
Close a context and free all internal state.