From patchwork Sat Sep 26 02:39:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zane van Iperen X-Patchwork-Id: 22598 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id A13A144B3E8 for ; Sat, 26 Sep 2020 05:39:26 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8464A68B497; Sat, 26 Sep 2020 05:39:26 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-40131.protonmail.ch (mail-40131.protonmail.ch [185.70.40.131]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 552FB68B31D for ; Sat, 26 Sep 2020 05:39:25 +0300 (EEST) Date: Sat, 26 Sep 2020 02:39:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zanevaniperen.com; s=protonmail2; t=1601087964; bh=BKGot589Kf2bo6XQcWkH5USt8dWnWcT+oQT8J+pghSA=; h=Date:To:From:Cc:Reply-To:Subject:From; b=j3f33Ow9CU7PbKBbYHWb1m9slB325gh7gVlm0BMQa4+Bzz6D5LT+mf5+KYu5hSgcL hfWdzcLEz9EpWL3kDwBeH2OMF21daHKNzrZpGPzp7ZZ0OUwpK3XsQlajLuR15QqynF /JjTuTd0D1REUOEbFuE7eOLhX+c0hzBIYSAVTVztoeuRdi/L5rX06BLZt6e9tGUHK5 s81KYzh8stCFquTwair2zXE89HwAh2O73HiG8qyasXwPeM0av80UK1lsNm1Tq+C7CF TK9smath3pDVNFmswM/pXnk9Au9MKKPnpllFdDsFweqge9mYkrxSoEzdrg3BHC8SW/ 3Gr9QHruleSNg== To: ffmpeg-devel@ffmpeg.org From: Zane van Iperen Message-ID: <20200926023817.7891-5-zane@zanevaniperen.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Subject: [FFmpeg-devel] [PATCH 5/6] avformat/argo_brp: allow v1.1 ASF streams to have a non-22050 sample rate in certain circumstances X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Zane van Iperen Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" It seems that in files where the BASF block isn't first, v1.1 ASF streams are allowed to be non-22050. Either this format is really inconsistent, or FX Fighter and Croc just ignored the sample rate field, requiring the v1.1 restriction in the first place. This bumps the version to 1.2 in these streams so they're not "corrected". Found in Alien Odyssey games files in: ./GRAPHICS/COMMBUNK/{{COMADD1,COMM2_{1,2,3E},COMM3_{2,3,4,5,6}},FADE{1,2}}.BRP Signed-off-by: Zane van Iperen --- libavformat/argo_brp.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libavformat/argo_brp.c b/libavformat/argo_brp.c index 4041183011..af64a0d6dc 100644 --- a/libavformat/argo_brp.c +++ b/libavformat/argo_brp.c @@ -323,6 +323,20 @@ static int argo_brp_read_header(AVFormatContext *s) ff_argo_asf_parse_chunk_header(&brp->basf.ckhdr, buf); + /* + * Special Case Hack. It seems that in files where the BASF block isn't first, + * v1.1 streams are allowed to be non-22050... + * Bump the version to 1.2 so ff_argo_asf_fill_stream() doesn't "correct" it. + * + * Found in Alien Odyssey games files in: + * ./GRAPHICS/COMMBUNK/{{COMADD1,COMM2_{1,2,3E},COMM3_{2,3,4,5,6}},FADE{1,2}}.BRP + * + * Either this format really inconsistent, or FX Fighter and Croc just ignored the + * sample rate field... + */ + if (i != 0 && hdr->extradata.basf.version_major == 1 && hdr->extradata.basf.version_minor == 1) + hdr->extradata.basf.version_minor = 2; + if ((ret = ff_argo_asf_fill_stream(s, st, &hdr->extradata.basf, &brp->basf.ckhdr)) < 0) return ret;