| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 5 #ifndef MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
| 6 #define MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 6 #define MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/linked_ptr.h" |
| 13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 16 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
| 17 #include "media/base/cdm_factory.h" | 18 #include "media/base/cdm_factory.h" |
| 18 #include "media/base/media_export.h" | |
| 19 #include "media/base/pipeline.h" | 19 #include "media/base/pipeline.h" |
| 20 #include "media/base/renderer_factory.h" | 20 #include "media/base/renderer_factory.h" |
| 21 #include "media/base/text_track.h" | 21 #include "media/base/text_track.h" |
| 22 #include "media/blink/buffered_data_source.h" | 22 #include "media/blink/buffered_data_source.h" |
| 23 #include "media/blink/buffered_data_source_host_impl.h" | 23 #include "media/blink/buffered_data_source_host_impl.h" |
| 24 #include "media/blink/encrypted_media_player_support.h" | 24 #include "media/blink/encrypted_media_player_support.h" |
| 25 #include "media/blink/media_blink_export.h" |
| 26 #include "media/blink/multibuffer_data_source.h" |
| 25 #include "media/blink/skcanvas_video_renderer.h" | 27 #include "media/blink/skcanvas_video_renderer.h" |
| 26 #include "media/blink/video_frame_compositor.h" | 28 #include "media/blink/video_frame_compositor.h" |
| 27 #include "media/blink/webmediaplayer_params.h" | 29 #include "media/blink/webmediaplayer_params.h" |
| 28 #include "media/blink/webmediaplayer_util.h" | 30 #include "media/blink/webmediaplayer_util.h" |
| 29 #include "third_party/WebKit/public/platform/WebAudioSourceProvider.h" | 31 #include "third_party/WebKit/public/platform/WebAudioSourceProvider.h" |
| 30 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" | 32 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" |
| 31 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" | 33 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
| 32 #include "url/gurl.h" | 34 #include "url/gurl.h" |
| 33 | 35 |
| 34 namespace blink { | 36 namespace blink { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 47 class WebLayerImpl; | 49 class WebLayerImpl; |
| 48 } | 50 } |
| 49 | 51 |
| 50 namespace media { | 52 namespace media { |
| 51 | 53 |
| 52 class AudioHardwareConfig; | 54 class AudioHardwareConfig; |
| 53 class ChunkDemuxer; | 55 class ChunkDemuxer; |
| 54 class GpuVideoAcceleratorFactories; | 56 class GpuVideoAcceleratorFactories; |
| 55 class MediaLog; | 57 class MediaLog; |
| 56 class VideoFrameCompositor; | 58 class VideoFrameCompositor; |
| 59 class ResourceMultiBuffer; |
| 57 class WebAudioSourceProviderImpl; | 60 class WebAudioSourceProviderImpl; |
| 58 class WebMediaPlayerDelegate; | 61 class WebMediaPlayerDelegate; |
| 59 class WebTextTrackImpl; | 62 class WebTextTrackImpl; |
| 60 | 63 |
| 61 // The canonical implementation of blink::WebMediaPlayer that's backed by | 64 // The canonical implementation of blink::WebMediaPlayer that's backed by |
| 62 // Pipeline. Handles normal resource loading, Media Source, and | 65 // Pipeline. Handles normal resource loading, Media Source, and |
| 63 // Encrypted Media. | 66 // Encrypted Media. |
| 64 class MEDIA_EXPORT WebMediaPlayerImpl | 67 class MEDIA_BLINK_EXPORT WebMediaPlayerImpl |
| 65 : public NON_EXPORTED_BASE(blink::WebMediaPlayer), | 68 : public NON_EXPORTED_BASE(blink::WebMediaPlayer), |
| 66 public base::SupportsWeakPtr<WebMediaPlayerImpl> { | 69 public base::SupportsWeakPtr<WebMediaPlayerImpl> { |
| 67 public: | 70 public: |
| 68 // Constructs a WebMediaPlayer implementation using Chromium's media stack. | 71 // Constructs a WebMediaPlayer implementation using Chromium's media stack. |
| 69 // |delegate| may be null. |renderer| may also be null, in which case an | 72 // |delegate| may be null. |renderer| may also be null, in which case an |
| 70 // internal renderer will be created. | 73 // internal renderer will be created. |
| 71 // TODO(xhwang): Drop the internal renderer path and always pass in a renderer | 74 // TODO(xhwang): Drop the internal renderer path and always pass in a renderer |
| 72 // here. | 75 // here. |
| 73 WebMediaPlayerImpl( | 76 WebMediaPlayerImpl( |
| 74 blink::WebLocalFrame* frame, | 77 blink::WebLocalFrame* frame, |
| 75 blink::WebMediaPlayerClient* client, | 78 blink::WebMediaPlayerClient* client, |
| 76 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, | 79 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, |
| 77 base::WeakPtr<WebMediaPlayerDelegate> delegate, | 80 base::WeakPtr<WebMediaPlayerDelegate> delegate, |
| 78 scoped_ptr<RendererFactory> renderer_factory, | 81 scoped_ptr<RendererFactory> renderer_factory, |
| 79 CdmFactory* cdm_factory, | 82 CdmFactory* cdm_factory, |
| 83 linked_ptr<ResourceMultiBuffer> resource_multibuffer, |
| 80 const WebMediaPlayerParams& params); | 84 const WebMediaPlayerParams& params); |
| 81 ~WebMediaPlayerImpl() override; | 85 ~WebMediaPlayerImpl() override; |
| 82 | 86 |
| 83 void load(LoadType load_type, | 87 void load(LoadType load_type, |
| 84 const blink::WebURL& url, | 88 const blink::WebURL& url, |
| 85 CORSMode cors_mode) override; | 89 CORSMode cors_mode) override; |
| 86 | 90 |
| 87 // Playback controls. | 91 // Playback controls. |
| 88 void play() override; | 92 void play() override; |
| 89 void pause() override; | 93 void pause() override; |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 scoped_refptr<WebAudioSourceProviderImpl> audio_source_provider_; | 308 scoped_refptr<WebAudioSourceProviderImpl> audio_source_provider_; |
| 305 | 309 |
| 306 bool supports_save_; | 310 bool supports_save_; |
| 307 | 311 |
| 308 // These two are mutually exclusive: | 312 // These two are mutually exclusive: |
| 309 // |data_source_| is used for regular resource loads. | 313 // |data_source_| is used for regular resource loads. |
| 310 // |chunk_demuxer_| is used for Media Source resource loads. | 314 // |chunk_demuxer_| is used for Media Source resource loads. |
| 311 // | 315 // |
| 312 // |demuxer_| will contain the appropriate demuxer based on which resource | 316 // |demuxer_| will contain the appropriate demuxer based on which resource |
| 313 // load strategy we're using. | 317 // load strategy we're using. |
| 314 scoped_ptr<BufferedDataSource> data_source_; | 318 scoped_ptr<BufferedDataSourceInterface> data_source_; |
| 315 scoped_ptr<Demuxer> demuxer_; | 319 scoped_ptr<Demuxer> demuxer_; |
| 316 ChunkDemuxer* chunk_demuxer_; | 320 ChunkDemuxer* chunk_demuxer_; |
| 317 | 321 |
| 318 BufferedDataSourceHostImpl buffered_data_source_host_; | 322 BufferedDataSourceHostImpl buffered_data_source_host_; |
| 323 linked_ptr<ResourceMultiBuffer> resource_multibuffer_; |
| 319 | 324 |
| 320 // Video rendering members. | 325 // Video rendering members. |
| 321 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; | 326 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; |
| 322 VideoFrameCompositor* compositor_; // Deleted on |compositor_task_runner_|. | 327 VideoFrameCompositor* compositor_; // Deleted on |compositor_task_runner_|. |
| 323 SkCanvasVideoRenderer skcanvas_video_renderer_; | 328 SkCanvasVideoRenderer skcanvas_video_renderer_; |
| 324 | 329 |
| 325 // The compositor layer for displaying the video content when using composited | 330 // The compositor layer for displaying the video content when using composited |
| 326 // playback. | 331 // playback. |
| 327 scoped_ptr<cc_blink::WebLayerImpl> video_weblayer_; | 332 scoped_ptr<cc_blink::WebLayerImpl> video_weblayer_; |
| 328 | 333 |
| 329 EncryptedMediaPlayerSupport encrypted_media_support_; | 334 EncryptedMediaPlayerSupport encrypted_media_support_; |
| 330 | 335 |
| 331 scoped_ptr<blink::WebContentDecryptionModuleResult> set_cdm_result_; | 336 scoped_ptr<blink::WebContentDecryptionModuleResult> set_cdm_result_; |
| 332 | 337 |
| 333 scoped_ptr<RendererFactory> renderer_factory_; | 338 scoped_ptr<RendererFactory> renderer_factory_; |
| 334 | 339 |
| 335 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 340 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
| 336 }; | 341 }; |
| 337 | 342 |
| 338 } // namespace media | 343 } // namespace media |
| 339 | 344 |
| 340 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 345 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
| OLD | NEW |