Basics of MP4 support in the player.
authorCarl Hetherington <cth@carlh.net>
Thu, 25 Oct 2018 23:25:00 +0000 (00:25 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 25 Oct 2018 23:25:00 +0000 (00:25 +0100)
src/tools/dcpomatic_player.cc
src/wx/controls.cc
src/wx/controls.h

index 860181477bbdef2f693fc33fb23a71b56a978689..844d92bc81b5fe21dd3eb283d0139e25a6904fa4 100644 (file)
@@ -444,11 +444,8 @@ public:
                _film->set_container (Ratio::from_id("185"));
 
                BOOST_FOREACH (shared_ptr<Content> i, _film->content()) {
                _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);
                        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);
                                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);
                        }
 
                                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);
                                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 */
                        }
 
                        /* 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);
                        }
                }
                                _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());
                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;
+                               }
                        }
                }
        }
                        }
                }
        }
index 8c24a0da323eaeb0c96b36ae6717c509295024ca..9540b85868be470b7839505faaa4cc1f2a56c234 100644 (file)
@@ -28,6 +28,7 @@
 #include "lib/dcp_content.h"
 #include "lib/job.h"
 #include "lib/examine_content_job.h"
 #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>
 #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 ();
        film_changed ();
 
        setup_sensitivity ();
-       update_dcp_directory ();
+       update_content_directory ();
 
        JobManager::instance()->ActiveJobsChanged.connect (
                bind (&Controls::active_jobs_changed, this, _2)
 
        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) {
 Controls::config_changed (int property)
 {
        if (property == Config::PLAYER_CONTENT_DIRECTORY) {
-               update_dcp_directory ();
+               update_content_directory ();
        } else {
                setup_sensitivity ();
        }
        } else {
                setup_sensitivity ();
        }
@@ -573,7 +574,7 @@ Controls::show_extended_player_controls (bool s)
 {
        _content_view->Show (s);
        if (s) {
 {
        _content_view->Show (s);
        if (s) {
-               update_dcp_directory ();
+               update_content_directory ();
        }
        _spl_view->Show (s);
        _log->Show (s);
        }
        _spl_view->Show (s);
        _log->Show (s);
@@ -615,7 +616,7 @@ Controls::add_content_to_list (shared_ptr<Content> content, wxListCtrl* ctrl)
 }
 
 void
 }
 
 void
-Controls::update_dcp_directory ()
+Controls::update_content_directory ()
 {
        if (!_content_view->IsShown()) {
                return;
 {
        if (!_content_view->IsShown()) {
                return;
@@ -630,13 +631,19 @@ Controls::update_dcp_directory ()
                return;
        }
 
                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 {
        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"))) {
                        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()) {
                                jm->add (shared_ptr<Job>(new ExamineContentJob(_film, content)));
                                while (jm->work_to_do()) {
                                        if (!progress.Pulse()) {
index dba981d1436e072bff1ff083c2fc27c42ed353dc..6e9b684a62c53e567d539be8fa0070dab9211141 100644 (file)
@@ -79,8 +79,7 @@ private:
        void started ();
        void stopped ();
        void film_changed ();
        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;
        void config_changed (int property);
 
        typedef std::pair<boost::shared_ptr<dcp::CPL>, boost::filesystem::path> CPL;