Try to clean up stream handling wrt audio channel counts.
[dcpomatic.git] / src / lib / stream.h
1 /*
2     Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #ifndef DVDOMATIC_STREAM_H
21 #define DVDOMATIC_STREAM_H
22
23 class Stream
24 {
25 public:
26         Stream ()
27                 : _id (-1)
28         {}
29         
30         Stream (std::string n, int i)
31                 : _name (n)
32                 , _id (i)
33         {}
34
35         virtual std::string to_string () const = 0;
36         
37         std::string name () const {
38                 return _name;
39         }
40
41         int id () const {
42                 return _id;
43         }
44
45 protected:
46         std::string _name;
47         int _id;
48 };
49
50 struct AudioStream : public Stream
51 {
52 public:
53         AudioStream (std::string t);
54         
55         AudioStream (std::string n, int i, int c)
56                 : Stream (n, i)
57                 , _channels (c)
58         {}
59
60         std::string to_string () const;
61
62         int channels () const {
63                 return _channels;
64         }
65
66 private:
67         int _channels;
68 };
69
70 class SubtitleStream : public Stream
71 {
72 public:
73         SubtitleStream (std::string t);
74
75         SubtitleStream (std::string n, int i)
76                 : Stream (n, i)
77         {}
78
79         std::string to_string () const;
80 };
81
82 #endif