summaryrefslogtreecommitdiffstats
path: root/media/base/video_frame.cc
diff options
context:
space:
mode:
Diffstat (limited to 'media/base/video_frame.cc')
-rw-r--r--media/base/video_frame.cc72
1 files changed, 10 insertions, 62 deletions
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
index c78b5a4..7d637db 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -37,8 +37,7 @@ scoped_refptr<VideoFrame> VideoFrame::CreateFrame(
base::TimeDelta duration) {
DCHECK(width > 0 && height > 0);
DCHECK(width * height < 100000000);
- scoped_refptr<VideoFrame> frame(
- new VideoFrame(VideoFrame::TYPE_SYSTEM_MEMORY, format, width, height));
+ scoped_refptr<VideoFrame> frame(new VideoFrame(format, width, height));
frame->SetTimestamp(timestamp);
frame->SetDuration(duration);
switch (format) {
@@ -68,53 +67,8 @@ scoped_refptr<VideoFrame> VideoFrame::CreateFrame(
}
// static
-scoped_refptr<VideoFrame> VideoFrame::CreateFrameExternal(
- SurfaceType type,
- Format format,
- size_t width,
- size_t height,
- size_t planes,
- uint8* const data[kMaxPlanes],
- const int32 strides[kMaxPlanes],
- base::TimeDelta timestamp,
- base::TimeDelta duration,
- void* private_buffer) {
- scoped_refptr<VideoFrame> frame(
- new VideoFrame(type, format, width, height));
- frame->SetTimestamp(timestamp);
- frame->SetDuration(duration);
- frame->external_memory_ = true;
- frame->planes_ = planes;
- frame->private_buffer_ = private_buffer;
- for (size_t i = 0; i < kMaxPlanes; ++i) {
- frame->data_[i] = data[i];
- frame->strides_[i] = strides[i];
- }
- return frame;
-}
-
-// static
-scoped_refptr<VideoFrame> VideoFrame::CreateFrameGlTexture(
- Format format,
- size_t width,
- size_t height,
- GlTexture const textures[kMaxPlanes]) {
- scoped_refptr<VideoFrame> frame(
- new VideoFrame(TYPE_GL_TEXTURE, format, width, height));
- frame->external_memory_ = true;
- frame->planes_ = GetNumberOfPlanes(format);
- for (size_t i = 0; i < kMaxPlanes; ++i) {
- frame->gl_textures_[i] = textures[i];
- // TODO(hclam): Fix me for color format other than RGBA.
- frame->strides_[i] = width;
- }
- return frame;
-}
-
-// static
scoped_refptr<VideoFrame> VideoFrame::CreateEmptyFrame() {
- return new VideoFrame(VideoFrame::TYPE_SYSTEM_MEMORY,
- VideoFrame::EMPTY, 0, 0);
+ return new VideoFrame(VideoFrame::EMPTY, 0, 0);
}
// static
@@ -200,28 +154,22 @@ void VideoFrame::AllocateYUV() {
strides_[VideoFrame::kVPlane] = uv_stride;
}
-VideoFrame::VideoFrame(VideoFrame::SurfaceType type,
- VideoFrame::Format format,
+VideoFrame::VideoFrame(VideoFrame::Format format,
size_t width,
- size_t height) {
- type_ = type;
- format_ = format;
- width_ = width;
- height_ = height;
- planes_ = 0;
+ size_t height)
+ : format_(format),
+ width_(width),
+ height_(height),
+ planes_(0) {
memset(&strides_, 0, sizeof(strides_));
memset(&data_, 0, sizeof(data_));
- memset(&gl_textures_, 0, sizeof(gl_textures_));
- external_memory_ = false;
- private_buffer_ = NULL;
}
VideoFrame::~VideoFrame() {
// In multi-plane allocations, only a single block of memory is allocated
// on the heap, and other |data| pointers point inside the same, single block
// so just delete index 0.
- if (!external_memory_)
- delete[] data_[0];
+ delete[] data_[0];
}
bool VideoFrame::IsEndOfStream() const {