#include "lib/ffmpeg_content.h"
#include "lib/dcpomatic_log.h"
#include "lib/file_log.h"
+#include <dcp/cpl.h>
#include <dcp/dcp.h>
#include <dcp/raw_convert.h>
#include <dcp/exceptions.h>
_stress.LoadDCP.connect (boost::bind(&DOMFrame::load_dcp, this, _1));
}
+ ~DOMFrame ()
+ {
+ /* It's important that this is stopped before our frame starts destroying its children,
+ * otherwise UI elements that it depends on will disappear from under it.
+ */
+ _viewer.reset ();
+ }
+
void setup_main_sizer (Config::PlayerMode mode)
{
_main_sizer->Detach (_viewer->panel());
reset_film ();
try {
_stress.set_suspended (true);
+ // here
auto dcp = make_shared<DCPContent>(dir);
auto job = make_shared<ExamineContentJob>(_film, dcp);
_examine_job_connection = job->Finished.connect(bind(&DOMFrame::add_dcp_to_film, this, weak_ptr<Job>(job), weak_ptr<Content>(dcp)));
return;
}
Config::instance()->add_to_player_history (dir);
+ } catch (ProjectFolderError &) {
+ error_dialog (
+ this,
+ wxString::Format(_("Could not load a DCP from %s"), std_to_wx(dir.string())),
+ _(
+ "This looks like a DCP-o-matic project folder, which cannot be loaded into the player. "
+ "Choose the DCP directory inside the DCP-o-matic project folder if that's what you want to play."
+ )
+ );
} catch (dcp::ReadError& e) {
error_dialog (this, wxString::Format(_("Could not load a DCP from %s"), std_to_wx(dir.string())), std_to_wx(e.what()));
} catch (DCPError& e) {
DCPOMATIC_ASSERT (dcp);
try {
if (dcp) {
+ _viewer->set_coalesce_player_changes (true);
dcp->add_kdm (dcp::EncryptedKDM(dcp::file_to_string(wx_to_std(d->GetPath()), MAX_KDM_SIZE)));
examine_content();
+ _viewer->set_coalesce_player_changes (false);
}
} catch (exception& e) {
error_dialog (this, wxString::Format (_("Could not load KDM.")), std_to_wx(e.what()));
return;
}
- if (uc->state() == UpdateChecker::YES) {
+ if (uc->state() == UpdateChecker::State::YES) {
auto dialog = new UpdateDialog (this, uc->stable (), uc->test ());
dialog->ShowModal ();
dialog->Destroy ();
- } else if (uc->state() == UpdateChecker::FAILED) {
+ } else if (uc->state() == UpdateChecker::State::FAILED) {
error_dialog (this, _("The DCP-o-matic download server could not be contacted."));
} else {
error_dialog (this, _("There are no new versions of DCP-o-matic available."));
}
_frame->Show ();
- PlayServer* server = new PlayServer (_frame);
- new thread (boost::bind (&PlayServer::run, server));
+ try {
+ auto server = new PlayServer (_frame);
+ new thread (boost::bind (&PlayServer::run, server));
+ } catch (std::exception& e) {
+ /* This is not the end of the world; probably a failure to bind the server socket
+ * because there's already another player running.
+ */
+ LOG_DEBUG_PLAYER ("Failed to start play server (%1)", e.what());
+ }
if (!_dcp_to_load.empty() && boost::filesystem::is_directory (_dcp_to_load)) {
try {