24 #include "libavutil/avassert.h"
25 #include "libavutil/avstring.h"
26 #include "libavutil/bprint.h"
27 #include "libavutil/common.h"
30 const char *font,
int font_size,
31 int color,
int back_color,
32 int bold,
int italic,
int underline,
37 "ScriptType: v4.00+\r\n"
40 "Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding\r\n"
41 "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"
44 "Format: Layer, Start, End, Style, Text\r\n",
45 font, font_size, color, color, back_color, back_color,
46 -bold, -italic, -underline, alignment);
73 h = ts/360000; ts -= 360000*h;
74 m = ts/ 6000; ts -= 6000*
m;
75 s = ts/ 100; ts -= 100*
s;
76 av_bprintf(buf,
"%d:%02d:%02d.%02d,", h, m, s, ts);
88 if (!raw || raw == 2) {
93 dialog = strchr(dialog,
',');
99 layer = strtol(dialog, (
char**)&dialog, 10);
106 insert_ts(&buf, duration == -1 ? -1 : ts_start + duration);
111 dlen = strcspn(dialog,
"\n");
112 dlen += dialog[dlen] ==
'\n';
uint8_t * subtitle_header
Header containing style information for text subtitles.
#define ASS_DEFAULT_ALIGNMENT
static const uint32_t color[16+AV_CLASS_CATEGORY_NB]
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 alignment)
Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS.
static void insert_ts(AVBPrint *buf, int ts)
#define ASS_DEFAULT_BACK_COLOR
#define ASS_DEFAULT_UNDERLINE
#define AV_BPRINT_SIZE_UNLIMITED
Convenience macros for special values for av_bprint_init() size_max parameter.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
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
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Init a print buffer.
Buffer to print data progressively.
static int av_bprint_is_complete(AVBPrint *buf)
Test if the print buffer is complete (not truncated).
void * av_realloc(void *ptr, size_t size) 1(2)
Allocate or reallocate a block of memory.
char * ass
0 terminated ASS/SSA compatible event line.
size_t char * av_asprintf(const char *fmt,...) av_printf_format(1
Print arguments following specified format into a large enough auto allocated buffer.
main external API structure.
#define ASS_DEFAULT_COLOR
void av_bprintf(AVBPrint *buf, const char *fmt,...) av_printf_format(2
Append a formatted string to a print buffer.
Formatted text, the ass field must be set by the decoder and is authoritative.
#define ASS_DEFAULT_ITALIC
#define AVERROR_INVALIDDATA
void * av_mallocz(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...