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 CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 5 #ifndef CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
6 #define CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 6 #define CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 }; | 56 }; |
57 | 57 |
58 // VideoResourceUpdater is by the video system to produce frame content as | 58 // VideoResourceUpdater is by the video system to produce frame content as |
59 // resources consumable by the compositor. | 59 // resources consumable by the compositor. |
60 class VideoResourceUpdater | 60 class VideoResourceUpdater |
61 : public base::SupportsWeakPtr<VideoResourceUpdater> { | 61 : public base::SupportsWeakPtr<VideoResourceUpdater> { |
62 public: | 62 public: |
63 explicit VideoResourceUpdater(ResourceProvider* resource_provider); | 63 explicit VideoResourceUpdater(ResourceProvider* resource_provider); |
64 ~VideoResourceUpdater(); | 64 ~VideoResourceUpdater(); |
65 | 65 |
66 VideoFrameExternalResources CreateForHardwarePlanes( | 66 VideoFrameExternalResources CreateExternalResourcesFromVideoFrame( |
67 const scoped_refptr<media::VideoFrame>& video_frame, | |
68 const TextureMailbox::ReleaseCallback& release_callback); | |
69 | |
70 VideoFrameExternalResources CreateForSoftwarePlanes( | |
71 const scoped_refptr<media::VideoFrame>& video_frame); | 67 const scoped_refptr<media::VideoFrame>& video_frame); |
72 | 68 |
73 private: | 69 private: |
74 struct PlaneResource { | 70 struct PlaneResource { |
75 unsigned resource_id; | 71 unsigned resource_id; |
76 gfx::Size resource_size; | 72 gfx::Size resource_size; |
77 unsigned resource_format; | 73 unsigned resource_format; |
78 unsigned sync_point; | 74 unsigned sync_point; |
79 | 75 |
80 PlaneResource(unsigned resource_id, | 76 PlaneResource(unsigned resource_id, |
81 gfx::Size resource_size, | 77 gfx::Size resource_size, |
82 unsigned resource_format, | 78 unsigned resource_format, |
83 unsigned sync_point) | 79 unsigned sync_point) |
84 : resource_id(resource_id), | 80 : resource_id(resource_id), |
85 resource_size(resource_size), | 81 resource_size(resource_size), |
86 resource_format(resource_format), | 82 resource_format(resource_format), |
87 sync_point(sync_point) {} | 83 sync_point(sync_point) {} |
88 }; | 84 }; |
89 | 85 |
90 bool VerifyFrame(const scoped_refptr<media::VideoFrame>& video_frame); | 86 bool VerifyFrame(const scoped_refptr<media::VideoFrame>& video_frame); |
| 87 VideoFrameExternalResources CreateForHardwarePlanes( |
| 88 const scoped_refptr<media::VideoFrame>& video_frame); |
| 89 VideoFrameExternalResources CreateForSoftwarePlanes( |
| 90 const scoped_refptr<media::VideoFrame>& video_frame); |
91 | 91 |
92 struct RecycleResourceData { | 92 struct RecycleResourceData { |
93 unsigned resource_id; | 93 unsigned resource_id; |
94 gfx::Size resource_size; | 94 gfx::Size resource_size; |
95 unsigned resource_format; | 95 unsigned resource_format; |
96 gpu::Mailbox mailbox; | 96 gpu::Mailbox mailbox; |
97 }; | 97 }; |
98 static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater, | 98 static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater, |
99 ResourceProvider* resource_provider, | 99 ResourceProvider* resource_provider, |
100 RecycleResourceData data, | 100 RecycleResourceData data, |
101 unsigned sync_point, | 101 unsigned sync_point, |
102 bool lost_resource); | 102 bool lost_resource); |
103 static void ReturnTexture(ResourceProvider* resource_provider, | 103 static void ReturnTexture(ResourceProvider* resource_provider, |
104 TextureMailbox::ReleaseCallback callback, | 104 scoped_refptr<media::VideoFrame> video_frame, |
105 unsigned texture_id, | |
106 gpu::Mailbox mailbox, | |
107 unsigned sync_point, | 105 unsigned sync_point, |
108 bool lost_resource); | 106 bool lost_resource); |
109 | 107 |
110 ResourceProvider* resource_provider_; | 108 ResourceProvider* resource_provider_; |
111 scoped_ptr<media::SkCanvasVideoRenderer> video_renderer_; | 109 scoped_ptr<media::SkCanvasVideoRenderer> video_renderer_; |
112 | 110 |
113 std::vector<PlaneResource> recycled_resources_; | 111 std::vector<PlaneResource> recycled_resources_; |
114 | 112 |
115 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); | 113 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); |
116 }; | 114 }; |
117 | 115 |
118 } // namespace cc | 116 } // namespace cc |
119 | 117 |
120 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 118 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
OLD | NEW |