No-op; fix GPL address and use the explicit-program-name version.
[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, bool fast, 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
45 private:
46
47         void reset_decoded ();
48         void add (boost::shared_ptr<const AudioBuffers>);
49
50         boost::shared_ptr<const AudioContent> _content;
51         AudioStreamPtr _stream;
52         Decoder* _decoder;
53         boost::shared_ptr<Log> _log;
54         boost::shared_ptr<Resampler> _resampler;
55         boost::optional<Frame> _position;
56         /** Currently-available decoded audio data */
57         ContentAudio _decoded;
58         /** The time of an accurate seek after which we have not yet received any actual
59             data at the seek time.
60         */
61         boost::optional<ContentTime> _seek_reference;
62 };
63
64 #endif