FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
dvbsubdec.c File Reference
#include "avcodec.h"
#include "get_bits.h"
#include "bytestream.h"
#include "internal.h"
#include "libavutil/colorspace.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"

Go to the source code of this file.

Data Structures

struct  DVBSubCLUT
 
struct  DVBSubObjectDisplay
 
struct  DVBSubObject
 
struct  DVBSubRegionDisplay
 
struct  DVBSubRegion
 
struct  DVBSubDisplayDefinition
 
struct  DVBSubContext
 

Macros

#define DVBSUB_PAGE_SEGMENT   0x10
 
#define DVBSUB_REGION_SEGMENT   0x11
 
#define DVBSUB_CLUT_SEGMENT   0x12
 
#define DVBSUB_OBJECT_SEGMENT   0x13
 
#define DVBSUB_DISPLAYDEFINITION_SEGMENT   0x14
 
#define DVBSUB_DISPLAY_SEGMENT   0x80
 
#define cm   (ff_crop_tab + MAX_NEG_CROP)
 
#define RGBA(r, g, b, a)   (((unsigned)(a) << 24) | ((r) << 16) | ((g) << 8) | (b))
 
#define V(x, y)   rect->data[0][(x) + (y)*stride]
 
#define L(x, y)   list[d[(x) + (y)*stride]]
 
#define DS   AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_SUBTITLE_PARAM
 

Functions

static DVBSubObjectget_object (DVBSubContext *ctx, int object_id)
 
static DVBSubCLUTget_clut (DVBSubContext *ctx, int clut_id)
 
static DVBSubRegionget_region (DVBSubContext *ctx, int region_id)
 
static void delete_region_display_list (DVBSubContext *ctx, DVBSubRegion *region)
 
static void delete_cluts (DVBSubContext *ctx)
 
static void delete_objects (DVBSubContext *ctx)
 
static void delete_regions (DVBSubContext *ctx)
 
static av_cold int dvbsub_init_decoder (AVCodecContext *avctx)
 
static av_cold int dvbsub_close_decoder (AVCodecContext *avctx)
 
static int dvbsub_read_2bit_string (AVCodecContext *avctx, uint8_t *destbuf, int dbuf_len, const uint8_t **srcbuf, int buf_size, int non_mod, uint8_t *map_table, int x_pos)
 
static int dvbsub_read_4bit_string (AVCodecContext *avctx, uint8_t *destbuf, int dbuf_len, const uint8_t **srcbuf, int buf_size, int non_mod, uint8_t *map_table, int x_pos)
 
static int dvbsub_read_8bit_string (AVCodecContext *avctx, uint8_t *destbuf, int dbuf_len, const uint8_t **srcbuf, int buf_size, int non_mod, uint8_t *map_table, int x_pos)
 
static void compute_default_clut (DVBSubContext *ctx, uint8_t *clut, AVSubtitleRect *rect, int w, int h)
 
static int save_subtitle_set (AVCodecContext *avctx, AVSubtitle *sub, int *got_output)
 
static void dvbsub_parse_pixel_data_block (AVCodecContext *avctx, DVBSubObjectDisplay *display, const uint8_t *buf, int buf_size, int top_bottom, int non_mod)
 
static int dvbsub_parse_object_segment (AVCodecContext *avctx, const uint8_t *buf, int buf_size)
 
static int dvbsub_parse_clut_segment (AVCodecContext *avctx, const uint8_t *buf, int buf_size)
 
static int dvbsub_parse_region_segment (AVCodecContext *avctx, const uint8_t *buf, int buf_size)
 
static int dvbsub_parse_page_segment (AVCodecContext *avctx, const uint8_t *buf, int buf_size, AVSubtitle *sub, int *got_output)
 
static int dvbsub_parse_display_definition_segment (AVCodecContext *avctx, const uint8_t *buf, int buf_size)
 
static int dvbsub_display_end_segment (AVCodecContext *avctx, const uint8_t *buf, int buf_size, AVSubtitle *sub, int *got_output)
 
