Merge branch '1.0' of ssh://houllier/home/carl/git/dvdomatic into 1.0
[dcpomatic.git] / src / lib / film.cc
index fc1d2d8a4ee2fa7c98ee7d34ad06a639cf42b38e..ef29d35fdde57806a2d0ef8f0a5f9a3def734789 100644 (file)
@@ -1,5 +1,3 @@
-/* -*- c-basic-offset: 8; default-tab-width: 8; -*- */
-
 /*
     Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
 
@@ -34,7 +32,6 @@
 #include <libxml++/libxml++.h>
 #include <libcxml/cxml.h>
 #include "film.h"
-#include "container.h"
 #include "job.h"
 #include "filter.h"
 #include "util.h"
@@ -56,6 +53,7 @@
 #include "imagemagick_content.h"
 #include "sndfile_content.h"
 #include "dcp_content_type.h"
+#include "ratio.h"
 
 #include "i18n.h"
 
@@ -75,6 +73,7 @@ using std::cout;
 using std::list;
 using boost::shared_ptr;
 using boost::lexical_cast;
+using boost::dynamic_pointer_cast;
 using boost::to_upper_copy;
 using boost::ends_with;
 using boost::starts_with;
@@ -316,14 +315,6 @@ Film::analyse_audio ()
        JobManager::instance()->add (_analyse_audio_job);
 }
 
-/** Start a job to examine a piece of content */
-void
-Film::examine_content (shared_ptr<Content> c)
-{
-       shared_ptr<Job> j (new ExamineContentJob (shared_from_this(), c));
-       JobManager::instance()->add (j);
-}
-
 void
 Film::analyse_audio_finished ()
 {
@@ -435,7 +426,7 @@ Film::read_metadata ()
        {
                optional<string> c = f.optional_string_child ("Container");
                if (c) {
-                       _container = Container::from_id (c.get ());
+                       _container = Ratio::from_id (c.get ());
                }
        }
 
@@ -611,7 +602,7 @@ Film::set_dcp_content_type (DCPContentType const * t)
 }
 
 void
-Film::set_container (Container const * c)
+Film::set_container (Ratio const * c)
 {
        {
                boost::mutex::scoped_lock lm (_state_mutex);
@@ -812,11 +803,22 @@ Film::content () const
        return _playlist->content ();
 }
 
+void
+Film::examine_and_add_content (shared_ptr<Content> c)
+{
+       shared_ptr<Job> j (new ExamineContentJob (shared_from_this(), c));
+       JobManager::instance()->add (j);
+}
+
 void
 Film::add_content (shared_ptr<Content> c)
 {
+       /* Add video content after any existing content */
+       if (dynamic_pointer_cast<VideoContent> (c)) {
+               c->set_start (_playlist->video_end ());
+       }
+
        _playlist->add (c);
-       examine_content (c);
 }
 
 void
@@ -903,3 +905,15 @@ Film::dcp_audio_frame_rate () const
        /* XXX */
        return 48000;
 }
+
+void
+Film::set_sequence_video (bool s)
+{
+       _playlist->set_sequence_video (s);
+}
+
+libdcp::Size
+Film::full_frame () const
+{
+       return libdcp::Size (2048, 1080);
+}