OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/logging.h" |
| 6 #include "media/base/data_buffer.h" |
| 7 |
| 8 namespace media { |
| 9 |
| 10 DataBuffer::DataBuffer(char* data, size_t buffer_size, size_t data_size, |
| 11 int64 timestamp, int64 duration) |
| 12 : data_(data), |
| 13 buffer_size_(buffer_size), |
| 14 data_size_(data_size), |
| 15 timestamp_(timestamp), |
| 16 duration_(duration) { |
| 17 DCHECK(data); |
| 18 DCHECK(buffer_size >= 0); |
| 19 DCHECK(data_size <= buffer_size); |
| 20 } |
| 21 |
| 22 DataBuffer::~DataBuffer() { |
| 23 delete [] data_; |
| 24 } |
| 25 |
| 26 int64 DataBuffer::GetTimestamp() const { |
| 27 return timestamp_; |
| 28 } |
| 29 |
| 30 void DataBuffer::SetTimestamp(int64 timestamp) { |
| 31 timestamp_ = timestamp; |
| 32 } |
| 33 |
| 34 int64 DataBuffer::GetDuration() const { |
| 35 return duration_; |
| 36 } |
| 37 |
| 38 void DataBuffer::SetDuration(int64 duration) { |
| 39 duration_ = duration; |
| 40 } |
| 41 |
| 42 const char* DataBuffer::GetData() const { |
| 43 return data_; |
| 44 } |
| 45 |
| 46 size_t DataBuffer::GetDataSize() const { |
| 47 return data_size_; |
| 48 } |
| 49 |
| 50 char* DataBuffer::GetWritableData() { |
| 51 return data_; |
| 52 } |
| 53 |
| 54 size_t DataBuffer::GetBufferSize() const { |
| 55 return buffer_size_; |
| 56 } |
| 57 |
| 58 void DataBuffer::SetDataSize(size_t data_size) { |
| 59 data_size_ = data_size; |
| 60 } |
| 61 |
| 62 } // namespace media |
OLD | NEW |