OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/cast/test/linux_output_window.h" | 5 #include "media/cast/test/linux_output_window.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "media/base/video_frame.h" |
8 #include "third_party/libyuv/include/libyuv/convert.h" | 9 #include "third_party/libyuv/include/libyuv/convert.h" |
| 10 #include "ui/gfx/size.h" |
9 | 11 |
10 namespace media { | 12 namespace media { |
11 namespace cast { | 13 namespace cast { |
12 namespace test { | 14 namespace test { |
13 | 15 |
14 LinuxOutputWindow::LinuxOutputWindow(int x_pos, | 16 LinuxOutputWindow::LinuxOutputWindow(int x_pos, |
15 int y_pos, | 17 int y_pos, |
16 int width, | 18 int width, |
17 int height, | 19 int height, |
18 const std::string& name) { | 20 const std::string& name) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 shminfo_.readOnly = false; | 103 shminfo_.readOnly = false; |
102 | 104 |
103 // Attach image to display. | 105 // Attach image to display. |
104 if (!XShmAttach(display_, &shminfo_)) { | 106 if (!XShmAttach(display_, &shminfo_)) { |
105 VLOG(1) << "XShmAttach failed"; | 107 VLOG(1) << "XShmAttach failed"; |
106 NOTREACHED(); | 108 NOTREACHED(); |
107 } | 109 } |
108 XSync(display_, false); | 110 XSync(display_, false); |
109 } | 111 } |
110 | 112 |
111 void LinuxOutputWindow::RenderFrame(const I420VideoFrame& video_frame) { | 113 void LinuxOutputWindow::RenderFrame( |
112 libyuv::I420ToARGB(video_frame.y_plane.data, | 114 const scoped_refptr<media::VideoFrame>& video_frame) { |
113 video_frame.y_plane.stride, | 115 libyuv::I420ToARGB(video_frame->data(VideoFrame::kYPlane), |
114 video_frame.u_plane.data, | 116 video_frame->stride(VideoFrame::kYPlane), |
115 video_frame.u_plane.stride, | 117 video_frame->data(VideoFrame::kUPlane), |
116 video_frame.v_plane.data, | 118 video_frame->stride(VideoFrame::kUPlane), |
117 video_frame.v_plane.stride, | 119 video_frame->data(VideoFrame::kVPlane), |
| 120 video_frame->stride(VideoFrame::kVPlane), |
118 render_buffer_, | 121 render_buffer_, |
119 video_frame.width * 4, // Stride. | 122 video_frame->coded_size().width() * 4, // Stride. |
120 video_frame.width, | 123 video_frame->coded_size().width(), |
121 video_frame.height); | 124 video_frame->coded_size().height()); |
122 | 125 |
123 // Place image in window. | 126 // Place image in window. |
124 XShmPutImage(display_, window_, gc_, image_, 0, 0, 0, 0, | 127 XShmPutImage(display_, window_, gc_, image_, 0, 0, 0, 0, |
125 video_frame.width, | 128 video_frame->coded_size().width(), |
126 video_frame.height, true); | 129 video_frame->coded_size().height(), true); |
127 | 130 |
128 // Very important for the image to update properly! | 131 // Very important for the image to update properly! |
129 XSync(display_, false); | 132 XSync(display_, false); |
130 } | 133 } |
131 | 134 |
132 } // namespace test | 135 } // namespace test |
133 } // namespace cast | 136 } // namespace cast |
134 } // namespace media | 137 } // namespace media |
OLD | NEW |