static int dvbsub_decode (AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
 

Variables

static DVBSubCLUT default_clut
 
static const AVOption options []
 
static const AVClass dvbsubdec_class
 
AVCodec ff_dvbsub_decoder
 

Macro Definition Documentation

#define DVBSUB_PAGE_SEGMENT   0x10

Definition at line 30 of file dvbsubdec.c.

Referenced by dvbsub_decode().

#define DVBSUB_REGION_SEGMENT   0x11

Definition at line 31 of file dvbsubdec.c.

Referenced by dvbsub_decode().

#define DVBSUB_CLUT_SEGMENT   0x12

Definition at line 32 of file dvbsubdec.c.

Referenced by dvbsub_decode().

#define DVBSUB_OBJECT_SEGMENT   0x13

Definition at line 33 of file dvbsubdec.c.

Referenced by dvbsub_decode().

#define DVBSUB_DISPLAYDEFINITION_SEGMENT   0x14

Definition at line 34 of file dvbsubdec.c.

Referenced by dvbsub_decode().

#define DVBSUB_DISPLAY_SEGMENT   0x80

Definition at line 35 of file dvbsubdec.c.

Referenced by dvbsub_decode().

#define cm   (ff_crop_tab + MAX_NEG_CROP)
#define RGBA (   r,
  g,
  b,
  a 
)    (((unsigned)(a) << 24) | ((r) << 16) | ((g) << 8) | (b))
#define V (   x,
 
)    rect->data[0][(x) + (y)*stride]

Referenced by compute_default_clut().

#define L (   x,
 
)    list[d[(x) + (y)*stride]]

Definition at line 1724 of file dvbsubdec.c.

Function Documentation

static DVBSubObject* get_object ( DVBSubContext ctx,
int  object_id 
)
static
static DVBSubCLUT* get_clut ( DVBSubContext ctx,
int  clut_id 
)
static

Definition at line 153 of file dvbsubdec.c.

Referenced by dvbsub_parse_clut_segment().

static DVBSubRegion* get_region ( DVBSubContext ctx,
int  region_id 
)
static
static void delete_region_display_list ( DVBSubContext ctx,
DVBSubRegion region 
)
static

Definition at line 175 of file dvbsubdec.c.

Referenced by delete_regions(), and dvbsub_parse_region_segment().

static void delete_cluts ( DVBSubContext ctx)
static

Definition at line 221 of file dvbsubdec.c.

Referenced by dvbsub_close_decoder(), and dvbsub_parse_page_segment().

static void delete_objects ( DVBSubContext ctx)
static

Definition at line 232 of file dvbsubdec.c.

Referenced by dvbsub_close_decoder(), and dvbsub_parse_page_segment().

static void delete_regions ( DVBSubContext ctx)
static

Definition at line 243 of file dvbsubdec.c.

Referenced by dvbsub_close_decoder(), and dvbsub_parse_page_segment().

static av_cold int dvbsub_init_decoder ( AVCodecContext avctx)
static

Definition at line 257 of file dvbsubdec.c.

static av_cold int dvbsub_close_decoder ( AVCodecContext avctx)
static

Definition at line 346 of file dvbsubdec.c.

static int dvbsub_read_2bit_string ( AVCodecContext avctx,
uint8_t destbuf,
int  dbuf_len,
const uint8_t **  srcbuf,
int  buf_size,
int  non_mod,
uint8_t map_table,
int  x_pos 
)
static

Definition at line 369 of file dvbsubdec.c.

Referenced by dvbsub_parse_pixel_data_block().

static int dvbsub_read_4bit_string ( AVCodecContext avctx,
uint8_t destbuf,
int  dbuf_len,
const uint8_t **  srcbuf,
int  buf_size,
int  non_mod,
uint8_t map_table,
int  x_pos 
)
static

Definition at line 477 of file dvbsubdec.c.

Referenced by dvbsub_parse_pixel_data_block().

static int dvbsub_read_8bit_string ( AVCodecContext avctx,
uint8_t destbuf,
int  dbuf_len,
const uint8_t **  srcbuf,
int  buf_size,
int  non_mod,
uint8_t map_table,
int  x_pos 
)
static

Definition at line 600 of file dvbsubdec.c.

