You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-11-29 05:57:37 +02:00
XMA1 and XMA2 stereo decoders
Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
@@ -99,10 +99,12 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb,
|
||||
codec->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
if (!big_endian) {
|
||||
id = avio_rl16(pb);
|
||||
codec->channels = avio_rl16(pb);
|
||||
codec->sample_rate = avio_rl32(pb);
|
||||
bitrate = avio_rl32(pb) * 8LL;
|
||||
codec->block_align = avio_rl16(pb);
|
||||
if (id != 0x0165) {
|
||||
codec->channels = avio_rl16(pb);
|
||||
codec->sample_rate = avio_rl32(pb);
|
||||
bitrate = avio_rl32(pb) * 8LL;
|
||||
codec->block_align = avio_rl16(pb);
|
||||
}
|
||||
} else {
|
||||
id = avio_rb16(pb);
|
||||
codec->channels = avio_rb16(pb);
|
||||
@@ -126,7 +128,7 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb,
|
||||
codec->codec_id = ff_wav_codec_get_id(id,
|
||||
codec->bits_per_coded_sample);
|
||||
}
|
||||
if (size >= 18) { /* We're obviously dealing with WAVEFORMATEX */
|
||||
if (size >= 18 && id != 0x0165) { /* We're obviously dealing with WAVEFORMATEX */
|
||||
int cbSize = avio_rl16(pb); /* cbSize */
|
||||
if (big_endian) {
|
||||
avpriv_report_missing_feature(codec, "WAVEFORMATEX support for RIFX files\n");
|
||||
@@ -149,6 +151,21 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb,
|
||||
/* It is possible for the chunk to contain garbage at the end */
|
||||
if (size > 0)
|
||||
avio_skip(pb, size);
|
||||
} else if (id == 0x0165 && size >= 32) {
|
||||
int nb_streams, i;
|
||||
|
||||
size -= 4;
|
||||
av_freep(&codec->extradata);
|
||||
if (ff_get_extradata(codec, pb, size) < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
nb_streams = AV_RL16(codec->extradata + 4);
|
||||
codec->sample_rate = AV_RL32(codec->extradata + 12);
|
||||
codec->channels = 0;
|
||||
bitrate = 0;
|
||||
if (size < 8 + nb_streams * 20)
|
||||
return AVERROR_INVALIDDATA;
|
||||
for (i = 0; i < nb_streams; i++)
|
||||
codec->channels += codec->extradata[8 + i * 20 + 17];
|
||||
}
|
||||
|
||||
if (bitrate > INT_MAX) {
|
||||
|
||||
Reference in New Issue
Block a user