| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 // Flushes the pending frames. Notify the rendering_helper there won't be | 103 // Flushes the pending frames. Notify the rendering_helper there won't be |
| 104 // more video frames. | 104 // more video frames. |
| 105 void Flush(size_t window_id); | 105 void Flush(size_t window_id); |
| 106 | 106 |
| 107 // Delete |texture_id|. | 107 // Delete |texture_id|. |
| 108 void DeleteTexture(uint32 texture_id); | 108 void DeleteTexture(uint32 texture_id); |
| 109 | 109 |
| 110 // Get the platform specific handle to the OpenGL display. | 110 // Get the platform specific handle to the OpenGL display. |
| 111 void* GetGLDisplay(); | 111 void* GetGLDisplay(); |
| 112 | 112 |
| 113 // Get the GL context. |
| 114 scoped_refptr<gfx::GLContext> GetGLContext(); |
| 115 |
| 113 // Get the platform specific handle to the OpenGL context. | 116 // Get the platform specific handle to the OpenGL context. |
| 114 void* GetGLContext(); | 117 void* GetGLContextHandle(); |
| 115 | 118 |
| 116 // Get rendered thumbnails as RGB. | 119 // Get rendered thumbnails as RGB. |
| 117 // Sets alpha_solid to true if the alpha channel is entirely 0xff. | 120 // Sets alpha_solid to true if the alpha channel is entirely 0xff. |
| 118 void GetThumbnailsAsRGB(std::vector<unsigned char>* rgb, | 121 void GetThumbnailsAsRGB(std::vector<unsigned char>* rgb, |
| 119 bool* alpha_solid, | 122 bool* alpha_solid, |
| 120 base::WaitableEvent* done); | 123 base::WaitableEvent* done); |
| 121 | 124 |
| 122 private: | 125 private: |
| 126 class StubOzoneDelegate; |
| 127 |
| 123 struct RenderedVideo { | 128 struct RenderedVideo { |
| 124 // The rect on the screen where the video will be rendered. | 129 // The rect on the screen where the video will be rendered. |
| 125 gfx::Rect render_area; | 130 gfx::Rect render_area; |
| 126 | 131 |
| 127 // True if the last (and the only one) frame in pending_frames has | 132 // True if the last (and the only one) frame in pending_frames has |
| 128 // been rendered. We keep the last remaining frame in pending_frames even | 133 // been rendered. We keep the last remaining frame in pending_frames even |
| 129 // after it has been rendered, so that we have something to display if the | 134 // after it has been rendered, so that we have something to display if the |
| 130 // client is falling behind on providing us with new frames during | 135 // client is falling behind on providing us with new frames during |
| 131 // timer-driven playback. | 136 // timer-driven playback. |
| 132 bool last_frame_rendered; | 137 bool last_frame_rendered; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 151 // |texture_target|. | 156 // |texture_target|. |
| 152 void RenderTexture(uint32 texture_target, uint32 texture_id); | 157 void RenderTexture(uint32 texture_target, uint32 texture_id); |
| 153 | 158 |
| 154 // Timer to trigger the RenderContent() repeatly. | 159 // Timer to trigger the RenderContent() repeatly. |
| 155 scoped_ptr<base::RepeatingTimer<RenderingHelper> > render_timer_; | 160 scoped_ptr<base::RepeatingTimer<RenderingHelper> > render_timer_; |
| 156 base::MessageLoop* message_loop_; | 161 base::MessageLoop* message_loop_; |
| 157 | 162 |
| 158 scoped_refptr<gfx::GLContext> gl_context_; | 163 scoped_refptr<gfx::GLContext> gl_context_; |
| 159 scoped_refptr<gfx::GLSurface> gl_surface_; | 164 scoped_refptr<gfx::GLSurface> gl_surface_; |
| 160 | 165 |
| 166 #if defined(USE_OZONE) |
| 167 scoped_ptr<StubOzoneDelegate> platform_window_delegate_; |
| 168 #endif |
| 169 |
| 161 gfx::AcceleratedWidget window_; | 170 gfx::AcceleratedWidget window_; |
| 162 | 171 |
| 163 gfx::Size screen_size_; | 172 gfx::Size screen_size_; |
| 164 | 173 |
| 165 std::vector<RenderedVideo> videos_; | 174 std::vector<RenderedVideo> videos_; |
| 166 | 175 |
| 167 bool render_as_thumbnails_; | 176 bool render_as_thumbnails_; |
| 168 int frame_count_; | 177 int frame_count_; |
| 169 GLuint thumbnails_fbo_id_; | 178 GLuint thumbnails_fbo_id_; |
| 170 GLuint thumbnails_texture_id_; | 179 GLuint thumbnails_texture_id_; |
| 171 gfx::Size thumbnails_fbo_size_; | 180 gfx::Size thumbnails_fbo_size_; |
| 172 gfx::Size thumbnail_size_; | 181 gfx::Size thumbnail_size_; |
| 173 GLuint program_; | 182 GLuint program_; |
| 174 base::TimeDelta frame_duration_; | 183 base::TimeDelta frame_duration_; |
| 175 | 184 |
| 176 DISALLOW_COPY_AND_ASSIGN(RenderingHelper); | 185 DISALLOW_COPY_AND_ASSIGN(RenderingHelper); |
| 177 }; | 186 }; |
| 178 | 187 |
| 179 } // namespace content | 188 } // namespace content |
| 180 | 189 |
| 181 #endif // CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ | 190 #endif // CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ |
| OLD | NEW |