X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=libavcodec%2Fass.c;h=627741936aee46438d277bec681a55d6da69cf07;hb=3749eede66c3774799766b1f246afae8a6ffc9bb;hp=b4f081c819e4098fd3c229d80632989a96ad9d0f;hpb=ecb5546e97c479378e057f527cc1d79a46c31cb1;p=ffmpeg diff --git a/libavcodec/ass.c b/libavcodec/ass.c index b4f081c819e..627741936ae 100644 --- a/libavcodec/ass.c +++ b/libavcodec/ass.c @@ -26,11 +26,13 @@ #include "libavutil/bprint.h" #include "libavutil/common.h" -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 border_style, int alignment) +int ff_ass_subtitle_header_full(AVCodecContext *avctx, + int play_res_x, int play_res_y, + const char *font, int font_size, + int primary_color, int secondary_color, + int outline_color, int back_color, + int bold, int italic, int underline, + int border_style, int alignment) { avctx->subtitle_header = av_asprintf( "[Script Info]\r\n" @@ -38,6 +40,7 @@ int ff_ass_subtitle_header(AVCodecContext *avctx, "ScriptType: v4.00+\r\n" "PlayResX: %d\r\n" "PlayResY: %d\r\n" + "ScaledBorderAndShadow: yes\r\n" "\r\n" "[V4+ Styles]\r\n" @@ -67,8 +70,8 @@ int ff_ass_subtitle_header(AVCodecContext *avctx, "[Events]\r\n" "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\r\n", !(avctx->flags & AV_CODEC_FLAG_BITEXACT) ? AV_STRINGIFY(LIBAVCODEC_VERSION) : "", - ASS_DEFAULT_PLAYRESX, ASS_DEFAULT_PLAYRESY, - font, font_size, color, color, back_color, back_color, + play_res_x, play_res_y, font, font_size, + primary_color, secondary_color, outline_color, back_color, -bold, -italic, -underline, border_style, alignment); if (!avctx->subtitle_header) @@ -77,6 +80,20 @@ int ff_ass_subtitle_header(AVCodecContext *avctx, return 0; } +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 border_style, int alignment) +{ + return ff_ass_subtitle_header_full(avctx, + ASS_DEFAULT_PLAYRESX, ASS_DEFAULT_PLAYRESY, + font, font_size, color, color, + back_color, back_color, + bold, italic, underline, + border_style, alignment); +} + int ff_ass_subtitle_header_default(AVCodecContext *avctx) { return ff_ass_subtitle_header(avctx, ASS_DEFAULT_FONT, @@ -105,7 +122,7 @@ int ff_ass_add_rect(AVSubtitle *sub, const char *dialog, char *ass_str; AVSubtitleRect **rects; - rects = av_realloc_array(sub->rects, (sub->num_rects+1), sizeof(*sub->rects)); + rects = av_realloc_array(sub->rects, sub->num_rects+1, sizeof(*sub->rects)); if (!rects) return AVERROR(ENOMEM); sub->rects = rects;