FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
libzvbi-teletextdec.c File Reference
#include "avcodec.h"
#include "libavutil/opt.h"
#include "libavutil/intreadwrite.h"
#include <libzvbi.h>

Go to the source code of this file.

Data Structures

struct  TeletextContext
 

Macros

#define TEXT_MAXSZ   (25 * (56 + 1) * 4 + 2)
 
#define VBI_NB_COLORS   40
 
#define RGBA(r, g, b, a)   (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
 
#define VBI_R(rgba)   (((rgba) >> 0) & 0xFF)
 
#define VBI_G(rgba)   (((rgba) >> 8) & 0xFF)
 
#define VBI_B(rgba)   (((rgba) >> 16) & 0xFF)
 
#define VBI_A(rgba)   (((rgba) >> 24) & 0xFF)
 
#define OFFSET(x)   offsetof(TeletextContext, x)
 
#define SD   AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM
 

Functions

static int chop_spaces_utf8 (const unsigned char *t, int len)
 
static int gen_sub_text (TeletextContext *ctx, vbi_page *page, int chop_top)
 
static void fix_transparency (TeletextContext *ctx, vbi_page *page, int chop_top, uint8_t transparent_color, int resx, int resy)
 
static int gen_sub_bitmap (TeletextContext *ctx, vbi_page *page, int chop_top)
 
static void handler (vbi_event *ev, void *user_data)
 
static int teletext_decode_frame (AVCodecContext *avctx, void *data, int *data_size, AVPacket *pkt)
 
static int teletext_init_decoder (AVCodecContext *avctx)
 
static int teletext_close_decoder (AVCodecContext *avctx)
 
static void teletext_flush (AVCodecContext *avctx)
 

Variables

static const AVOption options []
 
static const AVClass teletext_class
 
AVCodec ff_libzvbi_teletext_decoder
 

Macro Definition Documentation

#define TEXT_MAXSZ   (25 * (56 + 1) * 4 + 2)

Definition at line 27 of file libzvbi-teletextdec.c.

Referenced by gen_sub_text().

#define VBI_NB_COLORS   40

Definition at line 28 of file libzvbi-teletextdec.c.

Referenced by gen_sub_bitmap().

#define RGBA (   r,
  g,
  b,
  a 
)    (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))

Definition at line 29 of file libzvbi-teletextdec.c.

Referenced by gen_sub_bitmap().

#define VBI_R (   rgba)    (((rgba) >> 0) & 0xFF)

Definition at line 30 of file libzvbi-teletextdec.c.

Referenced by gen_sub_bitmap().

#define VBI_G (   rgba)    (((rgba) >> 8) & 0xFF)

Definition at line 31 of file libzvbi-teletextdec.c.

Referenced by gen_sub_bitmap().

#define VBI_B (   rgba)    (((rgba) >> 16) & 0xFF)

Definition at line 32 of file libzvbi-teletextdec.c.

Referenced by gen_sub_bitmap().

#define VBI_A (   rgba)    (((rgba) >> 24) & 0xFF)

Definition at line 33 of file libzvbi-teletextdec.c.

Referenced by gen_sub_bitmap().

#define OFFSET (   x)    offsetof(TeletextContext, x)

Definition at line 437 of file libzvbi-teletextdec.c.

Definition at line 438 of file libzvbi-teletextdec.c.

Function Documentation

static int chop_spaces_utf8 ( const unsigned char *  t,
int  len 
)
static

Definition at line 64 of file libzvbi-teletextdec.c.

Referenced by gen_sub_text().

static int gen_sub_text ( TeletextContext ctx,
vbi_page *  page,
int  chop_top 
)
static

Definition at line 77 of file libzvbi-teletextdec.c.

Referenced by handler().

static void fix_transparency ( TeletextContext ctx,
vbi_page *  page,
int  chop_top,
uint8_t  transparent_color,
int  resx,
int  resy 
)
static

Definition at line 143 of file libzvbi-teletextdec.c.

Referenced by gen_sub_bitmap().

static int gen_sub_bitmap ( TeletextContext ctx,
vbi_page *  page,
int  chop_top 
)
static

Definition at line 176 of file libzvbi-teletextdec.c.

Referenced by handler().

static void handler ( vbi_event *  ev,
void user_data 
)
static
static int teletext_decode_frame ( AVCodecContext avctx,
void data,
int *  data_size,
AVPacket pkt 
)
static

Definition at line 300 of file libzvbi-teletextdec.c.

static int teletext_init_decoder ( AVCodecContext avctx)
static

Definition at line 384 of file libzvbi-teletextdec.c.

static int teletext_close_decoder ( AVCodecContext avctx)
static

Definition at line 417 of file libzvbi-teletextdec.c.

Referenced by teletext_flush().

static void teletext_flush ( AVCodecContext avctx)
static

Definition at line 432 of file libzvbi-teletextdec.c.

Variable Documentation

const AVOption options[]
static
Initial value:
= {
{"txt_page", "list of teletext page numbers to decode, * is all", OFFSET(pgno), AV_OPT_TYPE_STRING, {.str = "*"}, 0, 0, SD},
{"txt_chop_top", "discards the top teletext line", OFFSET(chop_top), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, SD},
{"txt_format", "format of the subtitles (bitmap or text)", OFFSET(format), AV_OPT_TYPE_STRING, {.str = "bitmap"}, 0, 0, SD},
{"txt_left", "x offset of generated bitmaps", OFFSET(x_offset), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 65535, SD},
{"txt_top", "y offset of generated bitmaps", OFFSET(y_offset), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 65535, SD},
{"txt_chop_spaces", "chops leading and trailing spaces from text", OFFSET(chop_spaces), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, SD},
{"txt_duration", "display duration of teletext pages in msecs", OFFSET(sub_duration), AV_OPT_TYPE_INT, {.i64 = 30000}, 0, 86400000, SD},
{"txt_transparent", "force transparent background of the teletext", OFFSET(transparent_bg), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, SD},
{ NULL },
}

Definition at line 439 of file libzvbi-teletextdec.c.

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

Definition at line 451 of file libzvbi-teletextdec.c.

AVCodec ff_libzvbi_teletext_decoder
Initial value:
= {
.name = "libzvbi_teletextdec",
.long_name = NULL_IF_CONFIG_SMALL("Libzvbi DVB teletext decoder"),
.priv_data_size = sizeof(TeletextContext),
.priv_class= &teletext_class,
}

Definition at line 458 of file libzvbi-teletextdec.c.