Chromium Code Reviews| Index: media/base/video_frame.h |
| diff --git a/media/base/video_frame.h b/media/base/video_frame.h |
| index 0eb38fbe0c56680b244d372e9c9656527d1f6232..dd5f26ec6f826bdfb121b9c4975fa9a868d03f92 100644 |
| --- a/media/base/video_frame.h |
| +++ b/media/base/video_frame.h |
| @@ -17,6 +17,7 @@ class VideoFrame : public StreamSample { |
| static const size_t kRGBPlane = 0; |
| static const size_t kNumYUVPlanes = 3; |
| + static const size_t kNumNV12Planes = 2; |
| static const size_t kYPlane = 0; |
| static const size_t kUPlane = 1; |
| static const size_t kVPlane = 2; |
| @@ -50,7 +51,13 @@ class VideoFrame : public StreamSample { |
| TYPE_D3D_TEXTURE, |
| }; |
| - public: |
| + // 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; |
| + |
| // Creates a new frame in system memory with given parameters. Buffers for |
| // the frame are allocated but not initialized. |
| static void CreateFrame(Format format, |
| @@ -75,6 +82,24 @@ class VideoFrame : public StreamSample { |
| void* private_buffer, |
| scoped_refptr<VideoFrame>* frame_out); |
| + // Creates a new frame with GL textures. |
| + 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. |
| + 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); |
| @@ -100,6 +125,12 @@ class VideoFrame : public StreamSample { |
| // VideoFrame object and must not be freed by the caller. |
| 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]; } |
| + |
| + // 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. |
| @@ -140,6 +171,12 @@ class VideoFrame : public StreamSample { |
| // Array of data pointers to each plane. |
| uint8* data_[kMaxPlanes]; |
|
scherkus (not reviewing)
2010/09/13 07:19:23
at some point we may want to consider using a unio
|
| + // 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_; |