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 0B7E94BBBD for <ffmpegdev@gitmailbox.com>; Sat, 29 Mar 2025 15:37:15 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 258AB687C19; Sat, 29 Mar 2025 17:37:11 +0200 (EET) Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A8585687BD1 for <ffmpeg-devel@ffmpeg.org>; Sat, 29 Mar 2025 17:37:04 +0200 (EET) Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-ac2dfdf3c38so562345366b.3 for <ffmpeg-devel@ffmpeg.org>; Sat, 29 Mar 2025 08:37:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743262623; x=1743867423; darn=ffmpeg.org; h=content-transfer-encoding:in-reply-to:content-language:references :to:subject:from:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=y2dNMoEBAZ0RHatuzMuz36n5acFBQslAODOsGgQLt0c=; b=VPBORtU1nNf6kDkDAbdH/KpwiONMxn5RmjSvqulZ9HulCOKUvoXWKSqLOWmOhhXAve o7ityq8Lyl3LvUyjddgIZov8wttD9Z1XMuQiNIjxyqj7wV6lIbnva/0+gRma7kHjfdf2 kwGJS+1MJmXKZAjftW8YrV6d5dC/M9xUlNOM9HxEWCGvgP3ppbNCJFEjBzRktIcgnI4d Mme3MzI1NAd3YyXNvN2Iepk+8L01dIFqrfcZwkIk1ulqyMIkqkPhgfx+D2tnwuI9ZBJF reiFuiFDxVkn6G3WpNqXJoLYRUNn4gZDERn99vcmPkvX4mXOHgt/XwC5JcAH/g+mlb0Z JgjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743262623; x=1743867423; h=content-transfer-encoding:in-reply-to:content-language:references :to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=y2dNMoEBAZ0RHatuzMuz36n5acFBQslAODOsGgQLt0c=; b=ClRK6L+Nlu1bQXuRj95a7q6NQFtVc78iHYPLea5zhGnB0HPdrGw4zAgF0AFYjq9xLa 7rmMm89jtxCIP1tkFozTFx84r9NZdqUMF6vqROUixr/I0zq3J4tr0vOT+eQDzhUhFXQo M/daolbPmrM20EOUsd0n0VNDj52KyIcvhcMoUmJgs8l4w++7xGAiGcmh9+f3FmPMfz0l 4ju79W76vvglDq01Bb3BLYjf/zYyFKv7rRO/a4I9rAk5Q0OnEqEP44NXGCHBJJkeQzKe 5wkaLJH9Rcnbm8qGGC1GRA9LdaI5rx8tpoQZ/cHRtHTxmePz0XqUgr6yHEolaWPOOZQ/ K6rQ== X-Gm-Message-State: AOJu0Yzi2GLR1tvUJJI1AViUpHdk79PGVnAE7Qby9EkSGsHJoyO3PIE5 U1t+f+1tRp1DkJbTwRPtFn+RmWJ81YDvWqHi76IqW0hUnMBK/OrfzrvTLg== X-Gm-Gg: ASbGncsCQrDXwwFQWhJqCnZq5i8Mij4YMltX/HrWQ1KWawUX+ABd19H9LNiXmL6uqzZ dDxM3H+b41oAIz3P9TxiImQ6YYHvPmKahUYDDwuMVebZucwhQAXzTSdMYCxGTF5TZnSQ5k4QdGt 0X9zNM0vWriFKMZvt4MWVZ6d40tx8V2uBM19zdhYb+YOLRydjc1i/jM/ks4TKWF5sRY43JJvt5m 7jwRyd+SYUu+PiPTaFDHeXm8OHF40lJKWtlF+RUtvvFLSOVaKI58/LPM3lmPHf8T+2eBlXJKk3g iXTowsSn4cRpsrRc8t/CKLBVgDZobSLvjvdUQqndCDfB2PXBf5BeszHuy2I= X-Google-Smtp-Source: AGHT+IFGmYVi0qizIQ4bagY5YCaw/7Nb/whbz5+fgBQnjWJ4SxbTzRQvmAz2dIdrXPwbV3Ke7u9kdQ== X-Received: by 2002:a17:907:1c8b:b0:ac6:b731:965c with SMTP id a640c23a62f3a-ac738ae6ce6mr248945666b.23.1743262623089; Sat, 29 Mar 2025 08:37:03 -0700 (PDT) Received: from [192.168.1.145] ([188.90.220.200]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac71962177fsm343486466b.115.2025.03.29.08.37.02 for <ffmpeg-devel@ffmpeg.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 29 Mar 2025 08:37:02 -0700 (PDT) Message-ID: <e108d340-16df-46a3-8b13-ec816ac2514e@gmail.com> Date: Sat, 29 Mar 2025 16:37:02 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Leon Grutters <gruttersleonbot2@gmail.com> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> References: <20250321155502.418939-1-gruttersleonbot2@gmail.com> Content-Language: en-US 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/e108d340-16df-46a3-8b13-ec816ac2514e@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> Ping. > --- > 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".