From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id BB1E046484 for ; Fri, 19 May 2023 07:59:12 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4ECE368C139; Fri, 19 May 2023 10:59:09 +0300 (EEST) Received: from out203-205-221-149.mail.qq.com (out203-205-221-149.mail.qq.com [203.205.221.149]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1028E68BBA2 for ; Fri, 19 May 2023 10:59:02 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1684483134; bh=uhWeHZ6OCN4GYsM75f4TrUZ9JwMrVG6zk5x8aDX+2Xg=; h=From:To:Cc:Subject:Date; b=IUuxsbdr1T3sPrvnx0POntg8L1SsOMMAnDM8+nOGPmc6U7HNzqUR0m8HXgCMcf9F8 uAdrkRd0Nx+KIU52uSd4iAQT1ojLrgc+JB8HV6fGhuc35ImMojaIykv7mRlEd4o0Qw JhNK4oed8GzoqCW72BO1Nw+kmVRZTalVwPLw+I34= Received: from localhost.localdomain ([119.147.10.201]) by newxmesmtplogicsvrszb1-0.qq.com (NewEsmtp) with SMTP id EB524E61; Fri, 19 May 2023 15:58:53 +0800 X-QQ-mid: xmsmtpt1684483133tbwibpsn5 Message-ID: X-QQ-XMAILINFO: MtZ6QPwsmM9XpBHTwnBqg0SrYkkXTTSB0r7RxahNtJiUAFNS8GDIRRxUFS0zp+ WckkowVj9jIUQT+54z8I8nJQBYtUaeni14c7r0unUaOzE/Yc2kULeVkz+KfAgN1rzS9zcRdRgwju 2aguvOEWniq6rcKhbJguYGgzyinB7X+MD03oap0iqSWcozHoaP6DhllxI0bDaoywoEzqF5wo52y+ XDGHbUO0jpazvR9K7dWKKmmELpuCBoQquoT1LRYn+oMA32A5Lg68AxD7q+Sqfgz6ZSPKMMAj7n3t ETTMwv4m6kPlk+brk780Yx5VVHgOkCtESDG6t+OqzDkBt3pgUFDON6axfr4GIKbx4iVp2M3161uu Sonf3hebGjwu9mMDq93s1n4phEVPEHGtfCB2q+x3sL7GTrSmeHqkBRYMNDzSJ2f6zDMkLDF+fRsf Zyr1M5tvpGRBJTIvjDbZt64ANsYl6ECLRGl9EM3wJuZ4ETZziuahFWBxk3evezsMkpUumNXTZjiz hysnTJZXuY8xZV18diTdjdO8HUUwGS+B1/R4ctzn1u3UptroLP9cDKuH9jacRoyeigLSoGw3TBau RTPLanVe5h4V9O4Ybb8T5+y5+8yeCig9bhiEk38UkmHNzeYqB2IvRbVk8tYyI+dDsL9LhEJD4GFh c3MBpiB9RoMA0BdtQnyrhBxGf1UuhOAf8xMcLzo28Svvv9PlJ6irXelQ1sTV9gyGvZAaMPvhR/mh TQoIw5EUUBiwigVL3YGXWA+Rdt75gmuOLX1lIMqiVbLD/tJaVm22t7ShenM+OiTzdjOEHA5/LLIl pJcZiSwbwrwGCN3Ik63MB2JChMS6+P9EQnkiu5SnVAkny9PDLMmDxii+qktVGJfze+8gXZqhgyem cWeGTO5YuVM3ij/X2fcEhXtab856cr0or8ewmJlIIQx7VoNFvwmg2e4NW1RDAomQ/tJZtbAmpJtY EqRcPTFNxMPznpXh/nZAkV62JCh4MGxvPWHf6+Q8A= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Fri, 19 May 2023 23:58:59 +0800 X-OQ-MSGID: <20230519155859.2968296-1-quinkblack@foxmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avfilter/vf_subtitles: add wrap_unicode option X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Zhao Zhili Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Zhao Zhili So CJK can be wrapped automatically. Signed-off-by: Zhao Zhili --- libavfilter/version.h | 2 +- libavfilter/vf_subtitles.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/libavfilter/version.h b/libavfilter/version.h index ba8a6fdab2..08779130f5 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -32,7 +32,7 @@ #include "version_major.h" #define LIBAVFILTER_VERSION_MINOR 8 -#define LIBAVFILTER_VERSION_MICRO 100 +#define LIBAVFILTER_VERSION_MICRO 101 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c index 82e140e986..d6a68e5cdd 100644 --- a/libavfilter/vf_subtitles.c +++ b/libavfilter/vf_subtitles.c @@ -61,6 +61,7 @@ typedef struct AssContext { int original_w, original_h; int shaping; FFDrawContext draw; + int wrap_unicode; } AssContext; #define OFFSET(x) offsetof(AssContext, x) @@ -72,6 +73,7 @@ typedef struct AssContext { {"original_size", "set the size of the original video (used to scale fonts)", OFFSET(original_w), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, FLAGS }, \ {"fontsdir", "set the directory containing the fonts to read", OFFSET(fontsdir), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS }, \ {"alpha", "enable processing of alpha channel", OFFSET(alpha), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, FLAGS }, \ + {"wrap_unicode", "break lines according to the Unicode Line Breaking Algorithm", OFFSET(wrap_unicode), AV_OPT_TYPE_BOOL, {.i64 = 1 }, 0, 1, FLAGS }, \ /* libass supports a log level ranging from 0 to 7 */ static const int ass_libavfilter_log_level_map[] = { @@ -329,6 +331,17 @@ static av_cold int init_subtitles(AVFilterContext *ctx) return AVERROR(EINVAL); } + if (ass->wrap_unicode) { +#if (LIBASS_VERSION >= 0x01600010) + ret = ass_track_set_feature(ass->track, ASS_FEATURE_WRAP_UNICODE, 1); + if (ret < 0) + av_log(ctx, AV_LOG_WARNING, "libass doesn't build with ASS_FEATURE_WRAP_UNICODE support\n"); +#else + av_log(ctx, AV_LOG_INFO, "libass version %#x doesn't support ASS_FEATURE_WRAP_UNICODE\n", + LIBASS_VERSION); +#endif + } + /* Open subtitles file */ ret = avformat_open_input(&fmt, ass->filename, NULL, NULL); if (ret < 0) { -- 2.25.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".