X-Git-Url: https://git.piment-noir.org/?p=deb_ffmpeg.git;a=blobdiff_plain;f=ffmpeg%2Flibavcodec%2Fass.c;fp=ffmpeg%2Flibavcodec%2Fass.c;h=3a37ceee26a368f8073c80cf040ebd11d0c90e6b;hp=a5b5ae5fb2e4d130135fbb2a39583d5467211ff8;hb=f6fa7814ccfe3e76514b36cf04f5cd3cb657c8cf;hpb=2ba45a602cbfa7b771effba9b11bb4245c21bc00 diff --git a/ffmpeg/libavcodec/ass.c b/ffmpeg/libavcodec/ass.c index a5b5ae5..3a37cee 100644 --- a/ffmpeg/libavcodec/ass.c +++ b/ffmpeg/libavcodec/ass.c @@ -34,16 +34,39 @@ int ff_ass_subtitle_header(AVCodecContext *avctx, { avctx->subtitle_header = av_asprintf( "[Script Info]\r\n" + "; Script generated by FFmpeg/Lavc%s\r\n" "ScriptType: v4.00+\r\n" "PlayResX: 384\r\n" "PlayResY: 288\r\n" "\r\n" "[V4+ Styles]\r\n" - "Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding\r\n" - "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" + + /* ASSv4 header */ + "Format: Name, " + "Fontname, Fontsize, " + "PrimaryColour, SecondaryColour, OutlineColour, BackColour, " + "Bold, Italic, Underline, StrikeOut, " + "ScaleX, ScaleY, " + "Spacing, Angle, " + "BorderStyle, Outline, Shadow, " + "Alignment, MarginL, MarginR, MarginV, " + "Encoding\r\n" + + "Style: " + "Default," /* Name */ + "%s,%d," /* Font{name,size} */ + "&H%x,&H%x,&H%x,&H%x," /* {Primary,Secondary,Outline,Back}Colour */ + "%d,%d,%d,0," /* Bold, Italic, Underline, StrikeOut */ + "100,100," /* Scale{X,Y} */ + "0,0," /* Spacing, Angle */ + "1,1,0," /* BorderStyle, Outline, Shadow */ + "%d,10,10,10," /* Alignment, Margin[LRV] */ + "0\r\n" /* Encoding */ + "\r\n" "[Events]\r\n" - "Format: Layer, Start, End, Style, Text\r\n", + "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\r\n", + !(avctx->flags & CODEC_FLAG_BITEXACT) ? AV_STRINGIFY(LIBAVCODEC_VERSION) : "", font, font_size, color, color, back_color, back_color, -bold, -italic, -underline, alignment); @@ -104,7 +127,7 @@ int ff_ass_bprint_dialog(AVBPrint *buf, const char *dialog, insert_ts(buf, ts_start); insert_ts(buf, duration == -1 ? -1 : ts_start + duration); if (raw != 2) - av_bprintf(buf, "Default,"); + av_bprintf(buf, "Default,,0,0,0,,"); } dlen = strcspn(dialog, "\n"); @@ -151,6 +174,15 @@ err: return ret; } +int ff_ass_add_rect_bprint(AVSubtitle *sub, AVBPrint *buf, + int ts_start, int duration) +{ + av_bprintf(buf, "\r\n"); + if (!av_bprint_is_complete(buf)) + return AVERROR(ENOMEM); + return ff_ass_add_rect(sub, buf->str, ts_start, duration, 0); +} + void ff_ass_bprint_text_event(AVBPrint *buf, const char *p, int size, const char *linebreaks, int keep_ass_markup) { @@ -187,5 +219,4 @@ void ff_ass_bprint_text_event(AVBPrint *buf, const char *p, int size, av_bprint_chars(buf, *p, 1); } } - av_bprintf(buf, "\r\n"); }