Rename video/audio/subtitle part methods.
[dcpomatic.git] / src / lib / audio_content.h
1 /*
2     Copyright (C) 2013-2016 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 /** @file  src/lib/audio_content.h
21  *  @brief AudioContent and AudioContentProperty classes.
22  */
23
24 #ifndef DCPOMATIC_AUDIO_CONTENT_H
25 #define DCPOMATIC_AUDIO_CONTENT_H
26
27 #include "content_part.h"
28 #include "audio_stream.h"
29 #include "audio_mapping.h"
30
31 /** @class AudioContentProperty
32  *  @brief Names for properties of AudioContent.
33  */
34 class AudioContentProperty
35 {
36 public:
37 <<<<<<< 17dbd967c18aff2f3007eb86b5eee5b43f23bc4b
38         static int const AUDIO_STREAMS;
39         static int const AUDIO_GAIN;
40         static int const AUDIO_DELAY;
41         static int const AUDIO_VIDEO_FRAME_RATE;
42 =======
43         static int const STREAMS;
44         static int const GAIN;
45         static int const DELAY;
46 >>>>>>> Rename video/audio/subtitle part methods.
47 };
48
49 class AudioContent : public ContentPart
50 {
51 public:
52         AudioContent (Content* parent, boost::shared_ptr<const Film>);
53         AudioContent (Content* parent, boost::shared_ptr<const Film>, cxml::ConstNodePtr);
54         AudioContent (Content* parent, boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >);
55
56         void as_xml (xmlpp::Node *) const;
57         std::string technical_summary () const;
58
59         AudioMapping mapping () const;
60         void set_mapping (AudioMapping);
61         int resampled_frame_rate () const;
62         bool has_rate_above_48k () const;
63         std::vector<std::string> channel_names () const;
64
65         void set_gain (double);
66         void set_delay (int);
67
68         double gain () const {
69                 boost::mutex::scoped_lock lm (_mutex);
70                 return _gain;
71         }
72
73         int delay () const {
74                 boost::mutex::scoped_lock lm (_mutex);
75                 return _delay;
76         }
77
78         double audio_video_frame_rate () const;
79         void set_audio_video_frame_rate (double r);
80
81         std::string processing_description () const;
82
83         std::vector<AudioStreamPtr> streams () const {
84                 boost::mutex::scoped_lock lm (_mutex);
85                 return _streams;
86         }
87
88         void add_stream (AudioStreamPtr stream);
89         void set_stream (AudioStreamPtr stream);
90         void set_streams (std::vector<AudioStreamPtr> streams);
91         AudioStreamPtr stream () const;
92
93         void add_properties (std::list<UserProperty> &) const;
94
95 private:
96
97         /** Gain to apply to audio in dB */
98         double _gain;
99         /** Delay to apply to audio (positive moves audio later) in milliseconds */
100         int _delay;
101         boost::optional<double> _video_frame_rate;
102         std::vector<AudioStreamPtr> _streams;
103 };
104
105 #endif