FFmpeg
Data Structures | Macros | Functions | Variables
movtextenc.c File Reference
#include <stdarg.h>
#include "avcodec.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "libavutil/common.h"
#include "ass_split.h"
#include "ass.h"

Go to the source code of this file.

Data Structures

struct  StyleBox
 
struct  HighlightBox
 
struct  HilightcolorBox
 
struct  MovTextContext
 
struct  Box
 

Macros

#define STYLE_FLAG_BOLD   (1<<0)
 
#define STYLE_FLAG_ITALIC   (1<<1)
 
#define STYLE_FLAG_UNDERLINE   (1<<2)
 
#define STYLE_RECORD_SIZE   12
 
#define SIZE_ADD   10
 
#define STYL_BOX   (1<<0)
 
#define HLIT_BOX   (1<<1)
 
#define HCLR_BOX   (1<<2)
 
#define av_bprint_append_any(buf, data, size)   av_bprint_append_data(buf, ((const char*)data), size)
 

Functions

static void mov_text_cleanup (MovTextContext *s)
 
static void encode_styl (MovTextContext *s, uint32_t tsmb_type)
 
static void encode_hlit (MovTextContext *s, uint32_t tsmb_type)
 
static void encode_hclr (MovTextContext *s, uint32_t tsmb_type)
 
static av_cold int mov_text_encode_init (AVCodecContext *avctx)
 
static void mov_text_style_cb (void *priv, const char style, int close)
 
static void mov_text_color_cb (void *priv, unsigned int color, unsigned int color_id)
 
static uint16_t utf8_strlen (const char *text, int len)
 
static void mov_text_text_cb (void *priv, const char *text, int len)
 
static void mov_text_new_line_cb (void *priv, int forced)
 
static int mov_text_encode_frame (AVCodecContext *avctx, unsigned char *buf, int bufsize, const AVSubtitle *sub)
 
static int mov_text_encode_close (AVCodecContext *avctx)
 

Variables

static const Box box_types []
 
const static size_t box_count = FF_ARRAY_ELEMS(box_types)
 
static const ASSCodesCallbacks mov_text_callbacks
 
AVCodec ff_movtext_encoder
 

Macro Definition Documentation

◆ STYLE_FLAG_BOLD

#define STYLE_FLAG_BOLD   (1<<0)

Definition at line 32 of file movtextenc.c.

◆ STYLE_FLAG_ITALIC

#define STYLE_FLAG_ITALIC   (1<<1)

Definition at line 33 of file movtextenc.c.

◆ STYLE_FLAG_UNDERLINE

#define STYLE_FLAG_UNDERLINE   (1<<2)

Definition at line 34 of file movtextenc.c.

◆ STYLE_RECORD_SIZE

#define STYLE_RECORD_SIZE   12

Definition at line 35 of file movtextenc.c.

◆ SIZE_ADD

#define SIZE_ADD   10

Definition at line 36 of file movtextenc.c.

◆ STYL_BOX

#define STYL_BOX   (1<<0)

Definition at line 38 of file movtextenc.c.

◆ HLIT_BOX

#define HLIT_BOX   (1<<1)

Definition at line 39 of file movtextenc.c.

◆ HCLR_BOX

#define HCLR_BOX   (1<<2)

Definition at line 40 of file movtextenc.c.

◆ av_bprint_append_any

#define av_bprint_append_any (   buf,
  data,
  size 
)    av_bprint_append_data(buf, ((const char*)data), size)

Definition at line 42 of file movtextenc.c.

Function Documentation

◆ mov_text_cleanup()

static void mov_text_cleanup ( MovTextContext s)
static

Definition at line 83 of file movtextenc.c.

Referenced by encode_styl(), and mov_text_style_cb().

◆ encode_styl()

static void encode_styl ( MovTextContext s,
uint32_t  tsmb_type 
)
static

Definition at line 94 of file movtextenc.c.

◆ encode_hlit()

static void encode_hlit ( MovTextContext s,
uint32_t  tsmb_type 
)
static

Definition at line 122 of file movtextenc.c.

◆ encode_hclr()

static void encode_hclr ( MovTextContext s,
uint32_t  tsmb_type 
)
static

Definition at line 135 of file movtextenc.c.

◆ mov_text_encode_init()

static av_cold int mov_text_encode_init ( AVCodecContext avctx)
static

