| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // indicate a frame is silent metadata frame. Values taken from FFmpeg. | 81 // indicate a frame is silent metadata frame. Values taken from FFmpeg. |
| 82 static const int kXingHeaderMap[2][2] = {{32, 17}, {17, 9}}; | 82 static const int kXingHeaderMap[2][2] = {{32, 17}, {17, 9}}; |
| 83 | 83 |
| 84 // Frame header field constants. | 84 // Frame header field constants. |
| 85 static const int kBitrateFree = 0; | 85 static const int kBitrateFree = 0; |
| 86 static const int kBitrateBad = 0xf; | 86 static const int kBitrateBad = 0xf; |
| 87 static const int kSampleRateReserved = 3; | 87 static const int kSampleRateReserved = 3; |
| 88 static const int kCodecDelay = 529; | 88 static const int kCodecDelay = 529; |
| 89 | 89 |
| 90 // static | 90 // static |
| 91 bool MPEG1AudioStreamParser::ParseHeader( | 91 bool MPEG1AudioStreamParser::ParseHeader(MediaLog* media_log, |
| 92 const scoped_refptr<MediaLog>& media_log, | 92 const uint8_t* data, |
| 93 const uint8_t* data, | 93 Header* header) { |
| 94 Header* header) { | |
| 95 BitReader reader(data, kHeaderSize); | 94 BitReader reader(data, kHeaderSize); |
| 96 int sync; | 95 int sync; |
| 97 int version; | 96 int version; |
| 98 int layer; | 97 int layer; |
| 99 int is_protected; | 98 int is_protected; |
| 100 int bitrate_index; | 99 int bitrate_index; |
| 101 int sample_rate_index; | 100 int sample_rate_index; |
| 102 int has_padding; | 101 int has_padding; |
| 103 int is_private; | 102 int is_private; |
| 104 int channel_mode; | 103 int channel_mode; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 if (metadata_frame) | 282 if (metadata_frame) |
| 284 *metadata_frame = true; | 283 *metadata_frame = true; |
| 285 return header_bytes_read + reader.bits_read() / 8; | 284 return header_bytes_read + reader.bits_read() / 8; |
| 286 } | 285 } |
| 287 | 286 |
| 288 // If it wasn't a XING frame, just return the number consumed bytes. | 287 // If it wasn't a XING frame, just return the number consumed bytes. |
| 289 return header_bytes_read; | 288 return header_bytes_read; |
| 290 } | 289 } |
| 291 | 290 |
| 292 } // namespace media | 291 } // namespace media |
| OLD | NEW |