Commit 27cac1763e for ffmpeg

commit 27cac1763ed762ed58191bd32a2396416e65a9b3
Author: Baptiste Coudurier <baptiste.coudurier@gmail.com>
Date:   Wed Nov 18 16:04:47 2026 -0800

    avformat/movenc: write QDMC configuration in a wave atom

    The QuickTime File Format specification defines wave as the sound sample
    description extension for decompressor-specific configuration. QDMC
    extradata read from MOV already contains the complete wave payload,
    including the frma and terminator atoms.

    Write that payload in wave instead of the generic glbl atom, without
    adding another frma or terminator. This restores audio when the remuxed
    stream is decoded by a consumer expecting the QDMC wave configuration.

    Reference: https://developer.apple.com/documentation/quicktime-file-format/sidecompressionparam_atom
    Reference: https://developer.apple.com/documentation/quicktime-file-format/sound_sample_description_extensions
    Signed-off-by: Baptiste Coudurier <baptiste.coudurier@gmail.com>
    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 4b4ba9b9af..e0057dba3b 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1151,6 +1151,12 @@ static int mov_write_wave_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *tra
     avio_wb32(pb, 0);     /* size */
     ffio_wfourcc(pb, "wave");

+    if (track->par->codec_id == AV_CODEC_ID_QDMC) {
+        /* Extradata already contains the complete wave atom payload. */
+        mov_write_extradata_tag(pb, track);
+        return update_size(pb, pos);
+    }
+
     if (track->par->codec_id != AV_CODEC_ID_QDM2) {
         avio_wb32(pb, 12);    /* size */
         ffio_wfourcc(pb, "frma");
@@ -1582,6 +1588,7 @@ static int mov_write_audio_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContex
          track->par->codec_id == AV_CODEC_ID_ADPCM_MS      ||
          track->par->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV ||
          track->par->codec_id == AV_CODEC_ID_QDM2          ||
+         track->par->codec_id == AV_CODEC_ID_QDMC          ||
          (mov_pcm_le_gt16(track->par->codec_id) && version==1) ||
          (mov_pcm_be_gt16(track->par->codec_id) && version==1)))
         ret = mov_write_wave_tag(s, pb, track);
diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index 03f583e177..931a111543 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -371,6 +371,10 @@ FATE_MOV_FFMPEG_SAMPLES-$(call REMUX, MP4 MOV, AAC_PARSER) \
                           += fate-mov-mp4-edst-remainder
 fate-mov-mp4-edst-remainder: CMD = stream_remux mov $(TARGET_SAMPLES)/audiomatch/tones_fdkaac_44100_stereo_aac_lc.m4a "" mp4 "" "" "-c:a copy"

+# QDMC configuration must be written back in a wave atom
+FATE_MOV_FFMPEG_SAMPLES-$(call REMUX, MOV) += fate-mov-qdmc-remux
+fate-mov-qdmc-remux: CMD = transcode mov $(TARGET_SAMPLES)/qdmc/rumcoke.mov mov "-c copy -t 0.4" "-c copy"
+
 # Reserved colour values must not be written to colr
 FATE_MOV_FFMPEG_FFPROBE_SAMPLES-$(call REMUX, MP4 MOV, H264_PARSER H264_DECODER) += fate-mov-colr-reserved-color-tags
 fate-mov-colr-reserved-color-tags: CMD = stream_remux mov $(TARGET_SAMPLES)/mov/test_iibbibb.mp4 "" mp4 \
diff --git a/tests/ref/fate/mov-qdmc-remux b/tests/ref/fate/mov-qdmc-remux
new file mode 100644
index 0000000000..25246616f1
--- /dev/null
+++ b/tests/ref/fate/mov-qdmc-remux
@@ -0,0 +1,11 @@
+b3c337efc274d4585bc0444bad40c3b0 *tests/data/fate/mov-qdmc-remux.mov
+2398 tests/data/fate/mov-qdmc-remux.mov
+#extradata 0:       64, 0x269b07fa
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: qdmc
+#sample_rate 0: 44100
+#channel_layout_name 0: stereo
+0,          0,          0,     8192,      556, 0x7be0f27e
+0,       8192,       8192,     8192,      556, 0x7b53f4cc
+0,      16384,      16384,     8192,      556, 0x8973efc3