Definition at line 155 of file movtextenc.c.

◆ mov_text_style_cb()

static void mov_text_style_cb ( void *  priv,
const char  style,
int  close 
)
static

Definition at line 208 of file movtextenc.c.

◆ mov_text_color_cb()

static void mov_text_color_cb ( void *  priv,
unsigned int  color,
unsigned int  color_id 
)
static

Definition at line 289 of file movtextenc.c.

◆ utf8_strlen()

static uint16_t utf8_strlen ( const char *  text,
int  len 
)
static

Definition at line 308 of file movtextenc.c.

Referenced by mov_text_text_cb().

◆ mov_text_text_cb()

static void mov_text_text_cb ( void *  priv,
const char *  text,
int  len 
)
static

Definition at line 328 of file movtextenc.c.

◆ mov_text_new_line_cb()

static void mov_text_new_line_cb ( void *  priv,
int  forced 
)
static

Definition at line 338 of file movtextenc.c.

◆ mov_text_encode_frame()

static int mov_text_encode_frame ( AVCodecContext avctx,
unsigned char *  buf,
int  bufsize,
const AVSubtitle sub 
)
static

Definition at line 353 of file movtextenc.c.

◆ mov_text_encode_close()

static int mov_text_encode_close ( AVCodecContext avctx)
static

Definition at line 424 of file movtextenc.c.

Variable Documentation

◆ box_types

const Box box_types[]
static
Initial value:
= {
{ MKTAG('s','t','y','l'), encode_styl },
{ MKTAG('h','l','i','t'), encode_hlit },
{ MKTAG('h','c','l','r'), encode_hclr },
}

Definition at line 147 of file movtextenc.c.

Referenced by mov_text_encode_frame().

◆ box_count

const static size_t box_count = FF_ARRAY_ELEMS(box_types)
static

Definition at line 153 of file movtextenc.c.

Referenced by mov_text_encode_frame().

◆ mov_text_callbacks

const ASSCodesCallbacks mov_text_callbacks
static
Initial value:
= {
.new_line = mov_text_new_line_cb,
}

Definition at line 346 of file movtextenc.c.

Referenced by mov_text_encode_frame().

◆ ff_movtext_encoder

AVCodec ff_movtext_encoder
Initial value:
= {
.name = "mov_text",
.long_name = NULL_IF_CONFIG_SMALL("3GPP Timed Text subtitle"),
.priv_data_size = sizeof(MovTextContext),
.encode_sub = mov_text_encode_frame,
}

Definition at line 432 of file movtextenc.c.

AVMEDIA_TYPE_SUBTITLE
@ AVMEDIA_TYPE_SUBTITLE
Definition: avutil.h:204
init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
MKTAG
#define MKTAG(a, b, c, d)
Definition: common.h:366
mov_text_encode_init
static av_cold int mov_text_encode_init(AVCodecContext *avctx)
Definition: movtextenc.c:155
mov_text_color_cb
static void mov_text_color_cb(void *priv, unsigned int color, unsigned int color_id)
Definition: movtextenc.c:289
mov_text_text_cb
static void mov_text_text_cb(void *priv, const char *text, int len)
Definition: movtextenc.c:328
AV_CODEC_ID_MOV_TEXT
@ AV_CODEC_ID_MOV_TEXT
Definition: avcodec.h:663
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:188
mov_text_encode_close
static int mov_text_encode_close(AVCodecContext *avctx)
Definition: movtextenc.c:424
mov_text_encode_frame
static int mov_text_encode_frame(AVCodecContext *avctx, unsigned char *buf, int bufsize, const AVSubtitle *sub)
Definition: movtextenc.c:353
mov_text_new_line_cb
static void mov_text_new_line_cb(void *priv, int forced)
Definition: movtextenc.c:338
encode_hclr
static void encode_hclr(MovTextContext *s, uint32_t tsmb_type)
Definition: movtextenc.c:135
encode_styl
static void encode_styl(MovTextContext *s, uint32_t tsmb_type)
Definition: movtextenc.c:94
mov_text_style_cb
static void mov_text_style_cb(void *priv, const char style, int close)
Definition: movtextenc.c:208
encode_hlit
static void encode_hlit(MovTextContext *s, uint32_t tsmb_type)
Definition: movtextenc.c:122
MovTextContext
Definition: movtextdec.c:88