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 #include "media/tools/player_x11/gl_video_renderer.h" | 5 #include "media/tools/player_x11/gl_video_renderer.h" |
6 | 6 |
7 #include <X11/Xutil.h> | 7 #include <X11/Xutil.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "media/base/buffers.h" | 11 #include "media/base/buffers.h" |
12 #include "media/base/video_frame.h" | 12 #include "media/base/video_frame.h" |
13 #include "media/base/yuv_convert.h" | 13 #include "media/base/yuv_convert.h" |
14 #include "ui/gl/gl_implementation.h" | 14 #include "ui/gl/gl_implementation.h" |
15 | 15 |
16 enum { kNumYUVPlanes = 3 }; | 16 enum { kNumYUVPlanes = 3 }; |
17 | 17 |
18 static GLXContext InitGLContext(Display* display, Window window) { | 18 static GLXContext InitGLContext(Display* display, Window window) { |
19 // Some versions of NVIDIA's GL libGL.so include a broken version of | 19 // Some versions of NVIDIA's GL libGL.so include a broken version of |
20 // dlopen/dlsym, and so linking it into chrome breaks it. So we dynamically | 20 // dlopen/dlsym, and so linking it into chrome breaks it. So we dynamically |
21 // load it, and use glew to dynamically resolve symbols. | 21 // load it, and use glew to dynamically resolve symbols. |
22 // See http://code.google.com/p/chromium/issues/detail?id=16800 | 22 // See http://code.google.com/p/chromium/issues/detail?id=16800 |
23 if (!InitializeGLBindings(gfx::kGLImplementationDesktopGL)) { | 23 if (!InitializeStaticGLBindings(gfx::kGLImplementationDesktopGL)) { |
24 LOG(ERROR) << "InitializeGLBindings failed"; | 24 LOG(ERROR) << "InitializeStaticGLBindings failed"; |
25 return NULL; | 25 return NULL; |
26 } | 26 } |
27 | 27 |
28 XWindowAttributes attributes; | 28 XWindowAttributes attributes; |
29 XGetWindowAttributes(display, window, &attributes); | 29 XGetWindowAttributes(display, window, &attributes); |
30 XVisualInfo visual_info_template; | 30 XVisualInfo visual_info_template; |
31 visual_info_template.visualid = XVisualIDFromVisual(attributes.visual); | 31 visual_info_template.visualid = XVisualIDFromVisual(attributes.visual); |
32 int visual_info_count = 0; | 32 int visual_info_count = 0; |
33 XVisualInfo* visual_info_list = XGetVisualInfo(display, VisualIDMask, | 33 XVisualInfo* visual_info_list = XGetVisualInfo(display, VisualIDMask, |
34 &visual_info_template, | 34 &visual_info_template, |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 verts[0] = x0; verts[1] = y0; | 240 verts[0] = x0; verts[1] = y0; |
241 verts[2] = x0; verts[3] = y1; | 241 verts[2] = x0; verts[3] = y1; |
242 verts[4] = x1; verts[5] = y0; | 242 verts[4] = x1; verts[5] = y0; |
243 verts[6] = x1; verts[7] = y1; | 243 verts[6] = x1; verts[7] = y1; |
244 glVertexAttribPointer(tc_location, 2, GL_FLOAT, GL_FALSE, 0, verts); | 244 glVertexAttribPointer(tc_location, 2, GL_FLOAT, GL_FALSE, 0, verts); |
245 | 245 |
246 // We are getting called on a thread. Release the context so that it can be | 246 // We are getting called on a thread. Release the context so that it can be |
247 // made current on the main thread. | 247 // made current on the main thread. |
248 glXMakeCurrent(display_, 0, NULL); | 248 glXMakeCurrent(display_, 0, NULL); |
249 } | 249 } |
OLD | NEW |