FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 READ
 
#define READWRITE   read
 
#define RWContext   GetBitContext
 
#define xui(width, name, var)
 
#define ui(width, name)   xui(width, name, current->name)
 
#define marker_bit()
 
#define nextbits(width, compare, var)
 
#define WRITE
 
#define READWRITE   write
 
#define RWContext   PutBitContext
 
#define xui(width, name, var)
 
#define ui(width, name)   xui(width, name, current->name)
 
#define marker_bit()
 
#define nextbits(width, compare, var)   (var)
 
#define START(start_code, type, func)
 
#define START(start_code, type, func)
 

Functions

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)
 
static int cbs_mpeg2_assemble_fragment (CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
 
static void cbs_mpeg2_free_unit (CodedBitstreamUnit *unit)
 
static void cbs_mpeg2_close (CodedBitstreamContext *ctx)
 

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:288
AVFormatContext * ctx
Definition: movenc.c:48
const char * name
Definition: opengl_enc.c:103

Definition at line 27 of file cbs_mpeg2.c.

#define CHECK (   call)
Value:
do { \
err = (call); \
if (err < 0) \
return err; \
} while (0)
return
if(ret< 0)
Definition: vf_mcdeint.c:279

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 READ

Definition at line 42 of file cbs_mpeg2.c.

#define READWRITE   read

Definition at line 77 of file cbs_mpeg2.c.

#define RWContext   GetBitContext

Definition at line 78 of file cbs_mpeg2.c.

#define xui (   width,
  name,
  var 
)
Value:
do { \
uint32_t value = 0; \
&value, 0, (1 << width) - 1)); \
var = value; \
} while (0)
uint16_t width
Definition: gdv.c:47
#define CHECK(call)
Definition: cbs_mpeg2.c:31
GLsizei GLboolean const GLfloat * value
Definition: opengl_enc.c:109
AVFormatContext * ctx
Definition: movenc.c:48
const char * name
Definition: opengl_enc.c:103
int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, uint32_t *write_to, uint32_t range_min, uint32_t range_max)
Definition: cbs.c:321

Definition at line 80 of file cbs_mpeg2.c.

Referenced by slice_header(), and user_data().

#define ui (   width,
  name 
)    xui(width, name, current->name)
#define marker_bit ( )
Value:
do { \
av_unused uint32_t one; \
CHECK(ff_cbs_read_unsigned(ctx, rw, 1, "marker_bit", &one, 1, 1)); \
} while (0)
#define CHECK(call)
Definition: cbs_mpeg2.c:31
AVFormatContext * ctx
Definition: movenc.c:48
#define av_unused
Definition: attributes.h:125
int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, uint32_t *write_to, uint32_t range_min, uint32_t range_max)
Definition: cbs.c:321

Definition at line 88 of file cbs_mpeg2.c.

Referenced by picture_display_extension(), sequence_display_extension(), sequence_extension(), and sequence_header().

#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:587
uint16_t width
Definition: gdv.c:47
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
Definition: get_bits.h:296

Definition at line 92 of file cbs_mpeg2.c.

Referenced by slice_header().

#define WRITE

Definition at line 76 of file cbs_mpeg2.c.

#define READWRITE   write

Definition at line 77 of file cbs_mpeg2.c.

#define RWContext   PutBitContext

Definition at line 78 of file cbs_mpeg2.c.

#define xui (   width,
  name,
  var 
)
Value:
do { \
var, 0, (1 << width) - 1)); \
} while (0)
int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, uint32_t value, uint32_t range_min, uint32_t range_max)
Definition: cbs.c:362
uint16_t width
Definition: gdv.c:47
#define CHECK(call)
Definition: cbs_mpeg2.c:31
AVFormatContext * ctx
Definition: movenc.c:48
const char * name
Definition: opengl_enc.c:103

Definition at line 80 of file cbs_mpeg2.c.

#define ui (   width,
  name 
)    xui(width, name, current->name)

Definition at line 85 of file cbs_mpeg2.c.

#define marker_bit ( )
Value:
do { \
CHECK(ff_cbs_write_unsigned(ctx, rw, 1, "marker_bit", 1, 1, 1)); \
} while (0)
int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, uint32_t value, uint32_t range_min, uint32_t range_max)
Definition: cbs.c:362
#define CHECK(call)
Definition: cbs_mpeg2.c:31
AVFormatContext * ctx
Definition: movenc.c:48

Definition at line 88 of file cbs_mpeg2.c.

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

Definition at line 92 of file cbs_mpeg2.c.

#define START (   start_code,
  type,
  func 
)
Value:
case start_code: \
{ \
header = av_mallocz(sizeof(*header)); \
if (!header) \
return AVERROR(ENOMEM); \
err = cbs_mpeg2_read_ ## func(ctx, &gbc, header); \
if (err < 0) { \
av_free(header); \
return err; \
} \
unit->content = header; \
} \
break;
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:236
static const uint8_t header[24]
Definition: sdr2.c:67
#define AVERROR(e)
Definition: error.h:43
return
AVFormatContext * ctx
Definition: movenc.c:48
GLint GLenum type
Definition: opengl_enc.c:105
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Definition: jacosubdec.c:67
if(ret< 0)
Definition: vf_mcdeint.c:279
#define av_free(p)
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 int cbs_mpeg2_split_fragment ( CodedBitstreamContext ctx,
CodedBitstreamFragment frag,
int  header 
)
static

Definition at line 105 of file cbs_mpeg2.c.

static int cbs_mpeg2_read_unit ( CodedBitstreamContext ctx,
CodedBitstreamUnit unit 
)
static

Definition at line 157 of file cbs_mpeg2.c.

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

Definition at line 232 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 258 of file cbs_mpeg2.c.

Referenced by cbs_mpeg2_write_unit().

static int cbs_mpeg2_write_unit ( CodedBitstreamContext ctx,
CodedBitstreamUnit unit 
)
static

Definition at line 292 of file cbs_mpeg2.c.

static int cbs_mpeg2_assemble_fragment ( CodedBitstreamContext ctx,
CodedBitstreamFragment frag 
)
static

Definition at line 347 of file cbs_mpeg2.c.

static void cbs_mpeg2_free_unit ( CodedBitstreamUnit unit)
static

Definition at line 382 of file cbs_mpeg2.c.

static void cbs_mpeg2_close ( CodedBitstreamContext ctx)
static

Definition at line 395 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,
.free_unit = &cbs_mpeg2_free_unit,
.close = &cbs_mpeg2_close,
}
static void cbs_mpeg2_free_unit(CodedBitstreamUnit *unit)
Definition: cbs_mpeg2.c:382
static int cbs_mpeg2_write_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
Definition: cbs_mpeg2.c:292
static int cbs_mpeg2_read_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
Definition: cbs_mpeg2.c:157
static int cbs_mpeg2_assemble_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
Definition: cbs_mpeg2.c:347
static int cbs_mpeg2_split_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
Definition: cbs_mpeg2.c:105
preferred ID for MPEG-1/2 video decoding
Definition: avcodec.h:220
static void cbs_mpeg2_close(CodedBitstreamContext *ctx)
Definition: cbs_mpeg2.c:395

Definition at line 402 of file cbs_mpeg2.c.