Add basic content information, and some other bits.
[dcpomatic.git] / src / lib / sndfile_content.cc
1 #include "sndfile_content.h"
2 #include "compose.hpp"
3
4 #include "i18n.h"
5
6 using std::string;
7 using boost::shared_ptr;
8
9 SndfileContent::SndfileContent (boost::filesystem::path f)
10         : Content (f)
11         , AudioContent (f)
12 {
13
14 }
15
16 SndfileContent::SndfileContent (shared_ptr<const cxml::Node> node)
17         : Content (node)
18         , AudioContent (node)
19                    
20 {
21
22 }
23
24 string
25 SndfileContent::summary () const
26 {
27         return String::compose (_("Sound file: %1"), file().filename ());
28 }
29
30 string
31 SndfileContent::information () const
32 {
33         return "";
34 }
35
36 int
37 SndfileContent::audio_channels () const
38 {
39         /* XXX */
40         return 0;
41 }
42
43 ContentAudioFrame
44 SndfileContent::audio_length () const
45 {
46         /* XXX */
47         return 0;
48 }
49
50 int
51 SndfileContent::audio_frame_rate () const
52 {
53         /* XXX */
54         return 0;
55 }
56
57 int64_t
58 SndfileContent::audio_channel_layout () const
59 {
60         /* XXX */
61         return 0;
62 }
63         
64
65 bool
66 SndfileContent::valid_file (boost::filesystem::path f)
67 {
68         /* XXX: more extensions */
69         string ext = f.extension().string();
70         transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
71         return (ext == ".wav" || ext == ".aif" || ext == ".aiff");
72 }
73
74 shared_ptr<Content>
75 SndfileContent::clone () const
76 {
77         return shared_ptr<Content> (new SndfileContent (*this));
78 }