| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/formats/mpeg/mpeg1_audio_stream_parser.h" | 5 #include "media/formats/mpeg/mpeg1_audio_stream_parser.h" |
| 6 | 6 |
| 7 #include "media/base/media_log.h" | 7 #include "media/base/media_log.h" |
| 8 | 8 |
| 9 namespace media { | 9 namespace media { |
| 10 | 10 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 header->channel_mode = channel_mode; | 216 header->channel_mode = channel_mode; |
| 217 return true; | 217 return true; |
| 218 } | 218 } |
| 219 | 219 |
| 220 | 220 |
| 221 MPEG1AudioStreamParser::MPEG1AudioStreamParser() | 221 MPEG1AudioStreamParser::MPEG1AudioStreamParser() |
| 222 : MPEGAudioStreamParserBase(kMPEG1StartCodeMask, kCodecMP3, kCodecDelay) {} | 222 : MPEGAudioStreamParserBase(kMPEG1StartCodeMask, kCodecMP3, kCodecDelay) {} |
| 223 | 223 |
| 224 MPEG1AudioStreamParser::~MPEG1AudioStreamParser() {} | 224 MPEG1AudioStreamParser::~MPEG1AudioStreamParser() {} |
| 225 | 225 |
| 226 int MPEG1AudioStreamParser::ParseFrameHeader(const uint8_t* data, | 226 int MPEG1AudioStreamParser::ParseFrameHeader( |
| 227 int size, | 227 const uint8_t* data, |
| 228 int* frame_size, | 228 int size, |
| 229 int* sample_rate, | 229 int* frame_size, |
| 230 ChannelLayout* channel_layout, | 230 int* sample_rate, |
| 231 int* sample_count, | 231 ChannelLayout* channel_layout, |
| 232 bool* metadata_frame) const { | 232 int* sample_count, |
| 233 bool* metadata_frame, |
| 234 std::vector<uint8_t>* extra_data) const { |
| 233 DCHECK(data); | 235 DCHECK(data); |
| 234 DCHECK_GE(size, 0); | 236 DCHECK_GE(size, 0); |
| 235 DCHECK(frame_size); | 237 DCHECK(frame_size); |
| 236 | 238 |
| 237 if (size < kHeaderSize) | 239 if (size < kHeaderSize) |
| 238 return 0; | 240 return 0; |
| 239 | 241 |
| 240 Header header; | 242 Header header; |
| 241 if (!ParseHeader(media_log(), data, &header)) | 243 if (!ParseHeader(media_log(), data, &header)) |
| 242 return -1; | 244 return -1; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 if (metadata_frame) | 283 if (metadata_frame) |
| 282 *metadata_frame = true; | 284 *metadata_frame = true; |
| 283 return header_bytes_read + reader.bits_read() / 8; | 285 return header_bytes_read + reader.bits_read() / 8; |
| 284 } | 286 } |
| 285 | 287 |
| 286 // If it wasn't a XING frame, just return the number consumed bytes. | 288 // If it wasn't a XING frame, just return the number consumed bytes. |
| 287 return header_bytes_read; | 289 return header_bytes_read; |
| 288 } | 290 } |
| 289 | 291 |
| 290 } // namespace media | 292 } // namespace media |
| OLD | NEW |