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

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

Issue 10824141: Remove VideoDecoder::natural_size() & added VideoFrame::natural_size(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix copyright year. Created 8 years, 4 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/view.h ('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) 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.h" 10 #include "base/message_loop.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 gl_context_(NULL) { 114 gl_context_(NULL) {
115 } 115 }
116 116
117 GlVideoRenderer::~GlVideoRenderer() { 117 GlVideoRenderer::~GlVideoRenderer() {
118 glXMakeCurrent(display_, 0, NULL); 118 glXMakeCurrent(display_, 0, NULL);
119 glXDestroyContext(display_, gl_context_); 119 glXDestroyContext(display_, gl_context_);
120 } 120 }
121 121
122 void GlVideoRenderer::Paint(media::VideoFrame* video_frame) { 122 void GlVideoRenderer::Paint(media::VideoFrame* video_frame) {
123 if (!gl_context_) 123 if (!gl_context_)
124 Initialize(video_frame->width(), video_frame->height()); 124 Initialize(video_frame->data_size().width(),
125 video_frame->data_size().height());
125 126
126 // Convert YUV frame to RGB. 127 // Convert YUV frame to RGB.
127 DCHECK(video_frame->format() == media::VideoFrame::YV12 || 128 DCHECK(video_frame->format() == media::VideoFrame::YV12 ||
128 video_frame->format() == media::VideoFrame::YV16); 129 video_frame->format() == media::VideoFrame::YV16);
129 DCHECK(video_frame->stride(media::VideoFrame::kUPlane) == 130 DCHECK(video_frame->stride(media::VideoFrame::kUPlane) ==
130 video_frame->stride(media::VideoFrame::kVPlane)); 131 video_frame->stride(media::VideoFrame::kVPlane));
131 132
132 if (glXGetCurrentContext() != gl_context_ || 133 if (glXGetCurrentContext() != gl_context_ ||
133 glXGetCurrentDrawable() != window_) { 134 glXGetCurrentDrawable() != window_) {
134 glXMakeCurrent(display_, window_, gl_context_); 135 glXMakeCurrent(display_, window_, gl_context_);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 241
241 int tc_location = glGetAttribLocation(program, "in_tc"); 242 int tc_location = glGetAttribLocation(program, "in_tc");
242 glEnableVertexAttribArray(tc_location); 243 glEnableVertexAttribArray(tc_location);
243 glVertexAttribPointer(tc_location, 2, GL_FLOAT, GL_FALSE, 0, 244 glVertexAttribPointer(tc_location, 2, GL_FLOAT, GL_FALSE, 0,
244 kTextureCoords); 245 kTextureCoords);
245 246
246 // We are getting called on a thread. Release the context so that it can be 247 // We are getting called on a thread. Release the context so that it can be
247 // made current on the main thread. 248 // made current on the main thread.
248 glXMakeCurrent(display_, 0, NULL); 249 glXMakeCurrent(display_, 0, NULL);
249 } 250 }
OLDNEW
« no previous file with comments | « media/tools/player_wtl/view.h ('k') | media/tools/player_x11/x11_video_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698