Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: media/base/buffers.h

Issue 149573: Refactor WritableBuffer interface for more useful ptr management. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/base/buffer_queue_unittest.cc ('k') | media/base/data_buffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // Returns the size of valid data in bytes. 95 // Returns the size of valid data in bytes.
96 virtual size_t GetDataSize() const = 0; 96 virtual size_t GetDataSize() const = 0;
97 97
98 // If there's no data in this buffer, it represents end of stream. 98 // If there's no data in this buffer, it represents end of stream.
99 virtual bool IsEndOfStream() const { return GetData() == NULL; } 99 virtual bool IsEndOfStream() const { return GetData() == NULL; }
100 }; 100 };
101 101
102 102
103 class WritableBuffer : public Buffer { 103 class WritableBuffer : public Buffer {
104 public: 104 public:
105 // Returns a read-write pointer to the buffer data. When this method is 105 // Returns a read-write pointer to the buffer data.
106 // called, any pointers previously returned from this method are invalid, and 106 virtual uint8* GetWritableData() = 0;
107 // any data previously written to the buffer is invalid. The buffer size
108 // is guaranteed to be at least the size of |buffer_size|. The size
109 // that the GetDataSize() method will return is set to |buffer_size|.
110 // If, after filling the buffer, the caller wants to set the size to a smaller
111 // value then they can call the SetDataSize() method.
112 virtual uint8* GetWritableData(size_t buffer_size) = 0;
113 107
114 // Updates the size of valid data in bytes, which must be less than or equal 108 // Updates the size of valid data in bytes, which must be less than or equal
115 // to the |buffer_size| passed to GetWritableData(). 109 // to GetBufferSize().
116 virtual void SetDataSize(size_t data_size) = 0; 110 virtual void SetDataSize(size_t data_size) = 0;
111
112 // Returns the size of the underlying buffer.
113 virtual size_t GetBufferSize() const = 0;
117 }; 114 };
118 115
119 116
120 struct VideoSurface { 117 struct VideoSurface {
121 static const size_t kMaxPlanes = 3; 118 static const size_t kMaxPlanes = 3;
122 119
123 static const size_t kNumRGBPlanes = 1; 120 static const size_t kNumRGBPlanes = 1;
124 static const size_t kRGBPlane = 0; 121 static const size_t kRGBPlane = 0;
125 122
126 static const size_t kNumYUVPlanes = 3; 123 static const size_t kNumYUVPlanes = 3;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // Unlocks the underlying surface, the VideoSurface acquired from Lock is no 171 // Unlocks the underlying surface, the VideoSurface acquired from Lock is no
175 // longer guaranteed to be valid. 172 // longer guaranteed to be valid.
176 virtual void Unlock() = 0; 173 virtual void Unlock() = 0;
177 174
178 virtual bool IsEndOfStream() const = 0; 175 virtual bool IsEndOfStream() const = 0;
179 }; 176 };
180 177
181 } // namespace media 178 } // namespace media
182 179
183 #endif // MEDIA_BASE_BUFFERS_H_ 180 #endif // MEDIA_BASE_BUFFERS_H_
OLDNEW
« no previous file with comments | « media/base/buffer_queue_unittest.cc ('k') | media/base/data_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698