From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <ffmpeg-devel-bounces@ffmpeg.org> Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id AEA464D11D for <ffmpegdev@gitmailbox.com>; Wed, 16 Apr 2025 05:23:45 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 74628687D0C; Wed, 16 Apr 2025 08:23:39 +0300 (EEST) Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4356E687D19 for <ffmpeg-devel@ffmpeg.org>; Wed, 16 Apr 2025 08:23:33 +0300 (EEST) Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-ac298c8fa50so999705566b.1 for <ffmpeg-devel@ffmpeg.org>; Tue, 15 Apr 2025 22:23:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744781012; x=1745385812; darn=ffmpeg.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=9bPb1Bsm/UqYS5/z0KXPtUlcQw72f7qUWx2j0fBfOJM=; b=AGiaiNgnexokjV/qTWl4RO3nUP5bhcCwLQJ5EhnHJxfH2sqtjKzzWNJU2eo/ACVrv9 2If8sJOJGIbFLOTl53WoGfEa5h+1urgs6j8yW0CcpP8zbkKuyQ2/0zUYj/mzzPM9M0sG 9M/spdA2OyukULlplExX8j45rxfS91Z/Q0oKuD5po5OZ2cfV3dp5aJc9mY76AKewzTTA qg8Fguw8aE1hd6LalgvGryZQ631wDd7QkLMCR7ml95fgmqZLRFthIEMjsvPIknKV4QJB l2WcFiCiiGb0SgZav64ydot3rg8ME6r7TxAEBUdcU6WARv8KrV4/gICaD3zoHaXk2jE8 u4gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744781012; x=1745385812; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9bPb1Bsm/UqYS5/z0KXPtUlcQw72f7qUWx2j0fBfOJM=; b=T8dliyDWPpPKhjBrR+ksGS4ww3iZXdFmUc0GC20eRRZ3JgfPIGOH/q7p0FVlq5SgKo zWtJHR1KBBaP5jZB1sh41hyQe4Zrfs+R1fpe7L/9m36hd/FiDBXA7nJ55LtIdR54r8Io LgjI1pBwEduZcWsMTQkNyLIBu4Pjjox00nOZw6BnG50h0P/JU74bL9QTuN93NlzXb7Dy W04CFxvJLNdWp4xEJ9os5pce2ZxLF/PQfia6MyooR6fnohIjWz8z8/PX0HvjaHHHdhxF N/QNojPXzFUhdS1l3OoXQ0guU7icE8OQ9RFKR061lVUO/BOODp3jjm8GuY0ZCyLrdjJc o6nw== X-Gm-Message-State: AOJu0YwhDJ9dyrFHUyF2IYpzgMiMjzxtviswn468YYNgV9/BqPfB/ZXI 07tZ+seR+jVk1fJkwN8/Y6K8SsenL0Y3DCdXGj7/XXjR8hA/g0pX4CAV4w== X-Gm-Gg: ASbGncsGOZ9KCWEyw5tu9Yg55Tj8tx7/+NTMk7FoWhOY6SR96tnm0UFFbcZE0KcKRN1 NAU/69R6o8rXHHrFYnjRQJvj75v6KKk466mgeFzqCOKgpz0Nypcz8xQFVM1FbsbVC+u0Hbjuvz2 XRyAqWiw9vIDF6jCSHHCez/D3eQstDmv2OXK747l1BOcduwCZQEu4/6E+LukCKMuxRicHnqMn64 editj9M5wyLt9HcC6eUIx467tdwCeU16oa+vsfnf0kzKXZ/ZCEneIrO8m4SghLly3ZyeK4cq8he wHonPS6IaOTenibwD0b7nlsRTpSEXy7n3PNoKrJjUXUu6a06VXvHL4s= X-Google-Smtp-Source: AGHT+IGnxRl8HV/FkcmhMuEDRBKsdqhdg/2i9+kliehsFt7n2BsSpA4WCs+shmVzH5CaXhvzOM4ZQw== X-Received: by 2002:a17:907:3ea6:b0:ac7:970b:8ee5 with SMTP id a640c23a62f3a-acb429e41ffmr27956566b.27.1744781011524; Tue, 15 Apr 2025 22:23:31 -0700 (PDT) Received: from [192.168.1.145] ([188.90.220.200]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-acb3cdeb92csm56672266b.65.2025.04.15.22.23.31 for <ffmpeg-devel@ffmpeg.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Apr 2025 22:23:31 -0700 (PDT) Message-ID: <eff7e0bd-0ae6-402f-8826-20f2857fcc5c@gmail.com> Date: Wed, 16 Apr 2025 07:23:30 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> References: <20250321155502.418939-1-gruttersleonbot2@gmail.com> Content-Language: en-US From: Leon Grutters <gruttersleonbot2@gmail.com> In-Reply-To: <20250321155502.418939-1-gruttersleonbot2@gmail.com> Subject: Re: [FFmpeg-devel] [PATCH v2] avcodec/webvttdec: strip classes X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org> List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe> List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel> List-Post: <mailto:ffmpeg-devel@ffmpeg.org> List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help> List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe> Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org> Archived-At: <https://master.gitmailbox.com/ffmpegdev/eff7e0bd-0ae6-402f-8826-20f2857fcc5c@gmail.com/> List-Archive: <https://master.gitmailbox.com/ffmpegdev/> List-Post: <mailto:ffmpegdev@gitmailbox.com> On 3/21/25 4:55 PM, Leon Grutters wrote: > If a supported tag has a class, e.g "<i.bold>" it is ignored entirely; > so for example "<i.bold>Hello</i>" would be converted to "Hello{\i0}" > instead of the intended "{\i1}Hello{\i0}". > > Signed-off-by: Leon Grutters <gruttersleonbot2@gmail.com> Hi all, Wondering if anyone could review and/or apply this patch. Regards, Leon > --- > libavcodec/webvttdec.c | 39 ++++++++++++++++++++++++++++----------- > 1 file changed, 28 insertions(+), 11 deletions(-) > > diff --git a/libavcodec/webvttdec.c b/libavcodec/webvttdec.c > index 733fdee685..c375867643 100644 > --- a/libavcodec/webvttdec.c > +++ b/libavcodec/webvttdec.c > @@ -34,20 +34,41 @@ static const struct { > const char *from; > const char *to; > } webvtt_tag_replace[] = { > - {"<i>", "{\\i1}"}, {"</i>", "{\\i0}"}, > - {"<b>", "{\\b1}"}, {"</b>", "{\\b0}"}, > - {"<u>", "{\\u1}"}, {"</u>", "{\\u0}"}, > {"{", "\\{{}"}, {"\\", "\\\xe2\x81\xa0"}, // escape to avoid ASS markup conflicts > {">", ">"}, {"<", "<"}, > {"‎", "\xe2\x80\x8e"}, {"‏", "\xe2\x80\x8f"}, > {"&", "&"}, {" ", "\\h"}, > }; > +static const struct { > + const char from[6]; > + const char to[6]; > +} webvtt_valid_tags[] = { > + {"i", "{\\i1}"}, {"/i", "{\\i0}"}, > + {"b", "{\\b1}"}, {"/b", "{\\b0}"}, > + {"u", "{\\u1}"}, {"/u", "{\\u0}"}, > +}; > > static int webvtt_event_to_ass(AVBPrint *buf, const char *p) > { > - int i, again = 0, skip = 0; > + int i, again = 0; > > while (*p) { > + if (*p == '<') { > + const char *tag_end = strchr(p, '>'); > + ptrdiff_t len; > + if (!tag_end) > + break; > + len = tag_end - p + 1; > + for (i = 0; i < FF_ARRAY_ELEMS(webvtt_valid_tags); i++) { > + const char *from = webvtt_valid_tags[i].from; > + if(!strncmp(p + 1, from, strlen(from))) { > + av_bprintf(buf, "%s", webvtt_valid_tags[i].to); > + break; > + } > + } > + p += len; > + again = 1; > + } > > for (i = 0; i < FF_ARRAY_ELEMS(webvtt_tag_replace); i++) { > const char *from = webvtt_tag_replace[i].from; > @@ -59,21 +80,17 @@ static int webvtt_event_to_ass(AVBPrint *buf, const char *p) > break; > } > } > + > if (!*p) > break; > > if (again) { > again = 0; > - skip = 0; > continue; > } > - if (*p == '<') > - skip = 1; > - else if (*p == '>') > - skip = 0; > - else if (p[0] == '\n' && p[1]) > + if (p[0] == '\n' && p[1]) > av_bprintf(buf, "\\N"); > - else if (!skip && *p != '\r') > + else if (*p != '\r') > av_bprint_chars(buf, *p, 1); > p++; > } _______________________________________________ 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".