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 1919449443 for ; Tue, 12 Mar 2024 11:00:30 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7616868C736; Tue, 12 Mar 2024 13:00:27 +0200 (EET) Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 39E4C68C0A2 for ; Tue, 12 Mar 2024 13:00:21 +0200 (EET) Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a28a6cef709so587294566b.1 for ; Tue, 12 Mar 2024 04:00:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710241220; x=1710846020; darn=ffmpeg.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=7hb0MyWWxaO/Z7E0wyFtz9ehnkNnrnueDSXXXiBWzuw=; b=dpPGL77wnQkQmW3sfO71zWpUWVtUQafRaygFyGBVFgoWH7XVyTASTRu75+fPB4V5GX qX25lHqDoZTMHaATz5RvDjU6bkK/uXHJoZxfZsGncj2OnCAYvi+7nHKE6fL0JbvqZ2mx dYOun+de7Pu+xcLmUJYHNEtDRRLGRllujHPnALGD/uiVLfRy0aEf79RWOAuQaTN4XG3J Fi56IUdC5pZbpopFdEGvnCbTXtd18UtEXTRJQuHXSlDW6rwwm4mfHsL0O90UcgK+yj2u Son7uZh6N9YcZj+3znLruJXwJPN0dCqoO5vnayj0XuCkiD+ybR9BFJ2svaaxnWj1alU+ Hl6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710241220; x=1710846020; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7hb0MyWWxaO/Z7E0wyFtz9ehnkNnrnueDSXXXiBWzuw=; b=rm3UgfMDXb85OekiRNGvuonbfRYUOqOoLUX2XPryJpUEsd3QkU1ADig0P2w8sSOG53 bxaR6jhfkoKq5nRzWlOlSc4Tg9jvQNNdkxDCa3Bv1mBnv/WVPiz/qJzgoLl/eGQ4QuwH wsPjJuVx4I7XNhmz50fnCHs2ghqc47pzBvdNerDgudHuTl290Rpk/AKFvwV9bgUav6AK rHmTdrpBcImydGz9ntC4z75l8mdAU/b6SXLzHRIqdI29WGwK6iPgORVIr/bY7A+JNahu ntvTuEXHh+XsRUEcFMEotLX90/QhTkVx07tT0IxQtgjjZUwZVosWv/ysRnVvlj0CNsr0 08kA== X-Gm-Message-State: AOJu0YysEXKB47BJL7MiBLGbPPmk6+0FNvqnzGOG3eb2GNQPnD1quN49 xZirMPrXzFHeXb3YhvMuM9TAAEZ705Zb8HnYxb9dx0oFwZZsdghckeV9yVwq X-Google-Smtp-Source: AGHT+IHyJPnIvtwP8m0sqUUqwoHmP2b9zhV8FMaXVc2mC7tzs8RXO2DL8eU41t9MmKZChy4oqE/7Uw== X-Received: by 2002:a17:906:308e:b0:a45:ad00:eade with SMTP id 14-20020a170906308e00b00a45ad00eademr5962006ejv.57.1710241219916; Tue, 12 Mar 2024 04:00:19 -0700 (PDT) Received: from mariano ([188.210.239.79]) by smtp.gmail.com with ESMTPSA id h4-20020a170906260400b00a461e10094asm2387818ejc.95.2024.03.12.04.00.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 04:00:19 -0700 (PDT) Received: by mariano (Postfix, from userid 1000) id E3CA3BFCDC; Tue, 12 Mar 2024 12:00:17 +0100 (CET) Date: Tue, 12 Mar 2024 12:00:17 +0100 From: Stefano Sabatini To: FFmpeg development discussions and patches Message-ID: Mail-Followup-To: FFmpeg development discussions and patches , Marth64 References: <20240312060005.2111135-1-marth64@proxyid.net> <20240312060005.2111135-2-marth64@proxyid.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240312060005.2111135-2-marth64@proxyid.net> User-Agent: Mutt/2.1.4 (2021-12-11) Subject: Re: [FFmpeg-devel] [PATCH v3 1/6] avcodec/mpeg12dec: extract only one type of CC substream 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: Marth64 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 Tuesday 2024-03-12 01:00:00 -0500, Marth64 wrote: > In MPEG-2 user data, there can be different types of Closed Captions > formats embedded (A53, SCTE-20, or DVD). The current behavior of the > CC extraction code in the MPEG-2 decoder is to not be aware of > multiple formats if multiple exist, therefore allowing one format > to overwrite the other during the extraction process since the CC > extraction shares one output buffer for the normalized bytes. > > This causes sources that have two CC formats to produce flawed output. > There exist real-world samples which contain both A53 and SCTE-20 captions > in the same MPEG-2 stream, and that manifest this problem. Example of symptom: > THANK YOU (expected) --> THTHANANK K YOYOUU (actual) > > The solution is to pick only the first CC substream observed with valid bytes, > and ignore the other types. Additionally, provide an option for users > to manually "force" a type in the event that this matters for a particular > source. > > Signed-off-by: Marth64 > --- > libavcodec/mpeg12dec.c | 67 ++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 64 insertions(+), 3 deletions(-) > > diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c > index 3a2f17e508..8961a290a3 100644 > --- a/libavcodec/mpeg12dec.c > +++ b/libavcodec/mpeg12dec.c > @@ -62,6 +62,16 @@ > > #define A53_MAX_CC_COUNT 2000 > > +enum Mpeg2ClosedCaptionsFormat { > + CC_FORMAT_AUTO, > + CC_FORMAT_A53_PART4, > + CC_FORMAT_SCTE20, > + CC_FORMAT_DVD > +}; > +static const char mpeg2_cc_format_labels[4][12] = { nit: this might be static const char *mpeg2_cc_format_labels[4] = { to avoid unnecessary constraints on the string length, or you might pass the CC name in the function directly to avoid to maintain the array (as it is not shared at the moment) > + "Unknown", "A/53 Part 4", "SCTE-20", "DVD" > +}; > + [...] LGTM otherwise. _______________________________________________ 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".