Index: media/formats/mpeg/mpeg1_audio_stream_parser.h |
diff --git a/media/formats/mpeg/mpeg1_audio_stream_parser.h b/media/formats/mpeg/mpeg1_audio_stream_parser.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7ce8a0db30d8d3ff05ef328e14b3dd0cf7291696 |
--- /dev/null |
+++ b/media/formats/mpeg/mpeg1_audio_stream_parser.h |
@@ -0,0 +1,57 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef MEDIA_FORMATS_MPEG_MPEG1_AUDIO_STREAM_PARSER_H_ |
+#define MEDIA_FORMATS_MPEG_MPEG1_AUDIO_STREAM_PARSER_H_ |
+ |
+#include "base/basictypes.h" |
+#include "media/base/media_export.h" |
+#include "media/formats/mpeg/mpeg_audio_stream_parser_base.h" |
+ |
+namespace media { |
+ |
+// MPEG1AudioStreamParser handles MPEG-1 audio streams (ISO/IEC 11172-3) |
+// as well as the following extensions: |
+// - MPEG-2 audio (ISO/IEC 13818-3), |
+// - and MPEG2.5 (not an ISO standard). |
+class MEDIA_EXPORT MPEG1AudioStreamParser : public MPEGAudioStreamParserBase { |
+ public: |
+ struct Header { |
+ int version; |
acolwell GONE FROM CHROMIUM
2014/09/04 22:20:53
nit: Since this is a public struct, version and la
damienv1
2014/09/05 20:06:13
Done.
|
+ int layer; |
+ int frame_size; |
+ int sample_rate; |
+ int channel_mode; |
+ ChannelLayout channel_layout; |
+ int sample_count; |
+ }; |
+ |
+ static const int kHeaderSize; |
+ |
+ // Assumption: size of array |data| should be at least the size of an Mpeg1 |
+ // audio header (i.e. should be greater than or equal to 4). |
+ static bool ParseHeader( |
+ const LogCB& log_cb, |
+ const uint8* data, |
+ Header* header); |
+ |
+ MPEG1AudioStreamParser(); |
+ virtual ~MPEG1AudioStreamParser(); |
+ |
+ private: |
+ // MPEGAudioStreamParserBase overrides. |
+ virtual int ParseFrameHeader(const uint8* data, |
+ int size, |
+ int* frame_size, |
+ int* sample_rate, |
+ ChannelLayout* channel_layout, |
+ int* sample_count, |
+ bool* metadata_frame) const OVERRIDE; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(MPEG1AudioStreamParser); |
+}; |
+ |
+} // namespace media |
+ |
+#endif // MEDIA_FORMATS_MPEG_MPEG1_AUDIO_STREAM_PARSER_H_ |