diff options
author | John Stebbins <jstebbins@jetheaddev.com> | 2020-04-04 12:33:54 -0600 |
---|---|---|
committer | Philip Langdale <philipl@overt.org> | 2020-04-10 09:32:13 -0700 |
commit | b8d4a66b29b1dc3f6f48ce85577bfb6b57bd338f (patch) | |
tree | b875726be1abc2045afdf39eacc0be1c51d47448 /libavcodec/ass.c | |
parent | f406dc9ceb92e1a37b7cbfd27c1f38290fe857ec (diff) | |
download | ffmpeg-b8d4a66b29b1dc3f6f48ce85577bfb6b57bd338f.tar.gz |
lavc/movtextdec: allow setting subtitle frame dimensions
Font sizes are relative to the subtitle frame dimensions. If the
expected frame dimensions are not known, the font sizes will most
likely be incorrect.
Signed-off-by: Philip Langdale <philipl@overt.org>
Diffstat (limited to 'libavcodec/ass.c')
-rw-r--r-- | libavcodec/ass.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/libavcodec/ass.c b/libavcodec/ass.c index a51673fb4e..7c26e3fd6d 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" @@ -67,8 +69,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 +79,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, |