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 4DE1E46599 for ; Mon, 22 May 2023 04:05:41 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1C79B68C0C0; Mon, 22 May 2023 07:05:39 +0300 (EEST) Received: from out203-205-221-231.mail.qq.com (out203-205-221-231.mail.qq.com [203.205.221.231]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7BD7268C005 for ; Mon, 22 May 2023 07:05:30 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1684728323; bh=QGyefbNR5Z3HKnxU/30L+YaXn4q43D+QJWWK21FQtNo=; h=From:To:Cc:Subject:Date; b=QIsJXhYwxZ/T3deuBbISg/Gaia5v4YnX5N3x16Nz6+2jTvrzQMP+pmeViBFL1myAH kWFuidDuNjttJvTPtR7S1E6nfihJYMw7yb+pVTZXSUUvonGgo81BEdiHab37DGY40a 4/CVVF+lg/AlB/wQjH9HaVV5D991fw0t4V+3GQgE= Received: from localhost.localdomain ([119.147.10.186]) by newxmesmtplogicsvrszc2-0.qq.com (NewEsmtp) with SMTP id 15620087; Mon, 22 May 2023 12:05:22 +0800 X-QQ-mid: xmsmtpt1684728322tsmkpsa9p Message-ID: X-QQ-XMAILINFO: Md/xSstEnVzNO1kF7El2dV2qutmtLz6TOgY8F6+lF84/IDEi78ZppH8e5KMRMx 6hmSCwl2rI2qPNPPo0mCivIlCjHE43/jvlBgQpXes9MSVAaZz1v4sau5IuXG+SCD8quDtGL1I1V9 lJl0M7ISU3SaLIDoAbNUaEacFPLt/N9pFd6x6JmVhnjNm8JgpYUgJL6eXsjcMfgHINOAA0EiuvTd ufFY8qenDzDjshOMe5FbL88bzAvD0/SZu8oXrSkpdCv3EmIO19xlAfBupRS1wMo3N6OqQV8nRM5W 3of5JQb2NlqJTqNZNHooHYVJ3+PJunc4D9E5gmXRpmZBdB84GtYTaZeQ0nE777yh2ASTTNUwiJ19 NSRY8jkCHEsYS99BCAX2y3Vk4GvEYaH4zTpDgY2PcTIEmtl1eiq9g/AAOlpmTctlS/B7Xu6dIfOX o/vYbaGPDhWmOQP2m9l+AZ+7N5DRy4vGUB5PglNlW+L/+8yLnkLpzjPgwI8yBV+OFS+77EGMwWlf dozrJ40o7c++5zRr0SeHNSKpxVVqos1pNj9D80pHfmN5ZJw5lFTBfYlurAS64jOVE0kHmG/NDocw yLLPSD3fBFDwu6f4wgKOBQfUfCnp4+1+1199UU9jFBJPM672PFZZiKtIxiKGBypq9GUEPfLGaTCb 14vzywDbNuuHm5xBlM85WGBTBj/UxOkggUFhWXb0ojXyS/2p2ypQ2op4Kpm4N16Jj9fRpPO8uV4H bbXavR9+L+C7v47/xMyHo4xf/n7/64UPgx+5PP/UGmPc6YmuEkjRAmIpWM985bT9MIWtFY7VKrru FBbJJkUzgZ/30yn45PdcaGnIGkayUC9S9UWa8uxKZT6/tAPd1ZSG++YiXW/sS/1+pLwAxXscFxB9 P95Oq3UUF3Bw0Djj3nslA3fPYwY5hR48l6m58Ndch/zFCHLx3EBFufiQIj4BTO1X7v+lhQ99HzqL kiiWoWkT+rYrgbOW9WljWDxICvsnrq8BMNxQ98XkY= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Mon, 22 May 2023 20:05:30 +0800 X-OQ-MSGID: <20230522120530.397730-1-quinkblack@foxmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2] 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 --- v2: Don't overwrite wrap automatically for native ASS libavfilter/version.h | 2 +- libavfilter/vf_subtitles.c | 14 ++++++++++++++ 2 files changed, 15 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..48038cde23 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) @@ -271,6 +272,9 @@ static const AVOption subtitles_options[] = { {"stream_index", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, FLAGS}, {"si", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, FLAGS}, {"force_style", "force subtitle style", OFFSET(force_style), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS}, +#if (LIBASS_VERSION >= 0x01600010) + {"wrap_unicode", "break lines according to the Unicode Line Breaking Algorithm", OFFSET(wrap_unicode), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, FLAGS }, +#endif {NULL}, }; @@ -432,6 +436,16 @@ static av_cold int init_subtitles(AVFilterContext *ctx) if (ret < 0) goto end; + /* Don't overwrite wrap automatically for native ASS */ + if (ass->wrap_unicode == -1) + ass->wrap_unicode = st->codecpar->codec_id != AV_CODEC_ID_ASS; + if (ass->wrap_unicode) { + ret = ass_track_set_feature(ass->track, ASS_FEATURE_WRAP_UNICODE, 1); + if (ret < 0) + av_log(ctx, AV_LOG_WARNING, + "libass wasn't built with ASS_FEATURE_WRAP_UNICODE support\n"); + } + if (ass->force_style) { char **list = NULL; char *temp = NULL; -- 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".