• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 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 #include "media/blink/webmediaplayer_params.h"
6 
7 #include "base/single_thread_task_runner.h"
8 #include "media/base/audio_renderer_sink.h"
9 #include "media/base/media_log.h"
10 #include "media/filters/gpu_video_accelerator_factories.h"
11 
12 namespace media {
13 
WebMediaPlayerParams(const base::Callback<void (const base::Closure &)> & defer_load_cb,const scoped_refptr<AudioRendererSink> & audio_renderer_sink,const AudioHardwareConfig & audio_hardware_config,const scoped_refptr<MediaLog> & media_log,const scoped_refptr<GpuVideoAcceleratorFactories> & gpu_factories,const scoped_refptr<base::SingleThreadTaskRunner> & media_task_runner,const scoped_refptr<base::SingleThreadTaskRunner> & compositor_task_runner,const EncryptedMediaPlayerSupportCreateCB & encrypted_media_player_support_cb,blink::WebContentDecryptionModule * initial_cdm)14 WebMediaPlayerParams::WebMediaPlayerParams(
15     const base::Callback<void(const base::Closure&)>& defer_load_cb,
16     const scoped_refptr<AudioRendererSink>& audio_renderer_sink,
17     const AudioHardwareConfig& audio_hardware_config,
18     const scoped_refptr<MediaLog>& media_log,
19     const scoped_refptr<GpuVideoAcceleratorFactories>& gpu_factories,
20     const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner,
21     const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner,
22     const EncryptedMediaPlayerSupportCreateCB&
23         encrypted_media_player_support_cb,
24     blink::WebContentDecryptionModule* initial_cdm)
25     : defer_load_cb_(defer_load_cb),
26       audio_renderer_sink_(audio_renderer_sink),
27       audio_hardware_config_(audio_hardware_config),
28       media_log_(media_log),
29       gpu_factories_(gpu_factories),
30       media_task_runner_(media_task_runner),
31       compositor_task_runner_(compositor_task_runner),
32       encrypted_media_player_support_cb_(encrypted_media_player_support_cb),
33       initial_cdm_(initial_cdm) {
34 }
35 
~WebMediaPlayerParams()36 WebMediaPlayerParams::~WebMediaPlayerParams() {}
37 
38 scoped_ptr<EncryptedMediaPlayerSupport>
CreateEncryptedMediaPlayerSupport(blink::WebMediaPlayerClient * client) const39 WebMediaPlayerParams::CreateEncryptedMediaPlayerSupport(
40     blink::WebMediaPlayerClient* client) const {
41   scoped_ptr<EncryptedMediaPlayerSupport> encrypted_media_support =
42       encrypted_media_player_support_cb_.Run(client);
43   if (encrypted_media_support)
44     encrypted_media_support->SetInitialContentDecryptionModule(initial_cdm_);
45   return encrypted_media_support.Pass();
46 }
47 
48 }  // namespace media
49