From patchwork Sat Dec 30 21:13:37 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: 45397 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6623:b0:194:e134:edd4 with SMTP id n35csp5483541pzh; Sat, 30 Dec 2023 13:13:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IGRrQY1pPP+Y1tUZZBrQJgOo86X7s4VwJSnqmoT3LHGROwMSUYT8VLgHGvh9XTc4F1BFtKF X-Received: by 2002:a17:906:1603:b0:a23:62fd:e2f6 with SMTP id m3-20020a170906160300b00a2362fde2f6mr13766958ejd.30.1703970828818; Sat, 30 Dec 2023 13:13:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703970828; cv=none; d=google.com; s=arc-20160816; b=EUfhS/ErzxNiECvHgF0S3oNrgvOHqSy43nLcstEkpus74CPrFh7dBAzXj5rKDwE0v6 +eCWOG4XSoFV9GIUWry2LRgm3uUSzrE/Rk+ARr82ohyciWHV/yEkz0hv+XpuEVXcuzIT vhpSbiogI+mupZYZwDriID3SYo3ACriA2LxK+129tZL4T3X98S7W5t/v0KGw3EMX7Z7G oZSHd1gwsVL1l2DAOW79PDxEdAYjconc+kzfVU6UBfYnCu4sVxbE+P4o9RgS5cTek7hq YlwFCSGJEOQXQHGuSFT4du6PwG878EaHlDj6kXcOLzoAd1CG5yL0iMEPBwvMJjks17Zq XgOQ== 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=sZoTbLpFt74Q/QS1F6aS135MbhU4AWMkCes+hnrH2tg=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=STGyMJkPpNl6xXIZ0dQXfExHyA4s/3yS1LgUUQFsuu+kZLPoQnQn0TuWUqgukbVu25 0XG1Q1EIiHcZdKz9NtXv2dQLSxEXSH9JcagSSnxzmyjmwT6Cp/O6cS8SVBgyyzRz3GFC N5Zw7MRKmS1nJJMgVVU1gVhf+ifnuZwvofaQWpwzKsXLNiQGx2K0fRSUAEIdEnvUAPlH V7mjLTDkAmnu2WHBQVnznAs2hEronWOds/RMHy5ThRrRASq5fLo3kX+EOK8BSrW+KjIa s4M3hQYZFE3i9XBSUaGef76NLn59gdhvNqUGu4Kdpnm+onOgApiEVAscU+AbNOP74Fgg PWkg== 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 p9-20020a170906604900b00a272dd07ad2si3542789ejj.80.2023.12.30.13.13.48; Sat, 30 Dec 2023 13:13:48 -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 3971368CC40; Sat, 30 Dec 2023 23:13:46 +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 8AB8568B3B0 for ; Sat, 30 Dec 2023 23:13:39 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by glom.nmugroup.com (Postfix) with ESMTP id 330F35428441 for ; Sat, 30 Dec 2023 22:13:39 +0100 (CET) Received: from debian.lan (unknown [IPv6:2a00:66c0:a::72c]) (Authenticated sender: git01) by glom.nmugroup.com (Postfix) with ESMTPSA id A78AD5428493 for ; Sat, 30 Dec 2023 22:13:38 +0100 (CET) Message-ID: <390d655253d2b8036b3bd88b45a2262ad16cae5d.camel@haerdin.se> From: Tomas =?iso-8859-1?q?H=E4rdin?= To: FFmpeg development discussions and patches Date: Sat, 30 Dec 2023 22:13:37 +0100 In-Reply-To: References: User-Agent: Evolution 3.46.4-2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 3/6] Un-mark IMA APC as intra-only, only mark first packet as keyframe 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: qRejMnaF2Ks0 From f652daf2e9bad345c0e98ab058a5e07c3d45d13e 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 3/6] Un-mark IMA APC as intra-only, only mark first packet as keyframe 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 033344304c..45ef4c5091 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