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 "base/macros.h" | 10 #include "base/macros.h" |
11 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
12 #include "cc/layers/layer_impl.h" | 12 #include "cc/layers/layer_impl.h" |
13 #include "cc/resources/release_callback_impl.h" | 13 #include "cc/resources/release_callback_impl.h" |
14 #include "cc/resources/video_resource_updater.h" | 14 #include "cc/resources/video_resource_updater.h" |
15 #include "media/base/video_rotation.h" | 15 #include "media/base/video_rotation.h" |
16 | 16 |
17 namespace media { | 17 namespace media { |
18 class VideoFrame; | 18 class VideoFrame; |
19 } | 19 } |
20 | 20 |
21 namespace cc { | 21 namespace cc { |
22 class VideoFrameProvider; | 22 class VideoFrameProvider; |
23 class VideoFrameProviderClientImpl; | 23 class VideoFrameProviderClientImpl; |
24 | 24 |
25 class CC_EXPORT VideoLayerImpl : public LayerImpl { | 25 class CC_EXPORT VideoLayerImpl : public LayerImpl { |
26 public: | 26 public: |
27 // Must be called on the impl thread while the main thread is blocked. This is | 27 // Must be called on the impl thread while the main thread is blocked. This is |
28 // so that |provider| stays alive while this is being created. | 28 // so that |provider| stays alive while this is being created. |
29 static scoped_ptr<VideoLayerImpl> Create(LayerTreeImpl* tree_impl, | 29 static std::unique_ptr<VideoLayerImpl> Create( |
30 int id, | 30 LayerTreeImpl* tree_impl, |
31 VideoFrameProvider* provider, | 31 int id, |
32 media::VideoRotation video_rotation); | 32 VideoFrameProvider* provider, |
| 33 media::VideoRotation video_rotation); |
33 ~VideoLayerImpl() override; | 34 ~VideoLayerImpl() override; |
34 | 35 |
35 // LayerImpl implementation. | 36 // LayerImpl implementation. |
36 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 37 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
37 bool WillDraw(DrawMode draw_mode, | 38 bool WillDraw(DrawMode draw_mode, |
38 ResourceProvider* resource_provider) override; | 39 ResourceProvider* resource_provider) override; |
39 void AppendQuads(RenderPass* render_pass, | 40 void AppendQuads(RenderPass* render_pass, |
40 AppendQuadsData* append_quads_data) override; | 41 AppendQuadsData* append_quads_data) override; |
41 void DidDraw(ResourceProvider* resource_provider) override; | 42 void DidDraw(ResourceProvider* resource_provider) override; |
42 SimpleEnclosedRegion VisibleOpaqueRegion() const override; | 43 SimpleEnclosedRegion VisibleOpaqueRegion() const override; |
43 void DidBecomeActive() override; | 44 void DidBecomeActive() override; |
44 void ReleaseResources() override; | 45 void ReleaseResources() override; |
45 | 46 |
46 void SetNeedsRedraw(); | 47 void SetNeedsRedraw(); |
47 media::VideoRotation video_rotation() const { return video_rotation_; } | 48 media::VideoRotation video_rotation() const { return video_rotation_; } |
48 | 49 |
49 private: | 50 private: |
50 VideoLayerImpl( | 51 VideoLayerImpl( |
51 LayerTreeImpl* tree_impl, | 52 LayerTreeImpl* tree_impl, |
52 int id, | 53 int id, |
53 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl, | 54 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl, |
54 media::VideoRotation video_rotation); | 55 media::VideoRotation video_rotation); |
55 | 56 |
56 const char* LayerTypeAsString() const override; | 57 const char* LayerTypeAsString() const override; |
57 | 58 |
58 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl_; | 59 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl_; |
59 | 60 |
60 scoped_refptr<media::VideoFrame> frame_; | 61 scoped_refptr<media::VideoFrame> frame_; |
61 | 62 |
62 media::VideoRotation video_rotation_; | 63 media::VideoRotation video_rotation_; |
63 | 64 |
64 scoped_ptr<VideoResourceUpdater> updater_; | 65 std::unique_ptr<VideoResourceUpdater> updater_; |
65 VideoFrameExternalResources::ResourceType frame_resource_type_; | 66 VideoFrameExternalResources::ResourceType frame_resource_type_; |
66 float frame_resource_offset_; | 67 float frame_resource_offset_; |
67 float frame_resource_multiplier_; | 68 float frame_resource_multiplier_; |
68 | 69 |
69 struct FrameResource { | 70 struct FrameResource { |
70 FrameResource(ResourceId id, | 71 FrameResource(ResourceId id, |
71 gfx::Size size_in_pixels, | 72 gfx::Size size_in_pixels, |
72 bool is_overlay_candidate) | 73 bool is_overlay_candidate) |
73 : id(id), | 74 : id(id), |
74 size_in_pixels(size_in_pixels), | 75 size_in_pixels(size_in_pixels), |
75 is_overlay_candidate(is_overlay_candidate) {} | 76 is_overlay_candidate(is_overlay_candidate) {} |
76 ResourceId id; | 77 ResourceId id; |
77 gfx::Size size_in_pixels; | 78 gfx::Size size_in_pixels; |
78 bool is_overlay_candidate; | 79 bool is_overlay_candidate; |
79 }; | 80 }; |
80 std::vector<FrameResource> frame_resources_; | 81 std::vector<FrameResource> frame_resources_; |
81 | 82 |
82 // TODO(danakj): Remove these, hide software path inside ResourceProvider and | 83 // TODO(danakj): Remove these, hide software path inside ResourceProvider and |
83 // ExternalResource (aka TextureMailbox) classes. | 84 // ExternalResource (aka TextureMailbox) classes. |
84 std::vector<unsigned> software_resources_; | 85 std::vector<unsigned> software_resources_; |
85 // Called once for each software resource. | 86 // Called once for each software resource. |
86 ReleaseCallbackImpl software_release_callback_; | 87 ReleaseCallbackImpl software_release_callback_; |
87 | 88 |
88 DISALLOW_COPY_AND_ASSIGN(VideoLayerImpl); | 89 DISALLOW_COPY_AND_ASSIGN(VideoLayerImpl); |
89 }; | 90 }; |
90 | 91 |
91 } // namespace cc | 92 } // namespace cc |
92 | 93 |
93 #endif // CC_LAYERS_VIDEO_LAYER_IMPL_H_ | 94 #endif // CC_LAYERS_VIDEO_LAYER_IMPL_H_ |
OLD | NEW |