FFmpeg
Macros | Functions | Variables
cbs_jpeg.c File Reference
#include "cbs.h"
#include "cbs_internal.h"
#include "cbs_jpeg.h"
#include "cbs_jpeg_syntax_template.c"

Go to the source code of this file.

Macros

#define HEADER(name)
 
#define CHECK(call)
 
#define SUBSCRIPTS(subs, ...)   (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL)
 
#define u(width, name, range_min, range_max)   xu(width, name, range_min, range_max, 0, )
 
#define us(width, name, sub, range_min, range_max)   xu(width, name, range_min, range_max, 1, sub)
 
#define READ
 
#define READWRITE   read
 
#define RWContext   GetBitContext
 
#define FUNC(name)   cbs_jpeg_read_ ## name
 
#define xu(width, name, range_min, range_max, subs, ...)
 
#define WRITE
 
#define READWRITE   write
 
#define RWContext   PutBitContext
 
#define FUNC(name)   cbs_jpeg_write_ ## name
 
#define xu(width, name, range_min, range_max, subs, ...)
 
#define SEGMENT(marker, type, func, free)
 
#define SEGMENT(marker, func)
 

Functions

static void cbs_jpeg_free_application_data (void *opaque, uint8_t *content)
 
static void cbs_jpeg_free_comment (void *opaque, uint8_t *content)
 
static void cbs_jpeg_free_scan (void *opaque, uint8_t *content)
 
static int cbs_jpeg_split_fragment (CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
 
static int cbs_jpeg_read_unit (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
 
static int cbs_jpeg_write_scan (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
 
static int cbs_jpeg_write_segment (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
 
static int cbs_jpeg_write_unit (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
 
static int cbs_jpeg_assemble_fragment (CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
 

Variables

const CodedBitstreamType ff_cbs_type_jpeg
 

Macro Definition Documentation

◆ HEADER

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

Definition at line 24 of file cbs_jpeg.c.

◆ CHECK

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

Definition at line 28 of file cbs_jpeg.c.

◆ SUBSCRIPTS

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

Definition at line 34 of file cbs_jpeg.c.

◆ u

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

Definition at line 36 of file cbs_jpeg.c.

◆ us

#define us (   width,
  name,
  sub,
  range_min,
  range_max 
)    xu(width, name, range_min, range_max, 1, sub)

Definition at line 38 of file cbs_jpeg.c.

◆ READ

#define READ

Definition at line 42 of file cbs_jpeg.c.

◆ READWRITE [1/2]

#define READWRITE   read

Definition at line 64 of file cbs_jpeg.c.

◆ RWContext [1/2]

#define RWContext   GetBitContext

Definition at line 65 of file cbs_jpeg.c.

◆ FUNC [1/2]

#define FUNC (   name)    cbs_jpeg_read_ ## name

Definition at line 66 of file cbs_jpeg.c.

◆ xu [1/2]

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

Definition at line 68 of file cbs_jpeg.c.

◆ WRITE

#define WRITE

Definition at line 63 of file cbs_jpeg.c.

◆ READWRITE [2/2]

#define READWRITE   write

Definition at line 64 of file cbs_jpeg.c.

◆ RWContext [2/2]

#define RWContext   PutBitContext

Definition at line 65 of file cbs_jpeg.c.

◆ FUNC [2/2]

#define FUNC (   name)    cbs_jpeg_write_ ## name

Definition at line 66 of file cbs_jpeg.c.

◆ xu [2/2]

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

Definition at line 68 of file cbs_jpeg.c.

◆ SEGMENT [1/2]

#define SEGMENT (   marker,
  type,
  func,
  free 
)
Value:
case JPEG_MARKER_ ## marker: \
{ \
sizeof(type), free); \
if (err < 0) \
return err; \
err = cbs_jpeg_read_ ## func(ctx, &gbc, unit->content); \
if (err < 0) \
return err; \
} \
break

◆ SEGMENT [2/2]

#define SEGMENT (   marker,
  func 
)
Value:
case JPEG_MARKER_ ## marker: \
err = cbs_jpeg_write_ ## func(ctx, pbc, unit->content); \
break;

Function Documentation

◆ cbs_jpeg_free_application_data()

static void cbs_jpeg_free_application_data ( void *  opaque,
uint8_t *  content 
)
static

Definition at line 85 of file cbs_jpeg.c.

Referenced by cbs_jpeg_read_unit().

◆ cbs_jpeg_free_comment()

static void cbs_jpeg_free_comment ( void *  opaque,
uint8_t *  content 
)
static

Definition at line 92 of file cbs_jpeg.c.

Referenced by cbs_jpeg_read_unit().

◆ cbs_jpeg_free_scan()

static void cbs_jpeg_free_scan ( void *  opaque,
uint8_t *  content 
)
static

Definition at line 99 of file cbs_jpeg.c.

Referenced by cbs_jpeg_read_unit().

◆ cbs_jpeg_split_fragment()

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

Definition at line 106 of file cbs_jpeg.c.

◆ cbs_jpeg_read_unit()

static int cbs_jpeg_read_unit ( CodedBitstreamContext ctx,
CodedBitstreamUnit unit 
)
static

Definition at line 241 of file cbs_jpeg.c.

◆ cbs_jpeg_write_scan()

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

Definition at line 326 of file cbs_jpeg.c.

Referenced by cbs_jpeg_write_unit().

◆ cbs_jpeg_write_segment()

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

Definition at line 352 of file cbs_jpeg.c.

Referenced by cbs_jpeg_write_unit().

◆ cbs_jpeg_write_unit()

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

Definition at line 381 of file cbs_jpeg.c.

◆ cbs_jpeg_assemble_fragment()

static int cbs_jpeg_assemble_fragment ( CodedBitstreamContext ctx,
CodedBitstreamFragment frag 
)
static

Definition at line 391 of file cbs_jpeg.c.

Variable Documentation

◆ ff_cbs_type_jpeg

const CodedBitstreamType ff_cbs_type_jpeg
Initial value:
= {
.codec_id = AV_CODEC_ID_MJPEG,
.split_fragment = &cbs_jpeg_split_fragment,
.read_unit = &cbs_jpeg_read_unit,
.write_unit = &cbs_jpeg_write_unit,
.assemble_fragment = &cbs_jpeg_assemble_fragment,
}

Definition at line 459 of file cbs_jpeg.c.

func
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Definition: jacosubdec.c:68
name
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
Definition: writing_filters.txt:88
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:582
type
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
Definition: writing_filters.txt:86
width
#define width
cbs_jpeg_assemble_fragment
static int cbs_jpeg_assemble_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
Definition: cbs_jpeg.c:391
ctx
AVFormatContext * ctx
Definition: movenc.c:48
ff_cbs_alloc_unit_content
int ff_cbs_alloc_unit_content(CodedBitstreamUnit *unit, size_t size, void(*free)(void *opaque, uint8_t *data))
Definition: cbs.c:698
cbs_jpeg_read_unit
static int cbs_jpeg_read_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
Definition: cbs_jpeg.c:241
SUBSCRIPTS
#define SUBSCRIPTS(subs,...)
Definition: cbs_jpeg.c:34
AV_CODEC_ID_MJPEG
@ AV_CODEC_ID_MJPEG
Definition: codec_id.h:57
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
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:539
cbs_jpeg_split_fragment
static int cbs_jpeg_split_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
Definition: cbs_jpeg.c:106
cbs_jpeg_write_unit
static int cbs_jpeg_write_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
Definition: cbs_jpeg.c:381