Correct gfx dependency for cast_receiver_app.
[chromium-blink-merge.git] / media / filters / opus_audio_decoder.h
blobb3fb188b6e6f08590adf024e59896a4b45cec6ae
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_
6 #define MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_
8 #include "base/callback.h"
9 #include "base/time/time.h"
10 #include "media/base/audio_decoder.h"
11 #include "media/base/demuxer_stream.h"
12 #include "media/base/sample_format.h"
14 struct OpusMSDecoder;
16 namespace base {
17 class SingleThreadTaskRunner;
20 namespace media {
22 class AudioBuffer;
23 class AudioDiscardHelper;
24 class DecoderBuffer;
25 struct QueuedAudioBuffer;
27 class MEDIA_EXPORT OpusAudioDecoder : public AudioDecoder {
28 public:
29 explicit OpusAudioDecoder(
30 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
31 ~OpusAudioDecoder() override;
33 // AudioDecoder implementation.
34 std::string GetDisplayName() const override;
35 void Initialize(const AudioDecoderConfig& config,
36 const PipelineStatusCB& status_cb,
37 const OutputCB& output_cb) override;
38 void Decode(const scoped_refptr<DecoderBuffer>& buffer,
39 const DecodeCB& decode_cb) override;
40 void Reset(const base::Closure& closure) override;
42 private:
43 // Reads from the demuxer stream with corresponding callback method.
44 void ReadFromDemuxerStream();
45 void DecodeBuffer(const scoped_refptr<DecoderBuffer>& input,
46 const DecodeCB& decode_cb);
48 bool ConfigureDecoder();
49 void CloseDecoder();
50 void ResetTimestampState();
51 bool Decode(const scoped_refptr<DecoderBuffer>& input,
52 scoped_refptr<AudioBuffer>* output_buffer);
54 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
56 AudioDecoderConfig config_;
57 OutputCB output_cb_;
58 OpusMSDecoder* opus_decoder_;
60 // When the input timestamp is |start_input_timestamp_| the decoder needs to
61 // drop |config_.codec_delay()| frames.
62 base::TimeDelta start_input_timestamp_;
64 scoped_ptr<AudioDiscardHelper> discard_helper_;
66 DISALLOW_IMPLICIT_CONSTRUCTORS(OpusAudioDecoder);
69 } // namespace media
71 #endif // MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_