Merge master.
[dcpomatic.git] / src / lib / sndfile_content.cc
index d57cf04e3413b4b81baa97752c4ea0987ac881a3..f8648107ae709f07da54eb2fa528bdf58e38ca97 100644 (file)
@@ -23,6 +23,7 @@
 #include "film.h"
 #include "compose.hpp"
 #include "job.h"
+#include "util.h"
 
 #include "i18n.h"
 
@@ -42,13 +43,13 @@ SndfileContent::SndfileContent (shared_ptr<const Film> f, boost::filesystem::pat
 
 }
 
-SndfileContent::SndfileContent (shared_ptr<const Film> f, shared_ptr<const cxml::Node> node)
+SndfileContent::SndfileContent (shared_ptr<const Film> f, shared_ptr<const cxml::Node> node, int version)
        : Content (f, node)
        , AudioContent (f, node)
-       , _audio_mapping (node->node_child ("AudioMapping"))
+       , _audio_mapping (node->node_child ("AudioMapping"), version)
 {
        _audio_channels = node->number_child<int> ("AudioChannels");
-       _audio_length = node->number_child<AudioContent::Frame> ("AudioLength");
+       _audio_length = ContentTime (node->number_child<int64_t> ("AudioLength"));
        _audio_frame_rate = node->number_child<int> ("AudioFrameRate");
 }
 
@@ -56,7 +57,7 @@ string
 SndfileContent::summary () const
 {
        /* Get the string() here so that the name does not have quotes around it */
-       return String::compose (_("%1 [audio]"), path().filename().string());
+       return String::compose (_("%1 [audio]"), path_summary ());
 }
 
 string
@@ -140,13 +141,12 @@ SndfileContent::as_xml (xmlpp::Node* node) const
        _audio_mapping.as_xml (node->add_child("AudioMapping"));
 }
 
-Time
+DCPTime
 SndfileContent::full_length () const
 {
        shared_ptr<const Film> film = _film.lock ();
        assert (film);
-       
-       return film->audio_frames_to_time (audio_length ());
+       return DCPTime (audio_length(), film->active_frame_rate_change (position ()));
 }
 
 int