summaryrefslogtreecommitdiffstats
path: root/cc/test/fake_video_frame.cc
blob: 3efe46290ed03d3c9b25ee04001da97a200acd91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "cc/test/fake_video_frame.h"

namespace cc {

FakeVideoFrame::FakeVideoFrame(const scoped_refptr<media::VideoFrame>& frame)
    : frame_(frame) {}

FakeVideoFrame::~FakeVideoFrame() {}

WebKit::WebVideoFrame::Format FakeVideoFrame::format() const {
  return FormatInvalid;
}

unsigned FakeVideoFrame::width() const {
  return frame_->natural_size().width();
}

unsigned FakeVideoFrame::height() const {
  return frame_->natural_size().height();
}

unsigned FakeVideoFrame::planes() const {
  return 0;
}

int FakeVideoFrame::stride(unsigned plane) const {
  return 0;
}

const void* FakeVideoFrame::data(unsigned plane) const {
  return NULL;
}

unsigned FakeVideoFrame::textureId() const {
  return frame_->texture_id();
}

unsigned FakeVideoFrame::textureTarget() const {
  return frame_->texture_target();
}

WebKit::WebRect FakeVideoFrame::visibleRect() const {
  return frame_->visible_rect();
}

WebKit::WebSize FakeVideoFrame::textureSize() const {
  return frame_->coded_size();
}

// static
media::VideoFrame* FakeVideoFrame::ToVideoFrame(
    WebKit::WebVideoFrame* web_video_frame) {
  if (!web_video_frame)
    return NULL;
  FakeVideoFrame* fake_frame = static_cast<FakeVideoFrame*>(web_video_frame);
  return fake_frame->frame_.get();
}

}  // namespace cc