diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-10-20 21:29:20 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-10-20 21:29:20 +0100 |
| commit | 5911030f411e104778ad2c3faca8c8cb7bdbc387 (patch) | |
| tree | befe0ce3d1137497171b3c554f498354b9b6f798 /src | |
| parent | b6e73791a09cf0598024484f820385f4fec6190c (diff) | |
Extract audio more correctly and neatly; support 7.1 in DCP naming; fix up lack of update after changing audio stream.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/decoder.cc | 27 | ||||
| -rw-r--r-- | src/lib/film_state.cc | 3 | ||||
| -rw-r--r-- | src/wx/film_editor.cc | 4 |
3 files changed, 24 insertions, 10 deletions
diff --git a/src/lib/decoder.cc b/src/lib/decoder.cc index 14401994f..d78089265 100644 --- a/src/lib/decoder.cc +++ b/src/lib/decoder.cc @@ -200,28 +200,37 @@ Decoder::emit_audio (uint8_t* data, int size) switch (audio_sample_format()) { case AV_SAMPLE_FMT_S16: { - uint8_t* p = data; + int16_t* p = (int16_t *) data; int sample = 0; int channel = 0; for (int i = 0; i < total_samples; ++i) { - /* unsigned sample */ - int const ou = p[0] | (p[1] << 8); - /* signed sample */ - int const os = ou >= 0x8000 ? (- 0x10000 + ou) : ou; - /* float sample */ - audio->data(channel)[sample] = float(os) / 0x8000; + audio->data(channel)[sample] = float(*p++) / (1 << 15); ++channel; if (channel == _fs->audio_channels()) { channel = 0; ++sample; } - - p += 2; } } break; + case AV_SAMPLE_FMT_S32: + { + int32_t* p = (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); + + ++channel; + if (channel == _fs->audio_channels()) { + channel = 0; + ++sample; + } + } + } + case AV_SAMPLE_FMT_FLTP: { float* p = reinterpret_cast<float*> (data); diff --git a/src/lib/film_state.cc b/src/lib/film_state.cc index 8dd8309a8..09c5e3efd 100644 --- a/src/lib/film_state.cc +++ b/src/lib/film_state.cc @@ -431,6 +431,9 @@ FilmState::dci_name () const case 6: d << "51_"; break; + case 8: + d << "71_"; + break; } d << "2K_"; diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index 54b810db9..15755b9db 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -900,6 +900,9 @@ FilmEditor::audio_stream_changed (wxCommandEvent &) _ignore_changes = Film::AUDIO_STREAM; _film->set_audio_stream (_audio_stream->GetSelection ()); _ignore_changes = Film::NONE; + + _dcp_name->SetLabel (std_to_wx (_film->dcp_name ())); + setup_audio_details (); } void @@ -925,4 +928,3 @@ FilmEditor::setup_audio_details () _audio->SetLabel (std_to_wx (s.str ())); } } - |
