The branch, master has been updated
       via  6cdd2cbe323e04cb4bf88bea50c32aad60cba26e (commit)
       via  362d673ad6f4e5839411a26f95645d43371f1677 (commit)
      from  35464ad9ebe1f0502775748e680dc0167ddc57cc (commit)


- Log -----------------------------------------------------------------
commit 6cdd2cbe323e04cb4bf88bea50c32aad60cba26e
Author:     James Almer <[email protected]>
AuthorDate: Tue Nov 11 23:23:51 2025 -0300
Commit:     James Almer <[email protected]>
CommitDate: Wed Nov 12 21:30:02 2025 -0300

    avformat/riffenc: add support for HEAACWAVEFORMAT
    
    This is an extension to WAVEFORMATEX used for some AAC streams, defined in 
the
    Windows SDK.
    
    Signed-off-by: James Almer <[email protected]>

diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c
index df98b3b117..687bcb0c44 100644
--- a/libavformat/riffenc.c
+++ b/libavformat/riffenc.c
@@ -200,6 +200,18 @@ int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb,
                par->codec_tag != 0x0001 /* PCM */ ||
                riff_extradata - riff_extradata_start) {
         /* WAVEFORMATEX */
+        if (par->codec_tag == 0x1610) {
+            /* HEAACWAVEFORMAT */
+            avio_wl16(pb, par->extradata_size + 12); /* cbSize */
+            avio_wl16(pb, !par->extradata_size); // wPayloadType, 0 = Raw, 1 = 
ADTS
+            avio_wl16(pb, 0xFE); // wAudioProfileLevelIndication, 0xFE = 
unspecified
+            avio_wl16(pb, 0); // wStructType, 0 = AudioSpecificConfig()
+            avio_wl16(pb, 0); // wReserved1
+            avio_wl32(pb, 0); // dwReserved2
+        } else if (par->codec_tag == 0xFF && !par->extradata_size) {
+            av_log(s, AV_LOG_ERROR, "ADTS is only supported with codec tag 
0x1610\n");
+            return AVERROR(EINVAL);
+        } else
         avio_wl16(pb, riff_extradata - riff_extradata_start); /* cbSize */
     } /* else PCMWAVEFORMAT */
     avio_write(pb, riff_extradata_start, riff_extradata - 
riff_extradata_start);
diff --git a/libavformat/version.h b/libavformat/version.h
index 0d044ef7c6..8c1af81917 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@
 #include "version_major.h"
 
 #define LIBAVFORMAT_VERSION_MINOR   6
-#define LIBAVFORMAT_VERSION_MICRO 102
+#define LIBAVFORMAT_VERSION_MICRO 103
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \

commit 362d673ad6f4e5839411a26f95645d43371f1677
Author:     James Almer <[email protected]>
AuthorDate: Mon Nov 10 17:37:58 2025 -0300
Commit:     James Almer <[email protected]>
CommitDate: Wed Nov 12 21:29:49 2025 -0300

    avformat/riffdec: 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 <[email protected]>

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..30835d5f36 100644
--- a/libavformat/riffdec.c
+++ b/libavformat/riffdec.c
@@ -149,6 +149,20 @@ 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 == 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);
diff --git a/libavformat/version.h b/libavformat/version.h
index 35996a14ba..0d044ef7c6 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@
 #include "version_major.h"
 
 #define LIBAVFORMAT_VERSION_MINOR   6
-#define LIBAVFORMAT_VERSION_MICRO 101
+#define LIBAVFORMAT_VERSION_MICRO 102
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \

-----------------------------------------------------------------------

Summary of changes:
 libavformat/riff.c    |  1 +
 libavformat/riffdec.c | 14 ++++++++++++++
 libavformat/riffenc.c | 12 ++++++++++++
 libavformat/version.h |  2 +-
 4 files changed, 28 insertions(+), 1 deletion(-)


hooks/post-receive
-- 

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to