Automated Commit: Committing new LKGM version 7252.0.0 for chromeos.
[chromium-blink-merge.git] / chromecast / renderer / media / media_pipeline_proxy.h
blob1e8e9e6b7abdb3db9f667b0c948adf6dcdb1e8ad
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_RENDERER_MEDIA_MEDIA_PIPELINE_PROXY_H_
6 #define CHROMECAST_RENDERER_MEDIA_MEDIA_PIPELINE_PROXY_H_
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/threading/thread_checker.h"
13 #include "chromecast/media/cma/pipeline/load_type.h"
14 #include "chromecast/media/cma/pipeline/media_pipeline.h"
15 #include "chromecast/media/cma/pipeline/media_pipeline_client.h"
16 #include "media/base/serial_runner.h"
18 namespace base {
19 class SingleThreadTaskRunner;
22 namespace chromecast {
23 namespace media {
24 class AudioPipelineProxy;
25 class MediaChannelProxy;
26 class MediaPipelineProxyInternal;
27 class VideoPipelineProxy;
29 class MediaPipelineProxy : public MediaPipeline {
30 public:
31 MediaPipelineProxy(int render_frame_id,
32 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
33 LoadType load_type);
34 ~MediaPipelineProxy() override;
36 // MediaPipeline implementation.
37 void SetClient(const MediaPipelineClient& client) override;
38 void SetCdm(int cdm_id) override;
39 AudioPipeline* GetAudioPipeline() const override;
40 VideoPipeline* GetVideoPipeline() const override;
41 void InitializeAudio(
42 const ::media::AudioDecoderConfig& config,
43 scoped_ptr<CodedFrameProvider> frame_provider,
44 const ::media::PipelineStatusCB& status_cb) override;
45 void InitializeVideo(
46 const std::vector<::media::VideoDecoderConfig>& configs,
47 scoped_ptr<CodedFrameProvider> frame_provider,
48 const ::media::PipelineStatusCB& status_cb) override;
49 void StartPlayingFrom(base::TimeDelta time) override;
50 void Flush(const ::media::PipelineStatusCB& status_cb) override;
51 void Stop() override;
52 void SetPlaybackRate(double playback_rate) override;
54 private:
55 void OnProxyFlushDone(const ::media::PipelineStatusCB& status_cb,
56 ::media::PipelineStatus status);
58 base::ThreadChecker thread_checker_;
60 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
62 const int render_frame_id_;
64 // CMA channel to convey IPC messages.
65 scoped_refptr<MediaChannelProxy> const media_channel_proxy_;
67 scoped_ptr<MediaPipelineProxyInternal> proxy_;
69 bool has_audio_;
70 bool has_video_;
71 scoped_ptr<AudioPipelineProxy> audio_pipeline_;
72 scoped_ptr<VideoPipelineProxy> video_pipeline_;
73 scoped_ptr< ::media::SerialRunner> pending_flush_callbacks_;
75 base::WeakPtr<MediaPipelineProxy> weak_this_;
76 base::WeakPtrFactory<MediaPipelineProxy> weak_factory_;
78 DISALLOW_COPY_AND_ASSIGN(MediaPipelineProxy);
81 } // namespace media
82 } // namespace chromecast
84 #endif // CHROMECAST_RENDERER_MEDIA_MEDIA_PIPELINE_PROXY_H_