sipxmedialib  Version 3.3
MpAudioWaveFileRead.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2006 SIPez LLC.
3 // Licensed to SIPfoundry under a Contributor Agreement.
4 //
5 // Copyright (C) 2004-2006 SIPfoundry Inc.
6 // Licensed by SIPfoundry under the LGPL license.
7 //
8 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
9 // Licensed to SIPfoundry under a Contributor Agreement.
10 //
11 // $$
13 
14 
15 #ifndef MP_AUDIO_WAVE_FILE_READ_H
16 #define MP_AUDIO_WAVE_FILE_READ_H
17 
18 #include "mp/MpAudioAbstract.h"
20 
21 bool isWaveFile(istream &file);
22 
24 public:
25  typedef enum {
32 
33 /* ============================ CREATORS ================================== */
35 
36 
38  MpAudioWaveFileRead(istream & s);
39 
42 
44 
45 /* ============================ MANIPULATORS ============================== */
47 
48 
49  size_t readBytes(AudioByte *buffer, size_t numSamples);
50 
51  size_t getBytesSize();
52 
54 
56 
57 /* //////////////////////////// PRIVATE /////////////////////////////////// */
58 private:
59  void minMaxSamplingRate(long *min, long *max, long *preferred);
60  void minMaxChannels(int *min, int *max, int *preferred);
61  size_t getSamples(AudioSample *buffer, size_t numSamples);
63 
65  void nextChunk(void);
66 
67 private:
68  //: private stream, ... stuff
69  istream & mStream;
71  unsigned char *mpformatData;
72  unsigned long mformatDataLength;
73 
74 private:
75  //: Chunk stuff
76  // WAVE chunk stack
77  struct {
78  unsigned long type;
79  unsigned long size;
80  unsigned long remaining;
81  bool isContainer;
82  unsigned long containerType;
83  } _chunk[5];
85  unsigned long mFileSize;
86 };
87 
88 #endif
Definition: MpAudioAbstract.h:30
Definition: MpAudioWaveFileRead.h:27
unsigned long remaining
Bytes left to read.
Definition: MpAudioWaveFileRead.h:80
unsigned long mformatDataLength
length of fmt chunk
Definition: MpAudioWaveFileRead.h:72
WaveDecompressionType
Definition: MpAudioWaveFileRead.h:25
unsigned long containerType
type of container
Definition: MpAudioWaveFileRead.h:82
Definition: MpAudioFileDecompress.h:25
istream & mStream
Definition: MpAudioWaveFileRead.h:69
unsigned long size
Size of chunk.
Definition: MpAudioWaveFileRead.h:79
struct MpAudioWaveFileRead::@6 _chunk[5]
int _currentChunk
top of stack
Definition: MpAudioWaveFileRead.h:84
MpAudioWaveFileRead(istream &s)
Constructor form a stream.
Definition: MpAudioWaveFileRead.cpp:42
Definition: MpAudioWaveFileRead.h:29
AbstractDecompressor * _decoder
Current decompressor.
Definition: MpAudioWaveFileRead.h:70
int getDecompressionType()
get decompression type of the audio file
Definition: MpAudioWaveFileRead.cpp:109
Definition: MpAudioWaveFileRead.h:26
void minMaxSamplingRate(long *min, long *max, long *preferred)
TODO: the meaning of this function, get the prefered Sampling rate.
Definition: MpAudioWaveFileRead.cpp:143
void minMaxChannels(int *min, int *max, int *preferred)
Get prefered channel.
Definition: MpAudioWaveFileRead.cpp:150
unsigned long type
Type of chunk.
Definition: MpAudioWaveFileRead.h:78
Definition: MpAudioWaveFileRead.h:30
bool isContainer
true if this is a container
Definition: MpAudioWaveFileRead.h:81
Definition: MpAudioWaveFileRead.h:23
size_t readBytes(AudioByte *buffer, size_t numSamples)
read length of bytes
Definition: MpAudioWaveFileRead.cpp:78
unsigned char AudioByte
Definition: MpAudioAbstract.h:22
unsigned long mFileSize
Definition: MpAudioWaveFileRead.h:85
short AudioSample
Definition: MpAudioAbstract.h:21
Definition: MpAudioWaveFileRead.h:28
unsigned char * mpformatData
Contents of fmt chunk.
Definition: MpAudioWaveFileRead.h:71
size_t getSamples(AudioSample *buffer, size_t numSamples)
Returns number of samples actually read, 0 on error.
Definition: MpAudioWaveFileRead.cpp:160
bool isWaveFile(istream &file)
Definition: MpAudioWaveFileRead.cpp:27
~MpAudioWaveFileRead()
Destructor.
Definition: MpAudioWaveFileRead.cpp:70
void nextChunk(void)
Get next chunk for chunk management.
Definition: MpAudioWaveFileRead.cpp:227
void initializeDecompression()
Definition: MpAudioWaveFileRead.cpp:168
size_t getBytesSize()
get bytes size of the audio file
Definition: MpAudioWaveFileRead.cpp:96