Rename Content::_file to path and support md5sums of directories.
[dcpomatic.git] / src / lib / sndfile_content.cc
index 8eede89f4365241821ccf38a6db5b9c16acba08d..713b80dcb331d815f7c30e0dabdea25389c651cc 100644 (file)
@@ -20,6 +20,7 @@
 #include <libcxml/cxml.h>
 #include "sndfile_content.h"
 #include "sndfile_decoder.h"
+#include "film.h"
 #include "compose.hpp"
 #include "job.h"
 
@@ -44,17 +45,25 @@ SndfileContent::SndfileContent (shared_ptr<const Film> f, boost::filesystem::pat
 SndfileContent::SndfileContent (shared_ptr<const Film> f, shared_ptr<const cxml::Node> node)
        : Content (f, node)
        , AudioContent (f, node)
+       , _audio_mapping (node->node_child ("AudioMapping"))
 {
        _audio_channels = node->number_child<int> ("AudioChannels");
-       _audio_length = node->number_child<ContentAudioFrame> ("AudioLength");
+       _audio_length = node->number_child<AudioContent::Frame> ("AudioLength");
        _audio_frame_rate = node->number_child<int> ("AudioFrameRate");
-       _audio_mapping = AudioMapping (node->node_child ("AudioMapping"));
 }
 
 string
 SndfileContent::summary () const
 {
-       return String::compose (_("Sound file: %1"), file().filename().string());
+       return String::compose (_("%1 [audio]"), path().filename().string());
+}
+
+string
+SndfileContent::technical_summary () const
+{
+       return Content::technical_summary() + " - "
+               + AudioContent::technical_summary ()
+               + "sndfile";
 }
 
 string
@@ -85,12 +94,6 @@ SndfileContent::valid_file (boost::filesystem::path f)
        return (ext == ".wav" || ext == ".aif" || ext == ".aiff");
 }
 
-shared_ptr<Content>
-SndfileContent::clone () const
-{
-       return shared_ptr<Content> (new SndfileContent (*this));
-}
-
 void
 SndfileContent::examine (shared_ptr<Job> job)
 {
@@ -115,6 +118,7 @@ SndfileContent::examine (shared_ptr<Job> job)
 
        /* XXX: do this in signal_changed...? */
        _audio_mapping = AudioMapping (_audio_channels);
+       _audio_mapping.make_default ();
        signal_changed (AudioContentProperty::AUDIO_MAPPING);
 }
 
@@ -145,7 +149,7 @@ SndfileContent::output_audio_frame_rate () const
        shared_ptr<const Film> film = _film.lock ();
        assert (film);
        
-       return film->dcp_audio_frame_rate ();
+       return film->audio_frame_rate ();
 }
 
 void