| 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 <map> | 8 #include <map> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 base::WaitableEvent* done); | 93 base::WaitableEvent* done); |
| 94 | 94 |
| 95 // Render thumbnail in the |texture_id| to the FBO buffer using target | 95 // Render thumbnail in the |texture_id| to the FBO buffer using target |
| 96 // |texture_target|. | 96 // |texture_target|. |
| 97 void RenderThumbnail(uint32 texture_target, uint32 texture_id); | 97 void RenderThumbnail(uint32 texture_target, uint32 texture_id); |
| 98 | 98 |
| 99 // Queues the |video_frame| for rendering. | 99 // Queues the |video_frame| for rendering. |
| 100 void QueueVideoFrame(size_t window_id, | 100 void QueueVideoFrame(size_t window_id, |
| 101 scoped_refptr<VideoFrameTexture> video_frame); | 101 scoped_refptr<VideoFrameTexture> video_frame); |
| 102 | 102 |
| 103 // Drops all the pending video frames of the specified window. | 103 // Flushes the pending frames. Notify the rendering_helper there won't be |
| 104 void DropPendingFrames(size_t window_id); | 104 // more video frames. |
| 105 void Flush(size_t window_id); |
| 105 | 106 |
| 106 // Delete |texture_id|. | 107 // Delete |texture_id|. |
| 107 void DeleteTexture(uint32 texture_id); | 108 void DeleteTexture(uint32 texture_id); |
| 108 | 109 |
| 109 // Get the platform specific handle to the OpenGL display. | 110 // Get the platform specific handle to the OpenGL display. |
| 110 void* GetGLDisplay(); | 111 void* GetGLDisplay(); |
| 111 | 112 |
| 112 // Get the platform specific handle to the OpenGL context. | 113 // Get the platform specific handle to the OpenGL context. |
| 113 void* GetGLContext(); | 114 void* GetGLContext(); |
| 114 | 115 |
| 115 // Get rendered thumbnails as RGB. | 116 // Get rendered thumbnails as RGB. |
| 116 // Sets alpha_solid to true if the alpha channel is entirely 0xff. | 117 // Sets alpha_solid to true if the alpha channel is entirely 0xff. |
| 117 void GetThumbnailsAsRGB(std::vector<unsigned char>* rgb, | 118 void GetThumbnailsAsRGB(std::vector<unsigned char>* rgb, |
| 118 bool* alpha_solid, | 119 bool* alpha_solid, |
| 119 base::WaitableEvent* done); | 120 base::WaitableEvent* done); |
| 120 | 121 |
| 121 private: | 122 private: |
| 122 struct RenderedVideo { | 123 struct RenderedVideo { |
| 123 // The rect on the screen where the video will be rendered. | 124 // The rect on the screen where the video will be rendered. |
| 124 gfx::Rect render_area; | 125 gfx::Rect render_area; |
| 125 | 126 |
| 126 // True if the last (and the only one) frame in pending_frames has | 127 // True if the last (and the only one) frame in pending_frames has |
| 127 // been rendered. We keep the last remaining frame in pending_frames even | 128 // been rendered. We keep the last remaining frame in pending_frames even |
| 128 // after it has been rendered, so that we have something to display if the | 129 // after it has been rendered, so that we have something to display if the |
| 129 // client is falling behind on providing us with new frames during | 130 // client is falling behind on providing us with new frames during |
| 130 // timer-driven playback. | 131 // timer-driven playback. |
| 131 bool last_frame_rendered; | 132 bool last_frame_rendered; |
| 132 | 133 |
| 134 // True if there won't be any new video frames comming. |
| 135 bool is_flushing; |
| 136 |
| 133 // The video frames pending for rendering. | 137 // The video frames pending for rendering. |
| 134 std::queue<scoped_refptr<VideoFrameTexture> > pending_frames; | 138 std::queue<scoped_refptr<VideoFrameTexture> > pending_frames; |
| 135 | 139 |
| 136 RenderedVideo(); | 140 RenderedVideo(); |
| 137 ~RenderedVideo(); | 141 ~RenderedVideo(); |
| 138 }; | 142 }; |
| 139 | 143 |
| 140 void Clear(); | 144 void Clear(); |
| 141 | 145 |
| 142 void RenderContent(); | 146 void RenderContent(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 168 gfx::Size thumbnail_size_; | 172 gfx::Size thumbnail_size_; |
| 169 GLuint program_; | 173 GLuint program_; |
| 170 base::TimeDelta frame_duration_; | 174 base::TimeDelta frame_duration_; |
| 171 | 175 |
| 172 DISALLOW_COPY_AND_ASSIGN(RenderingHelper); | 176 DISALLOW_COPY_AND_ASSIGN(RenderingHelper); |
| 173 }; | 177 }; |
| 174 | 178 |
| 175 } // namespace content | 179 } // namespace content |
| 176 | 180 |
| 177 #endif // CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ | 181 #endif // CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ |
| OLD | NEW |