| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 const unsigned char* key, | 217 const unsigned char* key, |
| 215 unsigned key_length, | 218 unsigned key_length, |
| 216 const unsigned char* init_data, | 219 const unsigned char* init_data, |
| 217 unsigned init_data_length, | 220 unsigned init_data_length, |
| 218 const WebKit::WebString& session_id); | 221 const WebKit::WebString& session_id); |
| 219 | 222 |
| 220 virtual MediaKeyException cancelKeyRequest( | 223 virtual MediaKeyException cancelKeyRequest( |
| 221 const WebKit::WebString& key_system, | 224 const WebKit::WebString& key_system, |
| 222 const WebKit::WebString& session_id); | 225 const WebKit::WebString& session_id); |
| 223 | 226 |
| 224 | |
| 225 // As we are closing the tab or even the browser, |main_loop_| is destroyed | 227 // As we are closing the tab or even the browser, |main_loop_| is destroyed |
| 226 // even before this object gets destructed, so we need to know when | 228 // even before this object gets destructed, so we need to know when |
| 227 // |main_loop_| is being destroyed and we can stop posting repaint task | 229 // |main_loop_| is being destroyed and we can stop posting repaint task |
| 228 // to it. | 230 // to it. |
| 229 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; | 231 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; |
| 230 | 232 |
| 231 void Repaint(); | 233 void Repaint(); |
| 232 | 234 |
| 233 void OnPipelineInitialize(media::PipelineStatus status); | 235 void OnPipelineInitialize(media::PipelineStatus status); |
| 234 void OnPipelineSeek(media::PipelineStatus status); | 236 void OnPipelineSeek(media::PipelineStatus status); |
| 235 void OnPipelineEnded(media::PipelineStatus status); | 237 void OnPipelineEnded(media::PipelineStatus status); |
| 236 void OnPipelineError(media::PipelineStatus error); | 238 void OnPipelineError(media::PipelineStatus error); |
| 237 void OnNetworkEvent(media::NetworkEvent type); | 239 void OnNetworkEvent(media::NetworkEvent type); |
| 238 void OnDemuxerOpened(); | 240 void OnDemuxerOpened(); |
| 239 void OnKeyNeeded(scoped_array<uint8> init_data, int init_data_size); | 241 void OnKeyAdded(const std::string& key_system, const std::string& session_id); |
| 242 void OnKeyError(const std::string& key_system, |
| 243 const std::string& session_id, |
| 244 media::AesDecryptor::KeyError error_code, |
| 245 int system_code); |
| 246 void OnKeyMessage(const std::string& key_system, |
| 247 const std::string& session_id, |
| 248 scoped_array<uint8> message, |
| 249 int message_length, |
| 250 const std::string& default_url); |
| 251 void OnNeedKey(const std::string& key_system, |
| 252 const std::string& session_id, |
| 253 scoped_array<uint8> init_data, |
| 254 int init_data_size); |
| 240 void SetOpaque(bool); | 255 void SetOpaque(bool); |
| 241 | 256 |
| 242 private: | 257 private: |
| 243 // Called after asynchronous initialization of a data source completed. | 258 // Called after asynchronous initialization of a data source completed. |
| 244 void DataSourceInitialized(const GURL& gurl, media::PipelineStatus status); | 259 void DataSourceInitialized(const GURL& gurl, media::PipelineStatus status); |
| 245 | 260 |
| 246 // Finishes starting the pipeline due to a call to load(). | 261 // Finishes starting the pipeline due to a call to load(). |
| 247 void StartPipeline(); | 262 void StartPipeline(); |
| 248 | 263 |
| 249 // Helpers that set the network/ready state and notifies the client if | 264 // Helpers that set the network/ready state and notifies the client if |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 348 |
| 334 // TODO(fischman): see TODO on bytesLoaded() above. | 349 // TODO(fischman): see TODO on bytesLoaded() above. |
| 335 mutable uint64 fake_bytes_loaded_; | 350 mutable uint64 fake_bytes_loaded_; |
| 336 | 351 |
| 337 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 352 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
| 338 }; | 353 }; |
| 339 | 354 |
| 340 } // namespace webkit_media | 355 } // namespace webkit_media |
| 341 | 356 |
| 342 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_IMPL_H_ | 357 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_IMPL_H_ |
| OLD | NEW |