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

Side by Side Diff: media/tools/player_x11/x11_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_x11/gl_video_renderer.cc ('k') | media/video/ffmpeg_video_decode_engine.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/x11_video_renderer.h" 5 #include "media/tools/player_x11/x11_video_renderer.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #include <X11/Xutil.h> 8 #include <X11/Xutil.h>
9 #include <X11/extensions/Xrender.h> 9 #include <X11/extensions/Xrender.h>
10 #include <X11/extensions/Xcomposite.h> 10 #include <X11/extensions/Xcomposite.h>
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 if (callback) { 87 if (callback) {
88 callback->Run(); 88 callback->Run();
89 delete callback; 89 delete callback;
90 } 90 }
91 } 91 }
92 92
93 bool X11VideoRenderer::OnInitialize(media::VideoDecoder* decoder) { 93 bool X11VideoRenderer::OnInitialize(media::VideoDecoder* decoder) {
94 LOG(INFO) << "Initializing X11 Renderer..."; 94 LOG(INFO) << "Initializing X11 Renderer...";
95 95
96 // Resize the window to fit that of the video. 96 // Resize the window to fit that of the video.
97 int width = decoder->width(); 97 int width = decoder->natural_size().width();
98 int height = decoder->height(); 98 int height = decoder->natural_size().height();
99 XResizeWindow(display_, window_, width, height); 99 XResizeWindow(display_, window_, width, height);
100 100
101 // Allocate an XImage for caching RGB result. 101 // Allocate an XImage for caching RGB result.
102 image_ = CreateImage(display_, width, height); 102 image_ = CreateImage(display_, width, height);
103 103
104 // Testing XRender support. We'll use the very basic of XRender 104 // Testing XRender support. We'll use the very basic of XRender
105 // so if it presents it is already good enough. We don't need 105 // so if it presents it is already good enough. We don't need
106 // to check its version. 106 // to check its version.
107 int dummy; 107 int dummy;
108 use_render_ = XRenderQueryExtension(display_, &dummy, &dummy); 108 use_render_ = XRenderQueryExtension(display_, &dummy, &dummy);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 // If XRender is not used, simply put the image to the server. 229 // If XRender is not used, simply put the image to the server.
230 // This will have a tearing effect but this is OK. 230 // This will have a tearing effect but this is OK.
231 // TODO(hclam): Upload the image to a pixmap and do XCopyArea() 231 // TODO(hclam): Upload the image to a pixmap and do XCopyArea()
232 // to the window. 232 // to the window.
233 GC gc = XCreateGC(display_, window_, 0, NULL); 233 GC gc = XCreateGC(display_, window_, 0, NULL);
234 XPutImage(display_, window_, gc, image_, 234 XPutImage(display_, window_, gc, image_,
235 0, 0, 0, 0, width, height); 235 0, 0, 0, 0, width, height);
236 XFlush(display_); 236 XFlush(display_);
237 XFreeGC(display_, gc); 237 XFreeGC(display_, gc);
238 } 238 }
OLDNEW
« no previous file with comments | « media/tools/player_x11/gl_video_renderer.cc ('k') | media/video/ffmpeg_video_decode_engine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698