Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(462)

Side by Side Diff: webkit/media/webmediaplayer_proxy.h

Issue 11226019: Encrypted Media: Replace DecryptorClient with key event callbacks. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase again Created 7 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_ 5 #ifndef WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_
6 #define WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_ 6 #define WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_
7 7
8 #include <list>
9 #include <string>
10 #include <vector>
11
12 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
13 #include "base/synchronization/lock.h" 9 #include "base/synchronization/lock.h"
14 #include "media/base/decryptor_client.h"
15 #include "media/base/pipeline.h" 10 #include "media/base/pipeline.h"
16 #include "media/filters/chunk_demuxer.h"
17 #include "media/filters/ffmpeg_video_decoder.h"
18 #include "media/filters/skcanvas_video_renderer.h" 11 #include "media/filters/skcanvas_video_renderer.h"
19 #include "webkit/media/buffered_data_source.h" 12 #include "webkit/media/buffered_data_source.h"
20 13
21 class SkCanvas; 14 class SkCanvas;
22 15
23 namespace base { 16 namespace base {
24 class MessageLoopProxy; 17 class MessageLoopProxy;
25 } 18 }
26 19
27 namespace gfx { 20 namespace gfx {
28 class Rect; 21 class Rect;
29 } 22 }
30 23
31 namespace media { 24 namespace media {
32 class VideoFrame; 25 class VideoFrame;
33 class VideoRendererBase; 26 class VideoRendererBase;
34 } 27 }
35 28
36 namespace webkit_media { 29 namespace webkit_media {
37 30
38 class WebMediaPlayerImpl; 31 class WebMediaPlayerImpl;
39 32
40 // Acts as a thread proxy between the various threads used for multimedia and 33 // Acts as a thread proxy between the various threads used for multimedia and
41 // the render thread that WebMediaPlayerImpl is running on. 34 // the render thread that WebMediaPlayerImpl is running on.
42 class WebMediaPlayerProxy 35 class WebMediaPlayerProxy
43 : public base::RefCountedThreadSafe<WebMediaPlayerProxy>, 36 : public base::RefCountedThreadSafe<WebMediaPlayerProxy> {
44 public media::DecryptorClient {
45 public: 37 public:
46 WebMediaPlayerProxy(const scoped_refptr<base::MessageLoopProxy>& render_loop, 38 WebMediaPlayerProxy(const scoped_refptr<base::MessageLoopProxy>& render_loop,
47 WebMediaPlayerImpl* webmediaplayer); 39 WebMediaPlayerImpl* webmediaplayer);
48 const scoped_refptr<BufferedDataSource>& data_source() { 40 const scoped_refptr<BufferedDataSource>& data_source() {
49 return data_source_; 41 return data_source_;
50 } 42 }
51 void set_data_source(const scoped_refptr<BufferedDataSource>& data_source) { 43 void set_data_source(const scoped_refptr<BufferedDataSource>& data_source) {
52 data_source_ = data_source; 44 data_source_ = data_source;
53 } 45 }
54 46
55 // TODO(scherkus): remove this once VideoRendererBase::PaintCB passes 47 // TODO(scherkus): remove this once VideoRendererBase::PaintCB passes
56 // ownership of the VideoFrame http://crbug.com/108435 48 // ownership of the VideoFrame http://crbug.com/108435
57 void set_frame_provider(media::VideoRendererBase* frame_provider) { 49 void set_frame_provider(media::VideoRendererBase* frame_provider) {
58 frame_provider_ = frame_provider; 50 frame_provider_ = frame_provider;
59 } 51 }
60 52
61 // Methods for Filter -> WebMediaPlayerImpl communication. 53 // Methods for Filter -> WebMediaPlayerImpl communication.
62 void Repaint(); 54 void Repaint();
63 55
64 // Methods for WebMediaPlayerImpl -> Filter communication. 56 // Methods for WebMediaPlayerImpl -> Filter communication.
65 void Paint(SkCanvas* canvas, const gfx::Rect& dest_rect, uint8_t alpha); 57 void Paint(SkCanvas* canvas, const gfx::Rect& dest_rect, uint8_t alpha);
66 void Detach(); 58 void Detach();
67 void GetCurrentFrame(scoped_refptr<media::VideoFrame>* frame_out); 59 void GetCurrentFrame(scoped_refptr<media::VideoFrame>* frame_out);
68 void PutCurrentFrame(scoped_refptr<media::VideoFrame> frame); 60 void PutCurrentFrame(scoped_refptr<media::VideoFrame> frame);
69 bool HasSingleOrigin(); 61 bool HasSingleOrigin();
70 bool DidPassCORSAccessCheck() const; 62 bool DidPassCORSAccessCheck() const;
71 63
72 void AbortDataSource(); 64 void AbortDataSource();
73 65
74 // DecryptorClient implementation.
75 virtual void KeyAdded(const std::string& key_system,
76 const std::string& session_id) OVERRIDE;
77 virtual void KeyError(const std::string& key_system,
78 const std::string& session_id,
79 media::Decryptor::KeyError error_code,
80 int system_code) OVERRIDE;
81 virtual void KeyMessage(const std::string& key_system,
82 const std::string& session_id,
83 const std::string& message,
84 const std::string& default_url) OVERRIDE;
85 virtual void NeedKey(const std::string& key_system,
86 const std::string& session_id,
87 const std::string& type,
88 scoped_array<uint8> init_data,
89 int init_data_size) OVERRIDE;
90
91 private: 66 private:
92 friend class base::RefCountedThreadSafe<WebMediaPlayerProxy>; 67 friend class base::RefCountedThreadSafe<WebMediaPlayerProxy>;
93 virtual ~WebMediaPlayerProxy(); 68 virtual ~WebMediaPlayerProxy();
94 69
95 // Invoke |webmediaplayer_| to perform a repaint. 70 // Invoke |webmediaplayer_| to perform a repaint.
96 void RepaintTask(); 71 void RepaintTask();
97 72
98 // Notify |webmediaplayer_| that a key has been added.
99 void KeyAddedTask(const std::string& key_system,
100 const std::string& session_id);
101
102 // Notify |webmediaplayer_| that a key error occurred.
103 void KeyErrorTask(const std::string& key_system,
104 const std::string& session_id,
105 media::Decryptor::KeyError error_code,
106 int system_code);
107
108 // Notify |webmediaplayer_| that a key message has been generated.
109 void KeyMessageTask(const std::string& key_system,
110 const std::string& session_id,
111 const std::string& message,
112 const std::string& default_url);
113
114 // Notify |webmediaplayer_| that a key is needed for decryption.
115 void NeedKeyTask(const std::string& key_system,
116 const std::string& session_id,
117 const std::string& type,
118 scoped_array<uint8> init_data,
119 int init_data_size);
120
121 // The render message loop where WebKit lives. 73 // The render message loop where WebKit lives.
122 scoped_refptr<base::MessageLoopProxy> render_loop_; 74 scoped_refptr<base::MessageLoopProxy> render_loop_;
123 WebMediaPlayerImpl* webmediaplayer_; 75 WebMediaPlayerImpl* webmediaplayer_;
124 76
125 scoped_refptr<BufferedDataSource> data_source_; 77 scoped_refptr<BufferedDataSource> data_source_;
126 scoped_refptr<media::VideoRendererBase> frame_provider_; 78 scoped_refptr<media::VideoRendererBase> frame_provider_;
127 media::SkCanvasVideoRenderer video_renderer_; 79 media::SkCanvasVideoRenderer video_renderer_;
128 80
129 base::Lock lock_; 81 base::Lock lock_;
130 int outstanding_repaints_; 82 int outstanding_repaints_;
131 83
132 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMediaPlayerProxy); 84 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMediaPlayerProxy);
133 }; 85 };
134 86
135 } // namespace webkit_media 87 } // namespace webkit_media
136 88
137 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_ 89 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698