From patchwork Tue Dec 26 15:53:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Tomas_H=C3=A4rdin?= X-Patchwork-Id: 45327 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6623:b0:194:e134:edd4 with SMTP id n35csp3111424pzh; Tue, 26 Dec 2023 07:53:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IGN0OT06MOZ9mcu0Jc2kndUEGSYPP1MH1oT9z3WBTahOvgDkWueUA2MI2+t5pnyFLBWh2x1 X-Received: by 2002:a17:906:a182:b0:a23:44e8:81b with SMTP id s2-20020a170906a18200b00a2344e8081bmr3336940ejy.73.1703605998110; Tue, 26 Dec 2023 07:53:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703605998; cv=none; d=google.com; s=arc-20160816; b=hBsgewnCogpPyZNrsKBlP+rEo6uZitTpjBdpAWiwc6F7bux4jQo+Hj2eLD5Smo+nv3 2dxM+5UDS+zbG47PdBJTaEI2+cjO0CO1EjcgIAdwZvNaZeTdGeTiTShzfHNZeaxh64dF fcHb1Wd+Hjh3Rw/40hXj+0dxoZolDl3tWnTqSanHpg1craoXiVHuhpsdW9no1xr3aHZF volURhbzEBW0ESppnXS4v8bggOLDhXGg2xklFrrt6lvIRmGPPJ9fhTZPl7Nhs1r9RsLg lRBAQNQdyp5UNyxpetmaZ4ULE5iQqeKKKxiPpgHvpNxf/2py+JbhgEGVFJHWZl1YOUDJ F2Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:user-agent:references:in-reply-to:date:to:from :message-id:delivered-to; bh=w5Mr6g4nTZ1twyVjWDGrAacJo/R2ObxaGPVCdXXyC7Q=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=DgKRftxMBpS2CHC7e92mbmxXQS3qlwdAeBQUe3tCoqeKHWJs7i1GntC4jQG4zdZlrT baR1dzzHTH2egh13KalZXssYrUR2Oj/4bEI0xq5uRJGVJK54sAAdp8rOFcYNRXRtNLPb oAIyh4IiZS0xv4OZEv19dyHEfyT+90YE/VCnDqBoSI3T6m1ChXVm2jOievq3ZYyJbtTT /IaO3brWPuy3WhEl9rcfIfPYzUV8ufvCQ/U72WjjGc2Z1KGC3CpPR8vsLn6pjXLOOmpz R6x6WtYFZAe8Lj5s6qmzy7n9JH9uvpLnAmRhJal0gD82vPoVCbl2RDCOLlJd6JqCYMW7 05AA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id r1-20020a1709060d4100b00a26b378370bsi4288395ejh.776.2023.12.26.07.53.17; Tue, 26 Dec 2023 07:53:18 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A56B368CA03; Tue, 26 Dec 2023 17:53:15 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from glom.nmugroup.com (glom.nmugroup.com [193.183.80.6]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3E8D768CCB3 for ; Tue, 26 Dec 2023 17:53:09 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by glom.nmugroup.com (Postfix) with ESMTP id D34355422287 for ; Tue, 26 Dec 2023 16:53:08 +0100 (CET) Received: from [192.168.1.110] (81-226-156-116-no2430.tbcn.telia.com [81.226.156.116]) (Authenticated sender: git01) by glom.nmugroup.com (Postfix) with ESMTPSA id 9EEA05421B47 for ; Tue, 26 Dec 2023 16:53:08 +0100 (CET) Message-ID: From: Tomas =?iso-8859-1?q?H=E4rdin?= To: FFmpeg development discussions and patches Date: Tue, 26 Dec 2023 16:53:07 +0100 In-Reply-To: References: User-Agent: Evolution 3.46.4-2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/6] Un-mark IMA APC as intra-only 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 3YBE/Gt6EchK From dd84044af61931988e43bd58c202fe4e7ca7069a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= Date: Tue, 26 Dec 2023 16:30:35 +0100 Subject: [PATCH 4/6] Un-mark IMA APC as intra-only Packets must be decoded in order. There is no way to seek and get a bitexact decode. --- libavcodec/codec_desc.c | 2 +- libavformat/apc.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index 432a9c9ea6..899c082c83 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -2431,7 +2431,7 @@ static const AVCodecDescriptor codec_descriptors[] = { .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_ima_apc", .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA CRYO APC"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_VIMA, diff --git a/libavformat/apc.c b/libavformat/apc.c index 7765c53088..d1891954a8 100644 --- a/libavformat/apc.c +++ b/libavformat/apc.c @@ -75,8 +75,13 @@ static int apc_read_header(AVFormatContext *s) static int apc_read_packet(AVFormatContext *s, AVPacket *pkt) { + int first = avio_tell(s->pb) == 32; if (av_get_packet(s->pb, pkt, MAX_READ_SIZE) <= 0) return AVERROR(EIO); + // each IMA APC packet depends on the one before for bitexact decode + // extradata is used to initialize the decoder + if (first) + pkt->flags |= AV_PKT_FLAG_KEY; pkt->stream_index = 0; return 0; } -- 2.39.2