FFmpeg
Macros | Functions | Variables
cbs_mpeg2.c File Reference
#include "libavutil/avassert.h"
#include "cbs.h"
#include "cbs_internal.h"
#include "cbs_mpeg2.h"
#include "internal.h"
#include "cbs_mpeg2_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_MPEG2(rw, name)   FUNC_NAME(rw, mpeg2, name)
 
#define FUNC(name)   FUNC_MPEG2(READWRITE, name)
 
#define SUBSCRIPTS(subs, ...)   (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL)
 
#define ui(width, name)   xui(width, name, current->name, 0, MAX_UINT_BITS(width), 0)
 
#define uir(width, name)   xui(width, name, current->name, 1, MAX_UINT_BITS(width), 0)
 
#define uis(width, name, subs, ...)   xui(width, name, current->name, 0, MAX_UINT_BITS(width), subs, __VA_ARGS__)
 
#define uirs(width, name, subs, ...)   xui(width, name, current->name, 1, MAX_UINT_BITS(width), subs, __VA_ARGS__)
 
#define xui(width, name, var, range_min, range_max, subs, ...)   xuia(width, #name, var, range_min, range_max, subs, __VA_ARGS__)
 
#define sis(width, name, subs, ...)   xsi(width, name, current->name, subs, __VA_ARGS__)
 
#define marker_bit()   bit("marker_bit", 1)
 
#define bit(string, value)
 
#define READ
 
#define READWRITE   read
 
#define RWContext   GetBitContext
 
#define xuia(width, string, var, range_min, range_max, subs, ...)
 
#define xsi(width, name, var, subs, ...)
 
#define nextbits(width, compare, var)
 
#define infer(name, value)
 
#define WRITE
 
#define READWRITE   write
 
#define RWContext   PutBitContext
 
#define xuia(width, string, var, range_min, range_max, subs, ...)
 
#define xsi(width, name, var, subs, ...)
 
#define nextbits(width, compare, var)   (var)
 
#define infer(name, value)
 
#define START(start_code, type, read_func, free_func)
 
#define START(start_code, type, func)
 

Functions

static void cbs_mpeg2_free_picture_header (void *opaque, uint8_t *content)
 
static void cbs_mpeg2_free_user_data (void *opaque, uint8_t *content)
 
static void cbs_mpeg2_free_slice (void *opaque, uint8_t *content)
 
static int cbs_mpeg2_split_fragment (CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
 
static int cbs_mpeg2_read_unit (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
 
static int cbs_mpeg2_write_header (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
 
static int cbs_mpeg2_write_slice (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
 
static int cbs_mpeg2_write_unit (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
 
static int cbs_mpeg2_assemble_fragment (CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
 

Variables

const CodedBitstreamType ff_cbs_type_mpeg2
 

Macro Definition Documentation

#define HEADER (   name)
Value:
do { \
} while (0)
void ff_cbs_trace_header(CodedBitstreamContext *ctx, const char *name)
Definition: cbs.c:426
AVFormatContext * ctx
Definition: movenc.c:48
const char * name
Definition: opengl_enc.c:102

Definition at line 27 of file cbs_mpeg2.c.

#define CHECK (   call)
Value:
do { \
err = (call); \
if (err < 0) \
return err; \
} while (0)
if(ret)
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a it should return

Definition at line 31 of file cbs_mpeg2.c.

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

Definition at line 37 of file cbs_mpeg2.c.

#define FUNC_MPEG2 (   rw,
  name 
)    FUNC_NAME(rw, mpeg2, name)

Definition at line 38 of file cbs_mpeg2.c.

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

Definition at line 39 of file cbs_mpeg2.c.

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

Definition at line 41 of file cbs_mpeg2.c.

#define ui (   width,
  name 
)    xui(width, name, current->name, 0, MAX_UINT_BITS(width), 0)
#define uir (   width,
  name 
)    xui(width, name, current->name, 1, MAX_UINT_BITS(width), 0)
#define uis (   width,
  name,
  subs,
  ... 
)    xui(width, name, current->name, 0, MAX_UINT_BITS(width), subs, __VA_ARGS__)

Definition at line 47 of file cbs_mpeg2.c.

Referenced by user_data().

#define uirs (   width,
  name,
  subs,
  ... 
)    xui(width, name, current->name, 1, MAX_UINT_BITS(width), subs, __VA_ARGS__)

Definition at line 49 of file cbs_mpeg2.c.

Referenced by quant_matrix_extension(), and sequence_header().

#define xui (   width,
  name,
  var,
  range_min,
  range_max,
  subs,
  ... 
)    xuia(width, #name, var, range_min, range_max, subs, __VA_ARGS__)

Definition at line 51 of file cbs_mpeg2.c.

#define sis (   width,
  name,
  subs,
  ... 
)    xsi(width, name, current->name, subs, __VA_ARGS__)

