FFmpeg
Macros | Functions | Variables
cbs_h2645.c File Reference
#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "bytestream.h"
#include "cbs.h"
#include "cbs_internal.h"
#include "cbs_h264.h"
#include "cbs_h265.h"
#include "h264.h"
#include "h264_sei.h"
#include "h2645_parse.h"
#include "hevc.h"
#include "hevc_sei.h"
#include "cbs_h264_syntax_template.c"
#include "cbs_h265_syntax_template.c"

Go to the source code of this file.

Macros

#define HEADER(name)
 
#define CHECK(call)
 
#define FUNC_NAME(rw, codec, name)   cbs_ ## codec ## _ ## rw ## _ ## name
 
#define FUNC_H264(rw, name)   FUNC_NAME(rw, h264, name)
 
#define FUNC_H265(rw, name)   FUNC_NAME(rw, h265, name)
 
#define SUBSCRIPTS(subs, ...)   (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL)
 
#define u(width, name, range_min, range_max)   xu(width, name, current->name, range_min, range_max, 0)
 
#define ub(width, name)   xu(width, name, current->name, 0, MAX_UINT_BITS(width), 0)
 
#define flag(name)   ub(1, name)
 
#define ue(name, range_min, range_max)   xue(name, current->name, range_min, range_max, 0)
 
#define i(width, name, range_min, range_max)   xi(width, name, current->name, range_min, range_max, 0)
 
#define ib(width, name)   xi(width, name, current->name, MIN_INT_BITS(width), MAX_INT_BITS(width), 0)
 
#define se(name, range_min, range_max)   xse(name, current->name, range_min, range_max, 0)
 
#define us(width, name, range_min, range_max, subs, ...)   xu(width, name, current->name, range_min, range_max, subs, __VA_ARGS__)
 
#define ubs(width, name, subs, ...)   xu(width, name, current->name, 0, MAX_UINT_BITS(width), subs, __VA_ARGS__)
 
#define flags(name, subs, ...)   xu(1, name, current->name, 0, 1, subs, __VA_ARGS__)
 
#define ues(name, range_min, range_max, subs, ...)   xue(name, current->name, range_min, range_max, subs, __VA_ARGS__)
 
#define is(width, name, range_min, range_max, subs, ...)   xi(width, name, current->name, range_min, range_max, subs, __VA_ARGS__)
 
#define ibs(width, name, subs, ...)   xi(width, name, current->name, MIN_INT_BITS(width), MAX_INT_BITS(width), subs, __VA_ARGS__)
 
#define ses(name, range_min, range_max, subs, ...)   xse(name, current->name, range_min, range_max, subs, __VA_ARGS__)
 
#define fixed(width, name, value)
 
#define READ
 
#define READWRITE   read
 
#define RWContext   GetBitContext
 
#define xu(width, name, var, range_min, range_max, subs, ...)
 
#define xue(name, var, range_min, range_max, subs, ...)
 
#define xi(width, name, var, range_min, range_max, subs, ...)
 
#define xse(name, var, range_min, range_max, subs, ...)
 
#define infer(name, value)
 
#define more_rbsp_data(var)   ((var) = cbs_h2645_read_more_rbsp_data(rw))
 
#define byte_alignment(rw)   (get_bits_count(rw) % 8)
 
#define allocate(name, size)
 
#define FUNC(name)   FUNC_H264(READWRITE, name)
 
#define FUNC(name)   FUNC_H265(READWRITE, name)
 
#define WRITE
 
#define READWRITE   write
 
#define RWContext   PutBitContext
 
#define xu(width, name, var, range_min, range_max, subs, ...)
 
#define xue(name, var, range_min, range_max, subs, ...)
 
#define xi(width, name, var, range_min, range_max, subs, ...)
 
#define xse(name, var, range_min, range_max, subs, ...)
 
#define infer(name, value)
 
#define more_rbsp_data(var)   (var)
 
#define byte_alignment(rw)   (put_bits_count(rw) % 8)
 
#define allocate(name, size)
 
#define FUNC(name)   FUNC_H264(READWRITE, name)
 
#define FUNC(name)   FUNC_H265(READWRITE, name)
 
#define cbs_h2645_replace_ps(h26n, ps_name, ps_var, id_element)
 

