ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / chromecast / media / cma / pipeline / audio_pipeline_impl.h
blob7d2e63a13141eeca6968ee3c5a04b2b02a30274d
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.
5 #ifndef CHROMECAST_MEDIA_CMA_BASE_AUDIO_PIPELINE_IMPL_H_
6 #define CHROMECAST_MEDIA_CMA_BASE_AUDIO_PIPELINE_IMPL_H_
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"
16 namespace media {
17 class AudioDecoderConfig;
18 class VideoDecoderConfig;
21 namespace chromecast {
22 namespace media {
23 class AudioPipelineDevice;
24 class AvPipelineImpl;
25 class BrowserCdmCast;
26 class BufferingState;
27 class CodedFrameProvider;
29 class AudioPipelineImpl : public AudioPipeline {
30 public:
31 // |buffering_controller| can be NULL.
32 explicit AudioPipelineImpl(AudioPipelineDevice* audio_device);
33 ~AudioPipelineImpl() override;
35 // Input port of the pipeline.
36 void SetCodedFrameProvider(scoped_ptr<CodedFrameProvider> frame_provider);
38 // Provide the CDM to use to decrypt samples.
39 void SetCdm(BrowserCdmCast* media_keys);
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();
51 // Update the playback statistics for this audio stream.
52 void UpdateStatistics();
54 // AudioPipeline implementation.
55 void SetClient(const AvPipelineClient& client) override;
56 void SetVolume(float volume) override;
58 private:
59 void OnFlushDone(const ::media::PipelineStatusCB& status_cb);
60 void OnUpdateConfig(const ::media::AudioDecoderConfig& audio_config,
61 const ::media::VideoDecoderConfig& video_config);
63 AudioPipelineDevice* audio_device_;
65 scoped_ptr<AvPipelineImpl> av_pipeline_impl_;
66 AvPipelineClient audio_client_;
68 ::media::PipelineStatistics previous_stats_;
70 base::WeakPtr<AudioPipelineImpl> weak_this_;
71 base::WeakPtrFactory<AudioPipelineImpl> weak_factory_;
73 DISALLOW_COPY_AND_ASSIGN(AudioPipelineImpl);
76 } // namespace media
77 } // namespace chromecast
79 #endif // CHROMECAST_MEDIA_CMA_BASE_AUDIO_PIPELINE_IMPL_H_