FFmpeg
Data Structures | Functions | Variables
ttmlenc.c File Reference
#include "avcodec.h"
#include "codec_internal.h"
#include "libavutil/bprint.h"
#include "libavutil/internal.h"
#include "libavutil/mem.h"
#include "ass_split.h"
#include "ttmlenc.h"

Go to the source code of this file.

Data Structures

struct  TTMLContext
 

Functions

static void ttml_text_cb (void *priv, const char *text, int len)
 
static void ttml_new_line_cb (void *priv, int forced)
 
static int ttml_encode_frame (AVCodecContext *avctx, uint8_t *buf, int bufsize, const AVSubtitle *sub)
 
static av_cold int ttml_encode_close (AVCodecContext *avctx)
 
static const char * ttml_get_display_alignment (int alignment)
 
static const char * ttml_get_text_alignment (int alignment)
 
static void ttml_get_origin (ASSScriptInfo script_info, ASSStyle style, int *origin_left, int *origin_top)
 
static void ttml_get_extent (ASSScriptInfo script_info, ASSStyle style, int *width, int *height)
 
static int ttml_write_region (AVCodecContext *avctx, AVBPrint *buf, ASSScriptInfo script_info, ASSStyle style)
 
static int ttml_write_header_content (AVCodecContext *avctx)
 
static av_cold int ttml_encode_init (AVCodecContext *avctx)
 

Variables

static const ASSCodesCallbacks ttml_callbacks
 
const FFCodec ff_ttml_encoder
 

Detailed Description

TTML subtitle encoder

See also
https://www.w3.org/TR/ttml1/
https://www.w3.org/TR/ttml2/
https://www.w3.org/TR/ttml-imsc/rec

Definition in file ttmlenc.c.

Function Documentation

◆ ttml_text_cb()

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

Definition at line 44 of file ttmlenc.c.

◆ ttml_new_line_cb()

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

Definition at line 67 of file ttmlenc.c.

◆ ttml_encode_frame()

static int ttml_encode_frame ( AVCodecContext avctx,
uint8_t *  buf,
int  bufsize,
const AVSubtitle sub 
)
static

Definition at line 79 of file ttmlenc.c.

◆ ttml_encode_close()

static av_cold int ttml_encode_close ( AVCodecContext avctx)
static

Definition at line 141 of file ttmlenc.c.

◆ ttml_get_display_alignment()

static const char* ttml_get_display_alignment ( int  alignment)
static

Definition at line 150 of file ttmlenc.c.

Referenced by ttml_write_region().

◆ ttml_get_text_alignment()

static const char* ttml_get_text_alignment ( int  alignment)
static

Definition at line 170 of file ttmlenc.c.

Referenced by ttml_write_region().

◆ ttml_get_origin()

static void ttml_get_origin ( ASSScriptInfo  script_info,
ASSStyle  style,
int *  origin_left,
int *  origin_top 
)
static

Definition at line 190 of file ttmlenc.c.

Referenced by ttml_write_region().

◆ ttml_get_extent()

static void ttml_get_extent ( ASSScriptInfo  script_info,
ASSStyle  style,
int *  width,
int *  height 
)
static

Definition at line 199 of file ttmlenc.c.

Referenced by ttml_write_region().

◆ ttml_write_region()

static int ttml_write_region ( AVCodecContext avctx,
AVBPrint *  buf,
ASSScriptInfo  script_info,
ASSStyle  style 
)
static

Definition at line 210 of file ttmlenc.c.

Referenced by ttml_write_header_content().

◆ ttml_write_header_content()

static int ttml_write_header_content ( AVCodecContext avctx)
static

Definition at line 293 of file ttmlenc.c.

Referenced by ttml_encode_init().

◆ ttml_encode_init()

static av_cold int ttml_encode_init ( AVCodecContext avctx)
static

Definition at line 365 of file ttmlenc.c.

Variable Documentation

◆ ttml_callbacks

const ASSCodesCallbacks ttml_callbacks
static
Initial value:
= {
.text = ttml_text_cb,
.new_line = ttml_new_line_cb,
}

Definition at line 74 of file ttmlenc.c.

Referenced by ttml_encode_frame().

◆ ff_ttml_encoder

const FFCodec ff_ttml_encoder
Initial value:
= {
.p.name = "ttml",
CODEC_LONG_NAME("TTML subtitle"),
.priv_data_size = sizeof(TTMLContext),
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
}

Definition at line 382 of file ttmlenc.c.

AVMEDIA_TYPE_SUBTITLE
@ AVMEDIA_TYPE_SUBTITLE
Definition: avutil.h:204
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:43
ttml_text_cb
static void ttml_text_cb(void *priv, const char *text, int len)
Definition: ttmlenc.c:44
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:296
ttml_new_line_cb
static void ttml_new_line_cb(void *priv, int forced)
Definition: ttmlenc.c:67
ttml_encode_frame
static int ttml_encode_frame(AVCodecContext *avctx, uint8_t *buf, int bufsize, const AVSubtitle *sub)
Definition: ttmlenc.c:79
FF_CODEC_ENCODE_SUB_CB
#define FF_CODEC_ENCODE_SUB_CB(func)
Definition: codec_internal.h:323
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
TTMLContext
Definition: ttmlenc.c:38
ttml_encode_init
static av_cold int ttml_encode_init(AVCodecContext *avctx)
Definition: ttmlenc.c:365
AV_CODEC_ID_TTML
@ AV_CODEC_ID_TTML
Definition: codec_id.h:581
ttml_encode_close
static av_cold int ttml_encode_close(AVCodecContext *avctx)
Definition: ttmlenc.c:141