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