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