| 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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "ui/gfx/size.h" | 9 #include "ui/gfx/size.h" |
| 10 | 10 |
| 11 struct PP_BufferInfo_Dev; | 11 struct PP_BufferInfo_Dev; |
| 12 struct PP_GLESBuffer_Dev; | 12 struct PP_GLESBuffer_Dev; |
| 13 struct PP_Picture_Dev; | 13 struct PP_Picture_Dev; |
| 14 struct PP_SysmemBuffer_Dev; | 14 struct PP_SysmemBuffer_Dev; |
| 15 | 15 |
| 16 namespace media { | 16 namespace media { |
| 17 | 17 |
| 18 // Information about the picture buffer. | 18 // Common information about GLES & Sysmem picture buffers. |
| 19 // This is the media-namespace equivalent of PP_BufferInfo_Dev. | 19 // This is the media-namespace equivalent of PP_BufferInfo_Dev. |
| 20 class BufferInfo { | 20 class BaseBuffer { |
| 21 public: | 21 public: |
| 22 BufferInfo(int32 id, gfx::Size size); | 22 BaseBuffer(int32 id, gfx::Size size); |
| 23 BufferInfo(const PP_BufferInfo_Dev& info); | 23 BaseBuffer(const PP_BufferInfo_Dev& info); |
| 24 virtual ~BaseBuffer(); |
| 24 | 25 |
| 25 // Returns the client-specified id of the buffer. | 26 // Returns the client-specified id of the buffer. |
| 26 int32 id() const { | 27 int32 id() const { |
| 27 return id_; | 28 return id_; |
| 28 } | 29 } |
| 29 | 30 |
| 30 // Returns the size of the buffer. | 31 // Returns the size of the buffer. |
| 31 gfx::Size size() const { | 32 gfx::Size size() const { |
| 32 return size_; | 33 return size_; |
| 33 } | 34 } |
| 34 | 35 |
| 35 private: | 36 private: |
| 36 int32 id_; | 37 int32 id_; |
| 37 gfx::Size size_; | 38 gfx::Size size_; |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 // A picture buffer that is composed of a GLES2 texture and context. | 41 // A picture buffer that is composed of a GLES2 texture and context. |
| 41 // This is the media-namespace equivalent of PP_GLESBuffer_Dev. | 42 // This is the media-namespace equivalent of PP_GLESBuffer_Dev. |
| 42 class GLESBuffer { | 43 class GLESBuffer : public BaseBuffer { |
| 43 public: | 44 public: |
| 44 GLESBuffer(int32 id, gfx::Size size, uint32 texture_id, uint32 context_id); | 45 GLESBuffer(int32 id, gfx::Size size, uint32 texture_id, uint32 context_id); |
| 45 GLESBuffer(const PP_GLESBuffer_Dev& buffer); | 46 GLESBuffer(const PP_GLESBuffer_Dev& buffer); |
| 46 | 47 |
| 47 // Returns the id of the texture. | 48 // Returns the id of the texture. |
| 48 uint32 texture_id() const { | 49 uint32 texture_id() const { |
| 49 return texture_id_; | 50 return texture_id_; |
| 50 } | 51 } |
| 51 | 52 |
| 52 // Returns the id of the context in which this texture lives. | 53 // 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 // 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 // PPB_Context3D_Dev. Not sure how this eventually gets used. |
| 55 uint32 context_id() const { | 56 uint32 context_id() const { |
| 56 return context_id_; | 57 return context_id_; |
| 57 } | 58 } |
| 58 | 59 |
| 59 // Returns information regarding the buffer. | |
| 60 const BufferInfo& buffer_info() const { | |
| 61 return info_; | |
| 62 } | |
| 63 | |
| 64 private: | 60 private: |
| 65 uint32 texture_id_; | 61 uint32 texture_id_; |
| 66 uint32 context_id_; | 62 uint32 context_id_; |
| 67 BufferInfo info_; | |
| 68 }; | 63 }; |
| 69 | 64 |
| 70 // A picture buffer that lives in system memory. | 65 // A picture buffer that lives in system memory. |
| 71 // This is the media-namespace equivalent of PP_SysmemBuffer_Dev. | 66 // This is the media-namespace equivalent of PP_SysmemBuffer_Dev. |
| 72 class SysmemBuffer { | 67 class SysmemBuffer : public BaseBuffer { |
| 73 public: | 68 public: |
| 74 SysmemBuffer(int32 id, gfx::Size size, void* data); | 69 SysmemBuffer(int32 id, gfx::Size size, void* data); |
| 75 SysmemBuffer(const PP_SysmemBuffer_Dev&); | 70 SysmemBuffer(const PP_SysmemBuffer_Dev&); |
| 76 | 71 |
| 77 // Returns a pointer to the buffer data. | 72 // Returns a pointer to the buffer data. |
| 78 void* data() const { | 73 void* data() const { |
| 79 return data_; | 74 return data_; |
| 80 } | 75 } |
| 81 | 76 |
| 82 // Returns information regarding the buffer. | |
| 83 const BufferInfo& buffer_info() const { | |
| 84 return info_; | |
| 85 } | |
| 86 | |
| 87 private: | 77 private: |
| 88 void* data_; | 78 void* data_; |
| 89 BufferInfo info_; | |
| 90 }; | 79 }; |
| 91 | 80 |
| 92 // A decoded picture frame. | 81 // A decoded picture frame. |
| 93 // This is the media-namespace equivalent of PP_Picture_Dev. | 82 // This is the media-namespace equivalent of PP_Picture_Dev. |
| 94 class Picture { | 83 class Picture { |
| 95 public: | 84 public: |
| 96 Picture(int32 picture_buffer_id, int32 bitstream_buffer_id, | 85 Picture(int32 picture_buffer_id, int32 bitstream_buffer_id, |
| 97 gfx::Size visible_size, gfx::Size decoded_size); | 86 gfx::Size visible_size, gfx::Size decoded_size); |
| 98 Picture(const PP_Picture_Dev& picture); | 87 Picture(const PP_Picture_Dev& picture); |
| 99 | 88 |
| 100 // Returns the id of the picture buffer where this picture is contained. | 89 // Returns the id of the picture buffer where this picture is contained. |
| 101 int32 picture_buffer_id() const { | 90 int32 picture_buffer_id() const { |
| 102 return picture_buffer_id_; | 91 return picture_buffer_id_; |
| 103 } | 92 } |
| 104 | 93 |
| 105 // Returns the id of the bitstream buffer from which this frame was decoded. | 94 // Returns the id of the bitstream buffer from which this frame was decoded. |
| 106 // TODO(vrk): Handle the case where a picture can span multiple buffers. | 95 // TODO(fischman,vrk): Remove this field; pictures can span arbitrarily many |
| 96 // BitstreamBuffers, and it's not clear what clients would do with this |
| 97 // information, anyway. |
| 107 int32 bitstream_buffer_id() const { | 98 int32 bitstream_buffer_id() const { |
| 108 return bitstream_buffer_id_; | 99 return bitstream_buffer_id_; |
| 109 } | 100 } |
| 110 | 101 |
| 111 // Returns the visible size of the decoded picture in pixels. | 102 // Returns the visible size of the decoded picture in pixels. |
| 112 gfx::Size visible_size() const { | 103 gfx::Size visible_size() const { |
| 113 return visible_size_; | 104 return visible_size_; |
| 114 } | 105 } |
| 115 | 106 |
| 116 // Returns the decoded size of the decoded picture in pixels. | 107 // Returns the decoded size of the decoded picture in pixels. |
| 117 gfx::Size decoded_size() const { | 108 gfx::Size decoded_size() const { |
| 118 return decoded_size_; | 109 return decoded_size_; |
| 119 } | 110 } |
| 120 | 111 |
| 121 private: | 112 private: |
| 122 int32 picture_buffer_id_; | 113 int32 picture_buffer_id_; |
| 123 int32 bitstream_buffer_id_; | 114 int32 bitstream_buffer_id_; |
| 124 gfx::Size visible_size_; | 115 gfx::Size visible_size_; |
| 125 gfx::Size decoded_size_; | 116 gfx::Size decoded_size_; |
| 126 }; | 117 }; |
| 127 | 118 |
| 128 } // namespace media | 119 } // namespace media |
| 129 | 120 |
| 130 #endif // MEDIA_VIDEO_PICTURE_H_ | 121 #endif // MEDIA_VIDEO_PICTURE_H_ |
| OLD | NEW |