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