Functions

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)
 
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 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 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)
 
static int cbs_h2645_read_more_rbsp_data (GetBitContext *gbc)
 
static void cbs_h264_free_pps (void *unit, uint8_t *content)
 
static void cbs_h264_free_sei_payload (H264RawSEIPayload *payload)
 
static void cbs_h264_free_sei (void *unit, uint8_t *content)
 
static void cbs_h264_free_slice (void *unit, uint8_t *content)
 
static void cbs_h265_free_vps (void *unit, uint8_t *content)
 
static void cbs_h265_free_sps (void *unit, uint8_t *content)
 
static void cbs_h265_free_pps (void *unit, uint8_t *content)
 
static void cbs_h265_free_slice (void *unit, uint8_t *content)
 
static void cbs_h265_free_sei_payload (H265RawSEIPayload *payload)
 
static void cbs_h265_free_sei (void *unit, uint8_t *content)
 
static int cbs_h2645_fragment_add_nals (CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const H2645Packet *packet)
 
static int cbs_h2645_split_fragment (CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
 
 cbs_h2645_replace_ps (cbs_h2645_replace_ps(4, cbs_h2645_replace_ps(SPS, cbs_h2645_replace_ps(sps, seq_parameter_set_id)
 
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 int cbs_h264_write_nal_unit (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
 
static int cbs_h265_write_nal_unit (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
 
static int cbs_h2645_assemble_fragment (CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
 
static void cbs_h264_close (CodedBitstreamContext *ctx)
 
static void cbs_h265_close (CodedBitstreamContext *ctx)
 
int ff_cbs_h264_add_sei_message (CodedBitstreamContext *ctx, CodedBitstreamFragment *au, const H264RawSEIPayload *payload)
 Add an SEI message to an access unit. More...
 
void ff_cbs_h264_delete_sei_message (CodedBitstreamContext *ctx, CodedBitstreamFragment *au, CodedBitstreamUnit *nal, int position)
 Delete an SEI message from an access unit. More...
 

Variables

const CodedBitstreamType ff_cbs_type_h264
 
const CodedBitstreamType ff_cbs_type_h265
 

Macro Definition Documentation

◆ HEADER

#define HEADER (   name)
Value:
do { \
ff_cbs_trace_header(ctx, name); \
} while (0)

Definition at line 236 of file cbs_h2645.c.

◆ CHECK

#define CHECK (   call)
Value:
do { \
err = (call); \
if (err < 0) \
return err; \
} while (0)

Definition at line 240 of file cbs_h2645.c.

◆ FUNC_NAME

#define FUNC_NAME (   rw,
  codec,
  name 
)    cbs_ ## codec ## _ ## rw ## _ ## name

Definition at line 246 of file cbs_h2645.c.

◆ FUNC_H264

#define FUNC_H264 (   rw,
  name 
)    FUNC_NAME(rw, h264, name)

Definition at line 247 of file cbs_h2645.c.

◆ FUNC_H265

#define FUNC_H265 (   rw,
  name 
)    FUNC_NAME(rw, h265, name)

Definition at line 248 of file cbs_h2645.c.

◆ SUBSCRIPTS

#define SUBSCRIPTS (   subs,
  ... 
)    (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL)

Definition at line 250 of file cbs_h2645.c.

◆ u

#define u (   width,
  name,
  range_min,
  range_max 
)    xu(width, name, current->name, range_min, range_max, 0)

Definition at line 252 of file cbs_h2645.c.

◆ ub

#define ub (   width,
  name 
)    xu(width, name, current->name, 0, MAX_UINT_BITS(width), 0)

Definition at line 254 of file cbs_h2645.c.

◆ flag

#define flag (   name)    ub(1, name)

Definition at line 256 of file cbs_h2645.c.

◆ ue

#define ue (   name,
  range_min,
  range_max 
)    xue(name, current->name, range_min, range_max, 0)

Definition at line 257 of file cbs_h2645.c.

◆ i

#define i (   width,
  name,
  range_min,
  range_max 
)    xi(width, name, current->name, range_min, range_max, 0)

◆ ib

#define ib (   width,
  name 
)    xi(width, name, current->name, MIN_INT_BITS(width), MAX_INT_BITS(width), 0)

Definition at line 261 of file cbs_h2645.c.

