Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(409)

Side by Side Diff: webkit/media/webvideoframe_impl.cc

Issue 11754003: Move VideoFrameProvider to, and remove all usage of WebVideoFrame from cc/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/media/webvideoframe_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/base/video_frame.h"
5 #include "webkit/media/webvideoframe_impl.h" 6 #include "webkit/media/webvideoframe_impl.h"
6 7
7 #include "base/logging.h"
8 #include "media/base/video_frame.h"
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVideoFrame.h"
10
11 using WebKit::WebVideoFrame;
12
13 namespace webkit_media { 8 namespace webkit_media {
14 9
15 WebVideoFrameImpl::WebVideoFrameImpl( 10 WebVideoFrameImpl::WebVideoFrameImpl(
16 scoped_refptr<media::VideoFrame> video_frame) 11 scoped_refptr<media::VideoFrame> video_frame)
17 : video_frame_(video_frame) { 12 : video_frame(video_frame) {
18 } 13 }
19 14
20 WebVideoFrameImpl::~WebVideoFrameImpl() {} 15 WebVideoFrameImpl::~WebVideoFrameImpl() {}
21 16
22 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, chromium_name) \
23 COMPILE_ASSERT(int(WebKit::WebVideoFrame::webkit_name) == \
24 int(media::VideoFrame::chromium_name), \
25 mismatching_enums)
26 COMPILE_ASSERT_MATCHING_ENUM(FormatInvalid, INVALID);
27 COMPILE_ASSERT_MATCHING_ENUM(FormatRGB32, RGB32);
28 COMPILE_ASSERT_MATCHING_ENUM(FormatYV12, YV12);
29 COMPILE_ASSERT_MATCHING_ENUM(FormatYV16, YV16);
30 COMPILE_ASSERT_MATCHING_ENUM(FormatEmpty, EMPTY);
31 COMPILE_ASSERT_MATCHING_ENUM(FormatI420, I420);
32 COMPILE_ASSERT_MATCHING_ENUM(FormatNativeTexture, NATIVE_TEXTURE);
33
34 WebVideoFrame::Format WebVideoFrameImpl::format() const {
35 if (video_frame_.get())
36 return static_cast<WebVideoFrame::Format>(video_frame_->format());
37 return WebVideoFrame::FormatInvalid;
38 }
39
40 unsigned WebVideoFrameImpl::planes() const {
41 if (!video_frame_.get())
42 return 0;
43 switch (video_frame_->format()) {
44 case media::VideoFrame::RGB32:
45 return 1;
46 case media::VideoFrame::YV12:
47 case media::VideoFrame::YV16:
48 return 3;
49 case media::VideoFrame::INVALID:
50 case media::VideoFrame::EMPTY:
51 case media::VideoFrame::I420:
52 break;
53 case media::VideoFrame::NATIVE_TEXTURE:
54 return 0;
55 }
56 NOTREACHED();
57 return 0;
58 }
59
60 const void* WebVideoFrameImpl::data(unsigned plane) const {
61 if (!video_frame_.get() || format() == FormatNativeTexture)
62 return NULL;
63 return static_cast<const void*>(video_frame_->data(plane));
64 }
65
66 unsigned WebVideoFrameImpl::textureId() const {
67 if (!video_frame_.get() || format() != FormatNativeTexture)
68 return 0;
69 return video_frame_->texture_id();
70 }
71
72 unsigned WebVideoFrameImpl::textureTarget() const {
73 if (!video_frame_.get() || format() != FormatNativeTexture)
74 return 0;
75 return video_frame_->texture_target();
76 }
77
78 WebKit::WebRect WebVideoFrameImpl::visibleRect() const {
79 if (!video_frame_.get())
80 return WebKit::WebRect(0, 0, 0, 0);
81 return WebKit::WebRect(video_frame_->visible_rect());
82 }
83
84 WebKit::WebSize WebVideoFrameImpl::textureSize() const {
85 if (!video_frame_.get() || format() != FormatNativeTexture)
86 return WebKit::WebSize(0, 0);
87 return WebKit::WebSize(video_frame_->coded_size());
88 }
89
90 } // namespace webkit_media 17 } // namespace webkit_media
OLDNEW
« no previous file with comments | « webkit/media/webvideoframe_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698