| OLD | NEW |
| 1 // Copyright (c) 2006-2008 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 // A simple implementation of WritableBuffer that takes ownership of | 5 // A simple implementation of WritableBuffer that takes ownership of |
| 6 // the given data pointer. | 6 // the given data pointer. |
| 7 // | 7 // |
| 8 // DataBuffer assumes that memory was allocated with new char[]. | 8 // DataBuffer assumes that memory was allocated with new char[]. |
| 9 | 9 |
| 10 #ifndef MEDIA_BASE_DATA_BUFFER_H_ | 10 #ifndef MEDIA_BASE_DATA_BUFFER_H_ |
| 11 #define MEDIA_BASE_DATA_BUFFER_H_ | 11 #define MEDIA_BASE_DATA_BUFFER_H_ |
| 12 | 12 |
| 13 #include "media/base/buffers.h" | 13 #include "media/base/buffers.h" |
| 14 | 14 |
| 15 namespace media { | 15 namespace media { |
| 16 | 16 |
| 17 class DataBuffer : public WritableBuffer { | 17 class DataBuffer : public WritableBuffer { |
| 18 public: | 18 public: |
| 19 DataBuffer(char* data, size_t buffer_size, size_t data_size, | 19 DataBuffer(char* data, size_t buffer_size, size_t data_size, |
| 20 const base::TimeDelta& timestamp, const base::TimeDelta& duration); | 20 const base::TimeDelta& timestamp, const base::TimeDelta& duration); |
| 21 | 21 |
| 22 // StreamSample implementation. | |
| 23 virtual base::TimeDelta GetTimestamp() const; | |
| 24 virtual void SetTimestamp(const base::TimeDelta& timestamp); | |
| 25 virtual base::TimeDelta GetDuration() const; | |
| 26 virtual void SetDuration(const base::TimeDelta& duration); | |
| 27 | |
| 28 // Buffer implementation. | 22 // Buffer implementation. |
| 29 virtual const char* GetData() const; | 23 virtual const char* GetData() const; |
| 30 virtual size_t GetDataSize() const; | 24 virtual size_t GetDataSize() const; |
| 31 | 25 |
| 32 // WritableBuffer implementation. | 26 // WritableBuffer implementation. |
| 33 virtual char* GetWritableData(); | 27 virtual char* GetWritableData(); |
| 34 virtual size_t GetBufferSize() const; | 28 virtual size_t GetBufferSize() const; |
| 35 virtual void SetDataSize(size_t data_size); | 29 virtual void SetDataSize(size_t data_size); |
| 36 | 30 |
| 37 protected: | 31 protected: |
| 38 virtual ~DataBuffer(); | 32 virtual ~DataBuffer(); |
| 39 | 33 |
| 40 private: | 34 private: |
| 41 char* data_; | 35 char* data_; |
| 42 size_t buffer_size_; | 36 size_t buffer_size_; |
| 43 size_t data_size_; | 37 size_t data_size_; |
| 44 base::TimeDelta timestamp_; | |
| 45 base::TimeDelta duration_; | |
| 46 }; | 38 }; |
| 47 | 39 |
| 48 } // namespace media | 40 } // namespace media |
| 49 | 41 |
| 50 #endif // MEDIA_BASE_DATA_BUFFER_H_ | 42 #endif // MEDIA_BASE_DATA_BUFFER_H_ |
| OLD | NEW |