Another missing include.
[dcpomatic.git] / src / lib / audio_decoder_stream.h
1 /*
2     Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
6     DCP-o-matic is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     DCP-o-matic is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21 #ifndef DCPOMATIC_AUDIO_DECODER_STREAM_H
22 #define DCPOMATIC_AUDIO_DECODER_STREAM_H
23
24 #include "audio_stream.h"
25 #include "content_audio.h"
26 #include "dcpomatic_time.h"
27 #include <boost/shared_ptr.hpp>
28
29 class AudioContent;
30 class AudioDecoder;
31 class Resampler;
32 class Log;
33 class Decoder;
34
35 class AudioDecoderStream
36 {
37 public:
38         AudioDecoderStream (boost::shared_ptr<const AudioContent>, AudioStreamPtr, Decoder* decoder, boost::shared_ptr<Log> log);
39
40         ContentAudio get (Frame time, Frame length, bool accurate);
41         void audio (boost::shared_ptr<const AudioBuffers>, ContentTime);
42         void flush ();
43         void seek (ContentTime time, bool accurate);
44         void set_fast ();
45
46 private:
47
48         void reset_decoded ();
49         void add (boost::shared_ptr<const AudioBuffers>);
50
51         boost::shared_ptr<const AudioContent> _content;
52         AudioStreamPtr _stream;
53         Decoder* _decoder;
54         boost::shared_ptr<Log> _log;
55         boost::shared_ptr<Resampler> _resampler;
56         boost::optional<Frame> _position;
57         /** Currently-available decoded audio data */
58         ContentAudio _decoded;
59         /** The time of an accurate seek after which we have not yet received any actual
60             data at the seek time.
61         */
62         boost::optional<ContentTime> _seek_reference;
63 };
64
65 #endif