Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / media / blink / webmediaplayer_params.h
blob0811902a9ba57bd781b39a9696ea50678ccc499b
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.
5 #ifndef MEDIA_BLINK_WEBMEDIAPLAYER_PARAMS_H_
6 #define MEDIA_BLINK_WEBMEDIAPLAYER_PARAMS_H_
8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h"
10 #include "media/base/media_export.h"
11 #include "media/filters/context_3d.h"
13 namespace base {
14 class SingleThreadTaskRunner;
15 class TaskRunner;
18 namespace blink {
19 class WebContentDecryptionModule;
20 class WebMediaPlayerClient;
23 namespace media {
25 class AudioRendererSink;
26 class MediaLog;
27 class MediaPermission;
29 // Holds parameters for constructing WebMediaPlayerImpl without having
30 // to plumb arguments through various abstraction layers.
31 class MEDIA_EXPORT WebMediaPlayerParams {
32 public:
33 typedef base::Callback<void(const base::Closure&)> DeferLoadCB;
34 typedef base::Callback<Context3D()> Context3DCB;
36 // |defer_load_cb|, |audio_renderer_sink|, |compositor_task_runner|, and
37 // |context_3d_cb| may be null.
38 WebMediaPlayerParams(
39 const DeferLoadCB& defer_load_cb,
40 const scoped_refptr<AudioRendererSink>& audio_renderer_sink,
41 const scoped_refptr<MediaLog>& media_log,
42 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner,
43 const scoped_refptr<base::TaskRunner>& worker_task_runner,
44 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner,
45 const Context3DCB& context_3d,
46 MediaPermission* media_permission,
47 blink::WebContentDecryptionModule* initial_cdm);
49 ~WebMediaPlayerParams();
51 DeferLoadCB defer_load_cb() const { return defer_load_cb_; }
53 const scoped_refptr<AudioRendererSink>& audio_renderer_sink() const {
54 return audio_renderer_sink_;
57 const scoped_refptr<MediaLog>& media_log() const {
58 return media_log_;
61 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner() const {
62 return media_task_runner_;
65 const scoped_refptr<base::TaskRunner> worker_task_runner() const {
66 return worker_task_runner_;
69 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner()
70 const {
71 return compositor_task_runner_;
74 Context3DCB context_3d_cb() const { return context_3d_cb_; }
76 MediaPermission* media_permission() const { return media_permission_; }
78 blink::WebContentDecryptionModule* initial_cdm() const {
79 return initial_cdm_;
83 private:
84 DeferLoadCB defer_load_cb_;
85 scoped_refptr<AudioRendererSink> audio_renderer_sink_;
86 scoped_refptr<MediaLog> media_log_;
87 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_;
88 scoped_refptr<base::TaskRunner> worker_task_runner_;
89 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
90 Context3DCB context_3d_cb_;
92 // TODO(xhwang): Remove after prefixed EME API support is removed.
93 MediaPermission* media_permission_;
94 blink::WebContentDecryptionModule* initial_cdm_;
96 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMediaPlayerParams);
99 } // namespace media
101 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_PARAMS_H_