Chromium Code Reviews| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 class Buffer : public StreamSample { | 93 class Buffer : public StreamSample { |
| 94 public: | 94 public: |
| 95 // Returns a read only pointer to the buffer data. | 95 // Returns a read only pointer to the buffer data. |
| 96 virtual const uint8* GetData() const = 0; | 96 virtual const uint8* GetData() const = 0; |
| 97 | 97 |
| 98 // Returns the size of valid data in bytes. | 98 // Returns the size of valid data in bytes. |
| 99 virtual size_t GetDataSize() const = 0; | 99 virtual size_t GetDataSize() const = 0; |
| 100 | 100 |
| 101 // If there's no data in this buffer, it represents end of stream. | 101 // If there's no data in this buffer, it represents end of stream. |
| 102 virtual bool IsEndOfStream() const { return GetData() == NULL; } | 102 virtual bool IsEndOfStream() const { return GetData() == NULL; } |
| 103 | |
| 104 protected: | |
| 105 virtual ~Buffer() {} | |
| 103 }; | 106 }; |
| 104 | 107 |
| 105 | 108 |
| 106 class WritableBuffer : public Buffer { | 109 class WritableBuffer : public Buffer { |
| 107 public: | 110 public: |
| 108 // Returns a read-write pointer to the buffer data. | 111 // Returns a read-write pointer to the buffer data. |
| 109 virtual uint8* GetWritableData() = 0; | 112 virtual uint8* GetWritableData() = 0; |
| 110 | 113 |
| 111 // Updates the size of valid data in bytes, which must be less than or equal | 114 // Updates the size of valid data in bytes, which must be less than or equal |
| 112 // to GetBufferSize(). | 115 // to GetBufferSize(). |
| 113 virtual void SetDataSize(size_t data_size) = 0; | 116 virtual void SetDataSize(size_t data_size) = 0; |
| 114 | 117 |
| 115 // Returns the size of the underlying buffer. | 118 // Returns the size of the underlying buffer. |
| 116 virtual size_t GetBufferSize() const = 0; | 119 virtual size_t GetBufferSize() const = 0; |
| 120 | |
| 121 protected: | |
| 122 ~WritableBuffer() {} | |
|
M-A Ruel
2009/11/05 20:31:28
virtual
jam
2009/11/05 21:52:37
Done.
| |
| 117 }; | 123 }; |
| 118 | 124 |
| 119 | 125 |
| 120 struct VideoSurface { | 126 struct VideoSurface { |
| 121 static const size_t kMaxPlanes = 3; | 127 static const size_t kMaxPlanes = 3; |
| 122 | 128 |
| 123 static const size_t kNumRGBPlanes = 1; | 129 static const size_t kNumRGBPlanes = 1; |
| 124 static const size_t kRGBPlane = 0; | 130 static const size_t kRGBPlane = 0; |
| 125 | 131 |
| 126 static const size_t kNumYUVPlanes = 3; | 132 static const size_t kNumYUVPlanes = 3; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 174 // Unlocks the underlying surface, the VideoSurface acquired from Lock is no | 180 // Unlocks the underlying surface, the VideoSurface acquired from Lock is no |
| 175 // longer guaranteed to be valid. | 181 // longer guaranteed to be valid. |
| 176 virtual void Unlock() = 0; | 182 virtual void Unlock() = 0; |
| 177 | 183 |
| 178 virtual bool IsEndOfStream() const = 0; | 184 virtual bool IsEndOfStream() const = 0; |
| 179 }; | 185 }; |
| 180 | 186 |
| 181 } // namespace media | 187 } // namespace media |
| 182 | 188 |
| 183 #endif // MEDIA_BASE_BUFFERS_H_ | 189 #endif // MEDIA_BASE_BUFFERS_H_ |
| OLD | NEW |