| 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_RENDERER_MEDIA_MEDIA_PIPELINE_PROXY_H_ | |
| 6 #define CHROMECAST_RENDERER_MEDIA_MEDIA_PIPELINE_PROXY_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "base/memory/ref_counted.h" | |
| 12 #include "base/memory/weak_ptr.h" | |
| 13 #include "base/threading/thread_checker.h" | |
| 14 #include "chromecast/media/cma/pipeline/load_type.h" | |
| 15 #include "chromecast/media/cma/pipeline/media_pipeline_client.h" | |
| 16 #include "media/base/audio_decoder_config.h" | |
| 17 #include "media/base/serial_runner.h" | |
| 18 #include "media/base/video_decoder_config.h" | |
| 19 | |
| 20 namespace base { | |
| 21 class SingleThreadTaskRunner; | |
| 22 } | |
| 23 | |
| 24 namespace chromecast { | |
| 25 namespace media { | |
| 26 class AudioPipelineProxy; | |
| 27 class CodedFrameProvider; | |
| 28 class MediaChannelProxy; | |
| 29 class MediaPipelineProxyInternal; | |
| 30 class VideoPipelineProxy; | |
| 31 | |
| 32 class MediaPipelineProxy { | |
| 33 public: | |
| 34 MediaPipelineProxy(int render_frame_id, | |
| 35 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | |
| 36 LoadType load_type); | |
| 37 ~MediaPipelineProxy(); | |
| 38 | |
| 39 void SetClient(const MediaPipelineClient& client); | |
| 40 void SetCdm(int cdm_id); | |
| 41 AudioPipelineProxy* GetAudioPipeline() const; | |
| 42 VideoPipelineProxy* GetVideoPipeline() const; | |
| 43 void InitializeAudio(const ::media::AudioDecoderConfig& config, | |
| 44 std::unique_ptr<CodedFrameProvider> frame_provider, | |
| 45 const ::media::PipelineStatusCB& status_cb); | |
| 46 void InitializeVideo(const std::vector<::media::VideoDecoderConfig>& configs, | |
| 47 std::unique_ptr<CodedFrameProvider> frame_provider, | |
| 48 const ::media::PipelineStatusCB& status_cb); | |
| 49 void StartPlayingFrom(base::TimeDelta time); | |
| 50 void Flush(const base::Closure& flush_cb); | |
| 51 void Stop(); | |
| 52 void SetPlaybackRate(double playback_rate); | |
| 53 | |
| 54 private: | |
| 55 void OnProxyFlushDone(const base::Closure& flush_cb, | |
| 56 ::media::PipelineStatus status); | |
| 57 | |
| 58 base::ThreadChecker thread_checker_; | |
| 59 | |
| 60 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | |
| 61 | |
| 62 const int render_frame_id_; | |
| 63 | |
| 64 // CMA channel to convey IPC messages. | |
| 65 scoped_refptr<MediaChannelProxy> const media_channel_proxy_; | |
| 66 | |
| 67 std::unique_ptr<MediaPipelineProxyInternal> proxy_; | |
| 68 | |
| 69 bool has_audio_; | |
| 70 bool has_video_; | |
| 71 std::unique_ptr<AudioPipelineProxy> audio_pipeline_; | |
| 72 std::unique_ptr<VideoPipelineProxy> video_pipeline_; | |
| 73 std::unique_ptr<::media::SerialRunner> pending_flush_callbacks_; | |
| 74 | |
| 75 base::WeakPtr<MediaPipelineProxy> weak_this_; | |
| 76 base::WeakPtrFactory<MediaPipelineProxy> weak_factory_; | |
| 77 | |
| 78 DISALLOW_COPY_AND_ASSIGN(MediaPipelineProxy); | |
| 79 }; | |
| 80 | |
| 81 } // namespace media | |
| 82 } // namespace chromecast | |
| 83 | |
| 84 #endif // CHROMECAST_RENDERER_MEDIA_MEDIA_PIPELINE_PROXY_H_ | |
| OLD | NEW |