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 #include "media/base/decoder_buffer.h" | 5 #include "media/base/decoder_buffer.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "media/base/decrypt_config.h" | 8 #include "media/base/decrypt_config.h" |
9 | 9 |
10 namespace media { | 10 namespace media { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 CHECK(side_data); | 63 CHECK(side_data); |
64 return make_scoped_refptr(new DecoderBuffer(data, data_size, | 64 return make_scoped_refptr(new DecoderBuffer(data, data_size, |
65 side_data, side_data_size)); | 65 side_data, side_data_size)); |
66 } | 66 } |
67 | 67 |
68 // static | 68 // static |
69 scoped_refptr<DecoderBuffer> DecoderBuffer::CreateEOSBuffer() { | 69 scoped_refptr<DecoderBuffer> DecoderBuffer::CreateEOSBuffer() { |
70 return make_scoped_refptr(new DecoderBuffer(NULL, 0, NULL, 0)); | 70 return make_scoped_refptr(new DecoderBuffer(NULL, 0, NULL, 0)); |
71 } | 71 } |
72 | 72 |
73 base::TimeDelta DecoderBuffer::GetTimestamp() const { | 73 base::TimeDelta DecoderBuffer::timestamp() const { |
74 DCHECK(!IsEndOfStream()); | 74 DCHECK(!end_of_stream()); |
75 return timestamp_; | 75 return timestamp_; |
76 } | 76 } |
77 | 77 |
78 void DecoderBuffer::SetTimestamp(const base::TimeDelta& timestamp) { | 78 void DecoderBuffer::set_timestamp(const base::TimeDelta& timestamp) { |
79 DCHECK(!IsEndOfStream()); | 79 DCHECK(!end_of_stream()); |
80 timestamp_ = timestamp; | 80 timestamp_ = timestamp; |
81 } | 81 } |
82 | 82 |
83 base::TimeDelta DecoderBuffer::GetDuration() const { | 83 base::TimeDelta DecoderBuffer::duration() const { |
84 DCHECK(!IsEndOfStream()); | 84 DCHECK(!end_of_stream()); |
85 return duration_; | 85 return duration_; |
86 } | 86 } |
87 | 87 |
88 void DecoderBuffer::SetDuration(const base::TimeDelta& duration) { | 88 void DecoderBuffer::set_duration(const base::TimeDelta& duration) { |
89 DCHECK(!IsEndOfStream()); | 89 DCHECK(!end_of_stream()); |
90 duration_ = duration; | 90 duration_ = duration; |
91 } | 91 } |
92 | 92 |
93 const uint8* DecoderBuffer::GetData() const { | 93 const uint8* DecoderBuffer::data() const { |
94 DCHECK(!IsEndOfStream()); | 94 DCHECK(!end_of_stream()); |
95 return data_.get(); | 95 return data_.get(); |
96 } | 96 } |
97 | 97 |
98 uint8* DecoderBuffer::GetWritableData() const { | 98 uint8* DecoderBuffer::writable_data() const { |
99 DCHECK(!IsEndOfStream()); | 99 DCHECK(!end_of_stream()); |
100 return data_.get(); | 100 return data_.get(); |
101 } | 101 } |
102 | 102 |
103 int DecoderBuffer::GetDataSize() const { | 103 int DecoderBuffer::data_size() const { |
104 DCHECK(!IsEndOfStream()); | 104 DCHECK(!end_of_stream()); |
105 return size_; | 105 return size_; |
106 } | 106 } |
107 | 107 |
108 const uint8* DecoderBuffer::GetSideData() const { | 108 const uint8* DecoderBuffer::side_data() const { |
109 DCHECK(!IsEndOfStream()); | 109 DCHECK(!end_of_stream()); |
110 return side_data_.get(); | 110 return side_data_.get(); |
111 } | 111 } |
112 | 112 |
113 int DecoderBuffer::GetSideDataSize() const { | 113 int DecoderBuffer::side_data_size() const { |
114 DCHECK(!IsEndOfStream()); | 114 DCHECK(!end_of_stream()); |
115 return side_data_size_; | 115 return side_data_size_; |
116 } | 116 } |
117 | 117 |
118 const DecryptConfig* DecoderBuffer::GetDecryptConfig() const { | 118 const DecryptConfig* DecoderBuffer::decrypt_config() const { |
119 DCHECK(!IsEndOfStream()); | 119 DCHECK(!end_of_stream()); |
120 return decrypt_config_.get(); | 120 return decrypt_config_.get(); |
121 } | 121 } |
122 | 122 |
123 void DecoderBuffer::SetDecryptConfig(scoped_ptr<DecryptConfig> decrypt_config) { | 123 void DecoderBuffer::set_decrypt_config( |
124 DCHECK(!IsEndOfStream()); | 124 scoped_ptr<DecryptConfig> decrypt_config) { |
| 125 DCHECK(!end_of_stream()); |
125 decrypt_config_ = decrypt_config.Pass(); | 126 decrypt_config_ = decrypt_config.Pass(); |
126 } | 127 } |
127 | 128 |
128 bool DecoderBuffer::IsEndOfStream() const { | 129 bool DecoderBuffer::end_of_stream() const { |
129 return data_ == NULL; | 130 return data_ == NULL; |
130 } | 131 } |
131 | 132 |
132 std::string DecoderBuffer::AsHumanReadableString() { | 133 std::string DecoderBuffer::AsHumanReadableString() { |
133 if (IsEndOfStream()) { | 134 if (end_of_stream()) { |
134 return "end of stream"; | 135 return "end of stream"; |
135 } | 136 } |
136 | 137 |
137 std::ostringstream s; | 138 std::ostringstream s; |
138 s << "timestamp: " << timestamp_.InMicroseconds() | 139 s << "timestamp: " << timestamp_.InMicroseconds() |
139 << " duration: " << duration_.InMicroseconds() | 140 << " duration: " << duration_.InMicroseconds() |
140 << " size: " << size_ | 141 << " size: " << size_ |
141 << " side_data_size: " << side_data_size_ | 142 << " side_data_size: " << side_data_size_ |
142 << " encrypted: " << (decrypt_config_ != NULL); | 143 << " encrypted: " << (decrypt_config_ != NULL); |
143 return s.str(); | 144 return s.str(); |
144 } | 145 } |
145 | 146 |
146 } // namespace media | 147 } // namespace media |
OLD | NEW |