avformat/aiffenc: write CHAN chunk after COMM

COMM is where the channel count is indicated
Channel count can be useful when parsing the CHAN chunk
This commit is contained in:
Tim Walker
2026-06-03 14:32:19 +00:00
committed by James Almer
co-authored by James Almer
parent e8031e5b9a
commit 34ebcabcf1
2 changed files with 9 additions and 7 deletions
+8 -6
View File
@@ -147,12 +147,6 @@ static int aiff_write_header(AVFormatContext *s)
avio_wb32(pb, 0xA2805140);
}
if (par->ch_layout.order == AV_CHANNEL_ORDER_NATIVE && par->ch_layout.nb_channels > 2) {
ffio_wfourcc(pb, "CHAN");
avio_wb32(pb, 12);
ff_mov_write_chan(pb, par->ch_layout.u.mask);
}
put_meta(s, "title", MKBETAG('N', 'A', 'M', 'E'));
put_meta(s, "author", MKBETAG('A', 'U', 'T', 'H'));
put_meta(s, "copyright", MKBETAG('(', 'c', ')', ' '));
@@ -193,6 +187,14 @@ static int aiff_write_header(AVFormatContext *s)
avio_write(pb, par->extradata, par->extradata_size);
}
/* CHAN chunk; a decoder may use the channel count when parsing this chunk,
* so let's write it after the COMM chunk which indicates said channel count. */
if (par->ch_layout.order == AV_CHANNEL_ORDER_NATIVE && par->ch_layout.nb_channels > 2) {
ffio_wfourcc(pb, "CHAN");
avio_wb32(pb, 12);
ff_mov_write_chan(pb, par->ch_layout.u.mask);
}
/* Sound data chunk */
ffio_wfourcc(pb, "SSND");
aiff->ssnd = avio_tell(pb); /* Sound chunk size */
+1 -1
View File
@@ -1,4 +1,4 @@
9b8bfdf87a8d3d089819ef9f6f264ec4 *tests/data/fate/id3v2-utf16-bom.aiff
8e292c72670bc4b09b05b2eb11edfa70 *tests/data/fate/id3v2-utf16-bom.aiff
885482 tests/data/fate/id3v2-utf16-bom.aiff
#tb 0: 1/90000
#media_type 0: video