| OLD | NEW |
| 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 "webkit/media/webvideoframe_impl.h" | 5 #include "webkit/media/webvideoframe_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "media/base/video_frame.h" | 8 #include "media/base/video_frame.h" |
| 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVideoFrame.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVideoFrame.h" |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 COMPILE_ASSERT_MATCHING_ENUM(FormatRGB555, RGB555); | 36 COMPILE_ASSERT_MATCHING_ENUM(FormatRGB555, RGB555); |
| 37 COMPILE_ASSERT_MATCHING_ENUM(FormatRGB565, RGB565); | 37 COMPILE_ASSERT_MATCHING_ENUM(FormatRGB565, RGB565); |
| 38 COMPILE_ASSERT_MATCHING_ENUM(FormatRGB24, RGB24); | 38 COMPILE_ASSERT_MATCHING_ENUM(FormatRGB24, RGB24); |
| 39 COMPILE_ASSERT_MATCHING_ENUM(FormatRGB32, RGB32); | 39 COMPILE_ASSERT_MATCHING_ENUM(FormatRGB32, RGB32); |
| 40 COMPILE_ASSERT_MATCHING_ENUM(FormatRGBA, RGBA); | 40 COMPILE_ASSERT_MATCHING_ENUM(FormatRGBA, RGBA); |
| 41 COMPILE_ASSERT_MATCHING_ENUM(FormatYV12, YV12); | 41 COMPILE_ASSERT_MATCHING_ENUM(FormatYV12, YV12); |
| 42 COMPILE_ASSERT_MATCHING_ENUM(FormatYV16, YV16); | 42 COMPILE_ASSERT_MATCHING_ENUM(FormatYV16, YV16); |
| 43 COMPILE_ASSERT_MATCHING_ENUM(FormatNV12, NV12); | 43 COMPILE_ASSERT_MATCHING_ENUM(FormatNV12, NV12); |
| 44 COMPILE_ASSERT_MATCHING_ENUM(FormatEmpty, EMPTY); | 44 COMPILE_ASSERT_MATCHING_ENUM(FormatEmpty, EMPTY); |
| 45 COMPILE_ASSERT_MATCHING_ENUM(FormatASCII, ASCII); | 45 COMPILE_ASSERT_MATCHING_ENUM(FormatASCII, ASCII); |
| 46 COMPILE_ASSERT_MATCHING_ENUM(FormatI420, I420); |
| 47 COMPILE_ASSERT_MATCHING_ENUM(FormatNativeTexture, NATIVE_TEXTURE); |
| 46 | 48 |
| 47 WebVideoFrame::Format WebVideoFrameImpl::format() const { | 49 WebVideoFrame::Format WebVideoFrameImpl::format() const { |
| 48 if (video_frame_.get()) | 50 if (video_frame_.get()) |
| 49 return static_cast<WebVideoFrame::Format>(video_frame_->format()); | 51 return static_cast<WebVideoFrame::Format>(video_frame_->format()); |
| 50 return WebVideoFrame::FormatInvalid; | 52 return WebVideoFrame::FormatInvalid; |
| 51 } | 53 } |
| 52 | 54 |
| 53 unsigned WebVideoFrameImpl::width() const { | 55 unsigned WebVideoFrameImpl::width() const { |
| 54 if (video_frame_.get()) | 56 if (video_frame_.get()) |
| 55 return video_frame_->width(); | 57 return video_frame_->width(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 68 return 0; | 70 return 0; |
| 69 } | 71 } |
| 70 | 72 |
| 71 int WebVideoFrameImpl::stride(unsigned plane) const { | 73 int WebVideoFrameImpl::stride(unsigned plane) const { |
| 72 if (video_frame_.get()) | 74 if (video_frame_.get()) |
| 73 return static_cast<int>(video_frame_->stride(plane)); | 75 return static_cast<int>(video_frame_->stride(plane)); |
| 74 return 0; | 76 return 0; |
| 75 } | 77 } |
| 76 | 78 |
| 77 const void* WebVideoFrameImpl::data(unsigned plane) const { | 79 const void* WebVideoFrameImpl::data(unsigned plane) const { |
| 78 if (video_frame_.get()) | 80 if (!video_frame_.get() || format() == FormatNativeTexture) |
| 79 return static_cast<const void*>(video_frame_->data(plane)); | 81 return NULL; |
| 80 return NULL; | 82 return static_cast<const void*>(video_frame_->data(plane)); |
| 83 } |
| 84 |
| 85 unsigned WebVideoFrameImpl::textureId() const { |
| 86 if (!video_frame_.get() || format() != FormatNativeTexture) |
| 87 return 0; |
| 88 return video_frame_->texture_id(); |
| 81 } | 89 } |
| 82 | 90 |
| 83 } // namespace webkit_media | 91 } // namespace webkit_media |
| OLD | NEW |