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 0AB604A724 for ; Thu, 4 Apr 2024 17:45:00 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8624668D0E0; Thu, 4 Apr 2024 20:44:57 +0300 (EEST) Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E0F4968CCB3 for ; Thu, 4 Apr 2024 20:44:50 +0300 (EEST) Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-56e2c1650d8so35898a12.0 for ; Thu, 04 Apr 2024 10:44:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712252689; x=1712857489; darn=ffmpeg.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=JCSXR+t9RelOgZ301UgBTPA97/Nc356vCtzaMw2Ojnk=; b=XgRrfZRWX/Kx7Vd1Pu2tVZpKbIkJlr2ajiH1/NE8ow3EeYoOsu0Esv/Pa59sbo2qoi 5IBCL4PzGae1JZSVICVxb601dSM3/MHYROa5xT8w7jmms6Vv2RIbvMezSW6gzEkI/FzD kMS4d50uLISwxhTQJTw0ljDwp28bCN9nAkep9yMw5zZOsZOKN31TI8l/c3GyCr6FpELp M1jxGAiYnazKadhe3yWRLqHZkTYWdbOBA7IuqqlrT9SI7c6dHUEE5lFgvHm0QFwGQBM/ tH8kytqPW58J697egVBIaB/qEv9s40nYMN6gH8kiKO9jXHWtUlBY1fLu0q7HQff7JaBB zDwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712252689; x=1712857489; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=JCSXR+t9RelOgZ301UgBTPA97/Nc356vCtzaMw2Ojnk=; b=EB084NPbOzXAB10mCm6NCSOW8vS9c77KBuazCazTr+aNl1h7Khq+5Xqt8np6lvb0wz 33tDSioiomHqc+5M2MX4u58S+Ho2/T2HyDyyqNBapRIJCnuJAcdBCPcg19sYfzbQOVMI tvW7boP4tYvptHU1rc4qAObW6ys1cNkrRCRTAwW6XEI9LP9hQX1HeI3xniC6nOPWBJBM E33Hbczowj8vXJq8KEOpYnGrD+28APi3NAMGcEYNTsiX1lKUsfCucMmrvolotmgl48D/ Oelfsmn1GFllzGqdhgdjzsyomjGQJM2K0xdGkpw5LCCUTnx5u0uiuwXXmr5tAPJMJlgm 9qnQ== X-Gm-Message-State: AOJu0YyxaApDF9vnkXqquNF6zVj7AYbZNEK7qt8R1ngwm7J4phsZrJ+K YViR+A+CPtf1dW5LiZIQ9y064KPwntPo4GWT4CEgAiw/0sTgCx6+/AZW0CB1 X-Google-Smtp-Source: AGHT+IENJybpLc6gYzurZ8Kc2AFUr648g064psYSuVKiU14V+yosoU5Slzbn8EwrtjS56Ag7ACnLTg== X-Received: by 2002:a50:ccd5:0:b0:56b:8cbb:3695 with SMTP id b21-20020a50ccd5000000b0056b8cbb3695mr2170034edj.8.1712252689293; Thu, 04 Apr 2024 10:44:49 -0700 (PDT) Received: from mariano (host-79-42-51-175.retail.telecomitalia.it. [79.42.51.175]) by smtp.gmail.com with ESMTPSA id e5-20020a056402104500b0056dbd754811sm7192421edu.40.2024.04.04.10.44.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 10:44:48 -0700 (PDT) Received: by mariano (Postfix, from userid 1000) id BA50EBFCE8; Thu, 4 Apr 2024 19:44:47 +0200 (CEST) Date: Thu, 4 Apr 2024 19:44:47 +0200 From: Stefano Sabatini To: FFmpeg development discussions and patches Message-ID: Mail-Followup-To: FFmpeg development discussions and patches References: <20240219214227.19814-1-oneric@oneric.de> <20240219214227.19814-3-oneric@oneric.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240219214227.19814-3-oneric@oneric.de> User-Agent: Mutt/2.1.4 (2021-12-11) Subject: Re: [FFmpeg-devel] [PATCH v4 2/4] avcodec/{ass, webvttdec}: fix handling of backslashes 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 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: On date Monday 2024-02-19 22:42:25 +0100, Oneric wrote: > Backslashes cannot be escaped by a backslash in any ASS renderer, > but unless followed by specific characters it is just printed out. > Insert a word-joiner character after a backslash to break up > active sequences without changing the visual output. > --- > libavcodec/ass.c | 9 ++++++++- > libavcodec/webvttdec.c | 2 +- > 2 files changed, 9 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/ass.c b/libavcodec/ass.c > index 5058dc8337..a68d3568b4 100644 > --- a/libavcodec/ass.c > +++ b/libavcodec/ass.c > @@ -183,9 +183,16 @@ void ff_ass_bprint_text_event(AVBPrint *buf, const char *p, int size, > > /* standard ASS escaping so random characters don't get mis-interpreted > * as ASS */ > - } else if (!keep_ass_markup && strchr("{}\\", *p)) { > + } else if (!keep_ass_markup && strchr("{}", *p)) { > av_bprintf(buf, "\\%c", *p); > > + /* append word-joiner U+2060 as UTF-8 to break up sequences like \N */ I'm confused by this, what kind of \N sequences might appear in an ASS file? Can you show an offending sequence? > + } else if (!keep_ass_markup && *p == '\\') { > + if (p_end - p <= 3 || strncmp(p + 1, "\xe2\x81\xa0", 3)) > + av_bprintf(buf, "\\\xe2\x81\xa0"); > + else > + av_bprintf(buf, "\\"); > + > /* some packets might end abruptly (no \0 at the end, like for example > * in some cases of demuxing from a classic video container), some > * might be terminated with \n or \r\n which we have to remove (for > diff --git a/libavcodec/webvttdec.c b/libavcodec/webvttdec.c > index 990d150f16..6e55bc5499 100644 > --- a/libavcodec/webvttdec.c > +++ b/libavcodec/webvttdec.c > @@ -37,7 +37,7 @@ static const struct { > {"", "{\\i1}"}, {"", "{\\i0}"}, > {"", "{\\b1}"}, {"", "{\\b0}"}, > {"", "{\\u1}"}, {"", "{\\u0}"}, > - {"{", "\\{"}, {"}", "\\}"}, // escape to avoid ASS markup conflicts > + {"{", "\\{"}, {"}", "\\}"}, {"\\", "\\\xe2\x81\xa0"}, // escape to avoid ASS markup conflicts > {">", ">"}, {"<", "<"}, > {"‎", "\xe2\x80\x8e"}, {"‏", "\xe2\x80\x8f"}, > {"&", "&"}, {" ", "\\h"}, _______________________________________________ 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".