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