| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROMECAST_RENDERER_MEDIA_AUDIO_PIPELINE_PROXY_H_ | 5 #ifndef CHROMECAST_RENDERER_MEDIA_AUDIO_PIPELINE_PROXY_H_ |
| 6 #define CHROMECAST_RENDERER_MEDIA_AUDIO_PIPELINE_PROXY_H_ | 6 #define CHROMECAST_RENDERER_MEDIA_AUDIO_PIPELINE_PROXY_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 12 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
| 13 #include "chromecast/common/media/cma_ipc_common.h" | 14 #include "chromecast/common/media/cma_ipc_common.h" |
| 14 #include "media/base/pipeline_status.h" | 15 #include "media/base/pipeline_status.h" |
| 15 | 16 |
| 16 namespace base { | 17 namespace base { |
| 17 class SingleThreadTaskRunner; | 18 class SingleThreadTaskRunner; |
| 18 class SharedMemory; | 19 class SharedMemory; |
| 19 } | 20 } |
| 20 | 21 |
| 21 namespace media { | 22 namespace media { |
| 22 class AudioDecoderConfig; | 23 class AudioDecoderConfig; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace chromecast { | 26 namespace chromecast { |
| 26 namespace media { | 27 namespace media { |
| 27 class AudioPipelineProxyInternal; | 28 class AudioPipelineProxyInternal; |
| 28 class AvStreamerProxy; | 29 class AvStreamerProxy; |
| 29 class CodedFrameProvider; | 30 class CodedFrameProvider; |
| 30 class MediaChannelProxy; | 31 class MediaChannelProxy; |
| 31 struct AvPipelineClient; | 32 struct AvPipelineClient; |
| 32 | 33 |
| 33 class AudioPipelineProxy { | 34 class AudioPipelineProxy { |
| 34 public: | 35 public: |
| 35 AudioPipelineProxy(scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 36 AudioPipelineProxy(scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 36 scoped_refptr<MediaChannelProxy> media_channel_proxy); | 37 scoped_refptr<MediaChannelProxy> media_channel_proxy); |
| 37 ~AudioPipelineProxy(); | 38 ~AudioPipelineProxy(); |
| 38 | 39 |
| 39 void Initialize( | 40 void Initialize(const ::media::AudioDecoderConfig& config, |
| 40 const ::media::AudioDecoderConfig& config, | 41 std::unique_ptr<CodedFrameProvider> frame_provider, |
| 41 scoped_ptr<CodedFrameProvider> frame_provider, | 42 const ::media::PipelineStatusCB& status_cb); |
| 42 const ::media::PipelineStatusCB& status_cb); | |
| 43 void StartFeeding(); | 43 void StartFeeding(); |
| 44 void Flush(const base::Closure& done_cb); | 44 void Flush(const base::Closure& done_cb); |
| 45 void Stop(); | 45 void Stop(); |
| 46 | 46 |
| 47 void SetClient(const AvPipelineClient& client); | 47 void SetClient(const AvPipelineClient& client); |
| 48 void SetVolume(float volume); | 48 void SetVolume(float volume); |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 base::ThreadChecker thread_checker_; | 51 base::ThreadChecker thread_checker_; |
| 52 | 52 |
| 53 void OnAvPipeCreated( | 53 void OnAvPipeCreated(const ::media::AudioDecoderConfig& config, |
| 54 const ::media::AudioDecoderConfig& config, | 54 const ::media::PipelineStatusCB& status_cb, |
| 55 const ::media::PipelineStatusCB& status_cb, | 55 std::unique_ptr<base::SharedMemory> shared_memory); |
| 56 scoped_ptr<base::SharedMemory> shared_memory); | |
| 57 void OnPipeWrite(); | 56 void OnPipeWrite(); |
| 58 void OnPipeRead(); | 57 void OnPipeRead(); |
| 59 | 58 |
| 60 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 59 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 61 | 60 |
| 62 // |proxy_| main goal is to convert function calls to IPC messages. | 61 // |proxy_| main goal is to convert function calls to IPC messages. |
| 63 scoped_ptr<AudioPipelineProxyInternal> proxy_; | 62 std::unique_ptr<AudioPipelineProxyInternal> proxy_; |
| 64 | 63 |
| 65 scoped_ptr<AvStreamerProxy> audio_streamer_; | 64 std::unique_ptr<AvStreamerProxy> audio_streamer_; |
| 66 | 65 |
| 67 base::WeakPtr<AudioPipelineProxy> weak_this_; | 66 base::WeakPtr<AudioPipelineProxy> weak_this_; |
| 68 base::WeakPtrFactory<AudioPipelineProxy> weak_factory_; | 67 base::WeakPtrFactory<AudioPipelineProxy> weak_factory_; |
| 69 | 68 |
| 70 DISALLOW_COPY_AND_ASSIGN(AudioPipelineProxy); | 69 DISALLOW_COPY_AND_ASSIGN(AudioPipelineProxy); |
| 71 }; | 70 }; |
| 72 | 71 |
| 73 } // namespace media | 72 } // namespace media |
| 74 } // namespace chromecast | 73 } // namespace chromecast |
| 75 | 74 |
| 76 #endif // CHROMECAST_RENDERER_MEDIA_AUDIO_PIPELINE_PROXY_H_ | 75 #endif // CHROMECAST_RENDERER_MEDIA_AUDIO_PIPELINE_PROXY_H_ |
| OLD | NEW |