36 const char *
name,
const int *subscripts,
38 uint32_t range_min, uint32_t range_max)
47 for (i = 0; i < 32; i++) {
50 "%s: bitstream ended.\n", name);
54 bits[i] = k ?
'1' :
'0';
60 "%s: more than 31 zeroes.\n", name);
64 for (j = 0; j < i; j++) {
66 bits[i + j + 1] = k ?
'1' :
'0';
67 value = value << 1 | k;
78 "%"PRIu32
", but must be in [%"PRIu32
",%"PRIu32
"].\n",
79 name, value, range_min, range_max);
88 const char *
name,
const int *subscripts,
100 for (i = 0; i < 32; i++) {
103 "%s: bitstream ended.\n", name);
107 bits[i] = k ?
'1' :
'0';
113 "%s: more than 31 zeroes.\n", name);
117 for (j = 0; j < i; j++) {
119 bits[i + j + 1] = k ?
'1' :
'0';
134 "%"PRId32
", but must be in [%"PRId32
",%"PRId32
"].\n",
135 name, value, range_min, range_max);
144 const char *
name,
const int *subscripts,
146 uint32_t range_min, uint32_t range_max)
152 "%"PRIu32
", but must be in [%"PRIu32
",%"PRIu32
"].\n",
153 name, value, range_min, range_max);
166 for (i = 0; i <
len; i++)
169 for (i = 0; i <
len; i++)
170 bits[len + i + 1] = (value + 1) >> (len - i - 1) & 1 ?
'1' :
'0';
171 bits[len + len + 1] = 0;
174 name, subscripts, bits, value);
187 const char *
name,
const int *subscripts,
196 "%"PRId32
", but must be in [%"PRId32
",%"PRId32
"].\n",
197 name, value, range_min, range_max);
205 uvalue = 2 * (uint32_t)value - 1;
207 uvalue = 2 * (uint32_t)-value;
217 for (i = 0; i <
len; i++)
220 for (i = 0; i <
len; i++)
221 bits[len + i + 1] = (uvalue + 1) >> (len - i - 1) & 1 ?
'1' :
'0';
222 bits[len + len + 1] = 0;
225 name, subscripts, bits, value);
237 #define HEADER(name) do { \
238 ff_cbs_trace_header(ctx, name); \
241 #define CHECK(call) do { \
247 #define FUNC_NAME(rw, codec, name) cbs_ ## codec ## _ ## rw ## _ ## name
248 #define FUNC_H264(rw, name) FUNC_NAME(rw, h264, name)
249 #define FUNC_H265(rw, name) FUNC_NAME(rw, h265, name)
251 #define SUBSCRIPTS(subs, ...) (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL)
253 #define u(width, name, range_min, range_max) \
254 xu(width, name, current->name, range_min, range_max, 0)
255 #define flag(name) u(1, name, 0, 1)
256 #define ue(name, range_min, range_max) \
257 xue(name, current->name, range_min, range_max, 0)
258 #define se(name, range_min, range_max) \
259 xse(name, current->name, range_min, range_max, 0)
261 #define us(width, name, range_min, range_max, subs, ...) \
262 xu(width, name, current->name, range_min, range_max, subs, __VA_ARGS__)
263 #define flags(name, subs, ...) \
264 xu(1, name, current->name, 0, 1, subs, __VA_ARGS__)
265 #define ues(name, range_min, range_max, subs, ...) \
266 xue(name, current->name, range_min, range_max, subs, __VA_ARGS__)
267 #define ses(name, range_min, range_max, subs, ...) \
268 xse(name, current->name, range_min, range_max, subs, __VA_ARGS__)
270 #define fixed(width, name, value) do { \
271 av_unused uint32_t fixed_value = value; \
272 xu(width, name, fixed_value, value, value, 0); \
277 #define READWRITE read
278 #define RWContext GetBitContext
280 #define xu(width, name, var, range_min, range_max, subs, ...) do { \
281 uint32_t value = range_min; \
282 CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \
283 SUBSCRIPTS(subs, __VA_ARGS__), \
284 &value, range_min, range_max)); \
287 #define xue(name, var, range_min, range_max, subs, ...) do { \
288 uint32_t value = range_min; \
289 CHECK(cbs_read_ue_golomb(ctx, rw, #name, \
290 SUBSCRIPTS(subs, __VA_ARGS__), \
291 &value, range_min, range_max)); \
294 #define xse(name, var, range_min, range_max, subs, ...) do { \
295 int32_t value = range_min; \
296 CHECK(cbs_read_se_golomb(ctx, rw, #name, \
297 SUBSCRIPTS(subs, __VA_ARGS__), \
298 &value, range_min, range_max)); \
303 #define infer(name, value) do { \
304 current->name = value; \
312 if (
show_bits(gbc, bits_left) == 1 << (bits_left - 1))
317 #define more_rbsp_data(var) ((var) = cbs_h2645_read_more_rbsp_data(rw))
319 #define byte_alignment(rw) (get_bits_count(rw) % 8)
321 #define allocate(name, size) do { \
322 name ## _ref = av_buffer_allocz(size + \
323 AV_INPUT_BUFFER_PADDING_SIZE); \
325 return AVERROR(ENOMEM); \
326 name = name ## _ref->data; \
329 #define FUNC(name) FUNC_H264(READWRITE, name)
333 #define FUNC(name) FUNC_H265(READWRITE, name)
344 #undef more_rbsp_data
345 #undef byte_alignment
350 #define READWRITE write
351 #define RWContext PutBitContext
353 #define xu(width, name, var, range_min, range_max, subs, ...) do { \
354 uint32_t value = var; \
355 CHECK(ff_cbs_write_unsigned(ctx, rw, width, #name, \
356 SUBSCRIPTS(subs, __VA_ARGS__), \
357 value, range_min, range_max)); \
359 #define xue(name, var, range_min, range_max, subs, ...) do { \
360 uint32_t value = var; \
361 CHECK(cbs_write_ue_golomb(ctx, rw, #name, \
362 SUBSCRIPTS(subs, __VA_ARGS__), \
363 value, range_min, range_max)); \
365 #define xse(name, var, range_min, range_max, subs, ...) do { \
366 int32_t value = var; \
367 CHECK(cbs_write_se_golomb(ctx, rw, #name, \
368 SUBSCRIPTS(subs, __VA_ARGS__), \
369 value, range_min, range_max)); \
372 #define infer(name, value) do { \
373 if (current->name != (value)) { \
374 av_log(ctx->log_ctx, AV_LOG_WARNING, "Warning: " \
375 "%s does not match inferred value: " \
376 "%"PRId64", but should be %"PRId64".\n", \
377 #name, (int64_t)current->name, (int64_t)(value)); \
381 #define more_rbsp_data(var) (var)
383 #define byte_alignment(rw) (put_bits_count(rw) % 8)
385 #define allocate(name, size) do { \
387 av_log(ctx->log_ctx, AV_LOG_ERROR, "%s must be set " \
388 "for writing.\n", #name); \
389 return AVERROR_INVALIDDATA; \
393 #define FUNC(name) FUNC_H264(READWRITE, name)
397 #define FUNC(name) FUNC_H265(READWRITE, name)
412 #undef more_rbsp_data
413 #undef byte_alignment
517 for (i = 0; i < packet->
nb_nals; i++) {
523 while (size > 0 && nal->
data[size - 1] == 0)
530 memcpy(data, nal->
data, size);
569 version = bytestream2_get_byte(&gbc);
572 "first byte %u.", version);
580 count = bytestream2_get_byte(&gbc) & 0x1f;
582 for (i = 0; i <
count; i++) {
585 size = bytestream2_get_be16(&gbc);
593 frag->
data + start, end - start,
604 count = bytestream2_get_byte(&gbc);
606 for (i = 0; i <
count; i++) {
609 size = bytestream2_get_be16(&gbc);
617 frag->
data + start, end - start,
635 int i, j, nb_arrays, nal_unit_type, nb_nals,
version;
644 version = bytestream2_get_byte(&gbc);
647 "first byte %u.", version);
654 nb_arrays = bytestream2_get_byte(&gbc);
655 for (i = 0; i < nb_arrays; i++) {
656 nal_unit_type = bytestream2_get_byte(&gbc) & 0x3f;
657 nb_nals = bytestream2_get_be16(&gbc);
660 for (j = 0; j < nb_nals; j++) {
663 size = bytestream2_get_be16(&gbc);
671 frag->
data + start, end - start,
675 "HVCC array %d (%d NAL units of type %d).\n",
676 i, nb_nals, nal_unit_type);
703 #define cbs_h2645_replace_ps(h26n, ps_name, ps_var, id_element) \
704 static int cbs_h26 ## h26n ## _replace_ ## ps_var(CodedBitstreamContext *ctx, \
705 CodedBitstreamUnit *unit) \
707 CodedBitstreamH26 ## h26n ## Context *priv = ctx->priv_data; \
708 H26 ## h26n ## Raw ## ps_name *ps_var = unit->content; \
709 unsigned int id = ps_var->id_element; \
710 if (id > FF_ARRAY_ELEMS(priv->ps_var)) { \
711 av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid " #ps_name \
712 " id : %d.\n", id); \
713 return AVERROR_INVALIDDATA; \
715 if (priv->ps_var[id] == priv->active_ ## ps_var) \
716 priv->active_ ## ps_var = NULL ; \
717 av_buffer_unref(&priv->ps_var ## _ref[id]); \
718 if (unit->content_ref) \
719 priv->ps_var ## _ref[id] = av_buffer_ref(unit->content_ref); \
721 priv->ps_var ## _ref[id] = av_buffer_alloc(sizeof(*ps_var)); \
722 if (!priv->ps_var ## _ref[id]) \
723 return AVERROR(ENOMEM); \
724 priv->ps_var[id] = (H26 ## h26n ## Raw ## ps_name *)priv->ps_var ## _ref[id]->data; \
725 if (!unit->content_ref) \
726 memcpy(priv->ps_var[id], ps_var, sizeof(*ps_var)); \
732 cbs_h2645_replace_ps(5, VPS,
vps, vps_video_parameter_set_id)
733 cbs_h2645_replace_ps(5,
SPS,
sps, sps_seq_parameter_set_id)
734 cbs_h2645_replace_ps(5, PPS, pps, pps_pic_parameter_set_id)
746 switch (unit->type) {
756 err = cbs_h264_read_sps(ctx, &gbc, sps);
760 err = cbs_h264_replace_sps(ctx, unit);
774 err = cbs_h264_read_sps_extension(ctx, &gbc, unit->content);
790 err = cbs_h264_read_pps(ctx, &gbc, pps);
794 err = cbs_h264_replace_pps(ctx, unit);
811 slice = unit->content;
813 err = cbs_h264_read_slice_header(ctx, &gbc, &slice->
header);
818 len = unit->data_size;
819 if (!unit->data[len - 1]) {
821 for (z = 0; z < len && !unit->data[len - z - 1]; z++);
823 "from slice data.\n", z);
831 slice->
data = unit->data + pos / 8;
843 err = cbs_h264_read_aud(ctx, &gbc, unit->content);
856 err = cbs_h264_read_sei(ctx, &gbc, unit->content);
869 err = cbs_h264_read_filler(ctx, &gbc, unit->content);
885 cbs_h264_read_end_of_sequence :
886 cbs_h264_read_end_of_stream)(ctx, &gbc, unit->content);
909 switch (unit->
type) {
920 err = cbs_h265_read_vps(ctx, &gbc, vps);
924 err = cbs_h265_replace_vps(ctx, unit);
939 err = cbs_h265_read_sps(ctx, &gbc, sps);
943 err = cbs_h265_replace_sps(ctx, unit);
959 err = cbs_h265_read_pps(ctx, &gbc, pps);
963 err = cbs_h265_replace_pps(ctx, unit);
995 err = cbs_h265_read_slice_segment_header(ctx, &gbc, &slice->
header);
1001 if (!unit->
data[len - 1]) {
1003 for (z = 0; z < len && !unit->
data[len - z - 1]; z++);
1005 "from slice data.\n", z);
1013 slice->
data = unit->
data + pos / 8;
1025 err = cbs_h265_read_aud(ctx, &gbc, unit->
content);
1039 err = cbs_h265_read_sei(ctx, &gbc, unit->
content);
1059 switch (unit->
type) {
1064 err = cbs_h264_write_sps(ctx, pbc, sps);
1068 err = cbs_h264_replace_sps(ctx, unit);
1078 err = cbs_h264_write_sps_extension(ctx, pbc, sps_ext);
1088 err = cbs_h264_write_pps(ctx, pbc, pps);
1092 err = cbs_h264_replace_pps(ctx, unit);
1104 int bits_left,
end, zeroes;
1106 err = cbs_h264_write_slice_header(ctx, pbc, &slice->
header);
1128 if (bits_left > zeroes + 1)
1129 put_bits(pbc, bits_left - zeroes - 1,
1130 end >> (zeroes + 1));
1143 err = cbs_h264_write_aud(ctx, pbc, unit->
content);
1151 err = cbs_h264_write_sei(ctx, pbc, unit->
content);
1159 err = cbs_h264_write_filler(ctx, pbc, unit->
content);
1167 err = cbs_h264_write_end_of_sequence(ctx, pbc, unit->
content);
1175 err = cbs_h264_write_end_of_stream(ctx, pbc, unit->
content);
1183 "NAL unit type %"PRIu32
".\n", unit->
type);
1196 switch (unit->
type) {
1201 err = cbs_h265_write_vps(ctx, pbc, vps);
1205 err = cbs_h265_replace_vps(ctx, unit);
1215 err = cbs_h265_write_sps(ctx, pbc, sps);
1219 err = cbs_h265_replace_sps(ctx, unit);
1229 err = cbs_h265_write_pps(ctx, pbc, pps);
1233 err = cbs_h265_replace_pps(ctx, unit);
1258 int bits_left,
end, zeroes;
1260 err = cbs_h265_write_slice_segment_header(ctx, pbc, &slice->
header);
1282 if (bits_left > zeroes + 1)
1283 put_bits(pbc, bits_left - zeroes - 1,
1284 end >> (zeroes + 1));
1296 err = cbs_h265_write_aud(ctx, pbc, unit->
content);
1304 err = cbs_h265_write_sei(ctx, pbc, unit->
content);
1313 "NAL unit type %"PRIu32
".\n", unit->
type);
1332 reallocate_and_try_again:
1336 "sufficiently large write buffer (last attempt "
1352 goto reallocate_and_try_again;
1383 size_t max_size, dp,
sp;
1384 int err, i, zero_run;
1386 for (i = 0; i < frag->
nb_units; i++) {
1392 for (i = 0; i < frag->
nb_units; i++) {
1402 for (i = 0; i < frag->
nb_units; i++) {
1406 if (i < frag->nb_units - 1)
1408 "unaligned padding on non-final NAL unit.\n");
1430 for (sp = 0; sp < unit->
data_size; sp++) {
1432 if (unit->
data[sp] == 0)
1437 if ((unit->
data[sp] & ~3) == 0) {
1441 zero_run = unit->
data[
sp] == 0;
1443 data[dp++] = unit->
data[
sp];
1504 .read_unit = &cbs_h264_read_nal_unit,
1533 for (i = 0; i < au->
nb_units; i++) {
1535 nal = &au->
units[i];
1561 for (i = 0; i < au->
nb_units; i++) {
1594 av_assert0(position >= 0 && position < sei->payload_count);
1600 for (i = 0; i < au->
nb_units; i++) {
1601 if (&au->
units[i] == nal)
1604 av_assert0(i < au->nb_units &&
"NAL unit not in access unit.");
1611 memmove(sei->
payload + position,
static int cbs_h2645_write_nal_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length, void *logctx, int is_nalff, int nal_length_size, enum AVCodecID codec_id, int small_padding)
Split an input packet into NAL units.
static void av_unused put_bits32(PutBitContext *s, uint32_t value)
Write exactly 32 bits into a bitstream.
int nb_units
Number of units in this fragment.
H265RawPPS * pps[HEVC_MAX_PPS_COUNT]
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
ptrdiff_t const GLvoid * data
AVBufferRef * sps_ref[H264_MAX_SPS_COUNT]
union H264RawSEIPayload::@50 payload
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_LOG_WARNING
Something somehow does not look correct.
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
H264RawPPS * pps[H264_MAX_PPS_COUNT]
AVBufferRef * sps_ref[HEVC_MAX_SPS_COUNT]
H264RawNALUnitHeader nal_unit_header
CodedBitstreamUnitType type
Codec-specific type of this unit.
static int cbs_h265_write_nal_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
static int cbs_h265_read_nal_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
static int cbs_read_ue_golomb(CodedBitstreamContext *ctx, GetBitContext *gbc, const char *name, const int *subscripts, uint32_t *write_to, uint32_t range_min, uint32_t range_max)
int ff_cbs_alloc_unit_content(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, size_t size, void(*free)(void *opaque, uint8_t *data))
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.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
static int cbs_h2645_assemble_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
static void cbs_h265_free_sei_payload(H265RawSEIPayload *payload)
CodedBitstreamH2645Context common
static int cbs_write_se_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc, const char *name, const int *subscripts, int32_t value, int32_t range_min, int32_t range_max)
int ff_cbs_h264_add_sei_message(CodedBitstreamContext *ctx, CodedBitstreamFragment *au, const H264RawSEIPayload *payload)
Add an SEI message to an access unit.
Macro definitions for various function/variable attributes.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int trace_enable
Enable trace output during read/write operations.
static void cbs_h264_free_pps(void *unit, uint8_t *content)
struct H264RawSEIPayload::@50::@51 other
AVBufferRef * pps_ref[HEVC_MAX_PPS_COUNT]
static av_cold int end(AVCodecContext *avctx)
static void cbs_h265_free_slice(void *unit, uint8_t *content)
size_t data_bit_padding
The number of bits which should be ignored in the final byte.
H265RawSPS * sps[HEVC_MAX_SPS_COUNT]
void ff_h2645_packet_uninit(H2645Packet *pkt)
Free all the allocated memory in the packet.
static int get_bits_count(const GetBitContext *s)
H264RawSPS * sps[H264_MAX_SPS_COUNT]
H265RawSEIPayload payload[H265_MAX_SEI_PAYLOADS]
static void cbs_h264_close(CodedBitstreamContext *ctx)
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.
Coded bitstream unit structure.
void * content
Pointer to the decomposed form of this unit.
static const uint8_t header[24]
CodedBitstreamUnit * units
Pointer to an array of units of length nb_units.
H265RawPSExtensionData extension_data
uint8_t * data
Pointer to the directly-parsable bitstream form of this unit.
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.
size_t data_size
The number of bytes in the bitstream.
H.264 common definitions.
static int get_bits_left(GetBitContext *gb)
AVCodecID
Identify the syntax and semantics of the bitstream.
buffering period (H.264, D.1.1)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static void cbs_h265_free_pps(void *unit, uint8_t *content)
static int put_bits_left(PutBitContext *s)
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
union H265RawSEIPayload::@55 payload
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
simple assert() macros that are a bit more flexible than ISO C assert().
AVBufferRef * av_buffer_create(uint8_t *data, int size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags)
Create an AVBuffer from an existing array.
size_t data_bit_padding
The number of bits which should be ignored in the final byte.
static int put_bits_count(PutBitContext *s)
H264RawSEIUserDataUnregistered user_data_unregistered
void * log_ctx
Logging context to be passed to all av_log() calls associated with this context.
static void cbs_h264_free_sei_payload(H264RawSEIPayload *payload)
const CodedBitstreamType ff_cbs_type_h264
static void cbs_h265_close(CodedBitstreamContext *ctx)
H265RawPSExtensionData extension_data
GLsizei GLboolean const GLfloat * value
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
int ff_cbs_delete_unit(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int position)
Delete a unit from a fragment and free all memory it uses.
static void cbs_h265_free_vps(void *unit, uint8_t *content)
uint8_t * data
Pointer to the bitstream form of this fragment.
#define FF_ARRAY_ELEMS(a)
AVBufferRef * pps_ref[H264_MAX_PPS_COUNT]
H264RawSEIUserDataRegistered user_data_registered
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static av_always_inline int bytestream2_tell(GetByteContext *g)
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
static void cbs_h264_free_slice(void *unit, uint8_t *content)
Coded bitstream fragment structure, combining one or more units.
AVBufferRef * slice_group_id_ref
static unsigned int get_bits1(GetBitContext *s)
static int FUNC() pps(CodedBitstreamContext *ctx, RWContext *rw, H264RawPPS *current)
Context structure for coded bitstream operations.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
recovery point (frame # to decoder sync)
static int cbs_h2645_read_more_rbsp_data(GetBitContext *gbc)
registered user data as specified by Rec. ITU-T T.35
H264RawSEIPayload payload[H264_MAX_SEI_PAYLOADS]
static void cbs_h265_free_sei(void *unit, uint8_t *content)
static int FUNC() vps(CodedBitstreamContext *ctx, RWContext *rw, H265RawVPS *current)
static int cbs_read_se_golomb(CodedBitstreamContext *ctx, GetBitContext *gbc, const char *name, const int *subscripts, int32_t *write_to, int32_t range_min, int32_t range_max)
AVBufferRef * vps_ref[HEVC_MAX_VPS_COUNT]
void * priv_data
Internal codec-specific data.
A reference to a data buffer.
H265RawPSExtensionData extension_data
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
struct H265RawSEIPayload::@55::@56 other
AVBufferRef * data_ref
A reference to the buffer containing data.
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
const CodedBitstreamType ff_cbs_type_h265
static int FUNC() sei(CodedBitstreamContext *ctx, RWContext *rw, H264RawSEI *current)
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
H265RawSliceHeader header
H264RawSliceHeader header
int ff_cbs_h264_delete_sei_message(CodedBitstreamContext *ctx, CodedBitstreamFragment *au, CodedBitstreamUnit *nal, int position)
Delete an SEI message from an access unit.
mastering display properties
CodedBitstreamH2645Context common
static int cbs_h264_write_nal_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
const struct CodedBitstreamType * codec
Internal codec-specific hooks.
#define cbs_h2645_replace_ps(h26n, ps_name, ps_var, id_element)
static int cbs_h2645_split_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
H265RawVPS * vps[HEVC_MAX_VPS_COUNT]
AVBufferRef * data_ref
A reference to the buffer containing data.
static int cbs_write_ue_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc, const char *name, const int *subscripts, uint32_t value, uint32_t range_min, uint32_t range_max)
void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position, const char *str, const int *subscripts, const char *bits, int64_t value)
static void cbs_h264_free_sei(void *unit, uint8_t *content)
size_t data_size
The number of bytes in the bitstream (including any padding bits in the final byte).
static int cbs_h2645_fragment_add_nals(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const H2645Packet *packet)
static void cbs_h265_free_sps(void *unit, uint8_t *content)