| 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/mp3_stream_parser.h" | 5 #include "media/formats/mpeg/mp3_stream_parser.h" |
| 6 | 6 |
| 7 namespace media { | 7 namespace media { |
| 8 | 8 |
| 9 static const uint32 kMP3StartCodeMask = 0xffe00000; | 9 static const uint32 kMP3StartCodeMask = 0xffe00000; |
| 10 | 10 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 static const int kVersion2 = 2; | 83 static const int kVersion2 = 2; |
| 84 static const int kVersionReserved = 1; | 84 static const int kVersionReserved = 1; |
| 85 static const int kVersion2_5 = 0; | 85 static const int kVersion2_5 = 0; |
| 86 static const int kLayerReserved = 0; | 86 static const int kLayerReserved = 0; |
| 87 static const int kLayer1 = 3; | 87 static const int kLayer1 = 3; |
| 88 static const int kLayer2 = 2; | 88 static const int kLayer2 = 2; |
| 89 static const int kLayer3 = 1; | 89 static const int kLayer3 = 1; |
| 90 static const int kBitrateFree = 0; | 90 static const int kBitrateFree = 0; |
| 91 static const int kBitrateBad = 0xf; | 91 static const int kBitrateBad = 0xf; |
| 92 static const int kSampleRateReserved = 3; | 92 static const int kSampleRateReserved = 3; |
| 93 static const int kCodecDelay = 529; |
| 93 | 94 |
| 94 MP3StreamParser::MP3StreamParser() | 95 MP3StreamParser::MP3StreamParser() |
| 95 : MPEGAudioStreamParserBase(kMP3StartCodeMask, kCodecMP3) {} | 96 : MPEGAudioStreamParserBase(kMP3StartCodeMask, kCodecMP3, kCodecDelay) {} |
| 96 | 97 |
| 97 MP3StreamParser::~MP3StreamParser() {} | 98 MP3StreamParser::~MP3StreamParser() {} |
| 98 | 99 |
| 99 int MP3StreamParser::ParseFrameHeader(const uint8* data, | 100 int MP3StreamParser::ParseFrameHeader(const uint8* data, |
| 100 int size, | 101 int size, |
| 101 int* frame_size, | 102 int* frame_size, |
| 102 int* sample_rate, | 103 int* sample_rate, |
| 103 ChannelLayout* channel_layout, | 104 ChannelLayout* channel_layout, |
| 104 int* sample_count, | 105 int* sample_count, |
| 105 bool* metadata_frame) const { | 106 bool* metadata_frame) const { |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 if (metadata_frame) | 271 if (metadata_frame) |
| 271 *metadata_frame = true; | 272 *metadata_frame = true; |
| 272 return reader.bits_read() / 8; | 273 return reader.bits_read() / 8; |
| 273 } | 274 } |
| 274 | 275 |
| 275 // If it wasn't a XING frame, just return the number consumed bytes. | 276 // If it wasn't a XING frame, just return the number consumed bytes. |
| 276 return header_bytes_read; | 277 return header_bytes_read; |
| 277 } | 278 } |
| 278 | 279 |
| 279 } // namespace media | 280 } // namespace media |
| OLD | NEW |