| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_ | |
| 6 #define MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "base/time/time.h" | |
| 11 #include "media/base/audio_decoder.h" | |
| 12 #include "media/base/demuxer_stream.h" | |
| 13 #include "media/base/sample_format.h" | |
| 14 | |
| 15 struct OpusMSDecoder; | |
| 16 | |
| 17 namespace base { | |
| 18 class SingleThreadTaskRunner; | |
| 19 } | |
| 20 | |
| 21 namespace media { | |
| 22 | |
| 23 class AudioBuffer; | |
| 24 class AudioDiscardHelper; | |
| 25 class DecoderBuffer; | |
| 26 struct QueuedAudioBuffer; | |
| 27 | |
| 28 class MEDIA_EXPORT OpusAudioDecoder : public AudioDecoder { | |
| 29 public: | |
| 30 explicit OpusAudioDecoder( | |
| 31 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | |
| 32 ~OpusAudioDecoder() override; | |
| 33 | |
| 34 // AudioDecoder implementation. | |
| 35 std::string GetDisplayName() const override; | |
| 36 void Initialize(const AudioDecoderConfig& config, | |
| 37 CdmContext* cdm_context, | |
| 38 const InitCB& init_cb, | |
| 39 const OutputCB& output_cb) override; | |
| 40 void Decode(const scoped_refptr<DecoderBuffer>& buffer, | |
| 41 const DecodeCB& decode_cb) override; | |
| 42 void Reset(const base::Closure& closure) override; | |
| 43 | |
| 44 private: | |
| 45 // Reads from the demuxer stream with corresponding callback method. | |
| 46 void ReadFromDemuxerStream(); | |
| 47 void DecodeBuffer(const scoped_refptr<DecoderBuffer>& input, | |
| 48 const DecodeCB& decode_cb); | |
| 49 | |
| 50 bool ConfigureDecoder(); | |
| 51 void CloseDecoder(); | |
| 52 void ResetTimestampState(); | |
| 53 bool Decode(const scoped_refptr<DecoderBuffer>& input, | |
| 54 scoped_refptr<AudioBuffer>* output_buffer); | |
| 55 | |
| 56 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | |
| 57 | |
| 58 AudioDecoderConfig config_; | |
| 59 OutputCB output_cb_; | |
| 60 OpusMSDecoder* opus_decoder_; | |
| 61 std::unique_ptr<AudioDiscardHelper> discard_helper_; | |
| 62 | |
| 63 DISALLOW_IMPLICIT_CONSTRUCTORS(OpusAudioDecoder); | |
| 64 }; | |
| 65 | |
| 66 } // namespace media | |
| 67 | |
| 68 #endif // MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_ | |
| OLD | NEW |