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

Side by Side Diff: media/tools/player_x11/gl_video_renderer.cc

Issue 7932005: Reland r101418: Fix aspect ratio and clarify video frame dimensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « media/tools/player_wtl/wtl_renderer.cc ('k') | media/tools/player_x11/x11_video_renderer.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/message_loop.h" 9 #include "base/message_loop.h"
10 #include "media/base/buffers.h" 10 #include "media/base/buffers.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 " gl_FragColor = vec4(rgb, 1);\n" 121 " gl_FragColor = vec4(rgb, 1);\n"
122 "}\n"; 122 "}\n";
123 123
124 // Buffer size for compile errors. 124 // Buffer size for compile errors.
125 static const unsigned int kErrorSize = 4096; 125 static const unsigned int kErrorSize = 4096;
126 126
127 bool GlVideoRenderer::OnInitialize(media::VideoDecoder* decoder) { 127 bool GlVideoRenderer::OnInitialize(media::VideoDecoder* decoder) {
128 LOG(INFO) << "Initializing GL Renderer..."; 128 LOG(INFO) << "Initializing GL Renderer...";
129 129
130 // Resize the window to fit that of the video. 130 // Resize the window to fit that of the video.
131 XResizeWindow(display_, window_, decoder->width(), decoder->height()); 131 XResizeWindow(display_, window_, decoder->natural_size().width(),
132 decoder->natural_size().height());
132 133
133 gl_context_ = InitGLContext(display_, window_); 134 gl_context_ = InitGLContext(display_, window_);
134 if (!gl_context_) 135 if (!gl_context_)
135 return false; 136 return false;
136 137
137 // Create 3 textures, one for each plane, and bind them to different 138 // Create 3 textures, one for each plane, and bind them to different
138 // texture units. 139 // texture units.
139 glGenTextures(media::VideoFrame::kNumYUVPlanes, textures_); 140 glGenTextures(media::VideoFrame::kNumYUVPlanes, textures_);
140 glActiveTexture(GL_TEXTURE0); 141 glActiveTexture(GL_TEXTURE0);
141 glBindTexture(GL_TEXTURE_2D, textures_[0]); 142 glBindTexture(GL_TEXTURE_2D, textures_[0]);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 glActiveTexture(GL_TEXTURE0 + i); 266 glActiveTexture(GL_TEXTURE0 + i);
266 glPixelStorei(GL_UNPACK_ROW_LENGTH, video_frame->stride(i)); 267 glPixelStorei(GL_UNPACK_ROW_LENGTH, video_frame->stride(i));
267 glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, width, height, 0, 268 glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, width, height, 0,
268 GL_LUMINANCE, GL_UNSIGNED_BYTE, video_frame->data(i)); 269 GL_LUMINANCE, GL_UNSIGNED_BYTE, video_frame->data(i));
269 } 270 }
270 PutCurrentFrame(video_frame); 271 PutCurrentFrame(video_frame);
271 272
272 glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); 273 glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
273 glXSwapBuffers(display_, window_); 274 glXSwapBuffers(display_, window_);
274 } 275 }
OLDNEW
« no previous file with comments | « media/tools/player_wtl/wtl_renderer.cc ('k') | media/tools/player_x11/x11_video_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698