sipxmedialib  Version 3.3
mpau.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 #ifndef AU_H_INCLUDED
15 #define AU_H_INCLUDED
16 #include "mp/MpAudioAbstract.h"
18 #include <iostream>
19 
20 bool isAuFile(istream &file);
21 
22 class MpAuRead: public MpAudioAbstract {
23 
24 private:
25  istream & mStream;
28 public:
29  typedef enum {
34 
35  MpAuRead(istream & s, int raw = 0);
36 
38  if (_decoder) delete _decoder;
39  }
40  size_t getSamples(AudioSample *buffer, size_t numSamples) {
41  return _decoder->getSamples(buffer,numSamples);
42  }
43 private:
44  size_t _dataLength;
45 public:
46  size_t readBytes(AudioByte *buffer, size_t length);
48  size_t getBytesSize();
49 
50 private:
51  bool _headerRead;
54  void ReadHeader(void);
55 protected:
56  void minMaxSamplingRate(long *min, long *max, long *preferred) {
57  ReadHeader();
58  *min = *max = *preferred = _headerRate;
59  }
60  void minMaxChannels(int *min, int *max, int *preferred) {
61  ReadHeader();
62  *min = *max = *preferred = _headerChannels;
63  }
64 };
65 
66 #endif
Definition: MpAudioAbstract.h:30
Definition: mpau.h:22
MpAuRead(istream &s, int raw=0)
Definition: mpau.cpp:19
Definition: MpAudioFileDecompress.h:25
~MpAuRead()
Definition: mpau.h:37
size_t readBytes(AudioByte *buffer, size_t length)
read length of bytes
Definition: mpau.cpp:37
Definition: mpau.h:30
int m_CompressionType
Definition: mpau.h:26
void minMaxSamplingRate(long *min, long *max, long *preferred)
TODO: the meaning of this function, get the prefered Sampling rate.
Definition: mpau.h:56
size_t getBytesSize()
get bytes size of the audio file
Definition: mpau.cpp:46
Definition: mpau.h:32
size_t _dataLength
Definition: mpau.h:44
istream & mStream
Definition: mpau.h:25
int _headerChannels
channels from header
Definition: mpau.h:52
void ReadHeader(void)
Definition: mpau.cpp:51
bool isAuFile(istream &file)
Definition: mpau.cpp:30
AuDecompressionType
Definition: mpau.h:29
bool _headerRead
true if header has already been read
Definition: mpau.h:51
AbstractDecompressor * _decoder
Definition: mpau.h:27
unsigned char AudioByte
Definition: MpAudioAbstract.h:22
short AudioSample
Definition: MpAudioAbstract.h:21
size_t getSamples(AudioSample *buffer, size_t numSamples)
Returns number of samples actually read, 0 on error.
Definition: mpau.h:40
Definition: mpau.h:31
int getDecompressionType()
get decompression type of the audio file
Definition: mpau.h:47
int _headerRate
sampling rate from header
Definition: mpau.h:53
virtual size_t getSamples(AudioSample *, size_t)=0
void minMaxChannels(int *min, int *max, int *preferred)
Get prefered channel.
Definition: mpau.h:60