Add a load of explicit keywords.
[dcpomatic.git] / src / tools / dcpomatic_create.cc
index 136fbf9c0319790e33606cd085e3844267df2f46..a9d1165f14c02a563d93ca268974c2544a0050c0 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2017 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -30,6 +30,8 @@
 #include "lib/image_content.h"
 #include "lib/video_content.h"
 #include "lib/cross.h"
+#include "lib/dcp_content.h"
+#include <dcp/exceptions.h>
 #include <libxml++/libxml++.h>
 #include <boost/filesystem.hpp>
 #include <boost/foreach.hpp>
@@ -234,7 +236,17 @@ main (int argc, char* argv[])
                film->set_signed (sign);
 
                for (int i = optind; i < argc; ++i) {
-                       BOOST_FOREACH (shared_ptr<Content> j, content_factory (film, boost::filesystem::canonical (argv[i]))) {
+                       boost::filesystem::path const can = boost::filesystem::canonical (argv[i]);
+                       list<shared_ptr<Content> > content;
+
+                       if (boost::filesystem::exists (can / "ASSETMAP") || (boost::filesystem::exists (can / "ASSETMAP.xml"))) {
+                               content.push_back (shared_ptr<DCPContent> (new DCPContent (film, can)));
+                       } else {
+                               /* I guess it's not a DCP */
+                               content = content_factory (film, can);
+                       }
+
+                       BOOST_FOREACH (shared_ptr<Content> j, content) {
                                if (j->video) {
                                        j->video->set_scale (VideoContentScale (content_ratio));
                                }
@@ -257,7 +269,7 @@ main (int argc, char* argv[])
                ContentList content = film->content ();
                for (ContentList::iterator i = content.begin(); i != content.end(); ++i) {
                        shared_ptr<ImageContent> ic = dynamic_pointer_cast<ImageContent> (*i);
-                       if (ic) {
+                       if (ic && ic->still()) {
                                ic->video->set_length (still_length * 24);
                        }
                }