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

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

Issue 10534096: Generalize AesDecryptor to make it more spec compliant. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile error on Windows. Created 8 years, 6 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 | Annotate | Revision Log
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> 8 #include <list>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/synchronization/lock.h" 13 #include "base/synchronization/lock.h"
14 #include "media/base/pipeline.h" 14 #include "media/base/pipeline.h"
15 #include "media/crypto/decryptor_client.h"
15 #include "media/filters/chunk_demuxer.h" 16 #include "media/filters/chunk_demuxer.h"
16 #include "media/filters/chunk_demuxer_client.h" 17 #include "media/filters/chunk_demuxer_client.h"
17 #include "media/filters/ffmpeg_video_decoder.h" 18 #include "media/filters/ffmpeg_video_decoder.h"
18 #include "webkit/media/buffered_data_source.h" 19 #include "webkit/media/buffered_data_source.h"
19 #include "webkit/media/skcanvas_video_renderer.h" 20 #include "webkit/media/skcanvas_video_renderer.h"
20 21
21 class SkCanvas; 22 class SkCanvas;
22 23
23 namespace base { 24 namespace base {
24 class MessageLoopProxy; 25 class MessageLoopProxy;
25 } 26 }
26 27
27 namespace gfx { 28 namespace gfx {
28 class Rect; 29 class Rect;
29 } 30 }
30 31
31 namespace media { 32 namespace media {
32 class VideoFrame; 33 class VideoFrame;
33 class VideoRendererBase; 34 class VideoRendererBase;
34 } 35 }
35 36
36 namespace webkit_media { 37 namespace webkit_media {
37 38
38 class WebMediaPlayerImpl; 39 class WebMediaPlayerImpl;
39 40
40 // Acts as a thread proxy between the various threads used for multimedia and 41 // Acts as a thread proxy between the various threads used for multimedia and
41 // the render thread that WebMediaPlayerImpl is running on. 42 // the render thread that WebMediaPlayerImpl is running on.
42 class WebMediaPlayerProxy 43 class WebMediaPlayerProxy
43 : public base::RefCountedThreadSafe<WebMediaPlayerProxy>, 44 : public base::RefCountedThreadSafe<WebMediaPlayerProxy>,
44 public media::ChunkDemuxerClient { 45 public media::ChunkDemuxerClient,
46 public media::DecryptorClient {
45 public: 47 public:
46 WebMediaPlayerProxy(const scoped_refptr<base::MessageLoopProxy>& render_loop, 48 WebMediaPlayerProxy(const scoped_refptr<base::MessageLoopProxy>& render_loop,
47 WebMediaPlayerImpl* webmediaplayer); 49 WebMediaPlayerImpl* webmediaplayer);
48 const scoped_refptr<BufferedDataSource>& data_source() { 50 const scoped_refptr<BufferedDataSource>& data_source() {
49 return data_source_; 51 return data_source_;
50 } 52 }
51 void set_data_source(const scoped_refptr<BufferedDataSource>& data_source) { 53 void set_data_source(const scoped_refptr<BufferedDataSource>& data_source) {
52 data_source_ = data_source; 54 data_source_ = data_source;
53 } 55 }
54 56
(...skipping 27 matching lines...) Expand all
82 84
83 // Methods for Pipeline -> WebMediaPlayerImpl communication. 85 // Methods for Pipeline -> WebMediaPlayerImpl communication.
84 void PipelineInitializationCallback(media::PipelineStatus status); 86 void PipelineInitializationCallback(media::PipelineStatus status);
85 void PipelineSeekCallback(media::PipelineStatus status); 87 void PipelineSeekCallback(media::PipelineStatus status);
86 void PipelineEndedCallback(media::PipelineStatus status); 88 void PipelineEndedCallback(media::PipelineStatus status);
87 void PipelineErrorCallback(media::PipelineStatus error); 89 void PipelineErrorCallback(media::PipelineStatus error);
88 90
89 // ChunkDemuxerClient implementation. 91 // ChunkDemuxerClient implementation.
90 virtual void DemuxerOpened(media::ChunkDemuxer* demuxer) OVERRIDE; 92 virtual void DemuxerOpened(media::ChunkDemuxer* demuxer) OVERRIDE;
91 virtual void DemuxerClosed() OVERRIDE; 93 virtual void DemuxerClosed() OVERRIDE;
92 virtual void KeyNeeded(scoped_array<uint8> init_data, 94 virtual void DemuxerNeedKey(scoped_array<uint8> init_data,
93 int init_data_size) OVERRIDE; 95 int init_data_size) OVERRIDE;
94 96
95 // Methods for Demuxer communication. 97 // Methods for Demuxer communication.
96 void DemuxerStartWaitingForSeek(); 98 void DemuxerStartWaitingForSeek();
97 media::ChunkDemuxer::Status DemuxerAddId(const std::string& id, 99 media::ChunkDemuxer::Status DemuxerAddId(const std::string& id,
98 const std::string& type, 100 const std::string& type,
99 std::vector<std::string>& codecs); 101 std::vector<std::string>& codecs);
100 void DemuxerRemoveId(const std::string& id); 102 void DemuxerRemoveId(const std::string& id);
101 bool DemuxerBufferedRange(const std::string& id, 103 bool DemuxerBufferedRange(const std::string& id,
102 media::ChunkDemuxer::Ranges* ranges_out); 104 media::ChunkDemuxer::Ranges* ranges_out);
103 bool DemuxerAppend(const std::string& id, const uint8* data, size_t length); 105 bool DemuxerAppend(const std::string& id, const uint8* data, size_t length);
104 void DemuxerAbort(const std::string& id); 106 void DemuxerAbort(const std::string& id);
105 void DemuxerEndOfStream(media::PipelineStatus status); 107 void DemuxerEndOfStream(media::PipelineStatus status);
106 void DemuxerShutdown(); 108 void DemuxerShutdown();
107 109
108 void DemuxerOpenedTask(const scoped_refptr<media::ChunkDemuxer>& demuxer); 110 // DecryptorClient implementation.
109 void DemuxerClosedTask(); 111 virtual void KeyAdded(const std::string& key_system,
110 void KeyNeededTask(scoped_array<uint8> init_data, int init_data_size); 112 const std::string& session_id) OVERRIDE;
113 virtual void KeyError(const std::string& key_system,
114 const std::string& session_id,
115 media::AesDecryptor::KeyError error_code,
116 int system_code) OVERRIDE;
117 virtual void KeyMessage(const std::string& key_system,
118 const std::string& session_id,
119 scoped_array<uint8> message,
120 int message_length,
121 const std::string& default_url) OVERRIDE;
122 virtual void NeedKey(const std::string& key_system,
123 const std::string& session_id,
124 scoped_array<uint8> init_data,
125 int init_data_size) OVERRIDE;
111 126
112 private: 127 private:
113 friend class base::RefCountedThreadSafe<WebMediaPlayerProxy>; 128 friend class base::RefCountedThreadSafe<WebMediaPlayerProxy>;
114 virtual ~WebMediaPlayerProxy(); 129 virtual ~WebMediaPlayerProxy();
115 130
116 // Invoke |webmediaplayer_| to perform a repaint. 131 // Invoke |webmediaplayer_| to perform a repaint.
117 void RepaintTask(); 132 void RepaintTask();
118 133
119 // Notify |webmediaplayer_| that initialization has finished. 134 // Notify |webmediaplayer_| that initialization has finished.
120 void PipelineInitializationTask(media::PipelineStatus status); 135 void PipelineInitializationTask(media::PipelineStatus status);
121 136
122 // Notify |webmediaplayer_| that a seek has finished. 137 // Notify |webmediaplayer_| that a seek has finished.
123 void PipelineSeekTask(media::PipelineStatus status); 138 void PipelineSeekTask(media::PipelineStatus status);
124 139
125 // Notify |webmediaplayer_| that the media has ended. 140 // Notify |webmediaplayer_| that the media has ended.
126 void PipelineEndedTask(media::PipelineStatus status); 141 void PipelineEndedTask(media::PipelineStatus status);
127 142
128 // Notify |webmediaplayer_| that a pipeline error has occurred during 143 // Notify |webmediaplayer_| that a pipeline error has occurred during
129 // playback. 144 // playback.
130 void PipelineErrorTask(media::PipelineStatus error); 145 void PipelineErrorTask(media::PipelineStatus error);
131 146
132 // Inform |webmediaplayer_| whether the video content is opaque. 147 // Inform |webmediaplayer_| whether the video content is opaque.
133 void SetOpaqueTask(bool opaque); 148 void SetOpaqueTask(bool opaque);
134 149
150 void DemuxerOpenedTask(const scoped_refptr<media::ChunkDemuxer>& demuxer);
151 void DemuxerClosedTask();
152
153 // Notify |webmediaplayer_| that a key has been added.
154 void KeyAddedTask(const std::string& key_system,
155 const std::string& session_id);
156
157 // Notify |webmediaplayer_| that a key error has occurred.
ddorwin 2012/06/14 21:00:13 nit: remove "has" to be consistent with DecryptorC
xhwang 2012/06/15 01:41:04 Done.
158 void KeyErrorTask(const std::string& key_system,
159 const std::string& session_id,
160 media::AesDecryptor::KeyError error_code,
161 int system_code);
162
163 // Notify |webmediaplayer_| that a key message has been generated.
164 void KeyMessageTask(const std::string& key_system,
165 const std::string& session_id,
166 scoped_array<uint8> message,
167 int message_length,
168 const std::string& default_url);
169
170 // Notify |webmediaplayer_| that a key is needed for decryption.
171 void NeedKeyTask(const std::string& key_system,
172 const std::string& session_id,
173 scoped_array<uint8> init_data,
174 int init_data_size);
175
135 // The render message loop where WebKit lives. 176 // The render message loop where WebKit lives.
136 scoped_refptr<base::MessageLoopProxy> render_loop_; 177 scoped_refptr<base::MessageLoopProxy> render_loop_;
137 WebMediaPlayerImpl* webmediaplayer_; 178 WebMediaPlayerImpl* webmediaplayer_;
138 179
139 scoped_refptr<BufferedDataSource> data_source_; 180 scoped_refptr<BufferedDataSource> data_source_;
140 scoped_refptr<media::VideoRendererBase> frame_provider_; 181 scoped_refptr<media::VideoRendererBase> frame_provider_;
141 SkCanvasVideoRenderer video_renderer_; 182 SkCanvasVideoRenderer video_renderer_;
142 scoped_refptr<media::FFmpegVideoDecoder> video_decoder_; 183 scoped_refptr<media::FFmpegVideoDecoder> video_decoder_;
143 184
144 base::Lock lock_; 185 base::Lock lock_;
145 int outstanding_repaints_; 186 int outstanding_repaints_;
146 187
147 scoped_refptr<media::ChunkDemuxer> chunk_demuxer_; 188 scoped_refptr<media::ChunkDemuxer> chunk_demuxer_;
148 189
149 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMediaPlayerProxy); 190 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMediaPlayerProxy);
150 }; 191 };
151 192
152 } // namespace webkit_media 193 } // namespace webkit_media
153 194
154 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_ 195 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698