FFmpeg
Functions
ass.c File Reference
#include "avcodec.h"
#include "ass.h"
#include "libavutil/avstring.h"
#include "libavutil/bprint.h"
#include "libavutil/common.h"

Go to the source code of this file.

Functions

int ff_ass_subtitle_header_full (AVCodecContext *avctx, int play_res_x, int play_res_y, const char *font, int font_size, int primary_color, int secondary_color, int outline_color, int back_color, int bold, int italic, int underline, int border_style, int alignment)
 Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS. More...
 
int ff_ass_subtitle_header (AVCodecContext *avctx, const char *font, int font_size, int color, int back_color, int bold, int italic, int underline, int border_style, int alignment)
 Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS. More...
 
int ff_ass_subtitle_header_default (AVCodecContext *avctx)
 Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS with default style. More...
 
char * ff_ass_get_dialog (int readorder, int layer, const char *style, const char *speaker, const char *text)
 Craft an ASS dialog string. More...
 
int ff_ass_add_rect (AVSubtitle *sub, const char *dialog, int readorder, int layer, const char *style, const char *speaker)
 Add an ASS dialog to a subtitle. More...
 
void ff_ass_decoder_flush (AVCodecContext *avctx)
 Helper to flush a text subtitles decoder making use of the FFASSDecoderContext. More...
 
void ff_ass_bprint_text_event (AVBPrint *buf, const char *p, int size, const char *linebreaks, int keep_ass_markup)
 Escape a text subtitle using ASS syntax into an AVBPrint buffer. More...
 

Function Documentation

◆ ff_ass_subtitle_header_full()

int ff_ass_subtitle_header_full ( AVCodecContext avctx,
int  play_res_x,
int  play_res_y,
const char *  font,
int  font_size,
int  primary_color,
int  secondary_color,
int  outline_color,
int  back_color,
int  bold,
int  italic,
int  underline,
int  border_style,
int  alignment 
)

Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS.

Can specify all fields explicitly

Parameters
avctxpointer to the AVCodecContext
play_res_xsubtitle frame width
play_res_ysubtitle frame height
fontname of the default font face to use
font_sizedefault font size to use
primary_colordefault text color to use (ABGR)
secondary_colordefault secondary text color to use (ABGR)
outline_colordefault outline color to use (ABGR)
back_colordefault background color to use (ABGR)
bold1 for bold text, 0 for normal text
italic1 for italic text, 0 for normal text
underline1 for underline text, 0 for normal text
border_style1 for outline, 3 for opaque box
alignmentposition of the text (left, center, top...), defined after the layout of the numpad (1-3 sub, 4-6 mid, 7-9 top)
Returns
>= 0 on success otherwise an error code <0

Definition at line 28 of file ass.c.

Referenced by ff_ass_subtitle_header(), and mov_text_init().

◆ ff_ass_subtitle_header()

int ff_ass_subtitle_header ( AVCodecContext avctx,
const char *  font,
int  font_size,
int  color,
int  back_color,
int  bold,
int  italic,
int  underline,
int  border_style,
int  alignment 
)

Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS.

Parameters
avctxpointer to the AVCodecContext
fontname of the default font face to use
font_sizedefault font size to use
colordefault text color to use (ABGR)
back_colordefault background color to use (ABGR)
bold1 for bold text, 0 for normal text
italic1 for italic text, 0 for normal text
underline1 for underline text, 0 for normal text
alignmentposition of the text (left, center, top...), defined after the layout of the numpad (1-3 sub, 4-6 mid, 7-9 top)
Returns
>= 0 on success otherwise an error code <0

Definition at line 82 of file ass.c.

Referenced by ff_ass_subtitle_header_default(), init_decoder(), and microdvd_init().

◆ ff_ass_subtitle_header_default()

int ff_ass_subtitle_header_default ( AVCodecContext avctx)

Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS with default style.

Parameters
avctxpointer to the AVCodecContext
Returns
>= 0 on success otherwise an error code <0

Definition at line 96 of file ass.c.

Referenced by mov_text_init(), my_ass_subtitle_header(), sami_init(), and teletext_init_decoder().

◆ ff_ass_get_dialog()

char* ff_ass_get_dialog ( int  readorder,
int  layer,
const char *  style,
const char *  speaker,
const char *  text 
)

Craft an ASS dialog string.

Definition at line 109 of file ass.c.

Referenced by create_ass_text(), ff_ass_add_rect(), and gen_sub_ass().

◆ ff_ass_add_rect()

int ff_ass_add_rect ( AVSubtitle sub,
const char *  dialog,
int  readorder,
int  layer,
const char *  style,
const char *  speaker 
)

◆ ff_ass_decoder_flush()

void ff_ass_decoder_flush ( AVCodecContext avctx)

Helper to flush a text subtitles decoder making use of the FFASSDecoderContext.

Definition at line 140 of file ass.c.

◆ ff_ass_bprint_text_event()

void ff_ass_bprint_text_event ( AVBPrint *  buf,
const char *  p,
int  size,
const char *  linebreaks,
int  keep_ass_markup 
)

Escape a text subtitle using ASS syntax into an AVBPrint buffer.

Newline characters will be escaped to \N.

Parameters
bufpointer to an initialized AVBPrint buffer
psource text
sizesize of the source text
linebreaksadditional newline chars, which will be escaped to \N
keep_ass_markupbraces and backslash will not be escaped if set

Definition at line 147 of file ass.c.

Referenced by create_ass_text(), and text_decode_frame().