diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-12-19 10:10:36 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-12-19 10:10:36 +0000 |
| commit | dedac27070ac5ad65265a0db1fa316b3e436cea7 (patch) | |
| tree | f7c8ab0b7a02ee41006743af9ae6625064e9da82 /src/lib/ffmpeg_decoder.cc | |
| parent | 8d9acccb5488a3dc00746e424fdd5997f2aae267 (diff) | |
| parent | 6b5a3e9543ccf6fd209877b44e43aaf3604ac693 (diff) | |
Fix merge.
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index c4ca00fa6..60bb3271e 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -369,7 +369,7 @@ FFmpegDecoder::deinterleave_audio (uint8_t* data, int size) switch (audio_sample_format()) { case AV_SAMPLE_FMT_S16: { - int16_t* p = (int16_t *) data; + int16_t* p = reinterpret_cast<int16_t *> (data); int sample = 0; int channel = 0; for (int i = 0; i < total_samples; ++i) { @@ -384,13 +384,24 @@ FFmpegDecoder::deinterleave_audio (uint8_t* data, int size) } break; + case AV_SAMPLE_FMT_S16P: + { + int16_t* p = reinterpret_cast<int16_t *> (data); + for (int i = 0; i < _film->audio_channels(); ++i) { + for (int j = 0; j < frames; ++j) { + audio->data(i)[j] = static_cast<float>(*p++) / (1 << 15); + } + } + } + break; + case AV_SAMPLE_FMT_S32: { - int32_t* p = (int32_t *) data; + int32_t* p = reinterpret_cast<int32_t *> (data); int sample = 0; int channel = 0; for (int i = 0; i < total_samples; ++i) { - audio->data(channel)[sample] = float(*p++) / (1 << 31); + audio->data(channel)[sample] = static_cast<float>(*p++) / (1 << 31); ++channel; if (channel == _film->audio_channels()) { @@ -399,7 +410,25 @@ FFmpegDecoder::deinterleave_audio (uint8_t* data, int size) } } } + break; + case AV_SAMPLE_FMT_FLT: + { + float* p = reinterpret_cast<float*> (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<float*> (data); |
