| 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/gl/gl_context.h" | 9 #include "ui/gfx/gl/gl_context.h" |
| 10 #include "ui/gfx/size.h" | 10 #include "ui/gfx/size.h" |
| 11 | 11 |
| 12 struct PP_BufferInfo_Dev; | |
| 13 struct PP_GLESBuffer_Dev; | |
| 14 struct PP_Picture_Dev; | |
| 15 struct PP_SysmemBuffer_Dev; | |
| 16 | |
| 17 namespace media { | 12 namespace media { |
| 18 | 13 |
| 19 // Common information about GLES & Sysmem picture buffers. | 14 // Common information about GLES & Sysmem picture buffers. |
| 20 // This is the media-namespace equivalent of PP_BufferInfo_Dev. | 15 // This is the media-namespace equivalent of PP_BufferInfo_Dev. |
| 21 class BaseBuffer { | 16 class BaseBuffer { |
| 22 public: | 17 public: |
| 23 BaseBuffer(int32 id, gfx::Size size); | 18 BaseBuffer(int32 id, gfx::Size size); |
| 24 BaseBuffer(const PP_BufferInfo_Dev& info); | |
| 25 virtual ~BaseBuffer(); | 19 virtual ~BaseBuffer(); |
| 26 | 20 |
| 27 // Returns the client-specified id of the buffer. | 21 // Returns the client-specified id of the buffer. |
| 28 int32 id() const { | 22 int32 id() const { |
| 29 return id_; | 23 return id_; |
| 30 } | 24 } |
| 31 | 25 |
| 32 // Returns the size of the buffer. | 26 // Returns the size of the buffer. |
| 33 gfx::Size size() const { | 27 gfx::Size size() const { |
| 34 return size_; | 28 return size_; |
| 35 } | 29 } |
| 36 | 30 |
| 37 private: | 31 private: |
| 38 int32 id_; | 32 int32 id_; |
| 39 gfx::Size size_; | 33 gfx::Size size_; |
| 40 }; | 34 }; |
| 41 | 35 |
| 42 // A picture buffer that is composed of a GLES2 texture and context. | 36 // A picture buffer that is composed of a GLES2 texture and context. |
| 43 // This is the media-namespace equivalent of PP_GLESBuffer_Dev. | 37 // This is the media-namespace equivalent of PP_GLESBuffer_Dev. |
| 44 class GLESBuffer : public BaseBuffer { | 38 class GLESBuffer : public BaseBuffer { |
| 45 public: | 39 public: |
| 46 GLESBuffer(int32 id, gfx::Size size, uint32 texture_id); | 40 GLESBuffer(int32 id, gfx::Size size, uint32 texture_id); |
| 47 GLESBuffer(const PP_GLESBuffer_Dev& buffer); | |
| 48 | 41 |
| 49 // Returns the id of the texture. | 42 // Returns the id of the texture. |
| 50 // NOTE: The texture id in the renderer process corresponds to a different | 43 // NOTE: The texture id in the renderer process corresponds to a different |
| 51 // texture id in the GPU process. | 44 // texture id in the GPU process. |
| 52 uint32 texture_id() const { | 45 uint32 texture_id() const { |
| 53 return texture_id_; | 46 return texture_id_; |
| 54 } | 47 } |
| 55 | 48 |
| 56 private: | 49 private: |
| 57 uint32 texture_id_; | 50 uint32 texture_id_; |
| 58 }; | 51 }; |
| 59 | 52 |
| 60 // A picture buffer that lives in system memory. | 53 // A picture buffer that lives in system memory. |
| 61 // This is the media-namespace equivalent of PP_SysmemBuffer_Dev. | 54 // This is the media-namespace equivalent of PP_SysmemBuffer_Dev. |
| 62 class SysmemBuffer : public BaseBuffer { | 55 class SysmemBuffer : public BaseBuffer { |
| 63 public: | 56 public: |
| 64 SysmemBuffer(int32 id, gfx::Size size, void* data); | 57 SysmemBuffer(int32 id, gfx::Size size, void* data); |
| 65 SysmemBuffer(const PP_SysmemBuffer_Dev&); | |
| 66 | 58 |
| 67 // Returns a pointer to the buffer data. | 59 // Returns a pointer to the buffer data. |
| 68 void* data() const { | 60 void* data() const { |
| 69 return data_; | 61 return data_; |
| 70 } | 62 } |
| 71 | 63 |
| 72 private: | 64 private: |
| 73 void* data_; | 65 void* data_; |
| 74 }; | 66 }; |
| 75 | 67 |
| 76 // A decoded picture frame. | 68 // A decoded picture frame. |
| 77 // This is the media-namespace equivalent of PP_Picture_Dev. | 69 // This is the media-namespace equivalent of PP_Picture_Dev. |
| 78 class Picture { | 70 class Picture { |
| 79 public: | 71 public: |
| 80 Picture(int32 picture_buffer_id, int32 bitstream_buffer_id, | 72 Picture(int32 picture_buffer_id, int32 bitstream_buffer_id, |
| 81 gfx::Size visible_size, gfx::Size decoded_size); | 73 gfx::Size visible_size, gfx::Size decoded_size); |
| 82 Picture(const PP_Picture_Dev& picture); | |
| 83 | 74 |
| 84 // Returns the id of the picture buffer where this picture is contained. | 75 // Returns the id of the picture buffer where this picture is contained. |
| 85 int32 picture_buffer_id() const { | 76 int32 picture_buffer_id() const { |
| 86 return picture_buffer_id_; | 77 return picture_buffer_id_; |
| 87 } | 78 } |
| 88 | 79 |
| 89 // Returns the id of the bitstream buffer from which this frame was decoded. | 80 // Returns the id of the bitstream buffer from which this frame was decoded. |
| 90 int32 bitstream_buffer_id() const { | 81 int32 bitstream_buffer_id() const { |
| 91 return bitstream_buffer_id_; | 82 return bitstream_buffer_id_; |
| 92 } | 83 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 108 private: | 99 private: |
| 109 int32 picture_buffer_id_; | 100 int32 picture_buffer_id_; |
| 110 int32 bitstream_buffer_id_; | 101 int32 bitstream_buffer_id_; |
| 111 gfx::Size visible_size_; | 102 gfx::Size visible_size_; |
| 112 gfx::Size decoded_size_; | 103 gfx::Size decoded_size_; |
| 113 }; | 104 }; |
| 114 | 105 |
| 115 } // namespace media | 106 } // namespace media |
| 116 | 107 |
| 117 #endif // MEDIA_VIDEO_PICTURE_H_ | 108 #endif // MEDIA_VIDEO_PICTURE_H_ |
| OLD | NEW |