OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "webkit/glue/webvideoframe_impl.h" |
| 6 |
| 7 #include "media/base/video_frame.h" |
| 8 #include "third_party/WebKit/WebKit/chromium/public/WebVideoFrame.h" |
| 9 |
| 10 namespace webkit_glue { |
| 11 |
| 12 WebVideoFrameImpl::WebVideoFrameImpl(media::VideoFrame* frame) |
| 13 : frame_(frame) { |
| 14 } |
| 15 |
| 16 media::VideoFrame* WebVideoFrameImpl::toVideoFrame(WebKit::WebVideoFrame* frame)
{ |
| 17 WebVideoFrameImpl* wrappedFrame = static_cast<WebVideoFrameImpl*>(frame); |
| 18 if (wrappedFrame) |
| 19 return wrappedFrame->frame_; |
| 20 return 0; |
| 21 } |
| 22 |
| 23 WebKit::WebVideoFrame::SurfaceType WebVideoFrameImpl::type() const { |
| 24 if (frame_) |
| 25 return static_cast<WebKit::WebVideoFrame::SurfaceType>(frame_->type()); |
| 26 return TYPE_SYSTEM_MEMORY; |
| 27 } |
| 28 |
| 29 WebKit::WebVideoFrame::Format WebVideoFrameImpl::format() const { |
| 30 if (frame_) |
| 31 return static_cast<WebKit::WebVideoFrame::Format>(frame_->format()); |
| 32 return INVALID; |
| 33 } |
| 34 |
| 35 size_t WebVideoFrameImpl::width() const { |
| 36 if (frame_) |
| 37 return frame_->width(); |
| 38 return 0; |
| 39 } |
| 40 |
| 41 size_t WebVideoFrameImpl::height() const { |
| 42 if (frame_) |
| 43 return frame_->height(); |
| 44 return 0; |
| 45 } |
| 46 |
| 47 size_t WebVideoFrameImpl::planes() const { |
| 48 if (frame_) |
| 49 return frame_->planes(); |
| 50 return 0; |
| 51 } |
| 52 |
| 53 int WebVideoFrameImpl::stride(size_t plane) const { |
| 54 if (frame_) |
| 55 return static_cast<int>(frame_->stride(plane)); |
| 56 return 0; |
| 57 } |
| 58 |
| 59 void* WebVideoFrameImpl::data(size_t plane) const { |
| 60 if (frame_) |
| 61 return static_cast<void*>(frame_->data(plane)); |
| 62 return 0; |
| 63 } |
| 64 |
| 65 } // namespace webkit_glue |
OLD | NEW |