| 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> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/cancelable_callback.h" | 13 #include "base/cancelable_callback.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
| 16 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
| 17 #include "ui/gl/gl_bindings.h" | 17 #include "ui/gl/gl_bindings.h" |
| 18 #include "ui/gl/gl_context.h" | 18 #include "ui/gl/gl_context.h" |
| 19 #include "ui/gl/gl_surface.h" | 19 #include "ui/gl/gl_surface.h" |
| 20 | 20 |
| 21 namespace base { | 21 namespace base { |
| 22 class MessageLoop; | 22 class MessageLoop; |
| 23 class WaitableEvent; | 23 class WaitableEvent; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace ui { |
| 27 class DisplayConfigurator; |
| 28 } |
| 29 |
| 26 namespace content { | 30 namespace content { |
| 27 | 31 |
| 28 class VideoFrameTexture : public base::RefCounted<VideoFrameTexture> { | 32 class VideoFrameTexture : public base::RefCounted<VideoFrameTexture> { |
| 29 public: | 33 public: |
| 30 uint32 texture_id() const { return texture_id_; } | 34 uint32 texture_id() const { return texture_id_; } |
| 31 uint32 texture_target() const { return texture_target_; } | 35 uint32 texture_target() const { return texture_target_; } |
| 32 | 36 |
| 33 VideoFrameTexture(uint32 texture_target, | 37 VideoFrameTexture(uint32 texture_target, |
| 34 uint32 texture_id, | 38 uint32 texture_id, |
| 35 const base::Closure& no_longer_needed_cb); | 39 const base::Closure& no_longer_needed_cb); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // Flushes the pending frames. Notify the rendering_helper there won't be | 111 // Flushes the pending frames. Notify the rendering_helper there won't be |
| 108 // more video frames. | 112 // more video frames. |
| 109 void Flush(size_t window_id); | 113 void Flush(size_t window_id); |
| 110 | 114 |
| 111 // Delete |texture_id|. | 115 // Delete |texture_id|. |
| 112 void DeleteTexture(uint32 texture_id); | 116 void DeleteTexture(uint32 texture_id); |
| 113 | 117 |
| 114 // Get the platform specific handle to the OpenGL display. | 118 // Get the platform specific handle to the OpenGL display. |
| 115 void* GetGLDisplay(); | 119 void* GetGLDisplay(); |
| 116 | 120 |
| 121 // Get the GL context. |
| 122 scoped_refptr<gfx::GLContext> GetGLContext(); |
| 123 |
| 117 // Get the platform specific handle to the OpenGL context. | 124 // Get the platform specific handle to the OpenGL context. |
| 118 void* GetGLContext(); | 125 void* GetGLContextHandle(); |
| 119 | 126 |
| 120 // Get rendered thumbnails as RGB. | 127 // Get rendered thumbnails as RGB. |
| 121 // Sets alpha_solid to true if the alpha channel is entirely 0xff. | 128 // Sets alpha_solid to true if the alpha channel is entirely 0xff. |
| 122 void GetThumbnailsAsRGB(std::vector<unsigned char>* rgb, | 129 void GetThumbnailsAsRGB(std::vector<unsigned char>* rgb, |
| 123 bool* alpha_solid, | 130 bool* alpha_solid, |
| 124 base::WaitableEvent* done); | 131 base::WaitableEvent* done); |
| 125 | 132 |
| 126 private: | 133 private: |
| 127 struct RenderedVideo { | 134 struct RenderedVideo { |
| 128 // The rect on the screen where the video will be rendered. | 135 // The rect on the screen where the video will be rendered. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 169 |
| 163 // Render |texture_id| to the current view port of the screen using target | 170 // Render |texture_id| to the current view port of the screen using target |
| 164 // |texture_target|. | 171 // |texture_target|. |
| 165 void RenderTexture(uint32 texture_target, uint32 texture_id); | 172 void RenderTexture(uint32 texture_target, uint32 texture_id); |
| 166 | 173 |
| 167 base::MessageLoop* message_loop_; | 174 base::MessageLoop* message_loop_; |
| 168 | 175 |
| 169 scoped_refptr<gfx::GLContext> gl_context_; | 176 scoped_refptr<gfx::GLContext> gl_context_; |
| 170 scoped_refptr<gfx::GLSurface> gl_surface_; | 177 scoped_refptr<gfx::GLSurface> gl_surface_; |
| 171 | 178 |
| 179 #if defined(USE_OZONE) |
| 180 class StubOzoneDelegate; |
| 181 scoped_ptr<StubOzoneDelegate> platform_window_delegate_; |
| 182 |
| 183 #if defined(OS_CHROMEOS) |
| 184 scoped_ptr<ui::DisplayConfigurator> display_configurator_; |
| 185 #endif |
| 186 #endif |
| 187 |
| 172 gfx::AcceleratedWidget window_; | 188 gfx::AcceleratedWidget window_; |
| 173 | 189 |
| 174 gfx::Size screen_size_; | 190 gfx::Size screen_size_; |
| 175 | 191 |
| 176 std::vector<RenderedVideo> videos_; | 192 std::vector<RenderedVideo> videos_; |
| 177 | 193 |
| 178 bool render_as_thumbnails_; | 194 bool render_as_thumbnails_; |
| 179 int frame_count_; | 195 int frame_count_; |
| 180 GLuint thumbnails_fbo_id_; | 196 GLuint thumbnails_fbo_id_; |
| 181 GLuint thumbnails_texture_id_; | 197 GLuint thumbnails_texture_id_; |
| 182 gfx::Size thumbnails_fbo_size_; | 198 gfx::Size thumbnails_fbo_size_; |
| 183 gfx::Size thumbnail_size_; | 199 gfx::Size thumbnail_size_; |
| 184 GLuint program_; | 200 GLuint program_; |
| 185 base::TimeDelta frame_duration_; | 201 base::TimeDelta frame_duration_; |
| 186 base::TimeTicks scheduled_render_time_; | 202 base::TimeTicks scheduled_render_time_; |
| 187 base::CancelableClosure render_task_; | 203 base::CancelableClosure render_task_; |
| 188 base::TimeTicks vsync_timebase_; | 204 base::TimeTicks vsync_timebase_; |
| 189 base::TimeDelta vsync_interval_; | 205 base::TimeDelta vsync_interval_; |
| 190 | 206 |
| 191 DISALLOW_COPY_AND_ASSIGN(RenderingHelper); | 207 DISALLOW_COPY_AND_ASSIGN(RenderingHelper); |
| 192 }; | 208 }; |
| 193 | 209 |
| 194 } // namespace content | 210 } // namespace content |
| 195 | 211 |
| 196 #endif // CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ | 212 #endif // CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ |
| OLD | NEW |