• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef _IO_WAV_WAVCHUNKHEADER_H_
17 #define _IO_WAV_WAVCHUNKHEADER_H_
18 
19 #include "WavTypes.h"
20 
21 namespace parselib {
22 
23 class InputStream;
24 
25 /**
26  * Superclass for all RIFF chunks. Handles the chunk ID and chunk size.
27  * Concrete subclasses include chunks for 'RIFF' and 'fmt ' chunks.
28  */
29 class WavChunkHeader {
30 public:
31     static const RiffID RIFFID_DATA;
32 
33     RiffID mChunkId;
34     RiffInt32 mChunkSize;
35 
WavChunkHeader()36     WavChunkHeader() : mChunkId(0), mChunkSize(0) {}
37 
WavChunkHeader(RiffID chunkId)38     WavChunkHeader(RiffID chunkId) : mChunkId(chunkId), mChunkSize(0) {}
39 
40     /**
41      * Reads the contents of the chunk. In this class, just the ID and size fields.
42      * When implemented in a concrete subclass, that implementation MUST call this (super) method
43      * as the first step. It may then read the fields specific to that chunk type.
44      */
45     virtual void read(InputStream *stream);
46 };
47 
48 } // namespace parselib
49 
50 #endif // _IO_WAV_WAVCHUNKHEADER_H_
51