43 const char *font,
int font_size,
44 int color,
int back_color,
45 int bold,
int italic,
int underline,
50 snprintf(header,
sizeof(header),
52 "ScriptType: v4.00+\r\n"
55 "Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding\r\n"
56 "Style: Default,%s,%d,&H%x,&H%x,&H%x,&H%x,%d,%d,%d,1,1,0,%d,10,10,10,0,0\r\n"
59 "Format: Layer, Start, End, Text\r\n",
60 font, font_size, color, color, back_color, back_color,
61 -bold, -italic, -underline, alignment);
84 memset(sub, 0,
sizeof(*sub));
90 h = ts/360000; ts -= 360000*h;
91 m = ts/ 6000; ts -= 6000*m;
92 s = ts/ 100; ts -= 100*s;
93 return snprintf(str, strlen,
"%d:%02d:%02d.%02d", h, m, s, ts);
97 int ts_start,
int ts_end,
int raw)
100 char s_start[16], s_end[16], header[48] = {0};
106 len = snprintf(header,
sizeof(header),
"Dialogue: 0,%s,%s,",
110 dlen = strcspn(dialog,
"\n");
111 dlen += dialog[dlen] ==
'\n';
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
static 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_ALIGNMENT
int ff_ass_subtitle_header_default(AVCodecContext *avctx)
Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS with default style.
#define ASS_DEFAULT_BACK_COLOR
#define ASS_DEFAULT_UNDERLINE
void ff_ass_init(AVSubtitle *sub)
Initialize an AVSubtitle structure for use with ff_ass_add_rect().
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
#define ASS_DEFAULT_FONT_SIZE
uint32_t end_display_time
char * av_strdup(const char *s)
Duplicate the string s.
main external API structure.
static int ts_to_string(char *str, int strlen, int ts)
common internal and external API header
#define ASS_DEFAULT_COLOR
void * av_realloc(void *ptr, size_t size)
Allocate or reallocate a block of memory.
static const uint8_t color[]
Formatted text, the ass field must be set by the decoder and is authoritative.
#define ASS_DEFAULT_ITALIC
char * ass
0 terminated ASS/SSA compatible event line.
int ff_ass_add_rect(AVSubtitle *sub, const char *dialog, int ts_start, int ts_end, int raw)
Add an ASS dialog line to an AVSubtitle as a new AVSubtitleRect.
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.