Go to the documentation of this file.
   33                               const char *
name, 
const int *subscripts,
 
   35                               uint32_t range_min, uint32_t range_max)
 
   44     for (
i = 0; 
i < 32; 
i++) {
 
   47                    "%s: bitstream ended.\n", 
name);
 
   51         bits[
i] = k ? 
'1' : 
'0';
 
   57                "%s: more than 31 zeroes.\n", 
name);
 
   61     for (j = 0; j < 
i; j++) {
 
   63         bits[
i + j + 1] = k ? 
'1' : 
'0';
 
   69     if (
ctx->trace_enable)
 
   73     if (value < range_min || value > range_max) {
 
   75                "%"PRIu32
", but must be in [%"PRIu32
",%"PRIu32
"].\n",
 
   85                               const char *
name, 
const int *subscripts,
 
   97     for (
i = 0; 
i < 32; 
i++) {
 
  100                    "%s: bitstream ended.\n", 
name);
 
  104         bits[
i] = k ? 
'1' : 
'0';
 
  110                "%s: more than 31 zeroes.\n", 
name);
 
  114     for (j = 0; j < 
i; j++) {
 
  116         bits[
i + j + 1] = k ? 
'1' : 
'0';
 
  125     if (
ctx->trace_enable)
 
  129     if (value < range_min || value > range_max) {
 
  131                "%"PRId32
", but must be in [%"PRId32
",%"PRId32
"].\n",
 
  141                                const char *
name, 
const int *subscripts,
 
  143                                uint32_t range_min, uint32_t range_max)
 
  147     if (value < range_min || value > range_max) {
 
  149                "%"PRIu32
", but must be in [%"PRIu32
",%"PRIu32
"].\n",
 
  159     if (
ctx->trace_enable) {
 
  184                                const char *
name, 
const int *subscripts,
 
  191     if (value < range_min || value > range_max) {
 
  193                "%"PRId32
", but must be in [%"PRId32
",%"PRId32
"].\n",
 
  202         uvalue = 2 * (uint32_t)
value - 1;
 
  204         uvalue = 2 * (uint32_t)-
value;
 
  210     if (
ctx->trace_enable) {
 
  218             bits[
len + 
i + 1] = (uvalue + 1) >> (
len - 
i - 1) & 1 ? 
'1' : 
'0';
 
  239     int bits_left = payload_size * 8 - cur_pos;
 
  240     return (bits_left > 0 &&
 
  244 #define HEADER(name) do { \ 
  245         ff_cbs_trace_header(ctx, name); \ 
  248 #define CHECK(call) do { \ 
  254 #define FUNC_NAME2(rw, codec, name) cbs_ ## codec ## _ ## rw ## _ ## name 
  255 #define FUNC_NAME1(rw, codec, name) FUNC_NAME2(rw, codec, name) 
  256 #define FUNC_H264(name) FUNC_NAME1(READWRITE, h264, name) 
  257 #define FUNC_H265(name) FUNC_NAME1(READWRITE, h265, name) 
  258 #define FUNC_SEI(name)  FUNC_NAME1(READWRITE, sei,  name) 
  260 #define SUBSCRIPTS(subs, ...) (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL) 
  262 #define u(width, name, range_min, range_max) \ 
  263         xu(width, name, current->name, range_min, range_max, 0, ) 
  264 #define ub(width, name) \ 
  265         xu(width, name, current->name, 0, MAX_UINT_BITS(width), 0, ) 
  266 #define flag(name) ub(1, name) 
  267 #define ue(name, range_min, range_max) \ 
  268         xue(name, current->name, range_min, range_max, 0, ) 
  269 #define i(width, name, range_min, range_max) \ 
  270         xi(width, name, current->name, range_min, range_max, 0, ) 
  271 #define ib(width, name) \ 
  272         xi(width, name, current->name, MIN_INT_BITS(width), MAX_INT_BITS(width), 0, ) 
  273 #define se(name, range_min, range_max) \ 
  274         xse(name, current->name, range_min, range_max, 0, ) 
  276 #define us(width, name, range_min, range_max, subs, ...) \ 
  277         xu(width, name, current->name, range_min, range_max, subs, __VA_ARGS__) 
  278 #define ubs(width, name, subs, ...) \ 
  279         xu(width, name, current->name, 0, MAX_UINT_BITS(width), subs, __VA_ARGS__) 
  280 #define flags(name, subs, ...) \ 
  281         xu(1, name, current->name, 0, 1, subs, __VA_ARGS__) 
  282 #define ues(name, range_min, range_max, subs, ...) \ 
  283         xue(name, current->name, range_min, range_max, subs, __VA_ARGS__) 
  284 #define is(width, name, range_min, range_max, subs, ...) \ 
  285         xi(width, name, current->name, range_min, range_max, subs, __VA_ARGS__) 
  286 #define ibs(width, name, subs, ...) \ 
  287         xi(width, name, current->name, MIN_INT_BITS(width), MAX_INT_BITS(width), subs, __VA_ARGS__) 
  288 #define ses(name, range_min, range_max, subs, ...) \ 
  289         xse(name, current->name, range_min, range_max, subs, __VA_ARGS__) 
  291 #define fixed(width, name, value) do { \ 
  292         av_unused uint32_t fixed_value = value; \ 
  293         xu(width, name, fixed_value, value, value, 0, ); \ 
  298 #define READWRITE read 
  299 #define RWContext GetBitContext 
  301 #define xu(width, name, var, range_min, range_max, subs, ...) do { \ 
  303         CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \ 
  304                                    SUBSCRIPTS(subs, __VA_ARGS__), \ 
  305                                    &value, range_min, range_max)); \ 
  308 #define xue(name, var, range_min, range_max, subs, ...) do { \ 
  310         CHECK(cbs_read_ue_golomb(ctx, rw, #name, \ 
  311                                  SUBSCRIPTS(subs, __VA_ARGS__), \ 
  312                                  &value, range_min, range_max)); \ 
  315 #define xi(width, name, var, range_min, range_max, subs, ...) do { \ 
  317         CHECK(ff_cbs_read_signed(ctx, rw, width, #name, \ 
  318                                  SUBSCRIPTS(subs, __VA_ARGS__), \ 
  319                                  &value, range_min, range_max)); \ 
  322 #define xse(name, var, range_min, range_max, subs, ...) do { \ 
  324         CHECK(cbs_read_se_golomb(ctx, rw, #name, \ 
  325                                  SUBSCRIPTS(subs, __VA_ARGS__), \ 
  326                                  &value, range_min, range_max)); \ 
  331 #define infer(name, value) do { \ 
  332         current->name = value; \ 
  347 #define more_rbsp_data(var) ((var) = cbs_h2645_read_more_rbsp_data(rw)) 
  349 #define bit_position(rw)   (get_bits_count(rw)) 
  350 #define byte_alignment(rw) (get_bits_count(rw) % 8) 
  352 #define allocate(name, size) do { \ 
  353         name ## _ref = av_buffer_allocz(size + \ 
  354                                         AV_INPUT_BUFFER_PADDING_SIZE); \ 
  356             return AVERROR(ENOMEM); \ 
  357         name = name ## _ref->data; \ 
  360 #define FUNC(name) FUNC_SEI(name) 
  364 #define FUNC(name) FUNC_H264(name) 
  368 #define FUNC(name) FUNC_H265(name) 
  380 #undef more_rbsp_data 
  382 #undef byte_alignment 
  387 #define READWRITE write 
  388 #define RWContext PutBitContext 
  390 #define xu(width, name, var, range_min, range_max, subs, ...) do { \ 
  391         uint32_t value = var; \ 
  392         CHECK(ff_cbs_write_unsigned(ctx, rw, width, #name, \ 
  393                                     SUBSCRIPTS(subs, __VA_ARGS__), \ 
  394                                     value, range_min, range_max)); \ 
  396 #define xue(name, var, range_min, range_max, subs, ...) do { \ 
  397         uint32_t value = var; \ 
  398         CHECK(cbs_write_ue_golomb(ctx, rw, #name, \ 
  399                                   SUBSCRIPTS(subs, __VA_ARGS__), \ 
  400                                   value, range_min, range_max)); \ 
  402 #define xi(width, name, var, range_min, range_max, subs, ...) do { \ 
  403         int32_t value = var; \ 
  404         CHECK(ff_cbs_write_signed(ctx, rw, width, #name, \ 
  405                                   SUBSCRIPTS(subs, __VA_ARGS__), \ 
  406                                   value, range_min, range_max)); \ 
  408 #define xse(name, var, range_min, range_max, subs, ...) do { \ 
  409         int32_t value = var; \ 
  410         CHECK(cbs_write_se_golomb(ctx, rw, #name, \ 
  411                                   SUBSCRIPTS(subs, __VA_ARGS__), \ 
  412                                   value, range_min, range_max)); \ 
  415 #define infer(name, value) do { \ 
  416         if (current->name != (value)) { \ 
  417             av_log(ctx->log_ctx, AV_LOG_ERROR, \ 
  418                    "%s does not match inferred value: " \ 
  419                    "%"PRId64", but should be %"PRId64".\n", \ 
  420                    #name, (int64_t)current->name, (int64_t)(value)); \ 
  421             return AVERROR_INVALIDDATA; \ 
  425 #define more_rbsp_data(var) (var) 
  427 #define bit_position(rw)   (put_bits_count(rw)) 
  428 #define byte_alignment(rw) (put_bits_count(rw) % 8) 
  430 #define allocate(name, size) do { \ 
  432             av_log(ctx->log_ctx, AV_LOG_ERROR, "%s must be set " \ 
  433                    "for writing.\n", #name); \ 
  434             return AVERROR_INVALIDDATA; \ 
  438 #define FUNC(name) FUNC_SEI(name) 
  442 #define FUNC(name) FUNC_H264(name) 
  446 #define FUNC(name) FUNC_H265(name) 
  463 #undef more_rbsp_data 
  465 #undef byte_alignment 
  518         size_t size, start, end;
 
  528         version = bytestream2_get_byte(&gbc);
 
  539         count = bytestream2_get_byte(&gbc) & 0x1f;
 
  541         for (
i = 0; 
i < count; 
i++) {
 
  544             size = bytestream2_get_be16(&gbc);
 
  552                                     frag->
data + start, end - start,
 
  563         count = bytestream2_get_byte(&gbc);
 
  565         for (
i = 0; 
i < count; 
i++) {
 
  568             size = bytestream2_get_be16(&gbc);
 
  576                                     frag->
data + start, end - start,
 
  593         size_t size, start, end;
 
  594         int i, j, nb_arrays, nal_unit_type, nb_nals, 
version;
 
  603         version = bytestream2_get_byte(&gbc);
 
  613         nb_arrays = bytestream2_get_byte(&gbc);
 
  614         for (
i = 0; 
i < nb_arrays; 
i++) {
 
  615             nal_unit_type = bytestream2_get_byte(&gbc) & 0x3f;
 
  616             nb_nals = bytestream2_get_be16(&gbc);
 
  619             for (j = 0; j < nb_nals; j++) {
 
  622                 size = bytestream2_get_be16(&gbc);
 
  630                                         frag->
data + start, end - start,
 
  634                        "HVCC array %d (%d NAL units of type %d).\n",
 
  635                        i, nb_nals, nal_unit_type);
 
  662 #define cbs_h2645_replace_ps(h26n, ps_name, ps_var, id_element) \ 
  663 static int cbs_h26 ## h26n ## _replace_ ## ps_var(CodedBitstreamContext *ctx, \ 
  664                                                   CodedBitstreamUnit *unit)  \ 
  666     CodedBitstreamH26 ## h26n ## Context *priv = ctx->priv_data; \ 
  667     H26 ## h26n ## Raw ## ps_name *ps_var = unit->content; \ 
  668     unsigned int id = ps_var->id_element; \ 
  670     if (id >= FF_ARRAY_ELEMS(priv->ps_var)) { \ 
  671         av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid " #ps_name \ 
  672                " id : %d.\n", id); \ 
  673         return AVERROR_INVALIDDATA; \ 
  675     err = ff_cbs_make_unit_refcounted(ctx, unit); \ 
  678     if (priv->ps_var[id] == priv->active_ ## ps_var) \ 
  679         priv->active_ ## ps_var = NULL ; \ 
  680     av_buffer_unref(&priv->ps_var ## _ref[id]); \ 
  681     av_assert0(unit->content_ref); \ 
  682     priv->ps_var ## _ref[id] = av_buffer_ref(unit->content_ref); \ 
  683     if (!priv->ps_var ## _ref[id]) \ 
  684         return AVERROR(ENOMEM); \ 
  685     priv->ps_var[id] = (H26 ## h26n ## Raw ## ps_name *)priv->ps_var ## _ref[id]->data; \ 
  709     switch (unit->
type) {
 
  714             err = cbs_h264_read_sps(
ctx, &gbc, 
sps);
 
  718             err = cbs_h264_replace_sps(
ctx, unit);
 
  726             err = cbs_h264_read_sps_extension(
ctx, &gbc, unit->
content);
 
  736             err = cbs_h264_read_pps(
ctx, &gbc, 
pps);
 
  740             err = cbs_h264_replace_pps(
ctx, unit);
 
  753             err = cbs_h264_read_slice_header(
ctx, &gbc, &slice->
header);
 
  774             err = cbs_h264_read_aud(
ctx, &gbc, unit->
content);
 
  782             err = cbs_h264_read_sei(
ctx, &gbc, unit->
content);
 
  790             err = cbs_h264_read_filler(
ctx, &gbc, unit->
content);
 
  800                    cbs_h264_read_end_of_sequence :
 
  801                    cbs_h264_read_end_of_stream)(
ctx, &gbc, unit->
content);
 
  828     switch (unit->
type) {
 
  833             err = cbs_h265_read_vps(
ctx, &gbc, 
vps);
 
  837             err = cbs_h265_replace_vps(
ctx, unit);
 
  846             err = cbs_h265_read_sps(
ctx, &gbc, 
sps);
 
  850             err = cbs_h265_replace_sps(
ctx, unit);
 
  860             err = cbs_h265_read_pps(
ctx, &gbc, 
pps);
 
  864             err = cbs_h265_replace_pps(
ctx, unit);
 
  890             err = cbs_h265_read_slice_segment_header(
ctx, &gbc, &slice->
header);
 
  911             err = cbs_h265_read_aud(
ctx, &gbc, unit->
content);
 
  920             err = cbs_h265_read_sei(
ctx, &gbc, unit->
content,
 
  937                                       size_t data_size, 
int data_bit_start)
 
  939     size_t rest  = data_size - (data_bit_start + 7) / 8;
 
  940     const uint8_t *
pos = 
data + data_bit_start / 8;
 
  943                data_size > data_bit_start / 8);
 
  949         goto rbsp_stop_one_bit;
 
  954     if (data_bit_start % 8)
 
  955         put_bits(pbc, 8 - data_bit_start % 8,
 
  972         for (; rest > 4; rest -= 4, 
pos += 4)
 
  975         for (; rest > 1; rest--, 
pos++)
 
  984         i = rest ? (8 - 
i) : (8 - 
i - data_bit_start % 8);
 
  999     switch (unit->
type) {
 
 1004             err = cbs_h264_write_sps(
ctx, pbc, 
sps);
 
 1008             err = cbs_h264_replace_sps(
ctx, unit);
 
 1018             err = cbs_h264_write_sps_extension(
ctx, pbc, sps_ext);
 
 1028             err = cbs_h264_write_pps(
ctx, pbc, 
pps);
 
 1032             err = cbs_h264_replace_pps(
ctx, unit);
 
 1044             err = cbs_h264_write_slice_header(
ctx, pbc, &slice->
header);
 
 1063             err = cbs_h264_write_aud(
ctx, pbc, unit->
content);
 
 1071             err = cbs_h264_write_sei(
ctx, pbc, unit->
content);
 
 1079             err = cbs_h264_write_filler(
ctx, pbc, unit->
content);
 
 1087             err = cbs_h264_write_end_of_sequence(
ctx, pbc, unit->
content);
 
 1095             err = cbs_h264_write_end_of_stream(
ctx, pbc, unit->
content);
 
 1103                "NAL unit type %"PRIu32
".\n", unit->
type);
 
 1116     switch (unit->
type) {
 
 1121             err = cbs_h265_write_vps(
ctx, pbc, 
vps);
 
 1125             err = cbs_h265_replace_vps(
ctx, unit);
 
 1135             err = cbs_h265_write_sps(
ctx, pbc, 
sps);
 
 1139             err = cbs_h265_replace_sps(
ctx, unit);
 
 1149             err = cbs_h265_write_pps(
ctx, pbc, 
pps);
 
 1153             err = cbs_h265_replace_pps(
ctx, unit);
 
 1178             err = cbs_h265_write_slice_segment_header(
ctx, pbc, &slice->
header);
 
 1196             err = cbs_h265_write_aud(
ctx, pbc, unit->
content);
 
 1205             err = cbs_h265_write_sei(
ctx, pbc, unit->
content,
 
 1215                "NAL unit type %"PRIu32
".\n", unit->
type);
 
 1227     if (nal_unit_index == 0) {
 
 1242     size_t max_size, dp, 
sp;
 
 1243     int err, 
i, zero_run;
 
 1265             if (i < frag->nb_units - 1)
 
 1267                        "unaligned padding on non-final NAL unit.\n");
 
 1289                 if ((unit->
data[
sp] & ~3) == 0) {
 
 1293                 zero_run = unit->
data[
sp] == 0;
 
 1408         .nb_ref_offsets = 1,
 
 1444         .nb_ref_offsets = 1,
 
 1456         .nb_ref_offsets = 1,
 
 1482     .read_unit         = &cbs_h264_read_nal_unit,
 
 1661     switch (
ctx->codec->codec_id) {
 
  
H265RawVPS * vps[HEVC_MAX_VPS_COUNT]
#define AV_LOG_WARNING
Something somehow does not look correct.
@ SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS
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
#define CBS_UNIT_TYPE_COMPLEX(type, structure, free_func)
AVBufferRef * pps_ref[HEVC_MAX_PPS_COUNT]
static int FUNC() filler_payload(CodedBitstreamContext *ctx, RWContext *rw, SEIRawFillerPayload *current, SEIMessageState *state)
static int get_bits_left(GetBitContext *gb)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
AVBufferRef * sps_ref[HEVC_MAX_SPS_COUNT]
static void av_unused put_bits32(PutBitContext *s, uint32_t value)
Write exactly 32 bits into a bitstream.
CodedBitstreamH2645Context common
@ H264_NAL_AUXILIARY_SLICE
void * content
Pointer to the decomposed form of this unit.
H265RawSliceHeader header
static int get_bits_count(const GetBitContext *s)
@ SEI_TYPE_RECOVERY_POINT
H264RawPPS * pps[H264_MAX_PPS_COUNT]
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
H265RawSPS * sps[HEVC_MAX_SPS_COUNT]
Context structure for coded bitstream operations.
void ff_h2645_packet_uninit(H2645Packet *pkt)
Free all the allocated memory in the packet.
int ff_cbs_alloc_unit_content2(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
Allocate a new internal content buffer matching the type of the unit.
#define AV_LOG_VERBOSE
Detailed information.
CodedBitstreamUnitType type
Codec-specific type of this unit.
@ SEI_TYPE_BUFFERING_PERIOD
static int cbs_h2645_split_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
AVBufferRef * sps_ref[H264_MAX_SPS_COUNT]
CodedBitstreamH2645Context common
@ SEI_TYPE_USER_DATA_UNREGISTERED
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static int cbs_h2645_unit_requires_zero_byte(enum AVCodecID codec_id, CodedBitstreamUnitType type, int nal_unit_index)
Coded bitstream unit structure.
@ SEI_TYPE_ALPHA_CHANNEL_INFO
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
static void cbs_h265_flush(CodedBitstreamContext *ctx)
static const SEIMessageTypeDescriptor cbs_sei_h265_types[]
const H264RawSPS * active_sps
static int cbs_h2645_fragment_add_nals(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const H2645Packet *packet)
#define CBS_UNIT_TYPE_INTERNAL_REF(type, structure, ref_field)
static void cbs_h264_flush(CodedBitstreamContext *ctx)
@ CBS_CONTENT_TYPE_INTERNAL_REFS
static int put_bits_left(PutBitContext *s)
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.
static int FUNC() alternative_transfer_characteristics(CodedBitstreamContext *ctx, RWContext *rw, SEIRawAlternativeTransferCharacteristics *current, SEIMessageState *state)
static int FUNC() mastering_display_colour_volume(CodedBitstreamContext *ctx, RWContext *rw, SEIRawMasteringDisplayColourVolume *current, SEIMessageState *state)
static const SEIMessageTypeDescriptor cbs_sei_common_types[]
CodedBitstreamUnit * units
Pointer to an array of units of length nb_units_allocated.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static void cbs_h265_free_sei(void *opaque, uint8_t *content)
static int FUNC() extension_data(CodedBitstreamContext *ctx, RWContext *rw, H265RawExtensionData *current)
#define FF_ARRAY_ELEMS(a)
static int FUNC() sei_alpha_channel_info(CodedBitstreamContext *ctx, RWContext *rw, H265RawSEIAlphaChannelInfo *current, SEIMessageState *sei)
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)
Coded bitstream fragment structure, combining one or more units.
#define CBS_UNIT_TYPE_POD(type, structure)
size_t data_size
The number of bytes in the bitstream.
@ SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35
#define SEI_MESSAGE_RW(codec, name)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define SEI_MESSAGE_TYPE_END
int ff_cbs_append_unit_data(CodedBitstreamFragment *frag, CodedBitstreamUnitType type, uint8_t *data, size_t data_size, AVBufferRef *data_buf)
Add a new unit to a fragment with the given data bitstream.
#define cbs_h2645_replace_ps(h26n, ps_name, ps_var, id_element)
@ SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO
size_t data_bit_padding
The number of bits which should be ignored in the final byte.
#define MAX_UINT_BITS(length)
static int FUNC() sei_display_orientation(CodedBitstreamContext *ctx, RWContext *rw, H264RawSEIDisplayOrientation *current, SEIMessageState *sei)
static int cbs_h265_payload_extension_present(GetBitContext *gbc, uint32_t payload_size, int cur_pos)
static void flush(AVCodecContext *avctx)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
void * av_realloc(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
static int FUNC() film_grain_characteristics(CodedBitstreamContext *ctx, RWContext *rw, H264RawFilmGrainCharacteristics *current, SEIMessageState *state)
static int FUNC() sei_decoded_picture_hash(CodedBitstreamContext *ctx, RWContext *rw, H265RawSEIDecodedPictureHash *current, SEIMessageState *sei)
static int cbs_h265_write_nal_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
static int FUNC() user_data_unregistered(CodedBitstreamContext *ctx, RWContext *rw, SEIRawUserDataUnregistered *current, SEIMessageState *state)
static unsigned int get_bits1(GetBitContext *s)
size_t data_size
The number of bytes in the bitstream (including any padding bits in the final byte).
@ SEI_TYPE_FILLER_PAYLOAD
static int FUNC() vps(CodedBitstreamContext *ctx, RWContext *rw, H265RawVPS *current)
@ SEI_TYPE_FILM_GRAIN_CHARACTERISTICS
static int FUNC() sei(CodedBitstreamContext *ctx, RWContext *rw, H264RawSEI *current)
static const CodedBitstreamUnitTypeDescriptor cbs_h264_unit_types[]
AVBufferRef * av_buffer_create(uint8_t *data, size_t size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags)
Create an AVBuffer from an existing array.
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
AVCodecID
Identify the syntax and semantics of the bitstream.
static av_always_inline int bytestream2_tell(GetByteContext *g)
AVBufferRef * vps_ref[HEVC_MAX_VPS_COUNT]
static int FUNC() pps(CodedBitstreamContext *ctx, RWContext *rw, H264RawPPS *current)
const FFCodec * codec_list[]
AVBufferRef * pps_ref[H264_MAX_PPS_COUNT]
uint8_t * data
Pointer to the bitstream form of this fragment.
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
size_t data_bit_padding
The number of bits which should be ignored in the final byte.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
static void cbs_h264_free_sei(void *opaque, uint8_t *content)
@ CBS_CONTENT_TYPE_COMPLEX
static const uint8_t header[24]
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, int use_ref)
Split an input packet into NAL units.
static int FUNC() sei_active_parameter_sets(CodedBitstreamContext *ctx, RWContext *rw, H265RawSEIActiveParameterSets *current, SEIMessageState *sei)
static void cbs_h265_close(CodedBitstreamContext *ctx)
const H264RawPPS * active_pps
void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position, const char *str, const int *subscripts, const char *bits, int64_t value)
static int FUNC() sei_time_code(CodedBitstreamContext *ctx, RWContext *rw, H265RawSEITimeCode *current, SEIMessageState *sei)
const SEIMessageTypeDescriptor * ff_cbs_sei_find_type(CodedBitstreamContext *ctx, int payload_type)
Find the type descriptor for the given payload type.
H264RawSliceHeader header
uint8_t last_slice_nal_unit_type
AVBufferRef * data_ref
A reference to the buffer containing data.
#define i(width, name, range_min, range_max)
static int put_bits_count(PutBitContext *s)
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
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
AVBufferRef * rbsp_buffer_ref
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)
const H265RawSPS * active_sps
#define CBS_UNIT_TYPE_END_OF_LIST
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)
static void cbs_h264_close(CodedBitstreamContext *ctx)
H265RawPPS * pps[HEVC_MAX_PPS_COUNT]
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
#define AV_INPUT_BUFFER_PADDING_SIZE
const H265RawPPS * active_pps
static uint8_t * put_bits_ptr(PutBitContext *s)
Return the pointer to the byte where the bitstream writer will put the next bit.
uint32_t CodedBitstreamUnitType
The codec-specific type of a bitstream unit.
static int FUNC() sei_pan_scan_rect(CodedBitstreamContext *ctx, RWContext *rw, H264RawSEIPanScanRect *current, SEIMessageState *sei)
static void skip_put_bytes(PutBitContext *s, int n)
Skip the given number of bytes.
const H265RawVPS * active_vps
static int ref[MAX_W *MAX_W]
static int FUNC() content_light_level_info(CodedBitstreamContext *ctx, RWContext *rw, SEIRawContentLightLevelInfo *current, SEIMessageState *state)
@ SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME
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)
static int FUNC() sei_buffering_period(CodedBitstreamContext *ctx, RWContext *rw, H264RawSEIBufferingPeriod *current, SEIMessageState *sei)
@ SEI_TYPE_ACTIVE_PARAMETER_SETS
A reference to a data buffer.
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
static int cbs_h265_read_nal_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
static int cbs_h2645_write_slice_data(CodedBitstreamContext *ctx, PutBitContext *pbc, const uint8_t *data, size_t data_size, int data_bit_start)
static const CodedBitstreamUnitTypeDescriptor cbs_h265_unit_types[]
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
static int FUNC() sei_recovery_point(CodedBitstreamContext *ctx, RWContext *rw, H264RawSEIRecoveryPoint *current, SEIMessageState *sei)
const CodedBitstreamType ff_cbs_type_h264
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
AVBufferRef * data_ref
A reference to the buffer containing data.
void ff_cbs_sei_free_message_list(SEIRawMessageList *list)
Free all SEI messages in a message list.
static int FUNC() sei_pic_timing(CodedBitstreamContext *ctx, RWContext *rw, H264RawSEIPicTiming *current, SEIMessageState *sei)
@ SEI_TYPE_DISPLAY_ORIENTATION
H264RawSPS * sps[H264_MAX_SPS_COUNT]
const CodedBitstreamType ff_cbs_type_h265
@ SEI_TYPE_DECODED_PICTURE_HASH
void * priv_data
Format private data.
static int cbs_h264_write_nal_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
static const SEIMessageTypeDescriptor cbs_sei_h264_types[]
static int cbs_h2645_assemble_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
int nb_units
Number of units in this fragment.
static int cbs_h2645_read_more_rbsp_data(GetBitContext *gbc)
static int FUNC() user_data_registered(CodedBitstreamContext *ctx, RWContext *rw, SEIRawUserDataRegistered *current, SEIMessageState *state)