From patchwork Tue Jan 17 11:36:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Liu X-Patchwork-Id: 2230 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp478860vsb; Tue, 17 Jan 2017 03:36:30 -0800 (PST) X-Received: by 10.223.163.201 with SMTP id m9mr6117099wrb.66.1484652990275; Tue, 17 Jan 2017 03:36:30 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id u66si24695686wrc.269.2017.01.17.03.36.29; Tue, 17 Jan 2017 03:36:30 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 921BE68A125; Tue, 17 Jan 2017 13:36:16 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbgau1.qq.com (smtpbgau1.qq.com [54.206.16.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6D3FE689D8E for ; Tue, 17 Jan 2017 13:36:07 +0200 (EET) X-QQ-mid: bizesmtp8t1484652966tmfbcyg2k Received: from localhost (unknown [47.90.47.25]) by esmtp4.qq.com (ESMTP) with id ; Tue, 17 Jan 2017 19:36:05 +0800 (CST) X-QQ-SSF: 01100000002000F0F720000A0000000 X-QQ-FEAT: 6dXuswn9i1VlY/5RXztPISh2VFYXSE4Z+amfR+JZPd2mXypYjlQ8jZbh6x/Js 7QdBR/sQ+MklOXeztSiY+rOs7VqZrTfCklExdF8w05ass++SWOXmxRFT5NsRyES+6XaWws3 3hnLmdQkSJpgYdDr8voBAQDYEVEUGqiIKKnrRCa3iTr2NgyM9NQCQ1H4Z9ilR4iyrFEBUzN wX1TwcJjSHC0ZnzKXmm3mDP9SMhsXd7bB8HL7qf18eAizHlCwgw0+R225JXzj1UuTlCf3Pe ioQrEYd32jEbDd X-QQ-GoodBg: 0 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Tue, 17 Jan 2017 19:36:03 +0800 Message-Id: <20170117113603.15321-1-lq@chinaffmpeg.org> X-Mailer: git-send-email 2.10.1.382.ga23ca1b.dirty X-QQ-SENDSIZE: 520 X-QQ-Bgrelay: 1 Subject: [FFmpeg-devel] [PATCH] avfilter:vf_drawtext: add new line space size set parameter X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Steven Liu MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" add line_spacing parameter to set the space between two lines Based on an idea by: Leandro Santiago Signed-off-by: Steven Liu --- doc/filters.texi | 4 ++++ libavfilter/vf_drawtext.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/filters.texi b/doc/filters.texi index 94548b1..a0c2980 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -6750,6 +6750,10 @@ option, check the "Color" section in the ffmpeg-utils manual. The default value of @var{boxcolor} is "white". +@item line_spacing +Set the line spacing in pixels of the border to be drawn around the box using @var{box}. +The default value of @var{line_spacing} is 0. + @item borderw Set the width of the border to be drawn around the text using @var{bordercolor}. The default value of @var{borderw} is 0. diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c index 649240b..d8f7730 100644 --- a/libavfilter/vf_drawtext.c +++ b/libavfilter/vf_drawtext.c @@ -158,6 +158,7 @@ typedef struct DrawTextContext { int borderw; ///< border width unsigned int fontsize; ///< font size to use + int line_spacing; ///< lines spacing in pixels short int draw_box; ///< draw box around text - true or false int boxborderw; ///< box border width int use_kerning; ///< font kerning is used - true/false @@ -209,6 +210,7 @@ static const AVOption drawtext_options[]= { {"shadowcolor", "set shadow color", OFFSET(shadowcolor.rgba), AV_OPT_TYPE_COLOR, {.str="black"}, CHAR_MIN, CHAR_MAX, FLAGS}, {"box", "set box", OFFSET(draw_box), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 , FLAGS}, {"boxborderw", "set box border width", OFFSET(boxborderw), AV_OPT_TYPE_INT, {.i64=0}, INT_MIN, INT_MAX , FLAGS}, + {"line_spacing", "set line spacing in pixels", OFFSET(line_spacing), AV_OPT_TYPE_INT, {.dbl=0}, INT_MIN, INT_MAX,FLAGS}, {"fontsize", "set font size", OFFSET(fontsize), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX , FLAGS}, {"x", "set x expression", OFFSET(x_expr), AV_OPT_TYPE_STRING, {.str="0"}, CHAR_MIN, CHAR_MAX, FLAGS}, {"y", "set y expression", OFFSET(y_expr), AV_OPT_TYPE_STRING, {.str="0"}, CHAR_MIN, CHAR_MAX, FLAGS}, @@ -1250,7 +1252,7 @@ static int draw_text(AVFilterContext *ctx, AVFrame *frame, if (is_newline(code)) { max_text_line_w = FFMAX(max_text_line_w, x); - y += s->max_glyph_h; + y += s->max_glyph_h + s->line_spacing; x = 0; continue; }