Referenced by dvbsub_parse_pixel_data_block().

static void compute_default_clut ( DVBSubContext ctx,
uint8_t clut,
AVSubtitleRect rect,
int  w,
int  h 
)
static

Definition at line 654 of file dvbsubdec.c.

static int save_subtitle_set ( AVCodecContext avctx,
AVSubtitle sub,
int got_output 
)
static

Definition at line 720 of file dvbsubdec.c.

Referenced by dvbsub_display_end_segment(), and dvbsub_parse_page_segment().

static void dvbsub_parse_pixel_data_block ( AVCodecContext avctx,
DVBSubObjectDisplay display,
const uint8_t buf,
int  buf_size,
int  top_bottom,
int  non_mod 
)
static

Definition at line 868 of file dvbsubdec.c.

Referenced by dvbsub_parse_object_segment().

static int dvbsub_parse_object_segment ( AVCodecContext avctx,
const uint8_t buf,
int  buf_size 
)
static

Definition at line 985 of file dvbsubdec.c.

Referenced by dvbsub_decode().

static int dvbsub_parse_clut_segment ( AVCodecContext avctx,
const uint8_t buf,
int  buf_size 
)
static

Definition at line 1045 of file dvbsubdec.c.

Referenced by dvbsub_decode().

static int dvbsub_parse_region_segment ( AVCodecContext avctx,
const uint8_t buf,
int  buf_size 
)
static

Definition at line 1144 of file dvbsubdec.c.

Referenced by dvbsub_decode().

static int dvbsub_parse_page_segment ( AVCodecContext avctx,
const uint8_t buf,
int  buf_size,
AVSubtitle sub,
int got_output 
)
static

Definition at line 1285 of file dvbsubdec.c.

Referenced by dvbsub_decode().

static int dvbsub_parse_display_definition_segment ( AVCodecContext avctx,
const uint8_t buf,
int  buf_size 
)
static

Definition at line 1545 of file dvbsubdec.c.

Referenced by dvbsub_decode().

static int dvbsub_display_end_segment ( AVCodecContext avctx,
const uint8_t buf,
int  buf_size,
AVSubtitle sub,
int got_output 
)
static

Definition at line 1591 of file dvbsubdec.c.

Referenced by dvbsub_decode().

static int dvbsub_decode ( AVCodecContext avctx,
void data,
int data_size,
AVPacket avpkt 
)
static

Definition at line 1604 of file dvbsubdec.c.

Variable Documentation

DVBSubCLUT default_clut
static

Definition at line 52 of file dvbsubdec.c.

const AVOption options[]
static
Initial value:
= {
{"compute_edt", "compute end of time using pts or timeout", 0x42, AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DS},
{"compute_clut", "compute clut when not available(-1) or always(1) or never(0)", 0x42, AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, DS},
{"dvb_substream", "", 0x42, AV_OPT_TYPE_INT, {.i64 = -1}, -1, 63, DS},
{NULL}
}
#define NULL
Definition: coverity.c:32
#define DS
Definition: dvbsubdec.c:1724

Definition at line 1725 of file dvbsubdec.c.

const AVClass dvbsubdec_class
static
Initial value:
= {
.class_name = "DVB Sub Decoder",
.item_name = av_default_item_name,
.option = options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:191
static const AVOption options[]
Definition: dvbsubdec.c:1725

Definition at line 1731 of file dvbsubdec.c.

AVCodec ff_dvbsub_decoder
Initial value:
= {
.name = "dvbsub",
.long_name = NULL_IF_CONFIG_SMALL("DVB subtitles"),
.priv_data_size = sizeof(DVBSubContext),
.priv_class = &dvbsubdec_class,
}
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:42
static const AVClass dvbsubdec_class
Definition: dvbsubdec.c:1731
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
static av_cold int dvbsub_init_decoder(AVCodecContext *avctx)
Definition: dvbsubdec.c:257
static int dvbsub_decode(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
Definition: dvbsubdec.c:1604
static av_cold int dvbsub_close_decoder(AVCodecContext *avctx)
Definition: dvbsubdec.c:346

Definition at line 1738 of file dvbsubdec.c.