Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Side by Side Diff: media/formats/mpeg/mpeg1_audio_stream_parser.cc

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 namespace media { 7 namespace media {
8 8
9 static const uint32 kMPEG1StartCodeMask = 0xffe00000; 9 static const uint32_t kMPEG1StartCodeMask = 0xffe00000;
10 10
11 // Map that determines which bitrate_index & channel_mode combinations 11 // Map that determines which bitrate_index & channel_mode combinations
12 // are allowed. 12 // are allowed.
13 // Derived from: http://mpgedit.org/mpgedit/mpeg_format/MP3Format.html 13 // Derived from: http://mpgedit.org/mpgedit/mpeg_format/MP3Format.html
14 static const bool kIsAllowed[17][4] = { 14 static const bool kIsAllowed[17][4] = {
15 { true, true, true, true }, // free 15 { true, true, true, true }, // free
16 { true, false, false, false }, // 32 16 { true, false, false, false }, // 32
17 { true, false, false, false }, // 48 17 { true, false, false, false }, // 48
18 { true, false, false, false }, // 56 18 { true, false, false, false }, // 56
19 { true, true, true, true }, // 64 19 { true, true, true, true }, // 64
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 // Frame header field constants. 82 // Frame header field constants.
83 static const int kBitrateFree = 0; 83 static const int kBitrateFree = 0;
84 static const int kBitrateBad = 0xf; 84 static const int kBitrateBad = 0xf;
85 static const int kSampleRateReserved = 3; 85 static const int kSampleRateReserved = 3;
86 static const int kCodecDelay = 529; 86 static const int kCodecDelay = 529;
87 87
88 // static 88 // static
89 bool MPEG1AudioStreamParser::ParseHeader( 89 bool MPEG1AudioStreamParser::ParseHeader(
90 const scoped_refptr<MediaLog>& media_log, 90 const scoped_refptr<MediaLog>& media_log,
91 const uint8* data, 91 const uint8_t* data,
92 Header* header) { 92 Header* header) {
93 BitReader reader(data, kHeaderSize); 93 BitReader reader(data, kHeaderSize);
94 int sync; 94 int sync;
95 int version; 95 int version;
96 int layer; 96 int layer;
97 int is_protected; 97 int is_protected;
98 int bitrate_index; 98 int bitrate_index;
99 int sample_rate_index; 99 int sample_rate_index;
100 int has_padding; 100 int has_padding;
101 int is_private; 101 int is_private;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 header->channel_mode = channel_mode; 214 header->channel_mode = channel_mode;
215 return true; 215 return true;
216 } 216 }
217 217
218 218
219 MPEG1AudioStreamParser::MPEG1AudioStreamParser() 219 MPEG1AudioStreamParser::MPEG1AudioStreamParser()
220 : MPEGAudioStreamParserBase(kMPEG1StartCodeMask, kCodecMP3, kCodecDelay) {} 220 : MPEGAudioStreamParserBase(kMPEG1StartCodeMask, kCodecMP3, kCodecDelay) {}
221 221
222 MPEG1AudioStreamParser::~MPEG1AudioStreamParser() {} 222 MPEG1AudioStreamParser::~MPEG1AudioStreamParser() {}
223 223
224 int MPEG1AudioStreamParser::ParseFrameHeader(const uint8* data, 224 int MPEG1AudioStreamParser::ParseFrameHeader(const uint8_t* data,
225 int size, 225 int size,
226 int* frame_size, 226 int* frame_size,
227 int* sample_rate, 227 int* sample_rate,
228 ChannelLayout* channel_layout, 228 ChannelLayout* channel_layout,
229 int* sample_count, 229 int* sample_count,
230 bool* metadata_frame) const { 230 bool* metadata_frame) const {
231 DCHECK(data); 231 DCHECK(data);
232 DCHECK_GE(size, 0); 232 DCHECK_GE(size, 0);
233 DCHECK(frame_size); 233 DCHECK(frame_size);
234 234
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 if (metadata_frame) 279 if (metadata_frame)
280 *metadata_frame = true; 280 *metadata_frame = true;
281 return header_bytes_read + reader.bits_read() / 8; 281 return header_bytes_read + reader.bits_read() / 8;
282 } 282 }
283 283
284 // If it wasn't a XING frame, just return the number consumed bytes. 284 // If it wasn't a XING frame, just return the number consumed bytes.
285 return header_bytes_read; 285 return header_bytes_read;
286 } 286 }
287 287
288 } // namespace media 288 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698