From patchwork Thu Sep 3 22:32:36 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: 22083 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 14E24447EAD for ; Fri, 4 Sep 2020 01:33:22 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E286B68AC45; Fri, 4 Sep 2020 01:33:21 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay1.mymailcheap.com (relay1.mymailcheap.com [144.217.248.100]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D96F36881C8 for ; Fri, 4 Sep 2020 01:33:13 +0300 (EEST) Received: from filter1.mymailcheap.com (filter1.mymailcheap.com [149.56.130.247]) by relay1.mymailcheap.com (Postfix) with ESMTPS id 9DB853F202 for ; Thu, 3 Sep 2020 22:33:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by filter1.mymailcheap.com (Postfix) with ESMTP id 867482A0F2 for ; Thu, 3 Sep 2020 18:33:12 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mymailcheap.com; s=default; t=1599172392; bh=JxNvixrUFcxUKpyC740/Nsp1b7lwGMeY/H9g7dSH7bU=; h=From:To:Cc:Subject:Date:From; b=R69Zyv1Av2IL02h9c9754wPGErBYNWpObVAtpb/W+oMtOPmOSq6cGILefjNL4bByJ FgtCpeCCPW2FP/fT1OULF5wp1qfEgPWT9GdEkNPWmBdccJ1/jtY8HDF4Ob7pL/BITR mmUhpYXvoqtCQlU/IJ2RPsKbrupCUreWe4+ZtqHA= 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 TNB5NJEq6dR9 for ; Thu, 3 Sep 2020 18:33:09 -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 ; Thu, 3 Sep 2020 18:33:09 -0400 (EDT) Received: from [213.133.102.83] (ml.mymailcheap.com [213.133.102.83]) by mail20.mymailcheap.com (Postfix) with ESMTP id 4F1A440144; Thu, 3 Sep 2020 22:33:08 +0000 (UTC) Authentication-Results: mail20.mymailcheap.com; dkim=pass (1024-bit key; unprotected) header.d=aosc.io header.i=@aosc.io header.b="pNvEKILj"; 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 1A65440144; Thu, 3 Sep 2020 22:33:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=aosc.io; s=default; t=1599172382; bh=JxNvixrUFcxUKpyC740/Nsp1b7lwGMeY/H9g7dSH7bU=; h=From:To:Cc:Subject:Date:From; b=pNvEKILjr4uaZsZtOvSkgsGP8uIk68guwEmSpQanUFeXbfzSx0VF96GXCbQlbbdKJ 3DUo7oVu+VODRUaHFQoeWQENdd+QgN3vDwiv8EOVcY1zcdj7gkqizcv+9GLBKwtElJ zQSYq4Ui0DUi5iFQi3d6GBcvZ1xqUzcqIUOyW8zc= From: liushuyu@aosc.io To: ffmpeg-devel@ffmpeg.org Date: Thu, 3 Sep 2020 16:32:36 -0600 Message-Id: <20200903223237.111724-1-liushuyu@aosc.io> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-Rspamd-Queue-Id: 4F1A440144 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 v4 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() Patch version 4 changes * check version early in the probe() * removed redundant av_new_packet() call * libavformat minor version updated to 54 Zixing Liu (1): avformat: add mca demuxer Changelog | 1 + doc/general.texi | 2 + libavformat/Makefile | 1 + libavformat/allformats.c | 1 + libavformat/mca.c | 226 +++++++++++++++++++++++++++++++++++++++ libavformat/version.h | 2 +- 6 files changed, 232 insertions(+), 1 deletion(-) create mode 100644 libavformat/mca.c