Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: James Almer via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: James Almer <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] avformat/riff: add support for HEAACWAVEFORMAT (PR #20888)
Date: Mon, 10 Nov 2025 20:42:21 -0000
Message-ID: <176280734222.25.3164558145327278717@2cb04c0e5124> (raw)

PR #20888 opened by James Almer (jamrial)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20888
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20888.patch

This is an extension to WAVEFORMATEX used for some AAC streams, defined in the Windows SDK.

Fixes issue #20887.


>From 05a6c683e9a3e728bb139f3b2920957c6ff5530c Mon Sep 17 00:00:00 2001
From: James Almer <jamrial@gmail.com>
Date: Mon, 10 Nov 2025 17:37:58 -0300
Subject: [PATCH] avformat/riff: add support for HEAACWAVEFORMAT

This is an extension to WAVEFORMATEX used for some AAC streams, defined in the Windows SDK.

Fixes issue #20887.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/riff.c    |  1 +
 libavformat/riffdec.c | 16 ++++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/libavformat/riff.c b/libavformat/riff.c
index 3c12c4e6c3..fc79d0ac21 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -596,6 +596,7 @@ const AVCodecTag ff_codec_wav_tags[] = {
     /* ADTS AAC */
     { AV_CODEC_ID_AAC,             0x1600 },
     { AV_CODEC_ID_AAC_LATM,        0x1602 },
+    { AV_CODEC_ID_AAC,             0x1610 },
     { AV_CODEC_ID_AC3,             0x2000 },
     /* There is no Microsoft Format Tag for E-AC3, the GUID has to be used */
     { AV_CODEC_ID_EAC3,            0x2000 },
diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c
index 2b269b1682..685dffc893 100644
--- a/libavformat/riffdec.c
+++ b/libavformat/riffdec.c
@@ -149,6 +149,22 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb,
             parse_waveformatex(s, pb, par);
             cbSize -= 22;
             size   -= 22;
+        } else if (cbSize >= 12 && id == 0x1610) { /* HEAACWAVEFORMAT */
+            int wPayloadType = avio_rl16(pb);
+            if (wPayloadType == 2)
+                avpriv_request_sample(s, "wPayloadType \"1\" (ADTS)");
+            else if (wPayloadType == 3)
+                par->codec_id = AV_CODEC_ID_AAC_LATM;
+            avio_skip(pb, 2); // wAudioProfileLevelIndication
+            int wStructType = avio_rl16(pb);
+            if (wStructType) {
+                avpriv_report_missing_feature(s, "HEAACWAVEINFO wStructType \"%d\"", wStructType);
+                return AVERROR_PATCHWELCOME;
+            }
+            avio_skip(pb, 2); // wReserved1
+            avio_skip(pb, 4); // dwReserved2
+            cbSize -= 12;
+            size   -= 12;
         }
         if (cbSize > 0) {
             ret = ff_get_extradata(s, par, pb, cbSize);
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

                 reply	other threads:[~2025-11-10 20:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=176280734222.25.3164558145327278717@2cb04c0e5124 \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=code@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git