Numerous fixes to A/B mode so that at least it doesn't crash (#72).
[dcpomatic.git] / src / lib / film.cc
index 8f545952b336f512e363a9f87d8d00f4a29faade..8028f40ef0ee0bf6e849cd9798a43f3bed81b40e 100644 (file)
@@ -144,12 +144,13 @@ Film::Film (string d, bool must_exist)
                read_metadata ();
        }
 
-       _log = new FileLog (file ("log"));
+       _log.reset (new FileLog (file ("log")));
 }
 
 Film::Film (Film const & o)
        : boost::enable_shared_from_this<Film> (o)
-       , _log (0)
+       /* note: the copied film shares the original's log */
+       , _log               (o._log)
        , _directory         (o._directory)
        , _name              (o._name)
        , _use_dci_name      (o._use_dci_name)
@@ -188,12 +189,12 @@ Film::Film (Film const & o)
        , _source_frame_rate (o._source_frame_rate)
        , _dirty             (o._dirty)
 {
-
+       
 }
 
 Film::~Film ()
 {
-       delete _log;
+
 }
 
 string
@@ -1434,3 +1435,21 @@ Film::have_dcp () const
 
        return true;
 }
+
+bool
+Film::has_audio () const
+{
+       if (use_content_audio()) {
+               return audio_stream();
+       }
+
+       vector<string> const e = external_audio ();
+       for (vector<string>::const_iterator i = e.begin(); i != e.end(); ++i) {
+               if (!i->empty ()) {
+                       return true;
+               }
+       }
+
+       return false;
+}
+