mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-24 03:59:43 +00:00
add waveformatextensible support
Originally committed as revision 7714 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
cc1fb6238b
commit
72fd40bd3a
@ -422,22 +422,30 @@ void get_wav_header(ByteIOContext *pb, AVCodecContext *codec, int size)
|
|||||||
codec->bits_per_sample = 8;
|
codec->bits_per_sample = 8;
|
||||||
}else
|
}else
|
||||||
codec->bits_per_sample = get_le16(pb);
|
codec->bits_per_sample = get_le16(pb);
|
||||||
codec->codec_id = wav_codec_get_id(id, codec->bits_per_sample);
|
if (size >= 18) { /* We're obviously dealing with WAVEFORMATEX */
|
||||||
|
int cbSize = get_le16(pb); /* cbSize */
|
||||||
if (size > 16) { /* We're obviously dealing with WAVEFORMATEX */
|
size -= 18;
|
||||||
codec->extradata_size = get_le16(pb);
|
cbSize = FFMIN(size, cbSize);
|
||||||
if (codec->extradata_size > 0) {
|
if (cbSize >= 22 && id == 0xfffe) { /* WAVEFORMATEXTENSIBLE */
|
||||||
if (codec->extradata_size > size - 18)
|
codec->bits_per_sample = get_le16(pb);
|
||||||
codec->extradata_size = size - 18;
|
get_le32(pb); /* dwChannelMask */
|
||||||
|
id = get_le32(pb); /* 4 first bytes of GUID */
|
||||||
|
url_fskip(pb, 12); /* skip end of GUID */
|
||||||
|
cbSize -= 22;
|
||||||
|
size -= 22;
|
||||||
|
}
|
||||||
|
codec->extradata_size = cbSize;
|
||||||
|
if (cbSize > 0) {
|
||||||
codec->extradata = av_mallocz(codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
|
codec->extradata = av_mallocz(codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||||
get_buffer(pb, codec->extradata, codec->extradata_size);
|
get_buffer(pb, codec->extradata, codec->extradata_size);
|
||||||
} else
|
size -= cbSize;
|
||||||
codec->extradata_size = 0;
|
}
|
||||||
|
|
||||||
/* It is possible for the chunk to contain garbage at the end */
|
/* It is possible for the chunk to contain garbage at the end */
|
||||||
if (size - codec->extradata_size - 18 > 0)
|
if (size > 0)
|
||||||
url_fskip(pb, size - codec->extradata_size - 18);
|
url_fskip(pb, size);
|
||||||
}
|
}
|
||||||
|
codec->codec_id = wav_codec_get_id(id, codec->bits_per_sample);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user