30 const char *font,
int font_size,
31 int color,
int back_color,
32 int bold,
int italic,
int underline,
37 "; Script generated by FFmpeg/Lavc%s\r\n"
38 "ScriptType: v4.00+\r\n"
46 "Fontname, Fontsize, "
47 "PrimaryColour, SecondaryColour, OutlineColour, BackColour, "
48 "Bold, Italic, Underline, StrikeOut, "
51 "BorderStyle, Outline, Shadow, "
52 "Alignment, MarginL, MarginR, MarginV, "
58 "&H%x,&H%x,&H%x,&H%x,"
68 "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\r\n",
71 font, font_size, color, color, back_color, back_color,
72 -bold, -italic, -underline, alignment);
99 h = ts/360000; ts -= 360000*
h;
100 m = ts/ 6000; ts -= 6000*
m;
101 s = ts/ 100; ts -= 100*
s;
102 av_bprintf(buf,
"%d:%02d:%02d.%02d,", h, m, s, ts);
107 int ts_start,
int duration,
int raw)
111 if (!raw || raw == 2) {
116 dialog = strchr(dialog,
',');
122 layer = strtol(dialog, (
char**)&dialog, 10);
129 insert_ts(buf, duration == -1 ? -1 : ts_start + duration);
134 dlen = strcspn(dialog,
"\n");
135 dlen += dialog[dlen] ==
'\n';
145 int ts_start,
int duration,
int raw)
188 const char *linebreaks,
int keep_ass_markup)
190 const char *p_end = p +
size;
192 for (; p < p_end && *p; p++) {
195 if (linebreaks && strchr(linebreaks, *p)) {
200 }
else if (!keep_ass_markup && strchr(
"{}\\", *p)) {
209 }
else if (p[0] ==
'\n') {
213 }
else if (p[0] ==
'\r' && p < p_end - 1 && p[1] ==
'\n') {
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.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
void av_bprintf(AVBPrint *buf, const char *fmt,...)
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
#define ASS_DEFAULT_ALIGNMENT
int ff_ass_subtitle_header_default(AVCodecContext *avctx)
Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS with default style.
#define CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
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.
#define ASS_DEFAULT_PLAYRESY
static void insert_ts(AVBPrint *buf, int ts)
#define ASS_DEFAULT_BACK_COLOR
#define ASS_DEFAULT_UNDERLINE
#define AV_BPRINT_SIZE_UNLIMITED
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
simple assert() macros that are a bit more flexible than ISO C assert().
Libavcodec external API header.
#define ASS_DEFAULT_FONT_SIZE
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.
uint32_t end_display_time
char * av_asprintf(const char *fmt,...)
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
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.
main external API structure.
#define LIBAVCODEC_VERSION
common internal and external API header
#define ASS_DEFAULT_COLOR
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Formatted text, the ass field must be set by the decoder and is authoritative.
#define ASS_DEFAULT_ITALIC
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.
char * ass
0 terminated ASS/SSA compatible event line.
#define ASS_DEFAULT_PLAYRESX
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
uint8_t * subtitle_header
Header containing style information for text subtitles.
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.