◆ se

#define se (   name,
  range_min,
  range_max 
)    xse(name, current->name, range_min, range_max, 0)

Definition at line 263 of file cbs_h2645.c.

◆ us

#define us (   width,
  name,
  range_min,
  range_max,
  subs,
  ... 
)    xu(width, name, current->name, range_min, range_max, subs, __VA_ARGS__)

Definition at line 266 of file cbs_h2645.c.

◆ ubs

#define ubs (   width,
  name,
  subs,
  ... 
)    xu(width, name, current->name, 0, MAX_UINT_BITS(width), subs, __VA_ARGS__)

Definition at line 268 of file cbs_h2645.c.

◆ flags

#define flags (   name,
  subs,
  ... 
)    xu(1, name, current->name, 0, 1, subs, __VA_ARGS__)

Definition at line 270 of file cbs_h2645.c.

◆ ues

#define ues (   name,
  range_min,
  range_max,
  subs,
  ... 
)    xue(name, current->name, range_min, range_max, subs, __VA_ARGS__)

Definition at line 272 of file cbs_h2645.c.

◆ is

#define is (   width,
  name,
  range_min,
  range_max,
  subs,
  ... 
)    xi(width, name, current->name, range_min, range_max, subs, __VA_ARGS__)

Definition at line 274 of file cbs_h2645.c.

◆ ibs

#define ibs (   width,
  name,
  subs,
  ... 
)    xi(width, name, current->name, MIN_INT_BITS(width), MAX_INT_BITS(width), subs, __VA_ARGS__)

Definition at line 276 of file cbs_h2645.c.

◆ ses

#define ses (   name,
  range_min,
  range_max,
  subs,
  ... 
)    xse(name, current->name, range_min, range_max, subs, __VA_ARGS__)

Definition at line 278 of file cbs_h2645.c.

◆ fixed

#define fixed (   width,
  name,
  value 
)
Value:
do { \
av_unused uint32_t fixed_value = value; \
xu(width, name, fixed_value, value, value, 0); \
} while (0)

Definition at line 281 of file cbs_h2645.c.

◆ READ

#define READ

Definition at line 287 of file cbs_h2645.c.

◆ READWRITE [1/2]

#define READWRITE   read

Definition at line 371 of file cbs_h2645.c.

◆ RWContext [1/2]

#define RWContext   GetBitContext

Definition at line 372 of file cbs_h2645.c.

◆ xu [1/2]

#define xu (   width,
  name,
  var,
  range_min,
  range_max,
  subs,
  ... 
)
Value:
do { \
uint32_t value; \
SUBSCRIPTS(subs, __VA_ARGS__), \
&value, range_min, range_max)); \
var = value; \
} while (0)

Definition at line 374 of file cbs_h2645.c.

◆ xue [1/2]

#define xue (   name,
  var,
  range_min,
  range_max,
  subs,
  ... 
)
Value:
do { \
uint32_t value; \
CHECK(cbs_read_ue_golomb(ctx, rw, #name, \
SUBSCRIPTS(subs, __VA_ARGS__), \
&value, range_min, range_max)); \
var = value; \
} while (0)

Definition at line 380 of file cbs_h2645.c.

◆ xi [1/2]

#define xi (   width,
  name,
  var,
  range_min,
  range_max,
  subs,
  ... 
)
Value:
do { \
int32_t value; \
CHECK(ff_cbs_read_signed(ctx, rw, width, #name, \
SUBSCRIPTS(subs, __VA_ARGS__), \
&value, range_min, range_max)); \
var = value; \
} while (0)

Definition at line 386 of file cbs_h2645.c.

◆ xse [1/2]

#define xse (   name,
  var,
  range_min,
  range_max,
  subs,
  ... 
)
Value:
do { \
int32_t value; \
CHECK(cbs_read_se_golomb(ctx, rw, #name, \
SUBSCRIPTS(subs, __VA_ARGS__), \
&value, range_min, range_max)); \
var = value; \
} while (0)

Definition at line 392 of file cbs_h2645.c.

◆ infer [1/2]

#define infer (   name,
  value 
)
Value:
do { \
current->name = value; \
} while (0)

Definition at line 399 of file cbs_h2645.c.

◆ more_rbsp_data [1/2]

