| 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 // 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 12 matching lines...) Expand all Loading... |
| 23 // Duration*: 40000us 40000us 40000us ... 40000us | 23 // Duration*: 40000us 40000us 40000us ... 40000us |
| 24 // | 24 // |
| 25 // *25fps = 0.04s per frame = 40000us per frame | 25 // *25fps = 0.04s per frame = 40000us per frame |
| 26 | 26 |
| 27 #ifndef MEDIA_BASE_BUFFERS_H_ | 27 #ifndef MEDIA_BASE_BUFFERS_H_ |
| 28 #define MEDIA_BASE_BUFFERS_H_ | 28 #define MEDIA_BASE_BUFFERS_H_ |
| 29 | 29 |
| 30 #include "base/basictypes.h" | 30 #include "base/basictypes.h" |
| 31 #include "base/memory/ref_counted.h" | 31 #include "base/memory/ref_counted.h" |
| 32 #include "base/time.h" | 32 #include "base/time.h" |
| 33 #include "media/base/media_api.h" |
| 33 | 34 |
| 34 namespace media { | 35 namespace media { |
| 35 | 36 |
| 36 // Indicates an invalid or missing timestamp. | 37 // Indicates an invalid or missing timestamp. |
| 37 extern const base::TimeDelta kNoTimestamp; | 38 MEDIA_API extern const base::TimeDelta kNoTimestamp; |
| 38 | 39 |
| 39 class StreamSample : public base::RefCountedThreadSafe<StreamSample> { | 40 class MEDIA_API StreamSample : public base::RefCountedThreadSafe<StreamSample> { |
| 40 public: | 41 public: |
| 41 // Returns the timestamp of this buffer in microseconds. | 42 // Returns the timestamp of this buffer in microseconds. |
| 42 base::TimeDelta GetTimestamp() const { | 43 base::TimeDelta GetTimestamp() const { |
| 43 return timestamp_; | 44 return timestamp_; |
| 44 } | 45 } |
| 45 | 46 |
| 46 // Returns the duration of this buffer in microseconds. | 47 // Returns the duration of this buffer in microseconds. |
| 47 base::TimeDelta GetDuration() const { | 48 base::TimeDelta GetDuration() const { |
| 48 return duration_; | 49 return duration_; |
| 49 } | 50 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 69 virtual ~StreamSample(); | 70 virtual ~StreamSample(); |
| 70 | 71 |
| 71 base::TimeDelta timestamp_; | 72 base::TimeDelta timestamp_; |
| 72 base::TimeDelta duration_; | 73 base::TimeDelta duration_; |
| 73 | 74 |
| 74 private: | 75 private: |
| 75 DISALLOW_COPY_AND_ASSIGN(StreamSample); | 76 DISALLOW_COPY_AND_ASSIGN(StreamSample); |
| 76 }; | 77 }; |
| 77 | 78 |
| 78 | 79 |
| 79 class Buffer : public StreamSample { | 80 class MEDIA_API Buffer : public StreamSample { |
| 80 public: | 81 public: |
| 81 // Returns a read only pointer to the buffer data. | 82 // Returns a read only pointer to the buffer data. |
| 82 virtual const uint8* GetData() const = 0; | 83 virtual const uint8* GetData() const = 0; |
| 83 | 84 |
| 84 // Returns the size of valid data in bytes. | 85 // Returns the size of valid data in bytes. |
| 85 virtual size_t GetDataSize() const = 0; | 86 virtual size_t GetDataSize() const = 0; |
| 86 | 87 |
| 87 // If there's no data in this buffer, it represents end of stream. | 88 // If there's no data in this buffer, it represents end of stream. |
| 88 virtual bool IsEndOfStream() const; | 89 virtual bool IsEndOfStream() const; |
| 89 | 90 |
| 90 protected: | 91 protected: |
| 91 virtual ~Buffer() {} | 92 virtual ~Buffer() {} |
| 92 }; | 93 }; |
| 93 | 94 |
| 94 } // namespace media | 95 } // namespace media |
| 95 | 96 |
| 96 #endif // MEDIA_BASE_BUFFERS_H_ | 97 #endif // MEDIA_BASE_BUFFERS_H_ |
| OLD | NEW |