From patchwork Wed Sep 2 23:16:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liushuyu@aosc.io X-Patchwork-Id: 22069 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 505C844BBA0 for ; Thu, 3 Sep 2020 02:17:17 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2B0FC68AA6F; Thu, 3 Sep 2020 02:17:17 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay3.mymailcheap.com (relay3.mymailcheap.com [217.182.66.161]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B4B8D68ABFA for ; Thu, 3 Sep 2020 02:17:10 +0300 (EEST) Received: from filter1.mymailcheap.com (filter1.mymailcheap.com [149.56.130.247]) by relay3.mymailcheap.com (Postfix) with ESMTPS id E010F3F1CC for ; Thu, 3 Sep 2020 01:17:09 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by filter1.mymailcheap.com (Postfix) with ESMTP id 196C62A0E3 for ; Wed, 2 Sep 2020 19:17:09 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mymailcheap.com; s=default; t=1599088629; bh=bbZUdTygzdtZ6l4aFDhBEgKW0Q4Ms/DGrcGjbbTuHwA=; h=From:To:Cc:Subject:Date:From; b=gxvMNygFASZr4kpDOfCRYulOudwuqtfihM3pMaXtojRL8b67v6NzCawXrcPui3aov 9hjkVDc9LYBMIufY+zaSYjArnlh9bwaP62ImeqxwdybhF05VP8xKPdmJ6k5iLB6md1 EyU8i8Tt6TgIKHclxvu6ISDpImr6Mh4UXCWXrKPA= X-Virus-Scanned: Debian amavisd-new at filter1.mymailcheap.com Received: from filter1.mymailcheap.com ([127.0.0.1]) by localhost (filter1.mymailcheap.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nJGmtCkBETpL for ; Wed, 2 Sep 2020 19:17:07 -0400 (EDT) Received: from mail20.mymailcheap.com (mail20.mymailcheap.com [51.83.111.147]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by filter1.mymailcheap.com (Postfix) with ESMTPS for ; Wed, 2 Sep 2020 19:17:07 -0400 (EDT) Received: from [213.133.102.83] (ml.mymailcheap.com [213.133.102.83]) by mail20.mymailcheap.com (Postfix) with ESMTP id 8928940FDA; Wed, 2 Sep 2020 23:17:05 +0000 (UTC) Authentication-Results: mail20.mymailcheap.com; dkim=pass (1024-bit key; unprotected) header.d=aosc.io header.i=@aosc.io header.b="bWAkMXnP"; dkim-atps=neutral AI-Spam-Status: Not processed Received: from liushuyu.lan (d50-99-10-89.abhsia.telus.net [50.99.10.89]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail20.mymailcheap.com (Postfix) with ESMTPSA id 386D840FDA; Wed, 2 Sep 2020 23:16:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=aosc.io; s=default; t=1599088578; bh=bbZUdTygzdtZ6l4aFDhBEgKW0Q4Ms/DGrcGjbbTuHwA=; h=From:To:Cc:Subject:Date:From; b=bWAkMXnPVGuZUDRmGxR1AvAt/A7Px6dLcF4fp+qypOBvqTn/D6CwEl7+LfikCB3Fl CYKg2oGqwecIzmWh/jm8Ya4fbu1+nvmb2qcamlbIvf9WD96htML1q9h+N6WoMIiSQ5 tTfY3OUkbYQUB2OfFS4TYqu4t+dJPrJc8LjkcYIM= From: liushuyu@aosc.io To: ffmpeg-devel@ffmpeg.org Date: Wed, 2 Sep 2020 17:16:04 -0600 Message-Id: <20200902231605.694523-1-liushuyu@aosc.io> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-Rspamd-Queue-Id: 8928940FDA X-Spamd-Result: default: False [4.90 / 20.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(0.00)[aosc.io:s=default]; TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[aosc.io]; BROKEN_CONTENT_TYPE(1.50)[]; R_SPF_SOFTFAIL(0.00)[~all]; ML_SERVERS(-3.10)[213.133.102.83]; DKIM_TRACE(0.00)[aosc.io:+]; RCPT_COUNT_TWO(0.00)[2]; FROM_NO_DN(0.00)[]; MID_CONTAINS_FROM(1.00)[]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:213.133.96.0/19, country:DE]; RCVD_COUNT_TWO(0.00)[2]; HFILTER_HELO_BAREIP(3.00)[213.133.102.83,1] X-Rspamd-Server: mail20.mymailcheap.com Subject: [FFmpeg-devel] [PATCH v3 0/1] avformat: add mca demuxer 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: liushuyu Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: liushuyu This patch adds the MCA demuxer to FFmpeg. MCA is a format used by Capcom in some of their games, the audio format is always ADPCM_THP_LE in these files. This MCA demuxer implementation currently supports MCA version 1-5 and can partially handle some of the version 5 files with minor damages to the file header. There are some sample files I have prepared that you can try: * (version 4) https://streams.videolan.org/ffmpeg/incoming/bgm18_1632b.mca * (version 5) https://streams.videolan.org/ffmpeg/incoming/bgm020_1632.mca N.B. Files using version 1 to 3 are harder to find, I don't seem to find any to test. As required by https://ffmpeg.org/developer.html#New-codecs-or-formats-checklist, the minor version of libavformat is updated to 52. Patch version 2 changes: * changed version field to uint16_t and remove redundant compares Patch version 3 changes: * dropped excessive comments about offsets * removed redundant headers * indentation fixes and paddings around '=' * aliased st->codecpar to par to shorten the code * made m->samples_per_block zero check earlier * m->coef_offset converted to a local variable * replaced avio_read() checks with ffio_read_size() * moved sample size check to read_header() * manual sample copying replaced with av_get_packet() Zixing Liu (1): avformat: add mca demuxer Changelog | 1 + doc/general.texi | 2 + libavformat/Makefile | 1 + libavformat/allformats.c | 1 + libavformat/mca.c | 231 +++++++++++++++++++++++++++++++++++++++ libavformat/version.h | 4 +- 6 files changed, 238 insertions(+), 2 deletions(-) create mode 100644 libavformat/mca.c