Some allowances for video/audio/subtitle possibly being null.
[dcpomatic.git] / src / lib / image_content.cc
index 29af451b7edcaa03ca8a543b34a95c0b83b27098..ef82b3779d29d60b4a2231fb2e4f0ab200e88857 100644 (file)
@@ -66,7 +66,7 @@ ImageContent::ImageContent (shared_ptr<const Film> film, boost::filesystem::path
 ImageContent::ImageContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
        : Content (film, node)
 {
-       video.reset (new VideoContent (this, film, node, version));
+       video = VideoContent::from_xml (this, film, node, version);
 }
 
 string
@@ -103,7 +103,10 @@ ImageContent::as_xml (xmlpp::Node* node) const
 {
        node->add_child("Type")->add_child_text ("Image");
        Content::as_xml (node);
-       video->as_xml (node);
+
+       if (video) {
+               video->as_xml (node);
+       }
 }
 
 void
@@ -124,7 +127,7 @@ ImageContent::full_length () const
 {
        shared_ptr<const Film> film = _film.lock ();
        DCPOMATIC_ASSERT (film);
-       FrameRateChange const frc (video->frame_rate(), film->video_frame_rate());
+       FrameRateChange const frc (active_video_frame_rate(), film->video_frame_rate());
        return DCPTime::from_frames (llrint (video->length_after_3d_combine() * frc.factor ()), film->video_frame_rate ());
 }