Chromium Code Reviews| 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 #ifndef MEDIA_FORMATS_MPEG_MP3_STREAM_PARSER_H_ | 5 #ifndef MEDIA_FORMATS_MPEG_MP3_STREAM_PARSER_H_ |
| 6 #define MEDIA_FORMATS_MPEG_MP3_STREAM_PARSER_H_ | 6 #define MEDIA_FORMATS_MPEG_MP3_STREAM_PARSER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "media/base/media_export.h" | 9 #include "media/base/media_export.h" |
| 10 #include "media/formats/mpeg/mpeg_audio_stream_parser_base.h" | 10 #include "media/formats/mpeg/mpeg_audio_stream_parser_base.h" |
| 11 | 11 |
| 12 namespace media { | 12 namespace media { |
| 13 | 13 |
| 14 class MEDIA_EXPORT MP3StreamParser : public MPEGAudioStreamParserBase { | 14 class MEDIA_EXPORT MP3StreamParser : public MPEGAudioStreamParserBase { |
| 15 public: | 15 public: |
| 16 struct Mpeg1AudioHeader { | |
| 17 int version; | |
| 18 int layer; | |
| 19 int frame_size; | |
| 20 int sample_rate; | |
| 21 int channel_mode; | |
| 22 ChannelLayout channel_layout; | |
| 23 int sample_count; | |
| 24 }; | |
| 25 | |
| 26 static const int kMpeg1AudioHeaderSize; | |
| 27 | |
| 28 // Assumption: size of array |data| should be at least the size of an Mpeg1 | |
| 29 // audio header (i.e. should be greater than or equal to 4). | |
|
damienv1
2014/09/03 17:43:43
Update the comment using kMpeg1AudioHeaderSize ins
| |
| 30 static bool ParserMpeg1AudioFrameHeader( | |
|
damienv1
2014/09/03 18:59:54
Could be simply ParseMpeg1AudioHeader.
| |
| 31 const LogCB& log_cb, | |
| 32 const uint8* data, | |
| 33 Mpeg1AudioHeader* header); | |
| 34 | |
| 16 MP3StreamParser(); | 35 MP3StreamParser(); |
| 17 virtual ~MP3StreamParser(); | 36 virtual ~MP3StreamParser(); |
| 18 | 37 |
| 19 private: | 38 private: |
| 20 // MPEGAudioStreamParserBase overrides. | 39 // MPEGAudioStreamParserBase overrides. |
| 21 virtual int ParseFrameHeader(const uint8* data, | 40 virtual int ParseFrameHeader(const uint8* data, |
| 22 int size, | 41 int size, |
| 23 int* frame_size, | 42 int* frame_size, |
| 24 int* sample_rate, | 43 int* sample_rate, |
| 25 ChannelLayout* channel_layout, | 44 ChannelLayout* channel_layout, |
| 26 int* sample_count, | 45 int* sample_count, |
| 27 bool* metadata_frame) const OVERRIDE; | 46 bool* metadata_frame) const OVERRIDE; |
| 28 | 47 |
| 29 DISALLOW_COPY_AND_ASSIGN(MP3StreamParser); | 48 DISALLOW_COPY_AND_ASSIGN(MP3StreamParser); |
| 30 }; | 49 }; |
| 31 | 50 |
| 32 } // namespace media | 51 } // namespace media |
| 33 | 52 |
| 34 #endif // MEDIA_FORMATS_MPEG_MP3_STREAM_PARSER_H_ | 53 #endif // MEDIA_FORMATS_MPEG_MP3_STREAM_PARSER_H_ |
| OLD | NEW |