summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-09 00:06:33 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-09 00:06:33 +0000
commite82c747e5c09beeba226f4d319c687f10f3c123d (patch)
tree45c703437e8e86d5e97ddb9f1623c3aa59fd241c /media
parent3955344f69f3dae30b674a030e48d7c749fbdcce (diff)
downloadchromium_src-e82c747e5c09beeba226f4d319c687f10f3c123d.zip
chromium_src-e82c747e5c09beeba226f4d319c687f10f3c123d.tar.gz
chromium_src-e82c747e5c09beeba226f4d319c687f10f3c123d.tar.bz2
Clean up texture types in VideoFrame
A VideoFrame should only reveal it self as system memory or textures (GL or D3D). All the implementation details should be hidden. This removed EGL image, OMXBUFFERHEADERTYPE, D3D surface and MF buffer from video frame. We should only have 3 different types of video frames: 1. System memory Whether it is allocated by VideoFrame or is just memory mapped should fall into this category. Memory can either be allocated internally or provided externally. 2. GL texture EGL image or just plain GL texture should fall into this area. Decode engines should do all the necessary operations to convert texture to GL textures. 3. D3D texture Whether we are using Media Foundation or DxVA2, if we are on windows we should convert everything to D3D texture and again all the operations involved are done inside the decode engine. BUG=53714 TEST=Tree is green. This is just API change. Review URL: http://codereview.chromium.org/3303014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58899 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/base/video_frame.h16
-rw-r--r--media/filters/video_renderer_base.h5
-rw-r--r--media/tools/player_x11/gles_video_renderer.cc5
-rw-r--r--media/video/omx_video_decode_engine.cc7
4 files changed, 15 insertions, 18 deletions
diff --git a/media/base/video_frame.h b/media/base/video_frame.h
index cc54bba..0eb38fb 100644
--- a/media/base/video_frame.h
+++ b/media/base/video_frame.h
@@ -39,16 +39,20 @@ class VideoFrame : public StreamSample {
};
enum SurfaceType {
+ // Video frame is backed by system memory. The memory can be allocated by
+ // this object or be provided externally.
TYPE_SYSTEM_MEMORY,
- TYPE_OMXBUFFERHEAD,
- TYPE_EGL_IMAGE,
- TYPE_MFBUFFER,
- TYPE_DIRECT3DSURFACE
+
+ // Video frame is stored in GL texture(s).
+ TYPE_GL_TEXTURE,
+
+ // Video frame is stored in Direct3D texture(s).
+ TYPE_D3D_TEXTURE,
};
public:
- // Creates a new frame with given parameters. Buffers for the frame are
- // allocated but not initialized.
+ // Creates a new frame in system memory with given parameters. Buffers for
+ // the frame are allocated but not initialized.
static void CreateFrame(Format format,
size_t width,
size_t height,
diff --git a/media/filters/video_renderer_base.h b/media/filters/video_renderer_base.h
index f27955f7..6df61b9 100644
--- a/media/filters/video_renderer_base.h
+++ b/media/filters/video_renderer_base.h
@@ -102,11 +102,6 @@ class VideoRendererBase : public VideoRenderer,
VideoFrame::Format surface_format() { return surface_format_; }
VideoFrame::SurfaceType surface_type() { return surface_type_; }
- // TODO(jiesun): move this to gles_video_render.cc.
- inline bool uses_egl_image() {
- return surface_type_ == media::VideoFrame::TYPE_EGL_IMAGE;
- }
-
void ReadInput(scoped_refptr<VideoFrame> frame);
private:
diff --git a/media/tools/player_x11/gles_video_renderer.cc b/media/tools/player_x11/gles_video_renderer.cc
index 724efa4..d3b8051 100644
--- a/media/tools/player_x11/gles_video_renderer.cc
+++ b/media/tools/player_x11/gles_video_renderer.cc
@@ -181,8 +181,7 @@ void GlesVideoRenderer::Paint() {
}
if (uses_egl_image()) {
- if (media::VideoFrame::TYPE_EGL_IMAGE == video_frame->type()) {
-
+ if (media::VideoFrame::TYPE_GL_TEXTURE == video_frame->type()) {
GLuint texture = FindTexture(video_frame);
if (texture) {
glActiveTexture(GL_TEXTURE0);
@@ -438,7 +437,7 @@ void GlesVideoRenderer::CreateTextureAndProgramEgl() {
memset(data, 0, sizeof(data));
memset(strides, 0, sizeof(strides));
media::VideoFrame:: CreateFrameExternal(
- media::VideoFrame::TYPE_EGL_IMAGE,
+ media::VideoFrame::TYPE_GL_TEXTURE,
media::VideoFrame::RGB565,
width(), height(), 3,
data, strides,
diff --git a/media/video/omx_video_decode_engine.cc b/media/video/omx_video_decode_engine.cc
index 3aa8101..b953cfa 100644
--- a/media/video/omx_video_decode_engine.cc
+++ b/media/video/omx_video_decode_engine.cc
@@ -110,7 +110,7 @@ void OmxVideoDecodeEngine::Initialize(
info.success_ = true;
info.provides_buffers_ = !uses_egl_image_;
info.stream_info_.surface_type_ =
- uses_egl_image_ ? VideoFrame::TYPE_EGL_IMAGE
+ uses_egl_image_ ? VideoFrame::TYPE_GL_TEXTURE
: VideoFrame::TYPE_SYSTEM_MEMORY;
info.stream_info_.surface_format_ = GetSurfaceFormat();
info.stream_info_.surface_width_ = config.width_;
@@ -919,7 +919,7 @@ scoped_refptr<VideoFrame> OmxVideoDecodeEngine::CreateOmxBufferVideoFrame(
strides[1] = strides[2] = width_ >> 1;
VideoFrame::CreateFrameExternal(
- VideoFrame::TYPE_OMXBUFFERHEAD,
+ VideoFrame::TYPE_SYSTEM_MEMORY,
VideoFrame::YV12,
width_, height_, 3,
data, strides,
@@ -1121,8 +1121,7 @@ void OmxVideoDecodeEngine::ChangePort(OMX_COMMANDTYPE cmd, int port_index) {
OMX_BUFFERHEADERTYPE* OmxVideoDecodeEngine::FindOmxBuffer(
scoped_refptr<VideoFrame> video_frame) {
for (size_t i = 0; i < output_frames_.size(); ++i) {
- scoped_refptr<VideoFrame> frame = output_frames_[i].first;
- if (video_frame->private_buffer() == frame->private_buffer())
+ if (video_frame == output_frames_[i].first)
return output_frames_[i].second;
}
return NULL;