Add basic content information, and some other bits.
[dcpomatic.git] / src / lib / sndfile_content.cc
index 8f5b2890170dc5e1b8dc2879664978d7982ceade..cf7921a93b88b84f9310ea9f6aa3dd8df0db61d3 100644 (file)
@@ -3,7 +3,23 @@
 
 #include "i18n.h"
 
-using namespace std;
+using std::string;
+using boost::shared_ptr;
+
+SndfileContent::SndfileContent (boost::filesystem::path f)
+       : Content (f)
+       , AudioContent (f)
+{
+
+}
+
+SndfileContent::SndfileContent (shared_ptr<const cxml::Node> node)
+       : Content (node)
+       , AudioContent (node)
+                  
+{
+
+}
 
 string
 SndfileContent::summary () const
@@ -11,6 +27,12 @@ SndfileContent::summary () const
        return String::compose (_("Sound file: %1"), file().filename ());
 }
 
+string
+SndfileContent::information () const
+{
+       return "";
+}
+
 int
 SndfileContent::audio_channels () const
 {
@@ -39,3 +61,18 @@ SndfileContent::audio_channel_layout () const
        return 0;
 }
        
+
+bool
+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");
+}
+
+shared_ptr<Content>
+SndfileContent::clone () const
+{
+       return shared_ptr<Content> (new SndfileContent (*this));
+}