Definition at line 53 of file cbs_mpeg2.c.

Referenced by picture_display_extension().

#define marker_bit ( )    bit("marker_bit", 1)
#define bit (   string,
  value 
)
#define READ

Definition at line 64 of file cbs_mpeg2.c.

#define READWRITE   read

Definition at line 105 of file cbs_mpeg2.c.

#define RWContext   GetBitContext

Definition at line 106 of file cbs_mpeg2.c.

#define xuia (   width,
  string,
  var,
  range_min,
  range_max,
  subs,
  ... 
)
Value:
do { \
uint32_t value; \
SUBSCRIPTS(subs, __VA_ARGS__), \
&value, range_min, range_max)); \
var = value; \
} while (0)
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
GLsizei GLboolean const GLfloat * value
Definition: opengl_enc.c:108
#define CHECK(call)
Definition: cbs_mpeg2.c:31
#define width
AVFormatContext * ctx
Definition: movenc.c:48
#define SUBSCRIPTS(subs,...)
Definition: cbs_mpeg2.c:41

Definition at line 108 of file cbs_mpeg2.c.

Referenced by extra_information().

#define xsi (   width,
  name,
  var,
  subs,
  ... 
)
Value:
do { \
SUBSCRIPTS(subs, __VA_ARGS__), &value, \
var = value; \
} while (0)
GLsizei GLboolean const GLfloat * value
Definition: opengl_enc.c:108
#define MAX_INT_BITS(length)
Definition: cbs_internal.h:102
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
#define CHECK(call)
Definition: cbs_mpeg2.c:31
#define width
int32_t
AVFormatContext * ctx
Definition: movenc.c:48
#define SUBSCRIPTS(subs,...)
Definition: cbs_mpeg2.c:41
#define MIN_INT_BITS(length)
Definition: cbs_internal.h:106
const char * name
Definition: opengl_enc.c:102

Definition at line 114 of file cbs_mpeg2.c.

#define nextbits (   width,
  compare,
  var 
)
Value:
(get_bits_left(rw) >= width && \
(var = show_bits(rw, width)) == (compare))
static float compare(const AVFrame *haystack, const AVFrame *obj, int offx, int offy)
Definition: vf_find_rect.c:105
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:849
#define width
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
Definition: get_bits.h:446

Definition at line 121 of file cbs_mpeg2.c.

Referenced by extra_information(), and slice_header().

#define infer (   name,
  value 
)
Value:
do { \
current->name = value; \
} while (0)
GLsizei GLboolean const GLfloat * value
Definition: opengl_enc.c:108

Definition at line 123 of file cbs_mpeg2.c.

#define WRITE

Definition at line 104 of file cbs_mpeg2.c.

#define READWRITE   write

Definition at line 105 of file cbs_mpeg2.c.

#define RWContext   PutBitContext

Definition at line 106 of file cbs_mpeg2.c.

#define xuia (   width,
  string,
  var,
  range_min,
  range_max,
  subs,
  ... 
)
Value:
do { \
SUBSCRIPTS(subs, __VA_ARGS__), \
var, range_min, range_max)); \
} while (0)
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
#define CHECK(call)
Definition: cbs_mpeg2.c:31
#define width
AVFormatContext * ctx
Definition: movenc.c:48
#define SUBSCRIPTS(subs,...)
Definition: cbs_mpeg2.c:41

Definition at line 108 of file cbs_mpeg2.c.

