| 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 MOJO_SERVICES_HTML_VIEWER_WEBMEDIAPLAYER_FACTORY_H_ | 5 #ifndef MOJO_SERVICES_HTML_VIEWER_WEBMEDIAPLAYER_FACTORY_H_ |
| 6 #define MOJO_SERVICES_HTML_VIEWER_WEBMEDIAPLAYER_FACTORY_H_ | 6 #define MOJO_SERVICES_HTML_VIEWER_WEBMEDIAPLAYER_FACTORY_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" |
| 12 #include "media/audio/fake_audio_log_factory.h" | 12 #include "media/audio/fake_audio_log_factory.h" |
| 13 #include "media/base/audio_hardware_config.h" | 13 #include "media/base/audio_hardware_config.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class SingleThreadTaskRunner; | 16 class SingleThreadTaskRunner; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace blink { | 19 namespace blink { |
| 20 class WebContentDecryptionModule; |
| 20 class WebMediaPlayer; | 21 class WebMediaPlayer; |
| 21 class WebLocalFrame; | 22 class WebLocalFrame; |
| 22 class WebURL; | 23 class WebURL; |
| 23 class WebMediaPlayerClient; | 24 class WebMediaPlayerClient; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace media { | 27 namespace media { |
| 27 class AudioManager; | 28 class AudioManager; |
| 28 class AudioRendererSink; | 29 class AudioRendererSink; |
| 29 } | 30 } |
| 30 | 31 |
| 31 namespace mojo { | 32 namespace mojo { |
| 32 class Shell; | 33 class Shell; |
| 33 } | 34 } |
| 34 | 35 |
| 35 namespace html_viewer { | 36 namespace html_viewer { |
| 36 | 37 |
| 37 // Helper class used to create blink::WebMediaPlayer objects. | 38 // Helper class used to create blink::WebMediaPlayer objects. |
| 38 // This class stores the "global state" shared across all WebMediaPlayer | 39 // This class stores the "global state" shared across all WebMediaPlayer |
| 39 // instances. | 40 // instances. |
| 40 class WebMediaPlayerFactory { | 41 class WebMediaPlayerFactory { |
| 41 public: | 42 public: |
| 42 explicit WebMediaPlayerFactory(const scoped_refptr< | 43 explicit WebMediaPlayerFactory(const scoped_refptr< |
| 43 base::SingleThreadTaskRunner>& compositor_task_runner, | 44 base::SingleThreadTaskRunner>& compositor_task_runner, |
| 44 bool enable_mojo_media_renderer); | 45 bool enable_mojo_media_renderer); |
| 45 ~WebMediaPlayerFactory(); | 46 ~WebMediaPlayerFactory(); |
| 46 | 47 |
| 47 blink::WebMediaPlayer* CreateMediaPlayer(blink::WebLocalFrame* frame, | 48 blink::WebMediaPlayer* CreateMediaPlayer( |
| 48 const blink::WebURL& url, | 49 blink::WebLocalFrame* frame, |
| 49 blink::WebMediaPlayerClient* client, | 50 const blink::WebURL& url, |
| 50 mojo::Shell* shell); | 51 blink::WebMediaPlayerClient* client, |
| 52 blink::WebContentDecryptionModule* initial_cdm, |
| 53 mojo::Shell* shell); |
| 51 | 54 |
| 52 private: | 55 private: |
| 53 const media::AudioHardwareConfig& GetAudioHardwareConfig(); | 56 const media::AudioHardwareConfig& GetAudioHardwareConfig(); |
| 54 scoped_refptr<media::AudioRendererSink> CreateAudioRendererSink(); | 57 scoped_refptr<media::AudioRendererSink> CreateAudioRendererSink(); |
| 55 scoped_refptr<base::SingleThreadTaskRunner> GetMediaThreadTaskRunner(); | 58 scoped_refptr<base::SingleThreadTaskRunner> GetMediaThreadTaskRunner(); |
| 56 | 59 |
| 57 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; | 60 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; |
| 58 const bool enable_mojo_media_renderer_; | 61 const bool enable_mojo_media_renderer_; |
| 59 base::Thread media_thread_; | 62 base::Thread media_thread_; |
| 60 media::FakeAudioLogFactory fake_audio_log_factory_; | 63 media::FakeAudioLogFactory fake_audio_log_factory_; |
| 61 scoped_ptr<media::AudioManager> audio_manager_; | 64 scoped_ptr<media::AudioManager> audio_manager_; |
| 62 media::AudioHardwareConfig audio_hardware_config_; | 65 media::AudioHardwareConfig audio_hardware_config_; |
| 63 | 66 |
| 64 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerFactory); | 67 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerFactory); |
| 65 }; | 68 }; |
| 66 | 69 |
| 67 } // namespace html_viewer | 70 } // namespace html_viewer |
| 68 | 71 |
| 69 #endif // MOJO_SERVICES_HTML_VIEWER_WEBMEDIAPLAYER_FACTORY_H_ | 72 #endif // MOJO_SERVICES_HTML_VIEWER_WEBMEDIAPLAYER_FACTORY_H_ |
| OLD | NEW |