Make "Add folder..." to accept a directory of WAV files (#942).
[dcpomatic.git] / src / lib / util.cc
index 4eba58e0583cd82f7b20c15dd6bed74f3b52b79b..3f0c34a15004a9da88806366bee51967278700d5 100644 (file)
@@ -557,6 +557,18 @@ valid_image_file (boost::filesystem::path f)
                );
 }
 
+bool
+valid_sound_file (boost::filesystem::path f)
+{
+       if (boost::starts_with (f.leaf().string(), "._")) {
+               return false;
+       }
+
+       string ext = f.extension().string();
+       transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
+       return (ext == ".wav" || ext == ".mp3" || ext == ".aif" || ext == ".aiff");
+}
+
 bool
 valid_j2k_file (boost::filesystem::path f)
 {