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 COMPONENTS_HTML_VIEWER_MEDIA_FACTORY_H_
6 #define COMPONENTS_HTML_VIEWER_MEDIA_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"
14 #include "media/mojo/interfaces/service_factory.mojom.h"
15 #include "mojo/application/public/interfaces/service_provider.mojom.h"
18 class SingleThreadTaskRunner
;
22 class WebContentDecryptionModule
;
23 class WebEncryptedMediaClient
;
27 class WebMediaPlayerClient
;
28 class WebMediaPlayerEncryptedMediaClient
;
33 class AudioRendererSink
;
35 class MediaPermission
;
36 class WebEncryptedMediaClientImpl
;
40 class ServiceProvider
;
44 namespace html_viewer
{
46 // Helper class used to create blink::WebMediaPlayer objects.
47 // This class stores the "global state" shared across all WebMediaPlayer
52 const scoped_refptr
<base::SingleThreadTaskRunner
>& compositor_task_runner
,
56 blink::WebMediaPlayer
* CreateMediaPlayer(
57 blink::WebLocalFrame
* frame
,
58 const blink::WebURL
& url
,
59 blink::WebMediaPlayerClient
* client
,
60 blink::WebMediaPlayerEncryptedMediaClient
* encrypted_client
,
61 blink::WebContentDecryptionModule
* initial_cdm
,
64 blink::WebEncryptedMediaClient
* GetEncryptedMediaClient();
67 media::interfaces::ServiceFactory
* GetMediaServiceFactory();
68 media::MediaPermission
* GetMediaPermission();
69 media::CdmFactory
* GetCdmFactory();
71 #if !defined(OS_ANDROID)
72 const media::AudioHardwareConfig
& GetAudioHardwareConfig();
73 scoped_refptr
<media::AudioRendererSink
> CreateAudioRendererSink();
74 scoped_refptr
<base::SingleThreadTaskRunner
> GetMediaThreadTaskRunner();
76 base::Thread media_thread_
;
77 media::FakeAudioLogFactory fake_audio_log_factory_
;
78 scoped_ptr
<media::AudioManager
> audio_manager_
;
79 media::AudioHardwareConfig audio_hardware_config_
;
82 const bool enable_mojo_media_renderer_
;
83 scoped_refptr
<base::SingleThreadTaskRunner
> compositor_task_runner_
;
86 // Lazily initialized objects.
87 media::interfaces::ServiceFactoryPtr media_service_factory_
;
88 scoped_ptr
<media::WebEncryptedMediaClientImpl
> web_encrypted_media_client_
;
89 scoped_ptr
<media::MediaPermission
> media_permission_
;
90 scoped_ptr
<media::CdmFactory
> cdm_factory_
;
92 DISALLOW_COPY_AND_ASSIGN(MediaFactory
);
95 } // namespace html_viewer
97 #endif // COMPONENTS_HTML_VIEWER_MEDIA_FACTORY_H_