summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
Diffstat (limited to 'media')
-rw-r--r--media/base/video_frame.cc72
-rw-r--r--media/base/video_frame.h58
-rw-r--r--media/base/video_frame_unittest.cc23
-rw-r--r--media/filters/ffmpeg_video_decoder.cc3
-rw-r--r--media/filters/ffmpeg_video_decoder_unittest.cc1
-rw-r--r--media/filters/video_renderer_base.cc9
-rw-r--r--media/filters/video_renderer_base.h7
-rw-r--r--media/filters/video_renderer_base_unittest.cc2
-rw-r--r--media/tools/player_wtl/wtl_renderer.cc7
-rw-r--r--media/video/ffmpeg_video_decode_engine.cc1
-rw-r--r--media/video/video_decode_engine.h1
11 files changed, 16 insertions, 168 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 {
diff --git a/media/base/video_frame.h b/media/base/video_frame.h
index a694c5f..684e522 100644
--- a/media/base/video_frame.h
+++ b/media/base/video_frame.h
@@ -40,18 +40,6 @@ class VideoFrame : public StreamSample {
I420, // 12bpp YVU planar 1x1 Y, 2x2 UV samples.
};
- enum SurfaceType {
- // Video frame is backed by system memory. The memory can be allocated by
- // this object or be provided externally.
- TYPE_SYSTEM_MEMORY,
-
- // Video frame is stored in GL texture(s).
- TYPE_GL_TEXTURE,
- };
-
- // Defines a new type for GL texture so we don't include OpenGL headers.
- typedef unsigned int GlTexture;
-
// Get the number of planes for a video frame format.
static size_t GetNumberOfPlanes(VideoFrame::Format format);
@@ -64,28 +52,6 @@ class VideoFrame : public StreamSample {
base::TimeDelta timestamp,
base::TimeDelta duration);
- // Creates a new frame with given parameters. Buffers for the frame are
- // provided externally. Reference to the buffers and strides are copied
- // from |data| and |strides| respectively.
- static scoped_refptr<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);
-
- // Creates a new frame with GL textures.
- static scoped_refptr<VideoFrame> CreateFrameGlTexture(
- Format format,
- size_t width,
- size_t height,
- GlTexture const textures[kMaxPlanes]);
-
// Creates a frame with format equals to VideoFrame::EMPTY, width, height
// timestamp and duration are all 0.
static scoped_refptr<VideoFrame> CreateEmptyFrame();
@@ -94,8 +60,6 @@ class VideoFrame : public StreamSample {
// the YUV equivalent of RGB(0,0,0).
static scoped_refptr<VideoFrame> CreateBlackFrame(int width, int height);
- SurfaceType type() const { return type_; }
-
Format format() const { return format_; }
size_t width() const { return width_; }
@@ -108,21 +72,14 @@ class VideoFrame : public StreamSample {
// Returns pointer to the buffer for a given plane. The memory is owned by
// VideoFrame object and must not be freed by the caller.
- // TODO(hclam): Use union together with |gl_texture| and |d3d_texture|.
uint8* data(size_t plane) const { return data_[plane]; }
- // Returns the GL texture for a given plane.
- GlTexture gl_texture(size_t plane) const { return gl_textures_[plane]; }
-
- void* private_buffer() const { return private_buffer_; }
-
// StreamSample interface.
virtual bool IsEndOfStream() const;
protected:
// Clients must use the static CreateFrame() method to create a new frame.
- VideoFrame(SurfaceType type,
- Format format,
+ VideoFrame(Format format,
size_t video_width,
size_t video_height);
@@ -135,9 +92,6 @@ class VideoFrame : public StreamSample {
// Frame format.
Format format_;
- // Surface type.
- SurfaceType type_;
-
// Width and height of surface.
size_t width_;
size_t height_;
@@ -154,16 +108,6 @@ class VideoFrame : public StreamSample {
// Array of data pointers to each plane.
uint8* data_[kMaxPlanes];
- // Array fo GL textures.
- GlTexture gl_textures_[kMaxPlanes];
-
- // True of memory referenced by |data_| is provided externally and shouldn't
- // be deleted.
- bool external_memory_;
-
- // Private buffer pointer, can be used for EGLImage.
- void* private_buffer_;
-
DISALLOW_COPY_AND_ASSIGN(VideoFrame);
};
diff --git a/media/base/video_frame_unittest.cc b/media/base/video_frame_unittest.cc
index 8f6b4e7..2d4a2fe 100644
--- a/media/base/video_frame_unittest.cc
+++ b/media/base/video_frame_unittest.cc
@@ -114,7 +114,6 @@ TEST(VideoFrame, CreateFrame) {
EXPECT_FALSE(frame->IsEndOfStream());
// Test VideoFrame implementation.
- EXPECT_EQ(media::VideoFrame::TYPE_SYSTEM_MEMORY, frame->type());
EXPECT_EQ(media::VideoFrame::YV12, frame->format());
{
SCOPED_TRACE("");
@@ -170,26 +169,4 @@ TEST(VideoFrame, CreateBlackFrame) {
}
}
-TEST(VideoFram, CreateExternalFrame) {
- scoped_array<uint8> memory(new uint8[1]);
-
- uint8* data[3] = {memory.get(), NULL, NULL};
- int strides[3] = {1, 0, 0};
- scoped_refptr<media::VideoFrame> frame =
- VideoFrame::CreateFrameExternal(media::VideoFrame::TYPE_SYSTEM_MEMORY,
- media::VideoFrame::RGB32, 0, 0, 3,
- data, strides,
- base::TimeDelta(), base::TimeDelta(),
- NULL);
- ASSERT_TRUE(frame);
-
- // Test frame properties.
- EXPECT_EQ(1, frame->stride(VideoFrame::kRGBPlane));
- EXPECT_EQ(memory.get(), frame->data(VideoFrame::kRGBPlane));
-
- // Delete |memory| and then |frame|.
- memory.reset();
- frame = NULL;
-}
-
} // namespace media
diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc
index cc888d0..6fcbdff 100644
--- a/media/filters/ffmpeg_video_decoder.cc
+++ b/media/filters/ffmpeg_video_decoder.cc
@@ -100,9 +100,6 @@ void FFmpegVideoDecoder::OnInitializeComplete(const VideoCodecInfo& info) {
media_format_.SetAsInteger(MediaFormat::kHeight,
info.stream_info.surface_height);
media_format_.SetAsInteger(
- MediaFormat::kSurfaceType,
- static_cast<int>(info.stream_info.surface_type));
- media_format_.SetAsInteger(
MediaFormat::kSurfaceFormat,
static_cast<int>(info.stream_info.surface_format));
state_ = kNormal;
diff --git a/media/filters/ffmpeg_video_decoder_unittest.cc b/media/filters/ffmpeg_video_decoder_unittest.cc
index 3aa7769..a45a42f 100644
--- a/media/filters/ffmpeg_video_decoder_unittest.cc
+++ b/media/filters/ffmpeg_video_decoder_unittest.cc
@@ -111,7 +111,6 @@ class DecoderPrivateMock : public FFmpegVideoDecoder {
ACTION_P2(EngineInitialize, engine, success) {
engine->event_handler_ = arg1;
engine->info_.success = success;
- engine->info_.stream_info.surface_type = VideoFrame::TYPE_SYSTEM_MEMORY;
engine->info_.stream_info.surface_format = VideoFrame::YV12;
engine->info_.stream_info.surface_width = kWidth;
engine->info_.stream_info.surface_height = kHeight;
diff --git a/media/filters/video_renderer_base.cc b/media/filters/video_renderer_base.cc
index 0f07b12..038a1a8 100644
--- a/media/filters/video_renderer_base.cc
+++ b/media/filters/video_renderer_base.cc
@@ -31,7 +31,6 @@ VideoRendererBase::VideoRendererBase()
: width_(0),
height_(0),
surface_format_(VideoFrame::INVALID),
- surface_type_(VideoFrame::TYPE_SYSTEM_MEMORY),
frame_available_(&lock_),
state_(kUninitialized),
thread_(base::kNullThreadHandle),
@@ -49,15 +48,8 @@ VideoRendererBase::~VideoRendererBase() {
// static
bool VideoRendererBase::ParseMediaFormat(
const MediaFormat& media_format,
- VideoFrame::SurfaceType* surface_type_out,
VideoFrame::Format* surface_format_out,
int* width_out, int* height_out) {
- int surface_type;
- if (!media_format.GetAsInteger(MediaFormat::kSurfaceType, &surface_type))
- return false;
- if (surface_type_out)
- *surface_type_out = static_cast<VideoFrame::SurfaceType>(surface_type);
-
int surface_format;
if (!media_format.GetAsInteger(MediaFormat::kSurfaceFormat, &surface_format))
return false;
@@ -182,7 +174,6 @@ void VideoRendererBase::Initialize(VideoDecoder* decoder,
// Notify the pipeline of the video dimensions.
if (!ParseMediaFormat(decoder->media_format(),
- &surface_type_,
&surface_format_,
&width_, &height_)) {
EnterErrorState_Locked(PIPELINE_ERROR_INITIALIZATION_FAILED);
diff --git a/media/filters/video_renderer_base.h b/media/filters/video_renderer_base.h
index 2ea03ba..d48c97c 100644
--- a/media/filters/video_renderer_base.h
+++ b/media/filters/video_renderer_base.h
@@ -38,11 +38,10 @@ class VideoRendererBase
// Helper method to parse out video-related information from a MediaFormat.
// Returns true all the required parameters are existent in |media_format|.
- // |surface_type_out|, |surface_format_out|, |width_out|, |height_out| can
- // be NULL where the result is not needed.
+ // |surface_format_out|, |width_out|, |height_out| can be NULL where the
+ // result is not needed.
static bool ParseMediaFormat(
const MediaFormat& media_format,
- VideoFrame::SurfaceType* surface_type_out,
VideoFrame::Format* surface_format_out,
int* width_out, int* height_out);
@@ -103,7 +102,6 @@ class VideoRendererBase
int width() { return width_; }
int height() { return height_; }
VideoFrame::Format surface_format() { return surface_format_; }
- VideoFrame::SurfaceType surface_type() { return surface_type_; }
void ReadInput(scoped_refptr<VideoFrame> frame);
@@ -146,7 +144,6 @@ class VideoRendererBase
int width_;
int height_;
VideoFrame::Format surface_format_;
- VideoFrame::SurfaceType surface_type_;
// Queue of incoming frames as well as the current frame since the last time
// OnFrameAvailable() was called.
diff --git a/media/filters/video_renderer_base_unittest.cc b/media/filters/video_renderer_base_unittest.cc
index a6d6716..8fdf1e3 100644
--- a/media/filters/video_renderer_base_unittest.cc
+++ b/media/filters/video_renderer_base_unittest.cc
@@ -59,8 +59,6 @@ class VideoRendererBaseTest : public ::testing::Test {
.WillRepeatedly(Invoke(this, &VideoRendererBaseTest::EnqueueCallback));
// Sets the essential media format keys for this decoder.
- decoder_media_format_.SetAsInteger(MediaFormat::kSurfaceType,
- VideoFrame::TYPE_SYSTEM_MEMORY);
decoder_media_format_.SetAsInteger(MediaFormat::kSurfaceFormat,
VideoFrame::YV12);
decoder_media_format_.SetAsInteger(MediaFormat::kWidth, kWidth);
diff --git a/media/tools/player_wtl/wtl_renderer.cc b/media/tools/player_wtl/wtl_renderer.cc
index 73c97db..04a932c 100644
--- a/media/tools/player_wtl/wtl_renderer.cc
+++ b/media/tools/player_wtl/wtl_renderer.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 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.
@@ -10,13 +10,12 @@ WtlVideoRenderer::WtlVideoRenderer(WtlVideoWindow* window)
: window_(window) {
}
-WtlVideoRenderer::~WtlVideoRenderer() {
-}
+WtlVideoRenderer::~WtlVideoRenderer() {}
// static
bool WtlVideoRenderer::IsMediaFormatSupported(
const media::MediaFormat& media_format) {
- return ParseMediaFormat(media_format, NULL, NULL, NULL, NULL);
+ return ParseMediaFormat(media_format, NULL, NULL, NULL);
}
void WtlVideoRenderer::OnStop(media::FilterCallback* callback) {
diff --git a/media/video/ffmpeg_video_decode_engine.cc b/media/video/ffmpeg_video_decode_engine.cc
index ef56987..ce37a7d 100644
--- a/media/video/ffmpeg_video_decode_engine.cc
+++ b/media/video/ffmpeg_video_decode_engine.cc
@@ -103,7 +103,6 @@ void FFmpegVideoDecodeEngine::Initialize(
VideoCodecInfo info;
info.success = false;
info.provides_buffers = true;
- info.stream_info.surface_type = VideoFrame::TYPE_SYSTEM_MEMORY;
info.stream_info.surface_format = GetSurfaceFormat();
info.stream_info.surface_width = config.surface_width();
info.stream_info.surface_height = config.surface_height();
diff --git a/media/video/video_decode_engine.h b/media/video/video_decode_engine.h
index c82ba80..2cefc44 100644
--- a/media/video/video_decode_engine.h
+++ b/media/video/video_decode_engine.h
@@ -21,7 +21,6 @@ struct PipelineStatistics;
struct VideoStreamInfo {
VideoFrame::Format surface_format;
- VideoFrame::SurfaceType surface_type;
// Can be different with container's value.
uint32 surface_width;