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.
5 #ifndef MOJO_SERVICES_HTML_VIEWER_WEBMEDIAPLAYER_FACTORY_H_
6 #define MOJO_SERVICES_HTML_VIEWER_WEBMEDIAPLAYER_FACTORY_H_
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"
16 class SingleThreadTaskRunner
;
20 class WebContentDecryptionModule
;
24 class WebMediaPlayerClient
;
29 class AudioRendererSink
;
36 namespace html_viewer
{
38 // Helper class used to create blink::WebMediaPlayer objects.
39 // This class stores the "global state" shared across all WebMediaPlayer
41 class WebMediaPlayerFactory
{
43 explicit WebMediaPlayerFactory(const scoped_refptr
<
44 base::SingleThreadTaskRunner
>& compositor_task_runner
,
45 bool enable_mojo_media_renderer
);
46 ~WebMediaPlayerFactory();
48 blink::WebMediaPlayer
* CreateMediaPlayer(
49 blink::WebLocalFrame
* frame
,
50 const blink::WebURL
& url
,
51 blink::WebMediaPlayerClient
* client
,
52 blink::WebContentDecryptionModule
* initial_cdm
,
56 const media::AudioHardwareConfig
& GetAudioHardwareConfig();
57 scoped_refptr
<media::AudioRendererSink
> CreateAudioRendererSink();
58 scoped_refptr
<base::SingleThreadTaskRunner
> GetMediaThreadTaskRunner();
60 scoped_refptr
<base::SingleThreadTaskRunner
> compositor_task_runner_
;
61 const bool enable_mojo_media_renderer_
;
62 base::Thread media_thread_
;
63 media::FakeAudioLogFactory fake_audio_log_factory_
;
64 scoped_ptr
<media::AudioManager
> audio_manager_
;
65 media::AudioHardwareConfig audio_hardware_config_
;
67 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerFactory
);
70 } // namespace html_viewer
72 #endif // MOJO_SERVICES_HTML_VIEWER_WEBMEDIAPLAYER_FACTORY_H_