OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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 CHROMECAST_MEDIA_CMA_BASE_AUDIO_PIPELINE_IMPL_H_ |
| 6 #define CHROMECAST_MEDIA_CMA_BASE_AUDIO_PIPELINE_IMPL_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/macros.h" |
| 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/threading/thread_checker.h" |
| 13 #include "chromecast/media/cma/pipeline/audio_pipeline.h" |
| 14 #include "chromecast/media/cma/pipeline/av_pipeline_client.h" |
| 15 |
| 16 namespace media { |
| 17 class AudioDecoderConfig; |
| 18 class VideoDecoderConfig; |
| 19 } |
| 20 |
| 21 namespace chromecast { |
| 22 namespace media { |
| 23 class AudioPipelineDevice; |
| 24 class AvPipelineImpl; |
| 25 class BrowserCdmCast; |
| 26 class BufferingState; |
| 27 class CodedFrameProvider; |
| 28 |
| 29 class AudioPipelineImpl : public AudioPipeline { |
| 30 public: |
| 31 // |buffering_controller| can be NULL. |
| 32 explicit AudioPipelineImpl(AudioPipelineDevice* audio_device); |
| 33 ~AudioPipelineImpl() override; |
| 34 |
| 35 // Input port of the pipeline. |
| 36 void SetCodedFrameProvider(scoped_ptr<CodedFrameProvider> frame_provider); |
| 37 |
| 38 // Provide the CDM to use to decrypt samples. |
| 39 void SetCdm(BrowserCdmCast* media_keys); |
| 40 |
| 41 // Functions to control the state of the audio pipeline. |
| 42 void Initialize( |
| 43 const ::media::AudioDecoderConfig& config, |
| 44 scoped_ptr<CodedFrameProvider> frame_provider, |
| 45 const ::media::PipelineStatusCB& status_cb); |
| 46 bool StartPlayingFrom(base::TimeDelta time, |
| 47 const scoped_refptr<BufferingState>& buffering_state); |
| 48 void Flush(const ::media::PipelineStatusCB& status_cb); |
| 49 void Stop(); |
| 50 |
| 51 // Update the playback statistics for this audio stream. |
| 52 void UpdateStatistics(); |
| 53 |
| 54 // AudioPipeline implementation. |
| 55 void SetClient(const AvPipelineClient& client) override; |
| 56 void SetVolume(float volume) override; |
| 57 |
| 58 private: |
| 59 void OnFlushDone(const ::media::PipelineStatusCB& status_cb); |
| 60 void OnUpdateConfig(const ::media::AudioDecoderConfig& audio_config, |
| 61 const ::media::VideoDecoderConfig& video_config); |
| 62 |
| 63 AudioPipelineDevice* audio_device_; |
| 64 |
| 65 scoped_ptr<AvPipelineImpl> av_pipeline_impl_; |
| 66 AvPipelineClient audio_client_; |
| 67 |
| 68 ::media::PipelineStatistics previous_stats_; |
| 69 |
| 70 base::WeakPtrFactory<AudioPipelineImpl> weak_factory_; |
| 71 base::WeakPtr<AudioPipelineImpl> weak_this_; |
| 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(AudioPipelineImpl); |
| 74 }; |
| 75 |
| 76 } // namespace media |
| 77 } // namespace chromecast |
| 78 |
| 79 #endif // CHROMECAST_MEDIA_CMA_BASE_AUDIO_PIPELINE_IMPL_H_ |
OLD | NEW |