Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Volkert <thomas@homer-conferencing.com>2014-12-17 14:04:37 +0300
committerMichael Niedermayer <michaelni@gmx.at>2014-12-18 02:10:35 +0300
commit00d7555f3468193a761c0534df6742646b15829c (patch)
tree2048d6d1646b1256ddcbc1965b12d02b29af9aa6 /libavformat/riffdec.c
parente8714f6f93d1a32f4e4655209960afcf4c185214 (diff)
wavdec: RIFX file format support
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/riffdec.c')
-rw-r--r--libavformat/riffdec.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c
index 88e2229a77..edaf146d1c 100644
--- a/libavformat/riffdec.c
+++ b/libavformat/riffdec.c
@@ -80,23 +80,37 @@ static void parse_waveformatex(AVIOContext *pb, AVCodecContext *c)
}
}
-int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size)
+/* "big_endian" values are needed for RIFX file format */
+int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size, int big_endian)
{
int id;
if (size < 14)
avpriv_request_sample(codec, "wav header size < 14");
- id = avio_rl16(pb);
codec->codec_type = AVMEDIA_TYPE_AUDIO;
- codec->channels = avio_rl16(pb);
- codec->sample_rate = avio_rl32(pb);
- codec->bit_rate = avio_rl32(pb) * 8;
- codec->block_align = avio_rl16(pb);
+ if (!big_endian) {
+ id = avio_rl16(pb);
+ codec->channels = avio_rl16(pb);
+ codec->sample_rate = avio_rl32(pb);
+ codec->bit_rate = avio_rl32(pb) * 8;
+ codec->block_align = avio_rl16(pb);
+ } else {
+ id = avio_rb16(pb);
+ codec->channels = avio_rb16(pb);
+ codec->sample_rate = avio_rb32(pb);
+ codec->bit_rate = avio_rb32(pb) * 8;
+ codec->block_align = avio_rb16(pb);
+ }
if (size == 14) { /* We're dealing with plain vanilla WAVEFORMAT */
codec->bits_per_coded_sample = 8;
- } else
- codec->bits_per_coded_sample = avio_rl16(pb);
+ } else {
+ if (!big_endian) {
+ codec->bits_per_coded_sample = avio_rl16(pb);
+ } else {
+ codec->bits_per_coded_sample = avio_rb16(pb);
+ }
+ }
if (id == 0xFFFE) {
codec->codec_tag = 0;
} else {
@@ -106,6 +120,10 @@ int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size)
}
if (size >= 18) { /* 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");
+ return AVERROR_PATCHWELCOME;
+ }
size -= 18;
cbSize = FFMIN(size, cbSize);
if (cbSize >= 22 && id == 0xfffe) { /* WAVEFORMATEXTENSIBLE */