Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: media/base/data_buffer.cc

Issue 19739: Changed media::Buffer interfaces to use base::TimeDelta. (Closed)
Patch Set: Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/base/data_buffer.h ('k') | media/base/data_buffer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "base/logging.h" 5 #include "base/logging.h"
6 #include "media/base/data_buffer.h" 6 #include "media/base/data_buffer.h"
7 7
8 namespace media { 8 namespace media {
9 9
10 DataBuffer::DataBuffer(char* data, size_t buffer_size, size_t data_size, 10 DataBuffer::DataBuffer(char* data, size_t buffer_size, size_t data_size,
11 int64 timestamp, int64 duration) 11 const base::TimeDelta& timestamp,
12 const base::TimeDelta& duration)
12 : data_(data), 13 : data_(data),
13 buffer_size_(buffer_size), 14 buffer_size_(buffer_size),
14 data_size_(data_size), 15 data_size_(data_size),
15 timestamp_(timestamp), 16 timestamp_(timestamp),
16 duration_(duration) { 17 duration_(duration) {
17 DCHECK(data); 18 DCHECK(data);
18 DCHECK(buffer_size >= 0); 19 DCHECK(buffer_size >= 0);
19 DCHECK(data_size <= buffer_size); 20 DCHECK(data_size <= buffer_size);
20 } 21 }
21 22
22 DataBuffer::~DataBuffer() { 23 DataBuffer::~DataBuffer() {
23 delete [] data_; 24 delete [] data_;
24 } 25 }
25 26
26 int64 DataBuffer::GetTimestamp() const { 27 base::TimeDelta DataBuffer::GetTimestamp() const {
27 return timestamp_; 28 return timestamp_;
28 } 29 }
29 30
30 void DataBuffer::SetTimestamp(int64 timestamp) { 31 void DataBuffer::SetTimestamp(const base::TimeDelta& timestamp) {
31 timestamp_ = timestamp; 32 timestamp_ = timestamp;
32 } 33 }
33 34
34 int64 DataBuffer::GetDuration() const { 35 base::TimeDelta DataBuffer::GetDuration() const {
35 return duration_; 36 return duration_;
36 } 37 }
37 38
38 void DataBuffer::SetDuration(int64 duration) { 39 void DataBuffer::SetDuration(const base::TimeDelta& duration) {
39 duration_ = duration; 40 duration_ = duration;
40 } 41 }
41 42
42 const char* DataBuffer::GetData() const { 43 const char* DataBuffer::GetData() const {
43 return data_; 44 return data_;
44 } 45 }
45 46
46 size_t DataBuffer::GetDataSize() const { 47 size_t DataBuffer::GetDataSize() const {
47 return data_size_; 48 return data_size_;
48 } 49 }
49 50
50 char* DataBuffer::GetWritableData() { 51 char* DataBuffer::GetWritableData() {
51 return data_; 52 return data_;
52 } 53 }
53 54
54 size_t DataBuffer::GetBufferSize() const { 55 size_t DataBuffer::GetBufferSize() const {
55 return buffer_size_; 56 return buffer_size_;
56 } 57 }
57 58
58 void DataBuffer::SetDataSize(size_t data_size) { 59 void DataBuffer::SetDataSize(size_t data_size) {
59 data_size_ = data_size; 60 data_size_ = data_size;
60 } 61 }
61 62
62 } // namespace media 63 } // namespace media
OLDNEW
« no previous file with comments | « media/base/data_buffer.h ('k') | media/base/data_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698