[FFmpeg-devel] [PATCH] vf_subtitles: add line_spacing option
Nicolas George
nicolas.george at normalesup.org
Thu May 16 12:00:22 CEST 2013
Le septidi 27 floréal, an CCXXI, Jean First a écrit :
> Signed-off-by: Jean First <jeanfirst at gmail.com>
> ---
>
> Unfortunately the line spacing can not be specified in the ssa/ass file
>
> doc/filters.texi | 3 +++
> libavfilter/vf_subtitles.c | 4 ++++
> 2 files changed, 7 insertions(+)
>
> diff --git a/doc/filters.texi b/doc/filters.texi
> index cf2c1a4..3972833 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -6158,6 +6158,9 @@ Specify the size of the original video, the video for which the ASS file
> was composed. Due to a misdesign in ASS aspect ratio arithmetic, this is
> necessary to correctly scale the fonts if the aspect ratio has been changed.
>
> + at item line_spacing
> +Specify the height of the line spacing.
> +
> @item charenc
> Set subtitles input character encoding. @code{subtitles} filter only. Only
> useful if not UTF-8.
> diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c
> index b5f5bc9..ea45e71 100644
> --- a/libavfilter/vf_subtitles.c
> +++ b/libavfilter/vf_subtitles.c
> @@ -54,6 +54,7 @@ typedef struct {
> uint8_t rgba_map[4];
> int pix_step[4]; ///< steps per pixel for each plane of the main output
> int original_w, original_h;
> + int line_spacing;
> FFDrawContext draw;
> } AssContext;
>
> @@ -64,6 +65,7 @@ typedef struct {
> {"filename", "set the filename of file to read", OFFSET(filename), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, FLAGS }, \
> {"f", "set the filename of file to read", OFFSET(filename), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, FLAGS }, \
> {"original_size", "set the size of the original video (used to scale fonts)", OFFSET(original_w), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, CHAR_MIN, CHAR_MAX, FLAGS }, \
> + {"line_spacing", "set the height of the line spacing", OFFSET(line_spacing), AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX, FLAGS }, \
>
> /* libass supports a log level ranging from 0 to 7 */
> static const int ass_libavfilter_log_level_map[] = {
> @@ -139,6 +141,8 @@ static int config_input(AVFilterLink *inlink)
> if (ass->original_w && ass->original_h)
> ass_set_aspect_ratio(ass->renderer, (double)inlink->w / inlink->h,
> (double)ass->original_w / ass->original_h);
> + if (ass->line_spacing)
> + ass_set_line_spacing(ass->renderer, (double)ass->line_spacing);
Why do you make it an int and then cast it to a double, instead of making
the option a double directly?
>
> return 0;
> }
Apart from that, I see no reason not to apply, but I am not maintainer of
this file.
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130516/ad9879aa/attachment.asc>
More information about the ffmpeg-devel
mailing list