diff options
Diffstat (limited to 'src/wx/player_frame.cc')
| -rw-r--r-- | src/wx/player_frame.cc | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/wx/player_frame.cc b/src/wx/player_frame.cc index afc43b807..5097c5e00 100644 --- a/src/wx/player_frame.cc +++ b/src/wx/player_frame.cc @@ -71,6 +71,7 @@ LIBDCP_ENABLE_WARNINGS using std::dynamic_pointer_cast; using std::exception; using std::make_shared; +using std::pair; using std::shared_ptr; using std::string; using std::weak_ptr; @@ -1168,6 +1169,7 @@ PlayerFrame::setup_http_server() _http_server.reset(new HTTPServer(config->player_http_server_port())); _http_server->Play.connect(boost::bind(&FilmViewer::start, &_viewer)); _http_server->Stop.connect(boost::bind(&FilmViewer::stop, &_viewer)); + _http_server->LoadPlaylist.connect(boost::bind(&PlayerFrame::load_pair_playlist, this, _1)); _http_server_thread = boost::thread(boost::bind(&HTTPServer::run, _http_server.get())); } } catch (std::exception& e) { @@ -1330,7 +1332,18 @@ get_kdm_from_directory(shared_ptr<DCPContent> dcp) bool -PlayerFrame::set_playlist(vector<ShowPlaylistEntry> playlist) +PlayerFrame::load_playlist(vector<ShowPlaylistEntry> const& playlist) +{ + vector<pair<string, optional<float>>> details; + for (auto const& entry: playlist) { + details.push_back({entry.uuid(), entry.crop_to_ratio()}); + } + return load_pair_playlist(details); +} + + +bool +PlayerFrame::load_pair_playlist(vector<pair<string, optional<float>>> const& playlist) { bool was_playing = false; if (_viewer.playing()) { @@ -1346,7 +1359,7 @@ PlayerFrame::set_playlist(vector<ShowPlaylistEntry> playlist) auto const store = ShowPlaylistContentStore::instance(); for (auto const& entry: playlist) { dialog.Pulse(); - auto content = store->get(entry); + auto content = store->get(entry.first); if (!content) { error_dialog(this, _("This playlist cannot be loaded as some content is missing.")); _playlist.clear(); @@ -1374,7 +1387,7 @@ PlayerFrame::set_playlist(vector<ShowPlaylistEntry> playlist) return false; } } - _playlist.push_back({content, entry.crop_to_ratio()}); + _playlist.push_back({content, entry.second}); } take_playlist_entry(); @@ -1389,6 +1402,16 @@ PlayerFrame::set_playlist(vector<ShowPlaylistEntry> playlist) } +void +PlayerFrame::clear_playlist() +{ + _playlist.clear(); + _playlist_position = 0; + take_playlist_entry(); + _controls->playlist_changed(); +} + + /** Stop the viewer, take the thing at _playlist_position and prepare to play it. * Set up to play nothing if the playlist is empty, or we're off the * end of it. |
