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); | |
48 | 46 |
49 WebVideoFrame::Format WebVideoFrameImpl::format() const { | 47 WebVideoFrame::Format WebVideoFrameImpl::format() const { |
50 if (video_frame_.get()) | 48 if (video_frame_.get()) |
51 return static_cast<WebVideoFrame::Format>(video_frame_->format()); | 49 return static_cast<WebVideoFrame::Format>(video_frame_->format()); |
52 return WebVideoFrame::FormatInvalid; | 50 return WebVideoFrame::FormatInvalid; |
53 } | 51 } |
54 | 52 |
55 unsigned WebVideoFrameImpl::width() const { | 53 unsigned WebVideoFrameImpl::width() const { |
56 if (video_frame_.get()) | 54 if (video_frame_.get()) |
57 return video_frame_->width(); | 55 return video_frame_->width(); |
(...skipping 12 matching lines...) Expand all Loading... |
70 return 0; | 68 return 0; |
71 } | 69 } |
72 | 70 |
73 int WebVideoFrameImpl::stride(unsigned plane) const { | 71 int WebVideoFrameImpl::stride(unsigned plane) const { |
74 if (video_frame_.get()) | 72 if (video_frame_.get()) |
75 return static_cast<int>(video_frame_->stride(plane)); | 73 return static_cast<int>(video_frame_->stride(plane)); |
76 return 0; | 74 return 0; |
77 } | 75 } |
78 | 76 |
79 const void* WebVideoFrameImpl::data(unsigned plane) const { | 77 const void* WebVideoFrameImpl::data(unsigned plane) const { |
80 if (!video_frame_.get() || format() == FormatNativeTexture) | 78 if (video_frame_.get()) |
81 return NULL; | 79 return static_cast<const void*>(video_frame_->data(plane)); |
82 return static_cast<const void*>(video_frame_->data(plane)); | 80 return NULL; |
83 } | |
84 | |
85 unsigned WebVideoFrameImpl::textureId() const { | |
86 if (!video_frame_.get() || format() != FormatNativeTexture) | |
87 return 0; | |
88 return video_frame_->texture_id(); | |
89 } | 81 } |
90 | 82 |
91 } // namespace webkit_media | 83 } // namespace webkit_media |
OLD | NEW |