FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
ass.c File Reference
#include "avcodec.h"
#include "ass.h"
#include "libavutil/avassert.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 (AVCodecContext *avctx, const char *font, int font_size, int color, int back_color, int bold, int italic, int underline, int alignment)
 Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS.
 
int ff_ass_subtitle_header_default (AVCodecContext *avctx)
 Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS with default style.
 
static void insert_ts (AVBPrint *buf, int ts)
 
int ff_ass_bprint_dialog (AVBPrint *buf, const char *dialog, int ts_start, int duration, int raw)
 Add an ASS dialog line to an AVBPrint buffer.
 
int ff_ass_add_rect (AVSubtitle *sub, const char *dialog, int ts_start, int duration, int raw)
 Add an ASS dialog line to an AVSubtitle as a new AVSubtitleRect.
 
int ff_ass_add_rect_bprint (AVSubtitle *sub, AVBPrint *buf, int ts_start, int duration)
 Same as ff_ass_add_rect_bprint, but taking an AVBPrint buffer instead of a string, and assuming raw=0.
 
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.
 

Function Documentation

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  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 29 of file ass.c.

Referenced by ff_ass_subtitle_header_default(), and microdvd_init().

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 79 of file ass.c.

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

static void insert_ts ( AVBPrint buf,
int  ts 
)
static

Definition at line 91 of file ass.c.

Referenced by ff_ass_bprint_dialog().

int ff_ass_bprint_dialog ( AVBPrint buf,
const char *  dialog,
int  ts_start,
int  duration,
int  raw 
)

Add an ASS dialog line to an AVBPrint buffer.

Parameters
bufpointer to an initialized AVBPrint buffer
dialogASS dialog to add to sub
ts_startstart timestamp for this dialog (in 1/100 second unit)
durationduration for this dialog (in 1/100 second unit), can be -1 to last until the end of the presentation
rawwhen set to 2, it indicates that dialog contains an ASS dialog line as muxed in Matroska when set to 1, it indicates that dialog contains a whole SSA dialog line which should be copied as is. when set to 0, it indicates that dialog contains only the Text part of the ASS dialog line, the rest of the line will be generated.
Returns
number of characters read from dialog. It can be less than the whole length of dialog, if dialog contains several lines of text. A negative value indicates an error.

Definition at line 105 of file ass.c.

Referenced by ff_ass_add_rect().

int ff_ass_add_rect ( AVSubtitle sub,
const char *  dialog,
int  ts_start,
int  duration,
int  raw 
)

Add an ASS dialog line to an AVSubtitle as a new AVSubtitleRect.

Parameters
subpointer to the AVSubtitle
dialogASS dialog to add to sub
ts_startstart timestamp for this dialog (in 1/100 second unit)
durationduration for this dialog (in 1/100 second unit), can be -1 to last until the end of the presentation
rawwhen set to 2, it indicates that dialog contains an ASS dialog line as muxed in Matroska when set to 1, it indicates that dialog contains a whole SSA dialog line which should be copied as is. when set to 0, it indicates that dialog contains only the Text part of the ASS dialog line, the rest of the line will be generated.
Returns
number of characters read from dialog. It can be less than the whole length of dialog, if dialog contains several lines of text. A negative value indicates an error.

Definition at line 143 of file ass.c.

Referenced by ff_ass_add_rect_bprint().

int ff_ass_add_rect_bprint ( AVSubtitle sub,
AVBPrint buf,
int  ts_start,
int  duration 
)

Same as ff_ass_add_rect_bprint, but taking an AVBPrint buffer instead of a string, and assuming raw=0.

Definition at line 177 of file ass.c.

Referenced by jacosub_decode_frame(), realtext_decode_frame(), and subviewer_decode_frame().

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 .

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

Definition at line 186 of file ass.c.