summaryrefslogtreecommitdiff
path: root/src/lib/stream.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-10-20 19:30:04 +0100
committerCarl Hetherington <cth@carlh.net>2012-10-20 19:30:04 +0100
commit58f53485bb112896a9446771acfa2abe0a528cec (patch)
treef34f14aa40f8ce0854f104fbabccd4f756bafd3d /src/lib/stream.cc
parent6e8e4f7ae9a9ae243a1b7d9e17f6b6cacae277b3 (diff)
Try to clean up stream handling wrt audio channel counts.
Diffstat (limited to 'src/lib/stream.cc')
-rw-r--r--src/lib/stream.cc33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/lib/stream.cc b/src/lib/stream.cc
index e40738990..d1c2b5a9e 100644
--- a/src/lib/stream.cc
+++ b/src/lib/stream.cc
@@ -23,19 +23,40 @@
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);
}