| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/renderer/media/video_renderer_impl.h" | 5 #include "chrome/renderer/media/video_renderer_impl.h" |
| 6 #include "media/base/yuv_convert.h" | 6 #include "media/base/yuv_convert.h" |
| 7 | 7 |
| 8 VideoRendererImpl::VideoRendererImpl(WebMediaPlayerImpl* delegate) | 8 VideoRendererImpl::VideoRendererImpl(WebMediaPlayerImpl* delegate) |
| 9 : delegate_(delegate), | 9 : delegate_(delegate), |
| 10 last_converted_frame_(NULL) { | 10 last_converted_frame_(NULL) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 last_converted_frame_ = video_frame; | 76 last_converted_frame_ = video_frame; |
| 77 last_converted_timestamp_ = timestamp; | 77 last_converted_timestamp_ = timestamp; |
| 78 media::VideoSurface frame_in; | 78 media::VideoSurface frame_in; |
| 79 if (video_frame->Lock(&frame_in)) { | 79 if (video_frame->Lock(&frame_in)) { |
| 80 // TODO(hclam): Support more video formats than just YV12. | 80 // TODO(hclam): Support more video formats than just YV12. |
| 81 DCHECK(frame_in.format == media::VideoSurface::YV12); | 81 DCHECK(frame_in.format == media::VideoSurface::YV12); |
| 82 DCHECK(frame_in.strides[media::VideoSurface::kUPlane] == | 82 DCHECK(frame_in.strides[media::VideoSurface::kUPlane] == |
| 83 frame_in.strides[media::VideoSurface::kVPlane]); | 83 frame_in.strides[media::VideoSurface::kVPlane]); |
| 84 DCHECK(frame_in.planes == media::VideoSurface::kNumYUVPlanes); | 84 DCHECK(frame_in.planes == media::VideoSurface::kNumYUVPlanes); |
| 85 bitmap_.lockPixels(); | 85 bitmap_.lockPixels(); |
| 86 media::ConvertYV12ToRGB32(frame_in.data[media::VideoSurface::kYPlane], | 86 media::ConvertYUVToRGB32(frame_in.data[media::VideoSurface::kYPlane], |
| 87 frame_in.data[media::VideoSurface::kUPlane], | 87 frame_in.data[media::VideoSurface::kUPlane], |
| 88 frame_in.data[media::VideoSurface::kVPlane], | 88 frame_in.data[media::VideoSurface::kVPlane], |
| 89 static_cast<uint8*>(bitmap_.getPixels()), | 89 static_cast<uint8*>(bitmap_.getPixels()), |
| 90 frame_in.width, | 90 frame_in.width, |
| 91 frame_in.height, | 91 frame_in.height, |
| 92 frame_in.strides[media::VideoSurface::kYPlane], | 92 frame_in.strides[media::VideoSurface::kYPlane], |
| 93 frame_in.strides[media::VideoSurface::kUPlane], | 93 frame_in.strides[media::VideoSurface::kUPlane], |
| 94 bitmap_.rowBytes()); | 94 bitmap_.rowBytes(), |
| 95 media::YV12); |
| 95 bitmap_.unlockPixels(); | 96 bitmap_.unlockPixels(); |
| 96 video_frame->Unlock(); | 97 video_frame->Unlock(); |
| 97 } else { | 98 } else { |
| 98 NOTREACHED(); | 99 NOTREACHED(); |
| 99 } | 100 } |
| 100 } | 101 } |
| 101 } | 102 } |
| OLD | NEW |