OLD | NEW |
1 // Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008-2009 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 // Defines various types of timestamped media buffers used for transporting | 5 // Defines various types of timestamped media buffers used for transporting |
6 // data between filters. Every buffer contains a timestamp in microseconds | 6 // data between filters. Every buffer contains a timestamp in microseconds |
7 // describing the relative position of the buffer within the media stream, and | 7 // describing the relative position of the buffer within the media stream, and |
8 // the duration in microseconds for the length of time the buffer will be | 8 // the duration in microseconds for the length of time the buffer will be |
9 // rendered. | 9 // rendered. |
10 // | 10 // |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 bool discontinuous_; | 90 bool discontinuous_; |
91 | 91 |
92 private: | 92 private: |
93 DISALLOW_COPY_AND_ASSIGN(StreamSample); | 93 DISALLOW_COPY_AND_ASSIGN(StreamSample); |
94 }; | 94 }; |
95 | 95 |
96 | 96 |
97 class Buffer : public StreamSample { | 97 class Buffer : public StreamSample { |
98 public: | 98 public: |
99 // Returns a read only pointer to the buffer data. | 99 // Returns a read only pointer to the buffer data. |
100 virtual const char* GetData() const = 0; | 100 virtual const uint8* GetData() const = 0; |
101 | 101 |
102 // Returns the size of valid data in bytes. | 102 // Returns the size of valid data in bytes. |
103 virtual size_t GetDataSize() const = 0; | 103 virtual size_t GetDataSize() const = 0; |
104 }; | 104 }; |
105 | 105 |
106 | 106 |
107 class WritableBuffer : public Buffer { | 107 class WritableBuffer : public Buffer { |
108 public: | 108 public: |
109 // Returns a read-write pointer to the buffer data. | 109 // Returns a read-write pointer to the buffer data. When this method is |
110 virtual char* GetWritableData() = 0; | 110 // called, any pointers previously returned from this method are invalid, and |
| 111 // any data previously written to the buffer is invalid. The buffer size |
| 112 // is guaranteed to be at least the size of |buffer_size|. The size |
| 113 // that the GetDataSize() method will return is set to |buffer_size|. |
| 114 // If, after filling the buffer, the caller wants to set the size to a smaller |
| 115 // value then they can call the SetDataSize() method. |
| 116 virtual uint8* GetWritableData(size_t buffer_size) = 0; |
111 | 117 |
112 // Updates the size of valid data in bytes, which must be less than or equal | 118 // Updates the size of valid data in bytes, which must be less than or equal |
113 // to GetBufferSize. | 119 // to the |buffer_size| passed to GetWritableData(). |
114 virtual void SetDataSize(size_t data_size) = 0; | 120 virtual void SetDataSize(size_t data_size) = 0; |
115 | |
116 // Returns the maximum allocated size for this buffer. | |
117 virtual size_t GetBufferSize() const = 0; | |
118 }; | 121 }; |
119 | 122 |
120 | 123 |
121 struct VideoSurface { | 124 struct VideoSurface { |
122 static const size_t kMaxPlanes = 3; | 125 static const size_t kMaxPlanes = 3; |
123 | 126 |
124 static const size_t kNumRGBPlanes = 1; | 127 static const size_t kNumRGBPlanes = 1; |
125 static const size_t kRGBPlane = 0; | 128 static const size_t kRGBPlane = 0; |
126 | 129 |
127 static const size_t kNumYUVPlanes = 3; | 130 static const size_t kNumYUVPlanes = 3; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 private: | 227 private: |
225 OwnerType* owner_; | 228 OwnerType* owner_; |
226 scoped_refptr<BufferType> buffer_; | 229 scoped_refptr<BufferType> buffer_; |
227 | 230 |
228 DISALLOW_COPY_AND_ASSIGN(AssignableBuffer); | 231 DISALLOW_COPY_AND_ASSIGN(AssignableBuffer); |
229 }; | 232 }; |
230 | 233 |
231 } // namespace media | 234 } // namespace media |
232 | 235 |
233 #endif // MEDIA_BASE_BUFFERS_H_ | 236 #endif // MEDIA_BASE_BUFFERS_H_ |
OLD | NEW |