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

Side by Side Diff: media/blink/video_frame_compositor.cc

Issue 495353003: Move WebMediaPlayerImpl and its dependencies to media/blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 3 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
« no previous file with comments | « media/blink/video_frame_compositor.h ('k') | media/blink/video_frame_compositor_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/renderer/media/video_frame_compositor.h" 5 #include "media/blink/video_frame_compositor.h"
6 6
7 #include "media/base/video_frame.h" 7 #include "media/base/video_frame.h"
8 8
9 namespace content { 9 namespace media {
10 10
11 static bool IsOpaque(const scoped_refptr<media::VideoFrame>& frame) { 11 static bool IsOpaque(const scoped_refptr<VideoFrame>& frame) {
12 switch (frame->format()) { 12 switch (frame->format()) {
13 case media::VideoFrame::UNKNOWN: 13 case VideoFrame::UNKNOWN:
14 case media::VideoFrame::YV12: 14 case VideoFrame::YV12:
15 case media::VideoFrame::YV12J: 15 case VideoFrame::YV12J:
16 case media::VideoFrame::YV16: 16 case VideoFrame::YV16:
17 case media::VideoFrame::I420: 17 case VideoFrame::I420:
18 case media::VideoFrame::YV24: 18 case VideoFrame::YV24:
19 case media::VideoFrame::NV12: 19 case VideoFrame::NV12:
20 return true; 20 return true;
21 21
22 case media::VideoFrame::YV12A: 22 case VideoFrame::YV12A:
23 #if defined(VIDEO_HOLE) 23 #if defined(VIDEO_HOLE)
24 case media::VideoFrame::HOLE: 24 case VideoFrame::HOLE:
25 #endif // defined(VIDEO_HOLE) 25 #endif // defined(VIDEO_HOLE)
26 case media::VideoFrame::NATIVE_TEXTURE: 26 case VideoFrame::NATIVE_TEXTURE:
27 break; 27 break;
28 } 28 }
29 return false; 29 return false;
30 } 30 }
31 31
32 VideoFrameCompositor::VideoFrameCompositor( 32 VideoFrameCompositor::VideoFrameCompositor(
33 const base::Callback<void(gfx::Size)>& natural_size_changed_cb, 33 const base::Callback<void(gfx::Size)>& natural_size_changed_cb,
34 const base::Callback<void(bool)>& opacity_changed_cb) 34 const base::Callback<void(bool)>& opacity_changed_cb)
35 : natural_size_changed_cb_(natural_size_changed_cb), 35 : natural_size_changed_cb_(natural_size_changed_cb),
36 opacity_changed_cb_(opacity_changed_cb), 36 opacity_changed_cb_(opacity_changed_cb),
37 client_(NULL) { 37 client_(NULL) {
38 } 38 }
39 39
40 VideoFrameCompositor::~VideoFrameCompositor() { 40 VideoFrameCompositor::~VideoFrameCompositor() {
41 if (client_) 41 if (client_)
42 client_->StopUsingProvider(); 42 client_->StopUsingProvider();
43 } 43 }
44 44
45 void VideoFrameCompositor::SetVideoFrameProviderClient( 45 void VideoFrameCompositor::SetVideoFrameProviderClient(
46 cc::VideoFrameProvider::Client* client) { 46 cc::VideoFrameProvider::Client* client) {
47 if (client_) 47 if (client_)
48 client_->StopUsingProvider(); 48 client_->StopUsingProvider();
49 client_ = client; 49 client_ = client;
50 } 50 }
51 51
52 scoped_refptr<media::VideoFrame> VideoFrameCompositor::GetCurrentFrame() { 52 scoped_refptr<VideoFrame> VideoFrameCompositor::GetCurrentFrame() {
53 return current_frame_; 53 return current_frame_;
54 } 54 }
55 55
56 void VideoFrameCompositor::PutCurrentFrame( 56 void VideoFrameCompositor::PutCurrentFrame(
57 const scoped_refptr<media::VideoFrame>& frame) { 57 const scoped_refptr<VideoFrame>& frame) {
58 } 58 }
59 59
60 void VideoFrameCompositor::UpdateCurrentFrame( 60 void VideoFrameCompositor::UpdateCurrentFrame(
61 const scoped_refptr<media::VideoFrame>& frame) { 61 const scoped_refptr<VideoFrame>& frame) {
62 if (current_frame_.get() && 62 if (current_frame_.get() &&
63 current_frame_->natural_size() != frame->natural_size()) { 63 current_frame_->natural_size() != frame->natural_size()) {
64 natural_size_changed_cb_.Run(frame->natural_size()); 64 natural_size_changed_cb_.Run(frame->natural_size());
65 } 65 }
66 66
67 if (!current_frame_.get() || IsOpaque(current_frame_) != IsOpaque(frame)) { 67 if (!current_frame_.get() || IsOpaque(current_frame_) != IsOpaque(frame)) {
68 opacity_changed_cb_.Run(IsOpaque(frame)); 68 opacity_changed_cb_.Run(IsOpaque(frame));
69 } 69 }
70 70
71 current_frame_ = frame; 71 current_frame_ = frame;
72 72
73 if (client_) 73 if (client_)
74 client_->DidReceiveFrame(); 74 client_->DidReceiveFrame();
75 } 75 }
76 76
77 } // namespace content 77 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/video_frame_compositor.h ('k') | media/blink/video_frame_compositor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698