| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 Buffer that takes ownership of the given data | 5 // A simple implementation of Buffer that takes ownership of the given data |
| 6 // pointer. | 6 // pointer. |
| 7 // | 7 // |
| 8 // DataBuffer assumes that memory was allocated with new uint8[]. | 8 // DataBuffer assumes that memory was allocated with new uint8[]. |
| 9 | 9 |
| 10 #ifndef MEDIA_BASE_DATA_BUFFER_H_ | 10 #ifndef MEDIA_BASE_DATA_BUFFER_H_ |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 // Updates the size of valid data in bytes, which must be less than or equal | 38 // Updates the size of valid data in bytes, which must be less than or equal |
| 39 // to GetBufferSize(). | 39 // to GetBufferSize(). |
| 40 virtual void SetDataSize(int data_size); | 40 virtual void SetDataSize(int data_size); |
| 41 | 41 |
| 42 // Returns the size of the underlying buffer. | 42 // Returns the size of the underlying buffer. |
| 43 virtual int GetBufferSize() const; | 43 virtual int GetBufferSize() const; |
| 44 | 44 |
| 45 virtual void SetDecryptConfig(scoped_ptr<DecryptConfig> decrypt_config); | 45 virtual void SetDecryptConfig(scoped_ptr<DecryptConfig> decrypt_config); |
| 46 | 46 |
| 47 protected: | 47 protected: |
| 48 // Copies from [data,data+size) to owned array. |
| 49 DataBuffer(const uint8* data, int size); |
| 48 virtual ~DataBuffer(); | 50 virtual ~DataBuffer(); |
| 49 | 51 |
| 50 private: | 52 private: |
| 51 scoped_array<uint8> data_; | 53 scoped_array<uint8> data_; |
| 52 int buffer_size_; | 54 int buffer_size_; |
| 53 int data_size_; | 55 int data_size_; |
| 54 scoped_ptr<DecryptConfig> decrypt_config_; | 56 scoped_ptr<DecryptConfig> decrypt_config_; |
| 55 | 57 |
| 56 DISALLOW_COPY_AND_ASSIGN(DataBuffer); | 58 DISALLOW_COPY_AND_ASSIGN(DataBuffer); |
| 57 }; | 59 }; |
| 58 | 60 |
| 59 } // namespace media | 61 } // namespace media |
| 60 | 62 |
| 61 #endif // MEDIA_BASE_DATA_BUFFER_H_ | 63 #endif // MEDIA_BASE_DATA_BUFFER_H_ |
| OLD | NEW |