#define more_rbsp_data (   var)    ((var) = cbs_h2645_read_more_rbsp_data(rw))

Definition at line 408 of file cbs_h2645.c.

◆ byte_alignment [1/2]

#define byte_alignment (   rw)    (get_bits_count(rw) % 8)

Definition at line 410 of file cbs_h2645.c.

◆ allocate [1/2]

#define allocate (   name,
  size 
)
Value:
do { \
name ## _ref = av_buffer_allocz(size + \
if (!name ## _ref) \
return AVERROR(ENOMEM); \
name = name ## _ref->data; \
} while (0)

Definition at line 412 of file cbs_h2645.c.

◆ FUNC [1/4]

#define FUNC (   name)    FUNC_H264(READWRITE, name)

Definition at line 424 of file cbs_h2645.c.

◆ FUNC [2/4]

#define FUNC (   name)    FUNC_H265(READWRITE, name)

Definition at line 424 of file cbs_h2645.c.

◆ WRITE

#define WRITE

Definition at line 370 of file cbs_h2645.c.

◆ READWRITE [2/2]

#define READWRITE   write

Definition at line 371 of file cbs_h2645.c.

◆ RWContext [2/2]

#define RWContext   PutBitContext

Definition at line 372 of file cbs_h2645.c.

◆ xu [2/2]

#define xu (   width,
  name,
  var,
  range_min,
  range_max,
  subs,
  ... 
)
Value:
do { \
uint32_t value = var; \
SUBSCRIPTS(subs, __VA_ARGS__), \
value, range_min, range_max)); \
} while (0)

Definition at line 374 of file cbs_h2645.c.

◆ xue [2/2]

#define xue (   name,
  var,
  range_min,
  range_max,
  subs,
  ... 
)
Value:
do { \
uint32_t value = var; \
CHECK(cbs_write_ue_golomb(ctx, rw, #name, \
SUBSCRIPTS(subs, __VA_ARGS__), \
value, range_min, range_max)); \
} while (0)

Definition at line 380 of file cbs_h2645.c.

◆ xi [2/2]

#define xi (   width,
  name,
  var,
  range_min,
  range_max,
  subs,
  ... 
)
Value:
do { \
int32_t value = var; \
SUBSCRIPTS(subs, __VA_ARGS__), \
value, range_min, range_max)); \
} while (0)

Definition at line 386 of file cbs_h2645.c.

◆ xse [2/2]

#define xse (   name,
  var,
  range_min,
  range_max,
  subs,
  ... 
)
Value:
do { \
int32_t value = var; \
CHECK(cbs_write_se_golomb(ctx, rw, #name, \
SUBSCRIPTS(subs, __VA_ARGS__), \
value, range_min, range_max)); \
} while (0)

Definition at line 392 of file cbs_h2645.c.

◆ infer [2/2]

