OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 17 matching lines...) Expand all Loading... |
28 #define MEDIA_BASE_BUFFERS_H_ | 28 #define MEDIA_BASE_BUFFERS_H_ |
29 | 29 |
30 #include "base/ref_counted.h" | 30 #include "base/ref_counted.h" |
31 | 31 |
32 namespace media { | 32 namespace media { |
33 | 33 |
34 class StreamSampleInterface : | 34 class StreamSampleInterface : |
35 public base::RefCountedThreadSafe<StreamSampleInterface> { | 35 public base::RefCountedThreadSafe<StreamSampleInterface> { |
36 public: | 36 public: |
37 // Returns the timestamp of this buffer in microseconds. | 37 // Returns the timestamp of this buffer in microseconds. |
38 virtual int64 GetTimestamp() = 0; | 38 virtual int64 GetTimestamp() const = 0; |
39 | 39 |
40 // Returns the duration of this buffer in microseconds. | 40 // Returns the duration of this buffer in microseconds. |
41 virtual int64 GetDuration() = 0; | 41 virtual int64 GetDuration() const = 0; |
42 | 42 |
43 // Sets the timestamp of this buffer in microseconds. | 43 // Sets the timestamp of this buffer in microseconds. |
44 virtual void SetTimestamp(int64 timestamp) = 0; | 44 virtual void SetTimestamp(int64 timestamp) = 0; |
45 | 45 |
46 // Sets the duration of this buffer in microseconds. | 46 // Sets the duration of this buffer in microseconds. |
47 virtual void SetDuration(int64 duration) = 0; | 47 virtual void SetDuration(int64 duration) = 0; |
48 | 48 |
49 protected: | 49 protected: |
50 friend class base::RefCountedThreadSafe<StreamSampleInterface>; | 50 friend class base::RefCountedThreadSafe<StreamSampleInterface>; |
51 virtual ~StreamSampleInterface() {} | 51 virtual ~StreamSampleInterface() {} |
52 }; | 52 }; |
53 | 53 |
54 | 54 |
55 class BufferInterface : public StreamSampleInterface { | 55 class BufferInterface : public StreamSampleInterface { |
56 public: | 56 public: |
57 // Returns a read only pointer to the buffer data. | 57 // Returns a read only pointer to the buffer data. |
58 virtual const char* GetData() = 0; | 58 virtual const char* GetData() const = 0; |
59 | 59 |
60 // Returns the size of valid data in bytes. | 60 // Returns the size of valid data in bytes. |
61 virtual size_t GetDataSize() = 0; | 61 virtual size_t GetDataSize() const = 0; |
62 }; | 62 }; |
63 | 63 |
64 | 64 |
65 class WritableBufferInterface : public BufferInterface { | 65 class WritableBufferInterface : public BufferInterface { |
66 public: | 66 public: |
67 // Returns a read-write pointer to the buffer data. | 67 // Returns a read-write pointer to the buffer data. |
68 virtual char* GetWritableData() = 0; | 68 virtual char* GetWritableData() = 0; |
69 | 69 |
70 // Updates the size of valid data in bytes, which must be less than or equal | 70 // Updates the size of valid data in bytes, which must be less than or equal |
71 // to GetBufferSize. | 71 // to GetBufferSize. |
72 virtual void SetDataSize(size_t data_size) = 0; | 72 virtual void SetDataSize(size_t data_size) = 0; |
73 | 73 |
74 // Returns the maximum allocated size for this buffer. | 74 // Returns the maximum allocated size for this buffer. |
75 virtual size_t GetBufferSize() = 0; | 75 virtual size_t GetBufferSize() const = 0; |
76 }; | 76 }; |
77 | 77 |
78 | 78 |
79 struct VideoSurface { | 79 struct VideoSurface { |
80 static const size_t kMaxPlanes = 3; | 80 static const size_t kMaxPlanes = 3; |
81 | 81 |
82 // Surface formats roughly based on FOURCC labels, see: | 82 // Surface formats roughly based on FOURCC labels, see: |
83 // http://www.fourcc.org/rgb.php | 83 // http://www.fourcc.org/rgb.php |
84 // http://www.fourcc.org/yuv.php | 84 // http://www.fourcc.org/yuv.php |
85 enum Format { | 85 enum Format { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 private: | 160 private: |
161 OwnerType* owner_; | 161 OwnerType* owner_; |
162 scoped_refptr<BufferType> buffer_; | 162 scoped_refptr<BufferType> buffer_; |
163 | 163 |
164 DISALLOW_COPY_AND_ASSIGN(AssignableBuffer); | 164 DISALLOW_COPY_AND_ASSIGN(AssignableBuffer); |
165 }; | 165 }; |
166 | 166 |
167 } // namespace media | 167 } // namespace media |
168 | 168 |
169 #endif // MEDIA_BASE_BUFFERS_H_ | 169 #endif // MEDIA_BASE_BUFFERS_H_ |
OLD | NEW |