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
3 // found in the LICENSE file.
5 #ifndef MEDIA_FORMATS_MPEG_MPEG1_AUDIO_STREAM_PARSER_H_
6 #define MEDIA_FORMATS_MPEG_MPEG1_AUDIO_STREAM_PARSER_H_
8 #include "base/basictypes.h"
9 #include "media/base/media_export.h"
10 #include "media/formats/mpeg/mpeg_audio_stream_parser_base.h"
14 // MPEG1AudioStreamParser handles MPEG-1 audio streams (ISO/IEC 11172-3)
15 // as well as the following extensions:
16 // - MPEG-2 audio (ISO/IEC 13818-3),
17 // - and MPEG2.5 (not an ISO standard).
18 class MEDIA_EXPORT MPEG1AudioStreamParser
: public MPEGAudioStreamParserBase
{
20 // Size of an MPEG-1 frame header in bytes.
25 // Versions and layers as defined in ISO/IEC 11172-3.
43 // Layer as defined in ISO/IEC 11172-3 bitstream specification.
46 // Frame size in bytes.
52 // Channel mode as defined in ISO/IEC 11172-3 bitstream specification.
56 ChannelLayout channel_layout
;
58 // Number of samples per frame.
62 // Parses the header starting at |data|.
63 // Assumption: size of array |data| should be at least |kHeaderSize|.
64 // Returns false if the header is not valid.
65 static bool ParseHeader(const scoped_refptr
<MediaLog
>& media_log
,
69 MPEG1AudioStreamParser();
70 ~MPEG1AudioStreamParser() override
;
73 // MPEGAudioStreamParserBase overrides.
74 int ParseFrameHeader(const uint8
* data
,
78 ChannelLayout
* channel_layout
,
80 bool* metadata_frame
) const override
;
82 DISALLOW_COPY_AND_ASSIGN(MPEG1AudioStreamParser
);
87 #endif // MEDIA_FORMATS_MPEG_MPEG1_AUDIO_STREAM_PARSER_H_