From a54bdb873641bbc84298f4424dba17a075d0c0da Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 18 Dec 2012 19:05:55 +0000 Subject: Try to throw an exception rather than asserting on an unknown sound format. --- src/lib/ffmpeg_decoder.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib/ffmpeg_decoder.cc') diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 74eb8934c..911714d7b 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -450,7 +450,7 @@ FFmpegDecoder::deinterleave_audio (uint8_t* data, int size) break; default: - assert (false); + throw DecodeError (String::compose ("Unrecognised audio sample format (%1)", static_cast (audio_sample_format()))); } return audio; -- cgit v1.2.3 From b23ffefb21e43f0dc9d1bf031156331ea56e474d Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 18 Dec 2012 20:02:32 +0000 Subject: Support non-planar float audio. --- src/lib/ffmpeg_decoder.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/lib/ffmpeg_decoder.cc') diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 911714d7b..3c607a7fb 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -438,7 +438,25 @@ FFmpegDecoder::deinterleave_audio (uint8_t* data, int size) } } } + break; + + case AV_SAMPLE_FMT_FLT: + { + float* p = reinterpret_cast (data); + int sample = 0; + int channel = 0; + for (int i = 0; i < total_samples; ++i) { + audio->data(channel)[sample] = *p++; + ++channel; + if (channel == _film->audio_channels()) { + channel = 0; + ++sample; + } + } + } + break; + case AV_SAMPLE_FMT_FLTP: { float* p = reinterpret_cast (data); -- cgit v1.2.3