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