#define infer (   name,
  value 
)
Value:
do { \
if (current->name != (value)) { \
av_log(ctx->log_ctx, AV_LOG_WARNING, "Warning: " \
"%s does not match inferred value: " \
"%"PRId64", but should be %"PRId64".\n", \
#name, (int64_t)current->name, (int64_t)(value)); \
} \
} while (0)

Definition at line 399 of file cbs_h2645.c.

◆ more_rbsp_data [2/2]

#define more_rbsp_data (   var)    (var)

Definition at line 408 of file cbs_h2645.c.

◆ byte_alignment [2/2]

#define byte_alignment (   rw)    (put_bits_count(rw) % 8)

Definition at line 410 of file cbs_h2645.c.

◆ allocate [2/2]

#define allocate (   name,
  size 
)
Value:
do { \
if (!name) { \
av_log(ctx->log_ctx, AV_LOG_ERROR, "%s must be set " \
"for writing.\n", #name); \
} \
} while (0)

Definition at line 412 of file cbs_h2645.c.

◆ FUNC [3/4]

#define FUNC (   name)    FUNC_H264(READWRITE, name)

Definition at line 424 of file cbs_h2645.c.

◆ FUNC [4/4]

#define FUNC (   name)    FUNC_H265(READWRITE, name)

Definition at line 424 of file cbs_h2645.c.

◆ cbs_h2645_replace_ps

#define cbs_h2645_replace_ps (   h26n,
  ps_name,
  ps_var,
  id_element 
)
Value:
static int cbs_h26 ## h26n ## _replace_ ## ps_var(CodedBitstreamContext *ctx, \
{ \
CodedBitstreamH26 ## h26n ## Context *priv = ctx->priv_data; \
H26 ## h26n ## Raw ## ps_name *ps_var = unit->content; \
unsigned int id = ps_var->id_element; \
if (id >= FF_ARRAY_ELEMS(priv->ps_var)) { \
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid " #ps_name \
" id : %d.\n", id); \
} \
if (priv->ps_var[id] == priv->active_ ## ps_var) \
priv->active_ ## ps_var = NULL ; \
av_buffer_unref(&priv->ps_var ## _ref[id]); \
if (unit->content_ref) \
priv->ps_var ## _ref[id] = av_buffer_ref(unit->content_ref); \
else \
priv->ps_var ## _ref[id] = av_buffer_alloc(sizeof(*ps_var)); \
if (!priv->ps_var ## _ref[id]) \
return AVERROR(ENOMEM); \
priv->ps_var[id] = (H26 ## h26n ## Raw ## ps_name *)priv->ps_var ## _ref[id]->data; \
if (!unit->content_ref) \
memcpy(priv->ps_var[id], ps_var, sizeof(*ps_var)); \
return 0; \
}

Definition at line 747 of file cbs_h2645.c.

Function Documentation

◆ cbs_read_ue_golomb()

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 
)
static

Definition at line 34 of file cbs_h2645.c.

◆ cbs_read_se_golomb()

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

Definition at line 86 of file cbs_h2645.c.

◆ cbs_write_ue_golomb()

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

Definition at line 142 of file cbs_h2645.c.

◆ cbs_write_se_golomb()

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 
)
static

Definition at line 185 of file cbs_h2645.c.

◆ cbs_h2645_read_more_rbsp_data()

static int cbs_h2645_read_more_rbsp_data ( GetBitContext gbc)
static

Definition at line 325 of file cbs_h2645.c.

Referenced by cbs_h2645_replace_ps(), cbs_h265_read_nal_unit(), extension_data(), and sei().

◆ cbs_h264_free_pps()

static void cbs_h264_free_pps ( void *  unit,
uint8_t content 
)
static

Definition at line 446 of file cbs_h2645.c.

Referenced by cbs_h2645_replace_ps().

◆ cbs_h264_free_sei_payload()

static void cbs_h264_free_sei_payload ( H264RawSEIPayload payload)
static

Definition at line 453 of file cbs_h2645.c.

Referenced by cbs_h264_free_sei(), and ff_cbs_h264_delete_sei_message().

◆ cbs_h264_free_sei()

static void cbs_h264_free_sei ( void *  unit,
uint8_t content 
)
static

Definition at line 476 of file cbs_h2645.c.

Referenced by cbs_h2645_replace_ps(), and ff_cbs_h264_add_sei_message().

◆ cbs_h264_free_slice()

static void cbs_h264_free_slice ( void *  unit,
uint8_t content 
)
static

Definition at line 485 of file cbs_h2645.c.

Referenced by cbs_h2645_replace_ps().

◆ cbs_h265_free_vps()

static void cbs_h265_free_vps ( void *  unit,
uint8_t content 
)
static

Definition at line 492 of file cbs_h2645.c.

Referenced by cbs_h265_read_nal_unit().

◆ cbs_h265_free_sps()

static void cbs_h265_free_sps ( void *  unit,
uint8_t content 
)
static

Definition at line 499 of file cbs_h2645.c.

Referenced by cbs_h265_read_nal_unit().

◆ cbs_h265_free_pps()

static void cbs_h265_free_pps ( void *  unit,
uint8_t content 
)
static

Definition at line 506 of file cbs_h2645.c.

Referenced by cbs_h265_read_nal_unit().

◆ cbs_h265_free_slice()

static void cbs_h265_free_slice ( void *  unit,
uint8_t content 
)
static

Definition at line 513 of file cbs_h2645.c.

Referenced by cbs_h265_read_nal_unit().

◆ cbs_h265_free_sei_payload()

static void cbs_h265_free_sei_payload ( H265RawSEIPayload payload)
static

Definition at line 520 of file cbs_h2645.c.

Referenced by cbs_h265_free_sei().

