FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
dvdsubdec.c File Reference
#include "avcodec.h"
#include "get_bits.h"
#include "internal.h"
#include "libavutil/attributes.h"
#include "libavutil/colorspace.h"
#include "libavutil/opt.h"
#include "libavutil/imgutils.h"
#include "libavutil/avstring.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, 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 (AVSubtitle *s)
 
static int append_to_cached_buf (AVCodecContext *avctx, const uint8_t *buf, int buf_size)
 
static int dvdsub_decode (AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
 
static void parse_palette (DVDSubContext *ctx, char *p)
 
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)
 
static av_cold int dvdsub_close (AVCodecContext *avctx)
 

Variables

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

Macro Definition Documentation

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

Definition at line 218 of file dvdsubdec.c.

Referenced by decode_dvd_subtitles().

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

Definition at line 768 of file dvdsubdec.c.

Definition at line 769 of file dvdsubdec.c.

Function Documentation

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().

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

Definition at line 67 of file dvdsubdec.c.

Referenced by decode_rle().

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

Definition at line 81 of file dvdsubdec.c.

Referenced by decode_rle().

static int decode_rle ( uint8_t bitmap,
int  linesize,
int  w,
int  h,
const uint8_t buf,
int  start,
int  buf_size,
int  is_8bit 
)
static

Definition at line 103 of file dvdsubdec.c.

Referenced by decode_dvd_subtitles().

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().

static void reset_rects ( AVSubtitle sub_header)
static

Definition at line 203 of file dvdsubdec.c.

Referenced by decode_dvd_subtitles(), and dvdsub_decode().

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().

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

Definition at line 438 of file dvdsubdec.c.

Referenced by find_smallest_bounding_rectangle().

static int find_smallest_bounding_rectangle ( AVSubtitle s)
static

Definition at line 451 of file dvdsubdec.c.

Referenced by dvdsub_decode().

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

Definition at line 546 of file dvdsubdec.c.

Referenced by dvdsub_decode().

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

Definition at line 562 of file dvdsubdec.c.

static void parse_palette ( DVDSubContext ctx,
char *  p 
)
static

Definition at line 621 of file dvdsubdec.c.

Referenced by dvdsub_init(), and dvdsub_parse_extradata().

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

Definition at line 633 of file dvdsubdec.c.

Referenced by dvdsub_init().

static int dvdsub_parse_extradata ( AVCodecContext avctx)
static

Definition at line 693 of file dvdsubdec.c.

Referenced by dvdsub_init().

static av_cold int dvdsub_init ( AVCodecContext avctx)
static

Definition at line 733 of file dvdsubdec.c.

static void dvdsub_flush ( AVCodecContext avctx)
static

Definition at line 756 of file dvdsubdec.c.

Referenced by dvdsub_close().

static av_cold int dvdsub_close ( AVCodecContext avctx)
static

Definition at line 762 of file dvdsubdec.c.

Variable Documentation

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 }
}
#define NULL
Definition: coverity.c:32
#define SD
Definition: dvdsubdec.c:769
#define OFFSET(field)
Definition: dvdsubdec.c:768

Definition at line 770 of file dvdsubdec.c.

const AVClass dvdsub_class
static
Initial value:
= {
.class_name = "dvdsubdec",
.item_name = av_default_item_name,
.option = options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:70
av_default_item_name
static const AVOption options[]
Definition: dvdsubdec.c:770

Definition at line 776 of file dvdsubdec.c.

AVCodec ff_dvdsub_decoder
Initial value:
= {
.name = "dvdsub",
.long_name = NULL_IF_CONFIG_SMALL("DVD subtitles"),
.priv_data_size = sizeof(DVDSubContext),
.close = dvdsub_close,
.priv_class = &dvdsub_class,
}
static void dvdsub_flush(AVCodecContext *avctx)
Definition: dvdsubdec.c:756
static void flush(AVCodecContext *avctx)
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static av_cold int dvdsub_close(AVCodecContext *avctx)
Definition: dvdsubdec.c:762
static av_cold int dvdsub_init(AVCodecContext *avctx)
Definition: dvdsubdec.c:733
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
static const AVClass dvdsub_class
Definition: dvdsubdec.c:776
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
Definition: ccaption_dec.c:722
static int dvdsub_decode(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
Definition: dvdsubdec.c:562

Definition at line 783 of file dvdsubdec.c.