| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_VIDEO_PICTURE_H_ | 5 #ifndef MEDIA_VIDEO_PICTURE_H_ |
| 6 #define MEDIA_VIDEO_PICTURE_H_ | 6 #define MEDIA_VIDEO_PICTURE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include "base/basictypes.h" |
| 9 #include "ui/gfx/size.h" |
| 9 | 10 |
| 10 #include "base/compiler_specific.h" | 11 struct PP_BufferInfo_Dev; |
| 11 #include "media/video/video_decode_accelerator.h" | 12 struct PP_GLESBuffer_Dev; |
| 13 struct PP_Picture_Dev; |
| 14 struct PP_SysmemBuffer_Dev; |
| 12 | 15 |
| 13 namespace media { | 16 namespace media { |
| 14 | 17 |
| 15 // TODO(vmr): Evaluate the generalization potential of these interfaces & | 18 // Information about the picture buffer. |
| 16 // classes and refactor as needed with the rest of media stack. | 19 // This is the media-namespace equivalent of PP_BufferInfo_Dev. |
| 17 class PictureBuffer : public VideoDecodeAccelerator::PictureBuffer { | 20 class BufferInfo { |
| 18 public: | 21 public: |
| 19 PictureBuffer(int32 id, gfx::Size pixel_size, | 22 BufferInfo(int32 id, gfx::Size size); |
| 20 std::vector<uint32> color_format, MemoryType memory_type, | 23 BufferInfo(const PP_BufferInfo_Dev& info); |
| 21 std::vector<DataPlaneHandle> data_plane_handles); | |
| 22 virtual ~PictureBuffer(); | |
| 23 | 24 |
| 24 // VideoDecodeAccelerator::PictureBuffer implementation. | 25 // Returns the client-specified id of the buffer. |
| 25 virtual int32 GetId() OVERRIDE; | 26 int32 id() const { |
| 26 virtual gfx::Size GetSize() OVERRIDE; | 27 return id_; |
| 27 virtual const std::vector<uint32>& GetColorFormat() OVERRIDE; | 28 } |
| 28 virtual MemoryType GetMemoryType() OVERRIDE; | 29 |
| 29 virtual std::vector<DataPlaneHandle>& GetPlaneHandles() OVERRIDE; | 30 // Returns the size of the buffer. |
| 31 gfx::Size size() const { |
| 32 return size_; |
| 33 } |
| 30 | 34 |
| 31 private: | 35 private: |
| 32 int32 id_; | 36 int32 id_; |
| 33 gfx::Size pixel_size_; | 37 gfx::Size size_; |
| 34 std::vector<uint32> color_format_; | |
| 35 MemoryType memory_type_; | |
| 36 std::vector<DataPlaneHandle>& data_plane_handles_; | |
| 37 | |
| 38 DISALLOW_IMPLICIT_CONSTRUCTORS(PictureBuffer); | |
| 39 }; | 38 }; |
| 40 | 39 |
| 41 class Picture : public VideoDecodeAccelerator::Picture { | 40 // A picture buffer that is composed of a GLES2 texture and context. |
| 41 // This is the media-namespace equivalent of PP_GLESBuffer_Dev. |
| 42 class GLESBuffer { |
| 42 public: | 43 public: |
| 43 Picture(PictureBuffer* picture_buffer, gfx::Size decoded_pixel_size, | 44 GLESBuffer(int32 id, gfx::Size size, uint32 texture_id, uint32 context_id); |
| 44 gfx::Size visible_pixel_size, void* user_handle); | 45 GLESBuffer(const PP_GLESBuffer_Dev& buffer); |
| 45 virtual ~Picture(); | |
| 46 | 46 |
| 47 // VideoDecodeAccelerator::Picture implementation. | 47 // Returns the id of the texture. |
| 48 virtual PictureBuffer* picture_buffer() OVERRIDE; | 48 uint32 texture_id() const { |
| 49 virtual gfx::Size GetDecodedSize() const OVERRIDE; | 49 return texture_id_; |
| 50 virtual gfx::Size GetVisibleSize() const OVERRIDE; | 50 } |
| 51 virtual void* GetUserHandle() OVERRIDE; | 51 |
| 52 // Returns the id of the context in which this texture lives. |
| 53 // TODO(vrk): I'm not sure if "id" is what we want, or some reference to the |
| 54 // PPB_Context3D_Dev. Not sure how this eventually gets used. |
| 55 uint32 context_id() const { |
| 56 return context_id_; |
| 57 } |
| 58 |
| 59 // Returns information regarding the buffer. |
| 60 const BufferInfo& buffer_info() const { |
| 61 return info_; |
| 62 } |
| 52 | 63 |
| 53 private: | 64 private: |
| 54 // Pointer to the picture buffer which contains this picture. | 65 uint32 texture_id_; |
| 55 PictureBuffer* picture_buffer_; | 66 uint32 context_id_; |
| 56 gfx::Size decoded_pixel_size_; | 67 BufferInfo info_; |
| 57 gfx::Size visible_pixel_size_; | 68 }; |
| 69 |
| 70 // A picture buffer that lives in system memory. |
| 71 // This is the media-namespace equivalent of PP_SysmemBuffer_Dev. |
| 72 class SysmemBuffer { |
| 73 public: |
| 74 SysmemBuffer(int32 id, gfx::Size size, void* data); |
| 75 SysmemBuffer(const PP_SysmemBuffer_Dev&); |
| 76 |
| 77 // Returns a pointer to the buffer data. |
| 78 void* data() const { |
| 79 return data_; |
| 80 } |
| 81 |
| 82 // Returns information regarding the buffer. |
| 83 const BufferInfo& buffer_info() const { |
| 84 return info_; |
| 85 } |
| 86 |
| 87 private: |
| 88 void* data_; |
| 89 BufferInfo info_; |
| 90 }; |
| 91 |
| 92 // A decoded picture frame. |
| 93 // This is the media-namespace equivalent of PP_Picture_Dev. |
| 94 class Picture { |
| 95 public: |
| 96 Picture(const PP_Picture_Dev& picture); |
| 97 |
| 98 // Returns the id of the picture buffer where this picture is contained. |
| 99 int32 picture_buffer_id() const { |
| 100 return picture_buffer_id_; |
| 101 } |
| 102 |
| 103 // Returns the handle associated with the bitstream buffer from which this |
| 104 // picture was decoded. |
| 105 // TODO(vrk): Handle the case where a picture can span multiple buffers. |
| 106 void* user_handle() const { |
| 107 return user_handle_; |
| 108 } |
| 109 |
| 110 // Returns the visible size of the decoded picture in pixels. |
| 111 gfx::Size visible_size() const { |
| 112 return visible_size_; |
| 113 } |
| 114 |
| 115 // Returns the decoded size of the decoded picture in pixels. |
| 116 gfx::Size decoded_size() const { |
| 117 return decoded_size_; |
| 118 } |
| 119 |
| 120 private: |
| 121 int32 picture_buffer_id_; |
| 58 void* user_handle_; | 122 void* user_handle_; |
| 59 | 123 gfx::Size visible_size_; |
| 60 DISALLOW_IMPLICIT_CONSTRUCTORS(Picture); | 124 gfx::Size decoded_size_; |
| 61 }; | 125 }; |
| 62 | 126 |
| 63 } // namespace media | 127 } // namespace media |
| 64 | 128 |
| 65 #endif // MEDIA_VIDEO_PICTURE_H_ | 129 #endif // MEDIA_VIDEO_PICTURE_H_ |
| OLD | NEW |