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; | |
94 | 93 |
95 MP3StreamParser::MP3StreamParser() | 94 MP3StreamParser::MP3StreamParser() |
96 : MPEGAudioStreamParserBase(kMP3StartCodeMask, kCodecMP3, kCodecDelay) {} | 95 : MPEGAudioStreamParserBase(kMP3StartCodeMask, kCodecMP3) {} |
97 | 96 |
98 MP3StreamParser::~MP3StreamParser() {} | 97 MP3StreamParser::~MP3StreamParser() {} |
99 | 98 |
100 int MP3StreamParser::ParseFrameHeader(const uint8* data, | 99 int MP3StreamParser::ParseFrameHeader(const uint8* data, |
101 int size, | 100 int size, |
102 int* frame_size, | 101 int* frame_size, |
103 int* sample_rate, | 102 int* sample_rate, |
104 ChannelLayout* channel_layout, | 103 ChannelLayout* channel_layout, |
105 int* sample_count, | 104 int* sample_count, |
106 bool* metadata_frame) const { | 105 bool* metadata_frame) const { |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 if (metadata_frame) | 270 if (metadata_frame) |
272 *metadata_frame = true; | 271 *metadata_frame = true; |
273 return reader.bits_read() / 8; | 272 return reader.bits_read() / 8; |
274 } | 273 } |
275 | 274 |
276 // If it wasn't a XING frame, just return the number consumed bytes. | 275 // If it wasn't a XING frame, just return the number consumed bytes. |
277 return header_bytes_read; | 276 return header_bytes_read; |
278 } | 277 } |
279 | 278 |
280 } // namespace media | 279 } // namespace media |
OLD | NEW |