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