◆ cbs_h265_free_sei()

static void cbs_h265_free_sei ( void *  unit,
uint8_t content 
)
static

Definition at line 548 of file cbs_h2645.c.

Referenced by cbs_h265_read_nal_unit().

◆ cbs_h2645_fragment_add_nals()

static int cbs_h2645_fragment_add_nals ( CodedBitstreamContext ctx,
CodedBitstreamFragment frag,
const H2645Packet packet 
)
static

Definition at line 557 of file cbs_h2645.c.

Referenced by cbs_h2645_split_fragment().

◆ cbs_h2645_split_fragment()

static int cbs_h2645_split_fragment ( CodedBitstreamContext ctx,
CodedBitstreamFragment frag,
int  header 
)
static

Definition at line 588 of file cbs_h2645.c.

◆ cbs_h2645_replace_ps()

cbs_h2645_replace_ps ( cbs_h2645_replace_ps(  4,
cbs_h2645_replace_ps(  SPS,
cbs_h2645_replace_ps(  sps,
seq_parameter_set_id   
)

Definition at line 774 of file cbs_h2645.c.

◆ cbs_h265_read_nal_unit()

static int cbs_h265_read_nal_unit ( CodedBitstreamContext ctx,
CodedBitstreamUnit unit 
)
static

Definition at line 939 of file cbs_h2645.c.

◆ cbs_h2645_write_slice_data()

static int cbs_h2645_write_slice_data ( CodedBitstreamContext ctx,
PutBitContext pbc,
const uint8_t data,
size_t  data_size,
int  data_bit_start 
)
static

Definition at line 1091 of file cbs_h2645.c.

Referenced by cbs_h264_write_nal_unit(), and cbs_h265_write_nal_unit().

◆ cbs_h264_write_nal_unit()

static int cbs_h264_write_nal_unit ( CodedBitstreamContext ctx,
CodedBitstreamUnit unit,
PutBitContext pbc 
)
static

Definition at line 1149 of file cbs_h2645.c.

◆ cbs_h265_write_nal_unit()

static int cbs_h265_write_nal_unit ( CodedBitstreamContext ctx,
CodedBitstreamUnit unit,
PutBitContext pbc 
)
static

Definition at line 1266 of file cbs_h2645.c.

◆ cbs_h2645_assemble_fragment()

static int cbs_h2645_assemble_fragment ( CodedBitstreamContext ctx,
CodedBitstreamFragment frag 
)
static

Definition at line 1378 of file cbs_h2645.c.

◆ cbs_h264_close()

static void cbs_h264_close ( CodedBitstreamContext ctx)
static

Definition at line 1465 of file cbs_h2645.c.

◆ cbs_h265_close()

static void cbs_h265_close ( CodedBitstreamContext ctx)
static

Definition at line 1478 of file cbs_h2645.c.

◆ ff_cbs_h264_add_sei_message()

int ff_cbs_h264_add_sei_message ( CodedBitstreamContext ctx,
CodedBitstreamFragment au,
const H264RawSEIPayload payload 
)

Add an SEI message to an access unit.

Definition at line 1519 of file cbs_h2645.c.

Referenced by h264_metadata_filter().

◆ ff_cbs_h264_delete_sei_message()

void ff_cbs_h264_delete_sei_message ( CodedBitstreamContext ctx,
CodedBitstreamFragment access_unit,
CodedBitstreamUnit nal_unit,
int  position 
)

Delete an SEI message from an access unit.

Deletes from nal_unit, which must be an SEI NAL unit. If this is the last message in nal_unit, also deletes it from access_unit.

Requires nal_unit to be a unit in access_unit and position to be >= 0 and < the payload count of the SEI nal_unit.

Definition at line 1581 of file cbs_h2645.c.

Referenced by h264_metadata_filter().

Variable Documentation

◆ ff_cbs_type_h264

const CodedBitstreamType ff_cbs_type_h264
Initial value:
= {
.codec_id = AV_CODEC_ID_H264,
.priv_data_size = sizeof(CodedBitstreamH264Context),
.split_fragment = &cbs_h2645_split_fragment,
.read_unit = &cbs_h264_read_nal_unit,
.write_unit = &cbs_h264_write_nal_unit,
.assemble_fragment = &cbs_h2645_assemble_fragment,
.close = &cbs_h264_close,
}

Definition at line 1493 of file cbs_h2645.c.

◆ ff_cbs_type_h265

const CodedBitstreamType ff_cbs_type_h265
Initial value:
= {
.codec_id = AV_CODEC_ID_HEVC,
.priv_data_size = sizeof(CodedBitstreamH265Context),
.split_fragment = &cbs_h2645_split_fragment,
.read_unit = &cbs_h265_read_nal_unit,
.write_unit = &cbs_h265_write_nal_unit,
.assemble_fragment = &cbs_h2645_assemble_fragment,
.close = &cbs_h265_close,
}

Definition at line 1506 of file cbs_h2645.c.

AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
av_buffer_alloc
AVBufferRef * av_buffer_alloc(int size)
Allocate an AVBuffer of the given size using av_malloc().
Definition: buffer.c:67
AVERROR
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
name
const char * name
Definition: avisynth_c.h:867
CodedBitstreamContext
Context structure for coded bitstream operations.
Definition: cbs.h:168
av_buffer_allocz
AVBufferRef * av_buffer_allocz(int size)
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
Definition: buffer.c:83
cbs_h2645_split_fragment
static int cbs_h2645_split_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
Definition: cbs_h2645.c:588
CodedBitstreamUnit
Coded bitstream unit structure.
Definition: cbs.h:64
ff_cbs_write_unsigned
int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, const int *subscripts, uint32_t value, uint32_t range_min, uint32_t range_max)
Definition: cbs.c:528
Context
Definition: async.c:56
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
cbs_read_ue_golomb
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)
Definition: cbs_h2645.c:34
width
#define width
ctx
AVFormatContext * ctx
Definition: movenc.c:48
AV_CODEC_ID_H264
@ AV_CODEC_ID_H264
Definition: avcodec.h:245
if
if(ret)
Definition: filter_design.txt:179
NULL
#define NULL
Definition: coverity.c:32
cbs_h265_write_nal_unit
static int cbs_h265_write_nal_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
Definition: cbs_h2645.c:1266
CodedBitstreamH264Context
Definition: cbs_h264.h:445
id
enum AVCodecID id
Definition: extract_extradata_bsf.c:329
size
int size
Definition: twinvq_data.h:11134
ff_cbs_write_signed
int ff_cbs_write_signed(CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, const int *subscripts, int32_t value, int32_t range_min, int32_t range_max)
Definition: cbs.c:607
ff_cbs_read_signed
int ff_cbs_read_signed(CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, const int *subscripts, int32_t *write_to, int32_t range_min, int32_t range_max)
Definition: cbs.c:564
cbs_h265_close
static void cbs_h265_close(CodedBitstreamContext *ctx)
Definition: cbs_h2645.c:1478
AV_CODEC_ID_HEVC
@ AV_CODEC_ID_HEVC
Definition: avcodec.h:392
value
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
Definition: writing_filters.txt:86
cbs_write_se_golomb
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)
Definition: cbs_h2645.c:185
ff_cbs_read_unsigned
int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, const int *subscripts, uint32_t *write_to, uint32_t range_min, uint32_t range_max)
Definition: cbs.c:485
cbs_read_se_golomb
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)
Definition: cbs_h2645.c:86
cbs_h264_close
static void cbs_h264_close(CodedBitstreamContext *ctx)
Definition: cbs_h2645.c:1465
AV_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE
Definition: avcodec.h:790
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen_template.c:38
cbs_write_ue_golomb
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)
Definition: cbs_h2645.c:142
av_buffer_ref
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
Definition: buffer.c:93
cbs_h265_read_nal_unit
static int cbs_h265_read_nal_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
Definition: cbs_h2645.c:939
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
AVFormatContext::priv_data
void * priv_data
Format private data.
Definition: avformat.h:1370
cbs_h264_write_nal_unit
static int cbs_h264_write_nal_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
Definition: cbs_h2645.c:1149
cbs_h2645_assemble_fragment
static int cbs_h2645_assemble_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
Definition: cbs_h2645.c:1378
CodedBitstreamH265Context
Definition: cbs_h265.h:727
SUBSCRIPTS
#define SUBSCRIPTS(subs,...)
Definition: cbs_h2645.c:250