| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 CC_LAYERS_VIDEO_LAYER_IMPL_H_ | 5 #ifndef CC_LAYERS_VIDEO_LAYER_IMPL_H_ |
| 6 #define CC_LAYERS_VIDEO_LAYER_IMPL_H_ | 6 #define CC_LAYERS_VIDEO_LAYER_IMPL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
| 11 #include "cc/layers/layer_impl.h" | 11 #include "cc/layers/layer_impl.h" |
| 12 #include "cc/resources/release_callback_impl.h" | 12 #include "cc/resources/release_callback_impl.h" |
| 13 #include "cc/resources/video_resource_updater.h" | 13 #include "cc/resources/video_resource_updater.h" |
| 14 #include "media/base/video_rotation.h" | 14 #include "media/base/video_rotation.h" |
| 15 | 15 |
| 16 namespace media { | 16 namespace media { |
| 17 class VideoFrame; | 17 class VideoFrame; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace cc { | 20 namespace cc { |
| 21 class VideoFrameProvider; | 21 class VideoFrameProvider; |
| 22 class VideoFrameProviderClientImpl; | 22 class VideoFrameProviderClientImpl; |
| 23 | 23 |
| 24 class CC_EXPORT VideoLayerImpl : public LayerImpl { | 24 class CC_EXPORT VideoLayerImpl : public LayerImpl { |
| 25 public: | 25 public: |
| 26 static scoped_ptr<VideoLayerImpl> Create(LayerTreeImpl* tree_impl, | 26 static scoped_ptr<VideoLayerImpl> Create(LayerTreeImpl* tree_impl, |
| 27 int id, | 27 int id, |
| 28 VideoFrameProvider* provider, | 28 VideoFrameProvider* provider, |
| 29 media::VideoRotation video_rotation); | 29 media::VideoRotation video_rotation); |
| 30 virtual ~VideoLayerImpl(); | 30 ~VideoLayerImpl() override; |
| 31 | 31 |
| 32 // LayerImpl implementation. | 32 // LayerImpl implementation. |
| 33 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) | 33 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
| 34 override; | 34 void PushPropertiesTo(LayerImpl* layer) override; |
| 35 virtual void PushPropertiesTo(LayerImpl* layer) override; | 35 bool WillDraw(DrawMode draw_mode, |
| 36 virtual bool WillDraw(DrawMode draw_mode, | 36 ResourceProvider* resource_provider) override; |
| 37 ResourceProvider* resource_provider) override; | 37 void AppendQuads(RenderPass* render_pass, |
| 38 virtual void AppendQuads(RenderPass* render_pass, | 38 const Occlusion& occlusion_in_content_space, |
| 39 const Occlusion& occlusion_in_content_space, | 39 AppendQuadsData* append_quads_data) override; |
| 40 AppendQuadsData* append_quads_data) override; | 40 void DidDraw(ResourceProvider* resource_provider) override; |
| 41 virtual void DidDraw(ResourceProvider* resource_provider) override; | 41 void DidBecomeActive() override; |
| 42 virtual void DidBecomeActive() override; | 42 void ReleaseResources() override; |
| 43 virtual void ReleaseResources() override; | |
| 44 | 43 |
| 45 void SetNeedsRedraw(); | 44 void SetNeedsRedraw(); |
| 46 | 45 |
| 47 void SetProviderClientImpl( | 46 void SetProviderClientImpl( |
| 48 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl); | 47 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl); |
| 49 | 48 |
| 50 media::VideoRotation video_rotation() const { return video_rotation_; } | 49 media::VideoRotation video_rotation() const { return video_rotation_; } |
| 51 | 50 |
| 52 private: | 51 private: |
| 53 VideoLayerImpl(LayerTreeImpl* tree_impl, | 52 VideoLayerImpl(LayerTreeImpl* tree_impl, |
| 54 int id, | 53 int id, |
| 55 media::VideoRotation video_rotation); | 54 media::VideoRotation video_rotation); |
| 56 | 55 |
| 57 virtual const char* LayerTypeAsString() const override; | 56 const char* LayerTypeAsString() const override; |
| 58 | 57 |
| 59 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl_; | 58 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl_; |
| 60 | 59 |
| 61 scoped_refptr<media::VideoFrame> frame_; | 60 scoped_refptr<media::VideoFrame> frame_; |
| 62 | 61 |
| 63 media::VideoRotation video_rotation_; | 62 media::VideoRotation video_rotation_; |
| 64 | 63 |
| 65 scoped_ptr<VideoResourceUpdater> updater_; | 64 scoped_ptr<VideoResourceUpdater> updater_; |
| 66 VideoFrameExternalResources::ResourceType frame_resource_type_; | 65 VideoFrameExternalResources::ResourceType frame_resource_type_; |
| 67 std::vector<ResourceProvider::ResourceId> frame_resources_; | 66 std::vector<ResourceProvider::ResourceId> frame_resources_; |
| 68 | 67 |
| 69 // TODO(danakj): Remove these, hide software path inside ResourceProvider and | 68 // TODO(danakj): Remove these, hide software path inside ResourceProvider and |
| 70 // ExternalResource (aka TextureMailbox) classes. | 69 // ExternalResource (aka TextureMailbox) classes. |
| 71 std::vector<unsigned> software_resources_; | 70 std::vector<unsigned> software_resources_; |
| 72 // Called once for each software resource. | 71 // Called once for each software resource. |
| 73 ReleaseCallbackImpl software_release_callback_; | 72 ReleaseCallbackImpl software_release_callback_; |
| 74 | 73 |
| 75 DISALLOW_COPY_AND_ASSIGN(VideoLayerImpl); | 74 DISALLOW_COPY_AND_ASSIGN(VideoLayerImpl); |
| 76 }; | 75 }; |
| 77 | 76 |
| 78 } // namespace cc | 77 } // namespace cc |
| 79 | 78 |
| 80 #endif // CC_LAYERS_VIDEO_LAYER_IMPL_H_ | 79 #endif // CC_LAYERS_VIDEO_LAYER_IMPL_H_ |
| OLD | NEW |