summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-10-26 00:25:00 +0100
committerCarl Hetherington <cth@carlh.net>2018-10-26 00:25:00 +0100
commitee2cf80b14e8e78eb46280ba30cdb2f0c10c90a0 (patch)
tree24b18a6cce10daf260bb0e075257359b48b25dc1 /src
parentfad8d13cd779a6237feed2c855a46e1a7c66e0ad (diff)
Basics of MP4 support in the player.
Diffstat (limited to 'src')
-rw-r--r--src/tools/dcpomatic_player.cc34
-rw-r--r--src/wx/controls.cc19
-rw-r--r--src/wx/controls.h3
3 files changed, 30 insertions, 26 deletions
diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc
index 860181477..844d92bc8 100644
--- a/src/tools/dcpomatic_player.cc
+++ b/src/tools/dcpomatic_player.cc
@@ -444,11 +444,8 @@ public:
_film->set_container (Ratio::from_id("185"));
BOOST_FOREACH (shared_ptr<Content> i, _film->content()) {
- /* This DCP has been examined and loaded */
-
shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent>(i);
- DCPOMATIC_ASSERT (dcp);
- if (dcp->needs_kdm()) {
+ if (dcp && dcp->needs_kdm()) {
optional<dcp::EncryptedKDM> kdm;
#ifdef DCPOMATIC_VARIANT_SWAROOP
kdm = get_kdm_from_url (dcp);
@@ -463,12 +460,12 @@ public:
}
}
- BOOST_FOREACH (shared_ptr<TextContent> j, dcp->text) {
+ BOOST_FOREACH (shared_ptr<TextContent> j, i->text) {
j->set_use (true);
}
- if (dcp->video) {
- Ratio const * r = Ratio::nearest_from_ratio(dcp->video->size().ratio());
+ if (i->video) {
+ Ratio const * r = Ratio::nearest_from_ratio(i->video->size().ratio());
if (r->id() == "239") {
/* Any scope content means we use scope */
_film->set_container(r);
@@ -476,7 +473,7 @@ public:
}
/* Any 3D content means we use 3D mode */
- if (dcp->three_d()) {
+ if (i->video && i->video->frame_type() != VIDEO_FRAME_TYPE_2D) {
_film->set_three_d (true);
}
}
@@ -494,16 +491,17 @@ public:
if (_film->content().size() == 1) {
/* Offer a CPL menu */
shared_ptr<DCPContent> first = dynamic_pointer_cast<DCPContent>(_film->content().front());
- DCPOMATIC_ASSERT (first);
- DCPExaminer ex (first);
- int id = ID_view_cpl;
- BOOST_FOREACH (shared_ptr<dcp::CPL> i, ex.cpls()) {
- wxMenuItem* j = _cpl_menu->AppendRadioItem(
- id,
- wxString::Format("%s (%s)", std_to_wx(i->annotation_text()).data(), std_to_wx(i->id()).data())
- );
- j->Check(!first->cpl() || i->id() == *first->cpl());
- ++id;
+ if (first) {
+ DCPExaminer ex (first);
+ int id = ID_view_cpl;
+ BOOST_FOREACH (shared_ptr<dcp::CPL> i, ex.cpls()) {
+ wxMenuItem* j = _cpl_menu->AppendRadioItem(
+ id,
+ wxString::Format("%s (%s)", std_to_wx(i->annotation_text()).data(), std_to_wx(i->id()).data())
+ );
+ j->Check(!first->cpl() || i->id() == *first->cpl());
+ ++id;
+ }
}
}
}
diff --git a/src/wx/controls.cc b/src/wx/controls.cc
index 8c24a0da3..9540b8586 100644
--- a/src/wx/controls.cc
+++ b/src/wx/controls.cc
@@ -28,6 +28,7 @@
#include "lib/dcp_content.h"
#include "lib/job.h"
#include "lib/examine_content_job.h"
+#include "lib/content_factory.h"
#include "lib/cross.h"
#include <dcp/dcp.h>
#include <dcp/cpl.h>
@@ -190,7 +191,7 @@ Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool editor
film_changed ();
setup_sensitivity ();
- update_dcp_directory ();
+ update_content_directory ();
JobManager::instance()->ActiveJobsChanged.connect (
bind (&Controls::active_jobs_changed, this, _2)
@@ -256,7 +257,7 @@ void
Controls::config_changed (int property)
{
if (property == Config::PLAYER_CONTENT_DIRECTORY) {
- update_dcp_directory ();
+ update_content_directory ();
} else {
setup_sensitivity ();
}
@@ -573,7 +574,7 @@ Controls::show_extended_player_controls (bool s)
{
_content_view->Show (s);
if (s) {
- update_dcp_directory ();
+ update_content_directory ();
}
_spl_view->Show (s);
_log->Show (s);
@@ -615,7 +616,7 @@ Controls::add_content_to_list (shared_ptr<Content> content, wxListCtrl* ctrl)
}
void
-Controls::update_dcp_directory ()
+Controls::update_content_directory ()
{
if (!_content_view->IsShown()) {
return;
@@ -630,13 +631,19 @@ Controls::update_dcp_directory ()
return;
}
- wxProgressDialog progress (_("DCP-o-matic"), _("Reading DCP directory"));
+ wxProgressDialog progress (_("DCP-o-matic"), _("Reading content directory"));
JobManager* jm = JobManager::instance ();
for (directory_iterator i = directory_iterator(*dir); i != directory_iterator(); ++i) {
try {
+ shared_ptr<Content> content;
if (is_directory(*i) && (is_regular_file(*i / "ASSETMAP") || is_regular_file(*i / "ASSETMAP.xml"))) {
- shared_ptr<DCPContent> content (new DCPContent(_film, *i));
+ content.reset (new DCPContent(_film, *i));
+ } else if (i->path().extension() == ".mp4") {
+ content = content_factory(_film, *i).front();
+ }
+
+ if (content) {
jm->add (shared_ptr<Job>(new ExamineContentJob(_film, content)));
while (jm->work_to_do()) {
if (!progress.Pulse()) {
diff --git a/src/wx/controls.h b/src/wx/controls.h
index dba981d14..6e9b684a6 100644
--- a/src/wx/controls.h
+++ b/src/wx/controls.h
@@ -79,8 +79,7 @@ private:
void started ();
void stopped ();
void film_changed ();
- void update_dcp_directory ();
- void dcp_directory_changed ();
+ void update_content_directory ();
void config_changed (int property);
typedef std::pair<boost::shared_ptr<dcp::CPL>, boost::filesystem::path> CPL;