OLD | NEW |
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 // Delegate calls from WebCore::MediaPlayerPrivate to Chrome's video player. | 5 // Delegate calls from WebCore::MediaPlayerPrivate to Chrome's video player. |
6 // It contains Pipeline which is the actual media player pipeline, it glues | 6 // It contains Pipeline which is the actual media player pipeline, it glues |
7 // the media player pipeline, data source, audio renderer and renderer. | 7 // the media player pipeline, data source, audio renderer and renderer. |
8 // Pipeline would creates multiple threads and access some public methods | 8 // Pipeline would creates multiple threads and access some public methods |
9 // of this class, so we need to be extra careful about concurrent access of | 9 // of this class, so we need to be extra careful about concurrent access of |
10 // methods and members. | 10 // methods and members. |
(...skipping 30 matching lines...) Expand all Loading... |
41 // During tear down of the whole browser or a tab, the DOM tree may not be | 41 // During tear down of the whole browser or a tab, the DOM tree may not be |
42 // destructed nicely, and there will be some dangling media threads trying to | 42 // destructed nicely, and there will be some dangling media threads trying to |
43 // the main thread, so we need this class to listen to destruction event of the | 43 // the main thread, so we need this class to listen to destruction event of the |
44 // main thread and cleanup the media threads when the even is received. Also | 44 // main thread and cleanup the media threads when the even is received. Also |
45 // at destruction of this class we will need to unhook it from destruction event | 45 // at destruction of this class we will need to unhook it from destruction event |
46 // list of the main thread. | 46 // list of the main thread. |
47 | 47 |
48 #ifndef WEBKIT_MEDIA_WEBMEDIAPLAYER_IMPL_H_ | 48 #ifndef WEBKIT_MEDIA_WEBMEDIAPLAYER_IMPL_H_ |
49 #define WEBKIT_MEDIA_WEBMEDIAPLAYER_IMPL_H_ | 49 #define WEBKIT_MEDIA_WEBMEDIAPLAYER_IMPL_H_ |
50 | 50 |
| 51 #include <string> |
| 52 |
51 #include "base/memory/ref_counted.h" | 53 #include "base/memory/ref_counted.h" |
52 #include "base/memory/scoped_ptr.h" | 54 #include "base/memory/scoped_ptr.h" |
53 #include "base/memory/weak_ptr.h" | 55 #include "base/memory/weak_ptr.h" |
54 #include "base/message_loop.h" | 56 #include "base/message_loop.h" |
55 #include "googleurl/src/gurl.h" | 57 #include "googleurl/src/gurl.h" |
56 #include "media/base/audio_renderer_sink.h" | 58 #include "media/base/audio_renderer_sink.h" |
57 #include "media/base/filters.h" | 59 #include "media/base/filters.h" |
58 #include "media/base/message_loop_factory.h" | 60 #include "media/base/message_loop_factory.h" |
59 #include "media/base/pipeline.h" | 61 #include "media/base/pipeline.h" |
| 62 #include "media/crypto/aes_decryptor.h" |
60 #include "skia/ext/platform_canvas.h" | 63 #include "skia/ext/platform_canvas.h" |
61 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAudioSourceProvide
r.h" | 64 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAudioSourceProvide
r.h" |
62 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h" | 65 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h" |
63 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerClient.
h" | 66 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerClient.
h" |
64 | 67 |
65 class RenderAudioSourceProvider; | 68 class RenderAudioSourceProvider; |
66 | 69 |
67 namespace WebKit { | 70 namespace WebKit { |
68 class WebAudioSourceProvider; | 71 class WebAudioSourceProvider; |
69 class WebFrame; | 72 class WebFrame; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 const unsigned char* key, | 209 const unsigned char* key, |
207 unsigned key_length, | 210 unsigned key_length, |
208 const unsigned char* init_data, | 211 const unsigned char* init_data, |
209 unsigned init_data_length, | 212 unsigned init_data_length, |
210 const WebKit::WebString& session_id); | 213 const WebKit::WebString& session_id); |
211 | 214 |
212 virtual MediaKeyException cancelKeyRequest( | 215 virtual MediaKeyException cancelKeyRequest( |
213 const WebKit::WebString& key_system, | 216 const WebKit::WebString& key_system, |
214 const WebKit::WebString& session_id); | 217 const WebKit::WebString& session_id); |
215 | 218 |
216 | |
217 // As we are closing the tab or even the browser, |main_loop_| is destroyed | 219 // As we are closing the tab or even the browser, |main_loop_| is destroyed |
218 // even before this object gets destructed, so we need to know when | 220 // even before this object gets destructed, so we need to know when |
219 // |main_loop_| is being destroyed and we can stop posting repaint task | 221 // |main_loop_| is being destroyed and we can stop posting repaint task |
220 // to it. | 222 // to it. |
221 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; | 223 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; |
222 | 224 |
223 void Repaint(); | 225 void Repaint(); |
224 | 226 |
225 void OnPipelineInitialize(media::PipelineStatus status); | 227 void OnPipelineInitialize(media::PipelineStatus status); |
226 void OnPipelineSeek(media::PipelineStatus status); | 228 void OnPipelineSeek(media::PipelineStatus status); |
227 void OnPipelineEnded(media::PipelineStatus status); | 229 void OnPipelineEnded(media::PipelineStatus status); |
228 void OnPipelineError(media::PipelineStatus error); | 230 void OnPipelineError(media::PipelineStatus error); |
229 void OnDemuxerOpened(); | 231 void OnDemuxerOpened(); |
230 void OnKeyNeeded(scoped_array<uint8> init_data, int init_data_size); | 232 void OnKeyAdded(const std::string& key_system, const std::string& session_id); |
| 233 void OnKeyError(const std::string& key_system, |
| 234 const std::string& session_id, |
| 235 media::AesDecryptor::KeyError error_code, |
| 236 int system_code); |
| 237 void OnKeyMessage(const std::string& key_system, |
| 238 const std::string& session_id, |
| 239 scoped_array<uint8> message, |
| 240 int message_length, |
| 241 const std::string& default_url); |
| 242 void OnNeedKey(const std::string& key_system, |
| 243 const std::string& session_id, |
| 244 scoped_array<uint8> init_data, |
| 245 int init_data_size); |
231 void SetOpaque(bool); | 246 void SetOpaque(bool); |
232 | 247 |
233 private: | 248 private: |
234 // Called after asynchronous initialization of a data source completed. | 249 // Called after asynchronous initialization of a data source completed. |
235 void DataSourceInitialized(const GURL& gurl, media::PipelineStatus status); | 250 void DataSourceInitialized(const GURL& gurl, media::PipelineStatus status); |
236 | 251 |
237 // Called when the data source is downloading or paused. | 252 // Called when the data source is downloading or paused. |
238 void NotifyDownloading(bool is_downloading); | 253 void NotifyDownloading(bool is_downloading); |
239 | 254 |
240 // Finishes starting the pipeline due to a call to load(). | 255 // Finishes starting the pipeline due to a call to load(). |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 WebKit::WebAudioSourceProvider* audio_source_provider_; | 339 WebKit::WebAudioSourceProvider* audio_source_provider_; |
325 | 340 |
326 bool is_local_source_; | 341 bool is_local_source_; |
327 | 342 |
328 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 343 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
329 }; | 344 }; |
330 | 345 |
331 } // namespace webkit_media | 346 } // namespace webkit_media |
332 | 347 |
333 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_IMPL_H_ | 348 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_IMPL_H_ |
OLD | NEW |