FFmpeg
Data Structures | Macros | Functions | Variables
dvdsubdec.c File Reference
#include "avcodec.h"
#include "codec_internal.h"
#include "decode.h"
#include "dvdsub.h"
#include "get_bits.h"
#include "libavutil/attributes.h"
#include "libavutil/colorspace.h"
#include "libavutil/file_open.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/bswap.h"

Go to the source code of this file.

Data Structures

struct  DVDSubContext
 

Macros

#define READ_OFFSET(a)   (big_offsets ? AV_RB32(a) : AV_RB16(a))
 
#define OFFSET(field)   offsetof(DVDSubContext, field)
 
#define SD   AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM
 

Functions

static void yuv_a_to_rgba (const uint8_t *ycbcr, const uint8_t *alpha, uint32_t *rgba, int num_values)
 
static int decode_run_2bit (GetBitContext *gb, int *color)
 
static int decode_run_8bit (GetBitContext *gb, int *color)
 
static int decode_rle (uint8_t *bitmap, int linesize, int w, int h, uint8_t used_color[256], const uint8_t *buf, int start, int buf_size, int is_8bit)
 
static void guess_palette (DVDSubContext *ctx, uint32_t *rgba_palette, uint32_t subtitle_color)
 
static void reset_rects (AVSubtitle *sub_header)
 
static int decode_dvd_subtitles (DVDSubContext *ctx, AVSubtitle *sub_header, const uint8_t *buf, int buf_size)
 
static int is_transp (const uint8_t *buf, int pitch, int n, const uint8_t *transp_color)
 
static int find_smallest_bounding_rectangle (DVDSubContext *ctx, AVSubtitle *s)
 
static int append_to_cached_buf (AVCodecContext *avctx, const uint8_t *buf, int buf_size)
 
static int dvdsub_decode (AVCodecContext *avctx, AVSubtitle *sub, int *data_size, const AVPacket *avpkt)
 
static int parse_ifo_palette (DVDSubContext *ctx, char *p)
 
static int dvdsub_parse_extradata (AVCodecContext *avctx)
 
static av_cold int dvdsub_init (AVCodecContext *avctx)
 
static void dvdsub_flush (AVCodecContext *avctx)
 

Variables

static const AVOption options []
 
static const AVClass dvdsub_class
 
const FFCodec ff_dvdsub_decoder
 

Macro Definition Documentation

◆ READ_OFFSET

#define READ_OFFSET (   a)    (big_offsets ? AV_RB32(a) : AV_RB16(a))

Definition at line 218 of file dvdsubdec.c.

◆ OFFSET

#define OFFSET (   field)    offsetof(DVDSubContext, field)

Definition at line 695 of file dvdsubdec.c.

◆ SD

Definition at line 696 of file dvdsubdec.c.

Function Documentation

◆ yuv_a_to_rgba()

static void yuv_a_to_rgba ( const uint8_t *  ycbcr,
const uint8_t *  alpha,
uint32_t *  rgba,
int  num_values 
)
static

Definition at line 50 of file dvdsubdec.c.

Referenced by decode_dvd_subtitles().

◆ decode_run_2bit()

static int decode_run_2bit ( GetBitContext gb,
int *  color 
)
static

Definition at line 67 of file dvdsubdec.c.

Referenced by decode_rle().

◆ decode_run_8bit()

static int decode_run_8bit ( GetBitContext gb,
int *  color 
)
static

Definition at line 81 of file dvdsubdec.c.

Referenced by decode_rle().

◆ decode_rle()

static int decode_rle ( uint8_t *  bitmap,
int  linesize,
int  w,
int  h,
uint8_t  used_color[256],
const uint8_t *  buf,
int  start,
int  buf_size,
int  is_8bit 
)
static

Definition at line 100 of file dvdsubdec.c.

Referenced by decode_dvd_subtitles().

◆ guess_palette()

static void guess_palette ( DVDSubContext ctx,
uint32_t *  rgba_palette,
uint32_t  subtitle_color 
)
static

Definition at line 146 of file dvdsubdec.c.

Referenced by decode_dvd_subtitles().

◆ reset_rects()

static void reset_rects ( AVSubtitle sub_header)
static

Definition at line 203 of file dvdsubdec.c.

Referenced by decode_dvd_subtitles(), and dvdsub_decode().

