Switch TestFrameNavigationObserver to DidCommitProvisionalLoadForFrame.
[chromium-blink-merge.git] / media / formats / mpeg / mpeg1_audio_stream_parser.h
blobb2e5086f8471e8cb28f669271ab19bd65309b38c
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"
12 namespace media {
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 {
19 public:
20 // Size of an MPEG-1 frame header in bytes.
21 enum {
22 kHeaderSize = 4,
25 // Versions and layers as defined in ISO/IEC 11172-3.
26 enum Version {
27 kVersion1 = 3,
28 kVersion2 = 2,
29 kVersionReserved = 1,
30 kVersion2_5 = 0,
33 enum Layer {
34 kLayer1 = 3,
35 kLayer2 = 2,
36 kLayer3 = 1,
37 kLayerReserved = 0,
40 struct Header {
41 Version version;
43 // Layer as defined in ISO/IEC 11172-3 bitstream specification.
44 Layer layer;
46 // Frame size in bytes.
47 int frame_size;
49 // Sample frequency.
50 int sample_rate;
52 // Channel mode as defined in ISO/IEC 11172-3 bitstream specification.
53 int channel_mode;
55 // Channel layout.
56 ChannelLayout channel_layout;
58 // Number of samples per frame.
59 int sample_count;
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(
66 const LogCB& log_cb,
67 const uint8* data,
68 Header* header);
70 MPEG1AudioStreamParser();
71 ~MPEG1AudioStreamParser() override;
73 private:
74 // MPEGAudioStreamParserBase overrides.
75 int ParseFrameHeader(const uint8* data,
76 int size,
77 int* frame_size,
78 int* sample_rate,
79 ChannelLayout* channel_layout,
80 int* sample_count,
81 bool* metadata_frame) const override;
83 DISALLOW_COPY_AND_ASSIGN(MPEG1AudioStreamParser);
86 } // namespace media
88 #endif // MEDIA_FORMATS_MPEG_MPEG1_AUDIO_STREAM_PARSER_H_