Chromium Code Reviews| Index: media/video/picture.h |
| diff --git a/media/video/picture.h b/media/video/picture.h |
| index ec84453fa1f55992d9c665e8832b3be27628f3da..9ce17b634dc2d6ed86cb8c0c536f58bfe1b32a2b 100644 |
| --- a/media/video/picture.h |
| +++ b/media/video/picture.h |
| @@ -5,59 +5,121 @@ |
| #ifndef MEDIA_VIDEO_PICTURE_H_ |
| #define MEDIA_VIDEO_PICTURE_H_ |
| -#include <vector> |
| +#include "base/basictypes.h" |
| +#include "ui/gfx/size.h" |
| -#include "base/compiler_specific.h" |
| -#include "media/video/video_decode_accelerator.h" |
| +struct PP_BufferInfo_Dev; |
| +struct PP_GLESBuffer_Dev; |
| +struct PP_Picture_Dev; |
| +struct PP_SysmemBuffer_Dev; |
| namespace media { |
| -// TODO(vmr): Evaluate the generalization potential of these interfaces & |
| -// classes and refactor as needed with the rest of media stack. |
| -class PictureBuffer : public VideoDecodeAccelerator::PictureBuffer { |
| +// Information about the picture buffer. |
| +// This is the media-namespace equivalent of PP_BufferInfo_Dev. |
| +class BufferInfo { |
| public: |
| - PictureBuffer(int32 id, gfx::Size pixel_size, |
| - std::vector<uint32> color_format, MemoryType memory_type, |
| - std::vector<DataPlaneHandle> data_plane_handles); |
| - virtual ~PictureBuffer(); |
| - |
| - // VideoDecodeAccelerator::PictureBuffer implementation. |
| - virtual int32 GetId() OVERRIDE; |
| - virtual gfx::Size GetSize() OVERRIDE; |
| - virtual const std::vector<uint32>& GetColorFormat() OVERRIDE; |
| - virtual MemoryType GetMemoryType() OVERRIDE; |
| - virtual std::vector<DataPlaneHandle>& GetPlaneHandles() OVERRIDE; |
| + BufferInfo(int32 id, gfx::Size size); |
| + BufferInfo(const PP_BufferInfo_Dev& info); |
| + // Returns the client-specified id of the buffer. |
| + int32 id() const { |
| + return id_; |
| + } |
| + |
| + // Returns the size of the buffer. |
| + gfx::Size size() const { |
| + return size_; |
| + } |
| private: |
|
scherkus (not reviewing)
2011/05/04 00:03:28
nit: add blank line before public/private/protecte
vrk (LEFT CHROMIUM)
2011/05/05 05:57:12
Done.
|
| int32 id_; |
| - gfx::Size pixel_size_; |
| - std::vector<uint32> color_format_; |
| - MemoryType memory_type_; |
| - std::vector<DataPlaneHandle>& data_plane_handles_; |
| + gfx::Size size_; |
| +}; |
| + |
| +// A picture buffer that is composed of a GLES2 texture and context. |
| +// This is the media-namespace equivalent of PP_GLESBuffer_Dev. |
| +class GLESBuffer { |
| + public: |
| + GLESBuffer(int32 id, gfx::Size size, uint32 texture_id, uint32 context_id); |
| + GLESBuffer(const PP_GLESBuffer_Dev& buffer); |
| + |
| + // Returns the id of the texture. |
| + uint32 texture_id() const { |
| + return texture_id_; |
| + } |
| - DISALLOW_IMPLICIT_CONSTRUCTORS(PictureBuffer); |
| + // Returns the id of the context in which this texture lives. |
| + // TODO(vrk): I'm not sure if "id" is what we want, or some reference to the |
| + // PPB_Context3D_Dev. Not sure how this eventually gets used. |
| + uint32 context_id() const { |
| + return context_id_; |
| + } |
| + |
| + // Returns information regarding the buffer. |
| + const BufferInfo& buffer_info() const { |
| + return info_; |
| + } |
| + |
| + private: |
| + uint32 texture_id_; |
| + uint32 context_id_; |
| + BufferInfo info_; |
| }; |
| -class Picture : public VideoDecodeAccelerator::Picture { |
| +// A picture buffer that lives in system memory. |
| +// This is the media-namespace equivalent of PP_SysmemBuffer_Dev. |
| +class SysmemBuffer { |
| public: |
| - Picture(PictureBuffer* picture_buffer, gfx::Size decoded_pixel_size, |
| - gfx::Size visible_pixel_size, void* user_handle); |
| - virtual ~Picture(); |
| + SysmemBuffer(int32 id, gfx::Size size, void* data); |
| + SysmemBuffer(const PP_SysmemBuffer_Dev&); |
| - // VideoDecodeAccelerator::Picture implementation. |
| - virtual PictureBuffer* picture_buffer() OVERRIDE; |
| - virtual gfx::Size GetDecodedSize() const OVERRIDE; |
| - virtual gfx::Size GetVisibleSize() const OVERRIDE; |
| - virtual void* GetUserHandle() OVERRIDE; |
| + // Returns a pointer to the buffer data. |
| + void* data() const { |
| + return data_; |
| + } |
| + |
| + // Returns information regarding the buffer. |
| + const BufferInfo& buffer_info() const { |
| + return info_; |
| + } |
| private: |
| - // Pointer to the picture buffer which contains this picture. |
| - PictureBuffer* picture_buffer_; |
| - gfx::Size decoded_pixel_size_; |
| - gfx::Size visible_pixel_size_; |
| - void* user_handle_; |
| + void* data_; |
| + BufferInfo info_; |
|
Ami GONE FROM CHROMIUM
2011/05/03 23:34:47
I wonder if we're really going to end up wishing w
vrk (LEFT CHROMIUM)
2011/05/05 05:57:12
I think it's likely too... every time I've used he
|
| +}; |
| + |
| +// A decoded picture frame. |
| +// This is the media-namespace equivalent of PP_Picture_Dev. |
| +class Picture { |
| + public: |
| + Picture(const PP_Picture_Dev& picture); |
| + |
| + // Returns the id of the picture buffer where this picture is contained. |
| + int32 picture_buffer_id() const { |
| + return picture_buffer_id_; |
| + } |
| + |
| + // Returns the visible size of the decoded picture in pixels. |
| + gfx::Size visible_size() const { |
| + return visible_size_; |
| + } |
| - DISALLOW_IMPLICIT_CONSTRUCTORS(Picture); |
| + // Returns the decoded size of the decoded picture in pixels. |
| + gfx::Size decoded_size() const { |
| + return decoded_size_; |
| + } |
| + |
| + // Returns the handle associated with the bitstream buffer from which this |
| + // picture was decoded. |
|
Ami GONE FROM CHROMIUM
2011/05/03 23:34:47
What if a picture spans more than one (or more tha
vrk (LEFT CHROMIUM)
2011/05/05 05:57:12
Ooh, not prepared for that! Mind if I just leave a
|
| + void* user_handle() const { |
| + return user_handle_; |
| + } |
| + |
| + private: |
| + int32 picture_buffer_id_; |
| + gfx::Size decoded_size_; |
| + gfx::Size visible_size_; |
| + void* user_handle_; |
| }; |
| } // namespace media |