Clean up a bit by using Content::film() more.
[dcpomatic.git] / src / lib / sndfile_content.cc
index 6d3ee18f586dfc5b4a5b04d6768ecd42971e0deb..c4f418775f7d4126c1a824a2e13b35d08d2f25df 100644 (file)
@@ -27,6 +27,8 @@
 #include "safe_stringstream.h"
 #include "raw_convert.h"
 #include <libcxml/cxml.h>
+#include <libxml++/libxml++.h>
+#include <iostream>
 
 #include "i18n.h"
 
@@ -44,7 +46,7 @@ SndfileContent::SndfileContent (shared_ptr<const Film> film, boost::filesystem::
 SndfileContent::SndfileContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
        : Content (film, node)
        , SingleStreamAudioContent (film, node, version)
-       , _audio_length (node->number_child<int64_t> ("AudioLength"))
+       , _audio_length (node->number_child<Frame> ("AudioLength"))
 {
 
 }
@@ -80,7 +82,7 @@ SndfileContent::valid_file (boost::filesystem::path f)
        /* XXX: more extensions */
        string ext = f.extension().string();
        transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
-       return (ext == ".wav" || ext == ".aif" || ext == ".aiff");
+       return (ext == ".wav" || ext == ".w64" || ext == ".flac" || ext == ".aif" || ext == ".aiff");
 }
 
 void
@@ -104,9 +106,6 @@ SndfileContent::take_from_audio_examiner (shared_ptr<AudioExaminer> examiner)
 DCPTime
 SndfileContent::full_length () const
 {
-       shared_ptr<const Film> film = _film.lock ();
-       DCPOMATIC_ASSERT (film);
-       FrameRateChange const frc = film->active_frame_rate_change (position ());
+       FrameRateChange const frc = film()->active_frame_rate_change (position ());
        return DCPTime::from_frames (audio_length() / frc.speed_up, audio_stream()->frame_rate ());
 }
-