Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: content/common/gpu/media/rendering_helper.h

Issue 298123003: rendering_helper - Change the layout of the rendering areas. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compiling error Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/common/gpu/media/rendering_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <vector> 9 #include <vector>
10 10
(...skipping 25 matching lines...) Expand all
36 // This class is not thread safe and thus all the methods of this class 36 // This class is not thread safe and thus all the methods of this class
37 // (except for ctor/dtor) ensure they're being run on a single thread. 37 // (except for ctor/dtor) ensure they're being run on a single thread.
38 class RenderingHelper { 38 class RenderingHelper {
39 public: 39 public:
40 // Interface for the content provider of the RenderingHelper. 40 // Interface for the content provider of the RenderingHelper.
41 class Client { 41 class Client {
42 public: 42 public:
43 // Callback to tell client to render the content. 43 // Callback to tell client to render the content.
44 virtual void RenderContent(RenderingHelper* helper) = 0; 44 virtual void RenderContent(RenderingHelper* helper) = 0;
45 45
46 // Callback to get the desired window size of the client.
47 virtual const gfx::Size& GetWindowSize() = 0;
48
46 protected: 49 protected:
47 virtual ~Client() {} 50 virtual ~Client() {}
48 }; 51 };
49 52
50 RenderingHelper(); 53 RenderingHelper();
51 ~RenderingHelper(); 54 ~RenderingHelper();
52 55
53 // Create the render context and windows by the specified dimensions. 56 // Create the render context and windows by the specified dimensions.
54 void Initialize(const RenderingHelperParams& params, 57 void Initialize(const RenderingHelperParams& params,
55 base::WaitableEvent* done); 58 base::WaitableEvent* done);
56 59
57 // Undo the effects of Initialize() and signal |*done|. 60 // Undo the effects of Initialize() and signal |*done|.
58 void UnInitialize(base::WaitableEvent* done); 61 void UnInitialize(base::WaitableEvent* done);
59 62
60 // Return a newly-created GLES2 texture id rendering to a specific window, and 63 // Return a newly-created GLES2 texture id of the specified size, and
61 // signal |*done|. 64 // signal |*done|.
62 void CreateTexture(int window_id, 65 void CreateTexture(uint32 texture_target,
63 uint32 texture_target,
64 uint32* texture_id, 66 uint32* texture_id,
67 const gfx::Size& size,
65 base::WaitableEvent* done); 68 base::WaitableEvent* done);
66 69
67 // Render thumbnail in the |texture_id| to the FBO buffer using target 70 // Render thumbnail in the |texture_id| to the FBO buffer using target
68 // |texture_target|. 71 // |texture_target|.
69 void RenderThumbnail(uint32 texture_target, uint32 texture_id); 72 void RenderThumbnail(uint32 texture_target, uint32 texture_id);
70 73
71 // Render |texture_id| to the current view port of the screen using target 74 // Render |texture_id| to the current view port of the screen using target
72 // |texture_target|. 75 // |texture_target|.
73 void RenderTexture(uint32 texture_target, uint32 texture_id); 76 void RenderTexture(uint32 texture_target, uint32 texture_id);
74 77
(...skipping 10 matching lines...) Expand all
85 // Sets alpha_solid to true if the alpha channel is entirely 0xff. 88 // Sets alpha_solid to true if the alpha channel is entirely 0xff.
86 void GetThumbnailsAsRGB(std::vector<unsigned char>* rgb, 89 void GetThumbnailsAsRGB(std::vector<unsigned char>* rgb,
87 bool* alpha_solid, 90 bool* alpha_solid,
88 base::WaitableEvent* done); 91 base::WaitableEvent* done);
89 92
90 private: 93 private:
91 void Clear(); 94 void Clear();
92 95
93 void RenderContent(); 96 void RenderContent();
94 97
98 void LayoutRenderingAreas();
99
95 // Timer to trigger the RenderContent() repeatly. 100 // Timer to trigger the RenderContent() repeatly.
96 base::RepeatingTimer<RenderingHelper> render_timer_; 101 base::RepeatingTimer<RenderingHelper> render_timer_;
97 base::MessageLoop* message_loop_; 102 base::MessageLoop* message_loop_;
98 std::vector<gfx::Size> frame_dimensions_;
99 103
100 NativeContextType gl_context_; 104 NativeContextType gl_context_;
101 std::map<uint32, int> texture_id_to_surface_index_;
102 105
103 #if defined(GL_VARIANT_EGL) 106 #if defined(GL_VARIANT_EGL)
104 EGLDisplay gl_display_; 107 EGLDisplay gl_display_;
105 EGLSurface gl_surface_; 108 EGLSurface gl_surface_;
106 #else 109 #else
107 XVisualInfo* x_visual_; 110 XVisualInfo* x_visual_;
108 #endif 111 #endif
109 112
110 #if defined(OS_WIN) 113 #if defined(OS_WIN)
111 HWND window_; 114 HWND window_;
112 #else 115 #else
113 Display* x_display_; 116 Display* x_display_;
114 Window x_window_; 117 Window x_window_;
115 #endif 118 #endif
116 119
120 gfx::Size screen_size_;
121
117 // The rendering area of each window on the screen. 122 // The rendering area of each window on the screen.
118 std::vector<gfx::Rect> render_areas_; 123 std::vector<gfx::Rect> render_areas_;
119 124
120 std::vector<base::WeakPtr<Client> > clients_; 125 std::vector<base::WeakPtr<Client> > clients_;
121 126
122 bool render_as_thumbnails_; 127 bool render_as_thumbnails_;
123 int frame_count_; 128 int frame_count_;
124 GLuint thumbnails_fbo_id_; 129 GLuint thumbnails_fbo_id_;
125 GLuint thumbnails_texture_id_; 130 GLuint thumbnails_texture_id_;
126 gfx::Size thumbnails_fbo_size_; 131 gfx::Size thumbnails_fbo_size_;
127 gfx::Size thumbnail_size_; 132 gfx::Size thumbnail_size_;
128 GLuint program_; 133 GLuint program_;
129 base::TimeDelta frame_duration_; 134 base::TimeDelta frame_duration_;
130 135
131 DISALLOW_COPY_AND_ASSIGN(RenderingHelper); 136 DISALLOW_COPY_AND_ASSIGN(RenderingHelper);
132 }; 137 };
133 138
134 struct RenderingHelperParams { 139 struct RenderingHelperParams {
135 RenderingHelperParams(); 140 RenderingHelperParams();
136 ~RenderingHelperParams(); 141 ~RenderingHelperParams();
142
143 // The rendering FPS.
137 int rendering_fps; 144 int rendering_fps;
138 145
146 // The clients who provide the content for rendering.
139 std::vector<base::WeakPtr<RenderingHelper::Client> > clients; 147 std::vector<base::WeakPtr<RenderingHelper::Client> > clients;
140 int num_windows;
141 148
142 // Dimensions of window(s) created for displaying frames. In the
143 // case of thumbnail rendering, these won't match the frame dimensions.
144 std::vector<gfx::Size> window_dimensions;
145 // Dimensions of video frame texture(s).
146 std::vector<gfx::Size> frame_dimensions;
147 // Whether the frames are rendered as scaled thumbnails within a 149 // Whether the frames are rendered as scaled thumbnails within a
148 // larger FBO that is in turn rendered to the window. 150 // larger FBO that is in turn rendered to the window.
149 bool render_as_thumbnails; 151 bool render_as_thumbnails;
150 // The size of the FBO containing all visible thumbnails. 152 // The size of the FBO containing all visible thumbnails.
151 gfx::Size thumbnails_page_size; 153 gfx::Size thumbnails_page_size;
152 // The size of each thumbnail within the FBO. 154 // The size of each thumbnail within the FBO.
153 gfx::Size thumbnail_size; 155 gfx::Size thumbnail_size;
154 }; 156 };
155 } // namespace content 157 } // namespace content
156 158
157 #endif // CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ 159 #endif // CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu/media/rendering_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698