[FFmpeg-devel] [PATCH] vf_subtitles: add line_spacing option
Jean First
jeanfirst at gmail.com
Thu May 16 23:29:05 CEST 2013
On Thu May 16 2013 12:00:22 GMT+0200 (CEST), Nicolas George wrote:
> 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?
I did not need the precision, but I'll send a new patch.
More information about the ffmpeg-devel
mailing list