#define xsi (   width,
  name,
  var,
  subs,
  ... 
)
Value:
do { \
SUBSCRIPTS(subs, __VA_ARGS__), var, \
} while (0)
#define MAX_INT_BITS(length)
Definition: cbs_internal.h:102
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
#define CHECK(call)
Definition: cbs_mpeg2.c:31
#define width
AVFormatContext * ctx
Definition: movenc.c:48
#define SUBSCRIPTS(subs,...)
Definition: cbs_mpeg2.c:41
#define MIN_INT_BITS(length)
Definition: cbs_internal.h:106
const char * name
Definition: opengl_enc.c:102

Definition at line 114 of file cbs_mpeg2.c.

#define nextbits (   width,
  compare,
  var 
)    (var)

Definition at line 121 of file cbs_mpeg2.c.

#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)
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
GLsizei GLboolean const GLfloat * value
Definition: opengl_enc.c:108
#define av_log(a,...)
AVFormatContext * ctx
Definition: movenc.c:48
if(ret)
const char * name
Definition: opengl_enc.c:102

Definition at line 123 of file cbs_mpeg2.c.

#define START (   start_code,
  type,
  read_func,
  free_func 
)
Value:
case start_code: \
{ \
sizeof(*header), free_func); \
if (err < 0) \
return err; \
header = unit->content; \
err = cbs_mpeg2_read_ ## read_func(ctx, &gbc, header); \
if (err < 0) \
return err; \
} \
break;
int ff_cbs_alloc_unit_content(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, size_t size, void(*free)(void *opaque, uint8_t *data))
Definition: cbs.c:644
GLint GLenum type
Definition: opengl_enc.c:104
static const uint8_t header[24]
Definition: sdr2.c:67
AVFormatContext * ctx
Definition: movenc.c:48
if(ret)
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a it should return
static const uint8_t start_code[]

Referenced by cbs_mpeg2_read_unit(), and cbs_mpeg2_write_header().

#define START (   start_code,
  type,
  func 
)
Value:
case start_code: \
err = cbs_mpeg2_write_ ## func(ctx, pbc, unit->content); \
break;
AVFormatContext * ctx
Definition: movenc.c:48
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Definition: jacosubdec.c:67
static const uint8_t start_code[]

Function Documentation

static void cbs_mpeg2_free_picture_header ( void opaque,
uint8_t content 
)
static

Definition at line 143 of file cbs_mpeg2.c.

Referenced by cbs_mpeg2_read_unit().

static void cbs_mpeg2_free_user_data ( void opaque,
uint8_t content 
)
static

Definition at line 150 of file cbs_mpeg2.c.

Referenced by cbs_mpeg2_read_unit().

static void cbs_mpeg2_free_slice ( void opaque,
uint8_t content 
)
static

Definition at line 157 of file cbs_mpeg2.c.

Referenced by cbs_mpeg2_read_unit().

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

Definition at line 165 of file cbs_mpeg2.c.

static int cbs_mpeg2_read_unit ( CodedBitstreamContext ctx,
CodedBitstreamUnit unit 
)
static

Definition at line 224 of file cbs_mpeg2.c.

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

Definition at line 296 of file cbs_mpeg2.c.

Referenced by cbs_mpeg2_write_unit().

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

Definition at line 324 of file cbs_mpeg2.c.

Referenced by cbs_mpeg2_write_unit().

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

Definition at line 373 of file cbs_mpeg2.c.

static int cbs_mpeg2_assemble_fragment ( CodedBitstreamContext ctx,
CodedBitstreamFragment frag 
)
static

Definition at line 383 of file cbs_mpeg2.c.

Variable Documentation

const CodedBitstreamType ff_cbs_type_mpeg2
Initial value:
= {
.priv_data_size = sizeof(CodedBitstreamMPEG2Context),
.split_fragment = &cbs_mpeg2_split_fragment,
.read_unit = &cbs_mpeg2_read_unit,
.write_unit = &cbs_mpeg2_write_unit,
.assemble_fragment = &cbs_mpeg2_assemble_fragment,
}
static int cbs_mpeg2_read_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
Definition: cbs_mpeg2.c:224
static int cbs_mpeg2_assemble_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
Definition: cbs_mpeg2.c:383
static int cbs_mpeg2_split_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
Definition: cbs_mpeg2.c:165
preferred ID for MPEG-1/2 video decoding
Definition: avcodec.h:220
static int cbs_mpeg2_write_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
Definition: cbs_mpeg2.c:373

Definition at line 420 of file cbs_mpeg2.c.