Try to clean up stream handling wrt audio channel counts.
[dcpomatic.git] / src / lib / stream.cc
index e40738990fab050e4de0963628b30ebc6e7afc8a..d1c2b5a9e589790c4a5c5b8193a16cd5f98aa40b 100644 (file)
 
 using namespace std;
 
-Stream::Stream (string t)
+AudioStream::AudioStream (string t)
 {
        stringstream n (t);
-       n >> id;
-       
+       n >> _id >> _channels;
+
+       for (int i = 0; i < 2; ++i) {
+               size_t const s = t.find (' ');
+               if (s != string::npos) {
+                       t = t.substr (s + 1);
+               }
+       }
+
+       _name = t;
+}
+
+string
+AudioStream::to_string () const
+{
+       return String::compose ("%1 %2 %3", _id, _channels, _name);
+}
+
+SubtitleStream::SubtitleStream (string t)
+{
+       stringstream n (t);
+       n >> _id;
+
        size_t const s = t.find (' ');
        if (s != string::npos) {
-               name = t.substr (s + 1);
+               _name = t.substr (s + 1);
        }
 }
 
 string
-Stream::to_string () const
+SubtitleStream::to_string () const
 {
-       return String::compose ("%1 %2", id, name);
+       return String::compose ("%1 %2", _id, _name);
 }