X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Ffilm_viewer.cc;h=be555ad91f556beb19937d4585408af0d6f44e7d;hb=ff64d7f42884bb21e61c5f5b242c41415a5934b1;hp=893e1bf0fe4569dec8ede2d80bf75acc213b7beb;hpb=377de24c4cb129fab39e30a089050c2af8202494;p=dcpomatic.git diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 893e1bf0f..be555ad91 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -108,7 +108,6 @@ FilmViewer::FilmViewer (wxWindow* p) } _video_view->Sized.connect (boost::bind(&FilmViewer::video_view_sized, this)); - _timer.Bind (wxEVT_TIMER, boost::bind(&FilmViewer::timer, this)); set_film (shared_ptr ()); @@ -209,40 +208,17 @@ FilmViewer::recreate_butler () return; } - AudioMapping map = AudioMapping (_film->audio_channels(), _audio_channels); - - if (_audio_channels != 2 || _film->audio_channels() < 3) { - for (int i = 0; i < min (_film->audio_channels(), _audio_channels); ++i) { - map.set (i, i, 1); - } - } else { - /* Special case: stereo output, at least 3 channel input. - Map so that Lt = L(-3dB) + Ls(-3dB) + C(-6dB) + Lfe(-10dB) - Rt = R(-3dB) + Rs(-3dB) + C(-6dB) + Lfe(-10dB) - */ - if (_film->audio_channels() > 0) { - map.set (dcp::LEFT, 0, 1 / sqrt(2)); // L -> Lt - } - if (_film->audio_channels() > 1) { - map.set (dcp::RIGHT, 1, 1 / sqrt(2)); // R -> Rt - } - if (_film->audio_channels() > 2) { - map.set (dcp::CENTRE, 0, 1 / 2.0); // C -> Lt - map.set (dcp::CENTRE, 1, 1 / 2.0); // C -> Rt - } - if (_film->audio_channels() > 3) { - map.set (dcp::LFE, 0, 1 / sqrt(10)); // Lfe -> Lt - map.set (dcp::LFE, 1, 1 / sqrt(10)); // Lfe -> Rt - } - if (_film->audio_channels() > 4) { - map.set (dcp::LS, 0, 1 / sqrt(2)); // Ls -> Lt - } - if (_film->audio_channels() > 5) { - map.set (dcp::RS, 1, 1 / sqrt(2)); // Rs -> Rt - } - } + _butler.reset( + new Butler( + _player, + Config::instance()->audio_mapping(_audio_channels), + _audio_channels, + bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), + false, + true + ) + ); - _butler.reset (new Butler(_player, map, _audio_channels, bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, true)); if (!Config::instance()->sound() && !_audio.isStreamOpen()) { _butler->disable_audio (); } @@ -358,30 +334,6 @@ FilmViewer::display_player_video () _closed_captions_dialog->update (time()); } -void -FilmViewer::timer () -{ - if (!_film || !_playing || _suspended) { - return; - } - - get (false); - DCPTime const next = _video_position + one_video_frame(); - - if (next >= _film->length()) { - stop (); - Finished (); - return; - } - - LOG_DEBUG_PLAYER("%1 -> %2; delay %3", next.seconds(), time().seconds(), max((next.seconds() - time().seconds()) * 1000, 1.0)); - _timer.Start (max ((next.seconds() - time().seconds()) * 1000, 1.0), wxTIMER_ONE_SHOT); - - if (_butler) { - _butler->rethrow (); - } -} - void FilmViewer::set_outline_content (bool o) { @@ -477,7 +429,7 @@ FilmViewer::start () _playing = true; _dropped = 0; - timer (); + _video_view->start (); Started (position()); } @@ -626,6 +578,11 @@ FilmViewer::config_changed (Config::Property p) } #endif + if (p == Config::AUDIO_MAPPING) { + recreate_butler (); + return; + } + if (p != Config::SOUND && p != Config::SOUND_OUTPUT) { return; }