From: Carl Hetherington Date: Sat, 8 Mar 2014 13:15:06 +0000 (+0000) Subject: Merge master. X-Git-Tag: v2.0.48~892 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=a4c19a34244aeaf183c25878933b570fc5c0ee34;hp=cab9a1d569396065a6e9eb39386736908564d6b4 Merge master. --- diff --git a/ChangeLog b/ChangeLog index d7cd6adf8..7c6f4ebdd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,10 @@ * Add subtitle view. +2014-03-08 Carl Hetherington + + * Support for unsigned 8-bit audio (hmm!). + 2014-03-06 Carl Hetherington * Version 1.65.0 released. diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index dc2a5590b..d37399eb3 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -182,6 +182,23 @@ FFmpegDecoder::deinterleave_audio (uint8_t** data, int size) shared_ptr audio (new AudioBuffers (_ffmpeg_content->audio_channels(), frames)); switch (audio_sample_format()) { + case AV_SAMPLE_FMT_U8: + { + uint8_t* p = reinterpret_cast (data[0]); + int sample = 0; + int channel = 0; + for (int i = 0; i < total_samples; ++i) { + audio->data(channel)[sample] = float(*p++) / (1 << 23); + + ++channel; + if (channel == _ffmpeg_content->audio_channels()) { + channel = 0; + ++sample; + } + } + } + break; + case AV_SAMPLE_FMT_S16: { int16_t* p = reinterpret_cast (data[0]);