OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ |
6 #define CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 // Render thumbnail in the |texture_id| to the FBO buffer using target | 92 // Render thumbnail in the |texture_id| to the FBO buffer using target |
93 // |texture_target|. | 93 // |texture_target|. |
94 void RenderThumbnail(uint32 texture_target, uint32 texture_id); | 94 void RenderThumbnail(uint32 texture_target, uint32 texture_id); |
95 | 95 |
96 // Queues the VideoFrame for rendering. | 96 // Queues the VideoFrame for rendering. |
97 void QueueVideoFrame(size_t window_id, scoped_refptr<VideoFrame> video_frame); | 97 void QueueVideoFrame(size_t window_id, scoped_refptr<VideoFrame> video_frame); |
98 | 98 |
99 // Drops all the pending video frames of the specified window. | 99 // Drops all the pending video frames of the specified window. |
100 void DropPendingFrames(size_t window_id); | 100 void DropPendingFrames(size_t window_id); |
101 | 101 |
102 // Flushes the pending frames and calls the given callback when it is done. | |
103 void Flush(size_t window_id, const base::Closure& flush_done_cb); | |
Pawel Osciak
2014/08/15 06:06:43
You misunderstood me. I don't think we need flush_
Owen Lin
2014/08/18 10:06:36
Ah! I see. Thanks. We can save one CB.
| |
104 | |
102 // Delete |texture_id|. | 105 // Delete |texture_id|. |
103 void DeleteTexture(uint32 texture_id); | 106 void DeleteTexture(uint32 texture_id); |
104 | 107 |
105 // Get the platform specific handle to the OpenGL display. | 108 // Get the platform specific handle to the OpenGL display. |
106 void* GetGLDisplay(); | 109 void* GetGLDisplay(); |
107 | 110 |
108 // Get the platform specific handle to the OpenGL context. | 111 // Get the platform specific handle to the OpenGL context. |
109 void* GetGLContext(); | 112 void* GetGLContext(); |
110 | 113 |
111 // Get rendered thumbnails as RGB. | 114 // Get rendered thumbnails as RGB. |
112 // Sets alpha_solid to true if the alpha channel is entirely 0xff. | 115 // Sets alpha_solid to true if the alpha channel is entirely 0xff. |
113 void GetThumbnailsAsRGB(std::vector<unsigned char>* rgb, | 116 void GetThumbnailsAsRGB(std::vector<unsigned char>* rgb, |
114 bool* alpha_solid, | 117 bool* alpha_solid, |
115 base::WaitableEvent* done); | 118 base::WaitableEvent* done); |
116 | 119 |
117 private: | 120 private: |
118 struct RenderedVideo { | 121 struct RenderedVideo { |
119 // The rect on the screen where the video will be rendered. | 122 // The rect on the screen where the video will be rendered. |
120 gfx::Rect render_area; | 123 gfx::Rect render_area; |
121 | 124 |
122 // Ture if the last (and the only one) frame in pending_frames has | 125 // Ture if the last (and the only one) frame in pending_frames has |
123 // been rendered. | 126 // been rendered. |
124 bool last_frame_rendered; | 127 bool last_frame_rendered; |
125 | 128 |
129 // True if there won't be any new video frames comming. | |
130 bool is_flushing; | |
131 | |
126 // The video frames pending for rendering. | 132 // The video frames pending for rendering. |
127 std::deque<scoped_refptr<VideoFrame> > pending_frames; | 133 std::deque<scoped_refptr<VideoFrame> > pending_frames; |
128 | 134 |
129 RenderedVideo() : last_frame_rendered(false) {} | 135 // Callback calls when all pending frames are rendered. |
136 base::Closure flush_done_cb; | |
137 | |
138 RenderedVideo() : last_frame_rendered(false), is_flushing(false) {} | |
130 }; | 139 }; |
131 | 140 |
132 void Clear(); | 141 void Clear(); |
133 | 142 |
134 void RenderContent(); | 143 void RenderContent(); |
135 | 144 |
136 void LayoutRenderingAreas(const std::vector<gfx::Size>& window_sizes); | 145 void LayoutRenderingAreas(const std::vector<gfx::Size>& window_sizes); |
137 | 146 |
138 // Render |texture_id| to the current view port of the screen using target | 147 // Render |texture_id| to the current view port of the screen using target |
139 // |texture_target|. | 148 // |texture_target|. |
(...skipping 20 matching lines...) Expand all Loading... | |
160 gfx::Size thumbnail_size_; | 169 gfx::Size thumbnail_size_; |
161 GLuint program_; | 170 GLuint program_; |
162 base::TimeDelta frame_duration_; | 171 base::TimeDelta frame_duration_; |
163 | 172 |
164 DISALLOW_COPY_AND_ASSIGN(RenderingHelper); | 173 DISALLOW_COPY_AND_ASSIGN(RenderingHelper); |
165 }; | 174 }; |
166 | 175 |
167 } // namespace content | 176 } // namespace content |
168 | 177 |
169 #endif // CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ | 178 #endif // CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ |
OLD | NEW |