42 const char *font,
int font_size,
43 int color,
int back_color,
44 int bold,
int italic,
int underline,
49 snprintf(header,
sizeof(header),
51 "ScriptType: v4.00+\r\n"
54 "Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding\r\n"
55 "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"
58 "Format: Layer, Start, End, Text\r\n",
59 font, font_size, color, color, back_color, back_color,
60 -bold, -italic, -underline, alignment);
83 memset(sub, 0,
sizeof(*sub));
89 h = ts/360000; ts -= 360000*h;
90 m = ts/ 6000; ts -= 6000*m;
91 s = ts/ 100; ts -= 100*s;
92 return snprintf(str, strlen,
"%d:%02d:%02d.%02d", h, m, s, ts);
96 int ts_start,
int ts_end,
int raw)
99 char s_start[16], s_end[16], header[48] = {0};
105 len = snprintf(header,
sizeof(header),
"Dialogue: 0,%s,%s,",
109 dlen = strcspn(dialog,
"\n");
110 dlen += dialog[dlen] ==
'\n';
void * av_mallocz(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.
void * av_realloc(void *ptr, size_t size)
Allocate or reallocate a block of memory.
#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
Formatted text, the ass field must be set by the decoder and is authoritative.
char * av_strdup(const char *s)
Duplicate the string s.
main external API structure.
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
static int ts_to_string(char *str, int strlen, int ts)
#define ASS_DEFAULT_COLOR
static const uint8_t color[]
#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.
uint8_t * subtitle_header
Header containing style information for text subtitles.