summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-07 21:46:09 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-07 21:46:09 +0000
commite570464a01253a25520171f967fa3e7a97c70cb6 (patch)
tree60654fd2cabe038fd1dd8a14bda863e536e0b2dd /media
parent6c852924d5dad5c800b025c1b37233a355270122 (diff)
downloadchromium_src-e570464a01253a25520171f967fa3e7a97c70cb6.zip
chromium_src-e570464a01253a25520171f967fa3e7a97c70cb6.tar.gz
chromium_src-e570464a01253a25520171f967fa3e7a97c70cb6.tar.bz2
Cleanup in VideoFrame
Remove D3D textures from VideoFrame because it is not used anymore. Remove duration and timestamp when creating a video frame from textures. BUG=53714 TEST=Tree is green. Review URL: http://codereview.chromium.org/3501005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61852 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/base/video_frame.cc28
-rw-r--r--media/base/video_frame.h26
-rw-r--r--media/mf/mft_h264_decoder.cc15
-rw-r--r--media/mf/mft_h264_decoder_example.cc3
4 files changed, 3 insertions, 69 deletions
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
index 6d6b7f4..9a53090 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -106,15 +106,11 @@ void VideoFrame::CreateFrameGlTexture(Format format,
size_t width,
size_t height,
GlTexture const textures[kMaxPlanes],
- base::TimeDelta timestamp,
- base::TimeDelta duration,
scoped_refptr<VideoFrame>* frame_out) {
DCHECK(frame_out);
scoped_refptr<VideoFrame> frame =
new VideoFrame(TYPE_GL_TEXTURE, format, width, height);
if (frame) {
- frame->SetTimestamp(timestamp);
- frame->SetDuration(duration);
frame->external_memory_ = true;
frame->planes_ = GetNumberOfPlanes(format);
for (size_t i = 0; i < kMaxPlanes; ++i) {
@@ -125,29 +121,6 @@ void VideoFrame::CreateFrameGlTexture(Format format,
}
// static
-void VideoFrame::CreateFrameD3dTexture(Format format,
- size_t width,
- size_t height,
- D3dTexture const textures[kMaxPlanes],
- base::TimeDelta timestamp,
- base::TimeDelta duration,
- scoped_refptr<VideoFrame>* frame_out) {
- DCHECK(frame_out);
- scoped_refptr<VideoFrame> frame =
- new VideoFrame(TYPE_D3D_TEXTURE, format, width, height);
- if (frame) {
- frame->SetTimestamp(timestamp);
- frame->SetDuration(duration);
- frame->external_memory_ = true;
- frame->planes_ = GetNumberOfPlanes(format);
- for (size_t i = 0; i < kMaxPlanes; ++i) {
- frame->d3d_textures_[i] = textures[i];
- }
- }
- *frame_out = frame;
-}
-
-// static
void VideoFrame::CreateEmptyFrame(scoped_refptr<VideoFrame>* frame_out) {
*frame_out = new VideoFrame(VideoFrame::TYPE_SYSTEM_MEMORY,
VideoFrame::EMPTY, 0, 0);
@@ -260,7 +233,6 @@ VideoFrame::VideoFrame(VideoFrame::SurfaceType type,
memset(&strides_, 0, sizeof(strides_));
memset(&data_, 0, sizeof(data_));
memset(&gl_textures_, 0, sizeof(gl_textures_));
- memset(&d3d_textures_, 0, sizeof(d3d_textures_));
external_memory_ = false;
private_buffer_ = NULL;
}
diff --git a/media/base/video_frame.h b/media/base/video_frame.h
index 04c7927..ecb3f8a 100644
--- a/media/base/video_frame.h
+++ b/media/base/video_frame.h
@@ -46,18 +46,11 @@ class VideoFrame : public StreamSample {
// Video frame is stored in GL texture(s).
TYPE_GL_TEXTURE,
-
- // Video frame is stored in Direct3D texture(s).
- TYPE_D3D_TEXTURE,
};
// Defines a new type for GL texture so we don't include OpenGL headers.
typedef unsigned int GlTexture;
- // Defines a new type for D3D texture so we don't include D3D headers and
- // don't need to bind to a specific version of D3D.
- typedef void* D3dTexture;
-
// Get the number of planes for a video frame format.
static size_t GetNumberOfPlanes(VideoFrame::Format format);
@@ -86,25 +79,12 @@ class VideoFrame : public StreamSample {
scoped_refptr<VideoFrame>* frame_out);
// Creates a new frame with GL textures.
- // TODO(hclam): Remove timestamp and duration.
static void CreateFrameGlTexture(Format format,
size_t width,
size_t height,
GlTexture const textures[kMaxPlanes],
- base::TimeDelta timestamp,
- base::TimeDelta duration,
scoped_refptr<VideoFrame>* frame_out);
- // Creates a new frame with D3d textures.
- // TODO(hclam): Remove timestamp and duration.
- static void CreateFrameD3dTexture(Format format,
- size_t width,
- size_t height,
- D3dTexture const textures[kMaxPlanes],
- base::TimeDelta timestamp,
- base::TimeDelta duration,
- scoped_refptr<VideoFrame>* frame_out);
-
// Creates a frame with format equals to VideoFrame::EMPTY, width, height
// timestamp and duration are all 0.
static void CreateEmptyFrame(scoped_refptr<VideoFrame>* frame_out);
@@ -134,9 +114,6 @@ class VideoFrame : public StreamSample {
// Returns the GL texture for a given plane.
GlTexture gl_texture(size_t plane) const { return gl_textures_[plane]; }
- // Returns the D3D texture for a given plane.
- D3dTexture d3d_texture(size_t plane) const { return d3d_textures_[plane]; }
-
void* private_buffer() const { return private_buffer_; }
// StreamSample interface.
@@ -180,9 +157,6 @@ class VideoFrame : public StreamSample {
// Array fo GL textures.
GlTexture gl_textures_[kMaxPlanes];
- // Array for D3D textures.
- D3dTexture d3d_textures_[kMaxPlanes];
-
// True of memory referenced by |data_| is provided externally and shouldn't
// be deleted.
bool external_memory_;
diff --git a/media/mf/mft_h264_decoder.cc b/media/mf/mft_h264_decoder.cc
index e8d6b05..2c1970d 100644
--- a/media/mf/mft_h264_decoder.cc
+++ b/media/mf/mft_h264_decoder.cc
@@ -191,7 +191,7 @@ void MftH264Decoder::Initialize(
// Until we had hardware composition working.
if (use_dxva_) {
info_.stream_info.surface_format = VideoFrame::NV12;
- info_.stream_info.surface_type = VideoFrame::TYPE_D3D_TEXTURE;
+ info_.stream_info.surface_type = VideoFrame::TYPE_GL_TEXTURE;
} else {
info_.stream_info.surface_format = VideoFrame::YV12;
info_.stream_info.surface_type = VideoFrame::TYPE_SYSTEM_MEMORY;
@@ -667,19 +667,6 @@ bool MftH264Decoder::DoDecode() {
return true;
}
- // No distinction between the 3 planes - all 3 point to the handle of
- // the texture. (There are actually only 2 planes since the output
- // D3D surface is in NV12 format.)
- VideoFrame::D3dTexture textures[VideoFrame::kMaxPlanes] = { surface.get(),
- surface.get(),
- surface.get() };
- VideoFrame::CreateFrameD3dTexture(info_.stream_info.surface_format,
- info_.stream_info.surface_width,
- info_.stream_info.surface_height,
- textures,
- TimeDelta::FromMicroseconds(timestamp),
- TimeDelta::FromMicroseconds(duration),
- &frame);
if (!frame.get()) {
LOG(ERROR) << "Failed to allocate video frame for d3d texture";
event_handler_->OnError();
diff --git a/media/mf/mft_h264_decoder_example.cc b/media/mf/mft_h264_decoder_example.cc
index 0ed9553..b5b6b10 100644
--- a/media/mf/mft_h264_decoder_example.cc
+++ b/media/mf/mft_h264_decoder_example.cc
@@ -232,7 +232,8 @@ class RenderToWindowHandler : public MftH264DecoderHandler {
bool RenderD3dSurface(scoped_refptr<VideoFrame> frame) {
ScopedComPtr<IDirect3DSurface9> surface;
IDirect3DDevice9* device = decoder_->device();
- surface.Attach(static_cast<IDirect3DSurface9*>(frame->d3d_texture(0)));
+ // TODO(hclam): Comment this since this file will be removed later.
+ // surface.Attach(static_cast<IDirect3DSurface9*>(frame->d3d_texture(0)));
HRESULT hr;
hr = device->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0),
1.0f, 0);