| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 static const int kVersion2 = 2; | 79 static const int kVersion2 = 2; |
| 80 static const int kVersionReserved = 1; | 80 static const int kVersionReserved = 1; |
| 81 static const int kVersion2_5 = 0; | 81 static const int kVersion2_5 = 0; |
| 82 static const int kLayerReserved = 0; | 82 static const int kLayerReserved = 0; |
| 83 static const int kLayer1 = 3; | 83 static const int kLayer1 = 3; |
| 84 static const int kLayer2 = 2; | 84 static const int kLayer2 = 2; |
| 85 static const int kLayer3 = 1; | 85 static const int kLayer3 = 1; |
| 86 static const int kBitrateFree = 0; | 86 static const int kBitrateFree = 0; |
| 87 static const int kBitrateBad = 0xf; | 87 static const int kBitrateBad = 0xf; |
| 88 static const int kSampleRateReserved = 3; | 88 static const int kSampleRateReserved = 3; |
| 89 static const int kCodecDelay = 529; |
| 89 | 90 |
| 90 MP3StreamParser::MP3StreamParser() | 91 MP3StreamParser::MP3StreamParser() |
| 91 : MPEGAudioStreamParserBase(kMP3StartCodeMask, kCodecMP3) {} | 92 : MPEGAudioStreamParserBase(kMP3StartCodeMask, kCodecMP3, kCodecDelay) {} |
| 92 | 93 |
| 93 MP3StreamParser::~MP3StreamParser() {} | 94 MP3StreamParser::~MP3StreamParser() {} |
| 94 | 95 |
| 95 int MP3StreamParser::ParseFrameHeader(const uint8* data, | 96 int MP3StreamParser::ParseFrameHeader(const uint8* data, |
| 96 int size, | 97 int size, |
| 97 int* frame_size, | 98 int* frame_size, |
| 98 int* sample_rate, | 99 int* sample_rate, |
| 99 ChannelLayout* channel_layout, | 100 ChannelLayout* channel_layout, |
| 100 int* sample_count) const { | 101 int* sample_count) const { |
| 101 DCHECK(data); | 102 DCHECK(data); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 // Map Stereo(0), Joint Stereo(1), and Dual Channel (2) to | 231 // Map Stereo(0), Joint Stereo(1), and Dual Channel (2) to |
| 231 // CHANNEL_LAYOUT_STEREO and Single Channel (3) to CHANNEL_LAYOUT_MONO. | 232 // CHANNEL_LAYOUT_STEREO and Single Channel (3) to CHANNEL_LAYOUT_MONO. |
| 232 *channel_layout = | 233 *channel_layout = |
| 233 (channel_mode == 3) ? CHANNEL_LAYOUT_MONO : CHANNEL_LAYOUT_STEREO; | 234 (channel_mode == 3) ? CHANNEL_LAYOUT_MONO : CHANNEL_LAYOUT_STEREO; |
| 234 } | 235 } |
| 235 | 236 |
| 236 return 4; | 237 return 4; |
| 237 } | 238 } |
| 238 | 239 |
| 239 } // namespace media | 240 } // namespace media |
| OLD | NEW |