30 int play_res_x,
int play_res_y,
31 const char *font,
int font_size,
32 int primary_color,
int secondary_color,
33 int outline_color,
int back_color,
34 int bold,
int italic,
int underline,
35 int border_style,
int alignment)
39 "; Script generated by FFmpeg/Lavc%s\r\n"
40 "ScriptType: v4.00+\r\n"
43 "ScaledBorderAndShadow: yes\r\n"
49 "Fontname, Fontsize, "
50 "PrimaryColour, SecondaryColour, OutlineColour, BackColour, "
51 "Bold, Italic, Underline, StrikeOut, "
54 "BorderStyle, Outline, Shadow, "
55 "Alignment, MarginL, MarginR, MarginV, "
61 "&H%x,&H%x,&H%x,&H%x,"
71 "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\r\n",
73 play_res_x, play_res_y, font, font_size,
74 primary_color, secondary_color, outline_color, back_color,
75 -bold, -italic, -underline, border_style, alignment);
84 const char *font,
int font_size,
85 int color,
int back_color,
86 int bold,
int italic,
int underline,
87 int border_style,
int alignment)
92 back_color, back_color,
93 bold, italic, underline,
94 border_style, alignment);
111 const char *speaker,
const char *text)
114 readorder, layer, style ? style :
"Default",
115 speaker ? speaker :
"", text);
119 int readorder,
int layer,
const char *style,
130 if (!rects[
sub->num_rects])
136 rects[
sub->num_rects]->
ass = ass_str;
149 const char *linebreaks,
int keep_ass_markup)
151 const char *p_end = p +
size;
153 for (; p < p_end && *p; p++) {
156 if (linebreaks && strchr(linebreaks, *p)) {
161 }
else if (!keep_ass_markup && strchr(
"{}\\", *p)) {
170 }
else if (p[0] ==
'\n') {
174 }
else if (p[0] ==
'\r' && p < p_end - 1 && p[1] ==
'\n') {
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.
int ff_ass_subtitle_header_default(AVCodecContext *avctx)
Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS with default style.
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.
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.
void ff_ass_decoder_flush(AVCodecContext *avctx)
Helper to flush a text subtitles decoder making use of the FFASSDecoderContext.
char * ff_ass_get_dialog(int readorder, int layer, const char *style, const char *speaker, const char *text)
Craft an ASS dialog string.
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.
#define ASS_DEFAULT_PLAYRESY
#define ASS_DEFAULT_ALIGNMENT
#define ASS_DEFAULT_PLAYRESX
#define ASS_DEFAULT_FONT_SIZE
#define ASS_DEFAULT_COLOR
#define ASS_DEFAULT_BORDERSTYLE
#define ASS_DEFAULT_BACK_COLOR
#define ASS_DEFAULT_UNDERLINE
#define ASS_DEFAULT_ITALIC
simple assert() macros that are a bit more flexible than ISO C assert().
Libavcodec external API header.
char * av_asprintf(const char *fmt,...)
void av_bprintf(AVBPrint *buf, const char *fmt,...)
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.
common internal and external API header
static float sub(float src0, float src1)
#define AV_CODEC_FLAG2_RO_FLUSH_NOOP
Do not reset ASS ReadOrder field on flush (subtitles decoding)
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
@ SUBTITLE_ASS
Formatted text, the ass field must be set by the decoder and is authoritative.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Allocate, reallocate, or free an array.
#define LIBAVCODEC_VERSION
main external API structure.
int flags2
AV_CODEC_FLAG2_*.
uint8_t * subtitle_header
Header containing style information for text subtitles.
int flags
AV_CODEC_FLAG_*.
char * ass
0 terminated ASS/SSA compatible event line.