◆ decode_dvd_subtitles()

static int decode_dvd_subtitles ( DVDSubContext ctx,
AVSubtitle sub_header,
const uint8_t *  buf,
int  buf_size 
)
static

Definition at line 220 of file dvdsubdec.c.

Referenced by dvdsub_decode().

◆ is_transp()

static int is_transp ( const uint8_t *  buf,
int  pitch,
int  n,
const uint8_t *  transp_color 
)
static

Definition at line 429 of file dvdsubdec.c.

Referenced by find_smallest_bounding_rectangle().

◆ find_smallest_bounding_rectangle()

static int find_smallest_bounding_rectangle ( DVDSubContext ctx,
AVSubtitle s 
)
static

Definition at line 442 of file dvdsubdec.c.

Referenced by dvdsub_decode().

◆ append_to_cached_buf()

static int append_to_cached_buf ( AVCodecContext avctx,
const uint8_t *  buf,
int  buf_size 
)
static

Definition at line 501 of file dvdsubdec.c.

Referenced by dvdsub_decode().

◆ dvdsub_decode()

static int dvdsub_decode ( AVCodecContext avctx,
AVSubtitle sub,
int *  data_size,
const AVPacket avpkt 
)
static

Definition at line 518 of file dvdsubdec.c.

◆ parse_ifo_palette()

static int parse_ifo_palette ( DVDSubContext ctx,
char *  p 
)
static

Definition at line 563 of file dvdsubdec.c.

Referenced by dvdsub_init().

◆ dvdsub_parse_extradata()

static int dvdsub_parse_extradata ( AVCodecContext avctx)
static

Definition at line 623 of file dvdsubdec.c.

Referenced by dvdsub_init().

◆ dvdsub_init()

static av_cold int dvdsub_init ( AVCodecContext avctx)
static

Definition at line 664 of file dvdsubdec.c.

◆ dvdsub_flush()

static void dvdsub_flush ( AVCodecContext avctx)
static

Definition at line 689 of file dvdsubdec.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "palette", "set the global palette", OFFSET(palette_str), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, SD },
{ "ifo_palette", "obtain the global palette from .IFO file", OFFSET(ifo_str), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, SD },
{ "forced_subs_only", "Only show forced subtitles", OFFSET(forced_subs_only), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, SD},
{ NULL }
}

Definition at line 697 of file dvdsubdec.c.

◆ dvdsub_class

const AVClass dvdsub_class
static
Initial value:
= {
.class_name = "dvdsubdec",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 703 of file dvdsubdec.c.

◆ ff_dvdsub_decoder

const FFCodec ff_dvdsub_decoder
Initial value:
= {
.p.name = "dvdsub",
CODEC_LONG_NAME("DVD subtitles"),
.priv_data_size = sizeof(DVDSubContext),
.flush = dvdsub_flush,
.p.priv_class = &dvdsub_class,
}

Definition at line 710 of file dvdsubdec.c.

options
static const AVOption options[]
Definition: dvdsubdec.c:697
AVMEDIA_TYPE_SUBTITLE
@ AVMEDIA_TYPE_SUBTITLE
Definition: avutil.h:204
dvdsub_init
static av_cold int dvdsub_init(AVCodecContext *avctx)
Definition: dvdsubdec.c:664
dvdsub_flush
static void dvdsub_flush(AVCodecContext *avctx)
Definition: dvdsubdec.c:689
SD
#define SD
Definition: dvdsubdec.c:696
dvdsub_decode
static int dvdsub_decode(AVCodecContext *avctx, AVSubtitle *sub, int *data_size, const AVPacket *avpkt)
Definition: dvdsubdec.c:518
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:296
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
DVDSubContext
Definition: dvdsubdec.c:35
NULL
#define NULL
Definition: coverity.c:32
AV_CODEC_ID_DVD_SUBTITLE
@ AV_CODEC_ID_DVD_SUBTITLE
Definition: codec_id.h:550
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
dvdsub_class
static const AVClass dvdsub_class
Definition: dvdsubdec.c:703
FF_CODEC_DECODE_SUB_CB
#define FF_CODEC_DECODE_SUB_CB(func)
Definition: codec_internal.h:314
OFFSET
#define OFFSET(field)
Definition: dvdsubdec.c:695
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition: opt.h:327
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition: opt.h:276