| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 "webkit/glue/webvideoframe_impl.h" | 5 #include "webkit/glue/webvideoframe_impl.h" |
| 6 | 6 |
| 7 #include "media/base/video_frame.h" | 7 #include "media/base/video_frame.h" |
| 8 #include "third_party/WebKit/WebKit/chromium/public/WebVideoFrame.h" | 8 #include "third_party/WebKit/WebKit/chromium/public/WebVideoFrame.h" |
| 9 | 9 |
| 10 using namespace WebKit; | 10 using namespace WebKit; |
| 11 | 11 |
| 12 namespace webkit_glue { | 12 namespace webkit_glue { |
| 13 | 13 |
| 14 media::VideoFrame* WebVideoFrameImpl::toVideoFrame( | 14 media::VideoFrame* WebVideoFrameImpl::toVideoFrame( |
| 15 WebVideoFrame* web_video_frame) { | 15 WebVideoFrame* web_video_frame) { |
| 16 WebVideoFrameImpl* wrapped_frame = | 16 WebVideoFrameImpl* wrapped_frame = |
| 17 static_cast<WebVideoFrameImpl*>(web_video_frame); | 17 static_cast<WebVideoFrameImpl*>(web_video_frame); |
| 18 if (wrapped_frame) | 18 if (wrapped_frame) |
| 19 return wrapped_frame->video_frame_.get(); | 19 return wrapped_frame->video_frame_.get(); |
| 20 return NULL; | 20 return NULL; |
| 21 } | 21 } |
| 22 | 22 |
| 23 WebVideoFrameImpl::WebVideoFrameImpl( | 23 WebVideoFrameImpl::WebVideoFrameImpl( |
| 24 scoped_refptr<media::VideoFrame> video_frame) | 24 scoped_refptr<media::VideoFrame> video_frame) |
| 25 : video_frame_(video_frame) { | 25 : video_frame_(video_frame) { |
| 26 } | 26 } |
| 27 | 27 |
| 28 WebVideoFrameImpl::~WebVideoFrameImpl() {} |
| 29 |
| 28 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, chromium_name) \ | 30 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, chromium_name) \ |
| 29 COMPILE_ASSERT(int(WebKit::WebVideoFrame::webkit_name) == \ | 31 COMPILE_ASSERT(int(WebKit::WebVideoFrame::webkit_name) == \ |
| 30 int(media::VideoFrame::chromium_name), \ | 32 int(media::VideoFrame::chromium_name), \ |
| 31 mismatching_enums) | 33 mismatching_enums) |
| 32 COMPILE_ASSERT_MATCHING_ENUM(FormatInvalid, INVALID); | 34 COMPILE_ASSERT_MATCHING_ENUM(FormatInvalid, INVALID); |
| 33 COMPILE_ASSERT_MATCHING_ENUM(FormatRGB555, RGB555); | 35 COMPILE_ASSERT_MATCHING_ENUM(FormatRGB555, RGB555); |
| 34 COMPILE_ASSERT_MATCHING_ENUM(FormatRGB565, RGB565); | 36 COMPILE_ASSERT_MATCHING_ENUM(FormatRGB565, RGB565); |
| 35 COMPILE_ASSERT_MATCHING_ENUM(FormatRGB24, RGB24); | 37 COMPILE_ASSERT_MATCHING_ENUM(FormatRGB24, RGB24); |
| 36 COMPILE_ASSERT_MATCHING_ENUM(FormatRGB32, RGB32); | 38 COMPILE_ASSERT_MATCHING_ENUM(FormatRGB32, RGB32); |
| 37 COMPILE_ASSERT_MATCHING_ENUM(FormatRGBA, RGBA); | 39 COMPILE_ASSERT_MATCHING_ENUM(FormatRGBA, RGBA); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 return NULL; | 89 return NULL; |
| 88 } | 90 } |
| 89 | 91 |
| 90 unsigned WebVideoFrameImpl::texture(unsigned plane) const { | 92 unsigned WebVideoFrameImpl::texture(unsigned plane) const { |
| 91 if (video_frame_.get()) | 93 if (video_frame_.get()) |
| 92 return video_frame_->gl_texture(plane); | 94 return video_frame_->gl_texture(plane); |
| 93 return 0; | 95 return 0; |
| 94 } | 96 } |
| 95 | 97 |
| 96 } // namespace webkit_glue | 98 } // namespace webkit_glue |
| OLD | NEW |