| 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 // 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 int64 timestamp, int64 duration); | 20 const base::TimeDelta& timestamp, const base::TimeDelta& duration); |
| 21 | 21 |
| 22 // StreamSample implementation. | 22 // StreamSample implementation. |
| 23 virtual int64 GetTimestamp() const; | 23 virtual base::TimeDelta GetTimestamp() const; |
| 24 virtual void SetTimestamp(int64 timestamp); | 24 virtual void SetTimestamp(const base::TimeDelta& timestamp); |
| 25 virtual int64 GetDuration() const; | 25 virtual base::TimeDelta GetDuration() const; |
| 26 virtual void SetDuration(int64 duration); | 26 virtual void SetDuration(const base::TimeDelta& duration); |
| 27 | 27 |
| 28 // Buffer implementation. | 28 // Buffer implementation. |
| 29 virtual const char* GetData() const; | 29 virtual const char* GetData() const; |
| 30 virtual size_t GetDataSize() const; | 30 virtual size_t GetDataSize() const; |
| 31 | 31 |
| 32 // WritableBuffer implementation. | 32 // WritableBuffer implementation. |
| 33 virtual char* GetWritableData(); | 33 virtual char* GetWritableData(); |
| 34 virtual size_t GetBufferSize() const; | 34 virtual size_t GetBufferSize() const; |
| 35 virtual void SetDataSize(size_t data_size); | 35 virtual void SetDataSize(size_t data_size); |
| 36 | 36 |
| 37 protected: | 37 protected: |
| 38 virtual ~DataBuffer(); | 38 virtual ~DataBuffer(); |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 char* data_; | 41 char* data_; |
| 42 size_t buffer_size_; | 42 size_t buffer_size_; |
| 43 size_t data_size_; | 43 size_t data_size_; |
| 44 int64 timestamp_; | 44 base::TimeDelta timestamp_; |
| 45 int64 duration_; | 45 base::TimeDelta duration_; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 } // namespace media | 48 } // namespace media |
| 49 | 49 |
| 50 #endif // MEDIA_BASE_DATA_BUFFER_H_ | 50 #endif // MEDIA_BASE_DATA_BUFFER_H_ |
| OLD | NEW |