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

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

Issue 17315021: Refactored DataBuffer to use unix_hacker style methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Inlined getters and setters on DataBuffer Created 7 years, 5 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) 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 #include "media/base/data_buffer.h" 5 #include "media/base/data_buffer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace media { 9 namespace media {
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 scoped_refptr<DataBuffer> DataBuffer::CopyFrom(const uint8* data, int size) { 42 scoped_refptr<DataBuffer> DataBuffer::CopyFrom(const uint8* data, int size) {
43 // If you hit this CHECK you likely have a bug in a demuxer. Go fix it. 43 // If you hit this CHECK you likely have a bug in a demuxer. Go fix it.
44 CHECK(data); 44 CHECK(data);
45 return make_scoped_refptr(new DataBuffer(data, size)); 45 return make_scoped_refptr(new DataBuffer(data, size));
46 } 46 }
47 47
48 // static 48 // static
49 scoped_refptr<DataBuffer> DataBuffer::CreateEOSBuffer() { 49 scoped_refptr<DataBuffer> DataBuffer::CreateEOSBuffer() {
50 return make_scoped_refptr(new DataBuffer(NULL, 0)); 50 return make_scoped_refptr(new DataBuffer(NULL, 0));
51 } 51 }
52
53 base::TimeDelta DataBuffer::GetTimestamp() const {
54 DCHECK(!IsEndOfStream());
55 return timestamp_;
56 }
57
58 void DataBuffer::SetTimestamp(const base::TimeDelta& timestamp) {
59 DCHECK(!IsEndOfStream());
60 timestamp_ = timestamp;
61 }
62
63 base::TimeDelta DataBuffer::GetDuration() const {
64 DCHECK(!IsEndOfStream());
65 return duration_;
66 }
67
68 void DataBuffer::SetDuration(const base::TimeDelta& duration) {
69 DCHECK(!IsEndOfStream());
70 duration_ = duration;
71 }
72
73 bool DataBuffer::IsEndOfStream() const {
74 return data_ == NULL;
75 }
76
77 const uint8* DataBuffer::GetData() const {
78 DCHECK(!IsEndOfStream());
79 return data_.get();
80 }
81
82 uint8* DataBuffer::GetWritableData() {
83 DCHECK(!IsEndOfStream());
84 return data_.get();
85 }
86
87 int DataBuffer::GetDataSize() const {
88 DCHECK(!IsEndOfStream());
89 return data_size_;
90 }
91
92 void DataBuffer::SetDataSize(int data_size) {
93 DCHECK(!IsEndOfStream());
94 CHECK_LE(data_size, buffer_size_);
95 data_size_ = data_size;
96 }
97
98 } // namespace media 52 } // 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