35 #ifndef PTLIB_PWAVFILE_H
36 #define PTLIB_PWAVFILE_H
50 #define P_PACKED __attribute__ ((packed));
470 #endif // PTLIB_PWAVFILE_H
PINDEX lastWriteCount
Number of byte last written by the Write() function.
Definition: channel.h:723
off_t RawGetPosition() const
PString GetFormatString() const
Return a string that describes the WAV format.
Definition: pwavfile.h:414
IMA-ADPCM, 8kHz mono.
Definition: pwavfile.h:188
This class represents a disk file.
Definition: file.h:60
virtual PString GetFormatAsString() const
PBYTEArray wavHeaderData
Definition: pwavfile.h:450
virtual PBoolean Open(OpenMode mode=ReadWrite, int opts=ModeDefault)
Open the current file in the specified mode and with the specified options.
static PWAVFile * format(const PString &format)
void SetLastReadCount(PINDEX v)
Definition: pwavfile.h:433
Definition: pwavfile.h:203
virtual ~PWAVFileConverter()
Definition: pwavfile.h:158
bool SelectFormat(unsigned fmt)
Definition: pwavfile.h:200
virtual void SetSampleSize(unsigned v)
virtual PBoolean Read(PWAVFile &file, void *buf, PINDEX len)=0
virtual PBoolean SetPosition(PWAVFile &file, off_t pos, PFile::FilePositionOrigin origin)=0
virtual PBoolean Read(void *buf, PINDEX len)
Call PFile::Read() to read in audio data and perform necessary processing such as byte-order swaping...
PBoolean RawSetPosition(off_t pos, FilePositionOrigin origin)
A class representing a WAV audio file.
Definition: pwavfile.h:172
MS-ADPCM, 8kHz, mono.
Definition: pwavfile.h:184
virtual unsigned GetFormat() const
Find out the format of the WAV file.
PWAVFileConverter * autoConverter
Definition: pwavfile.h:460
virtual void SetBytesPerSecond(unsigned v)
RFC2361.
Definition: pwavfile.h:191
This class describes a full description for a file on the particular platform.
Definition: filepath.h:65
File can be both read and written.
Definition: file.h:80
PWAV::FMTChunk wavFmtChunk
Definition: pwavfile.h:451
virtual unsigned GetSampleRate() const
Find out the sample rate of the WAV file in Hz.
PBoolean RawRead(void *buf, PINDEX len)
PBYTEArray extendedHeader
Definition: pwavfile.h:452
PWAVFileFormat * formatHandler
Definition: pwavfile.h:457
virtual unsigned GetSampleSize(const PWAVFile &file) const =0
VivoActive G.723.1.
Definition: pwavfile.h:196
off_t GetHeaderLength() const
Find out the size of WAV header presented in the file.
virtual off_t GetPosition(const PWAVFile &file) const =0
off_t lenHeader
Definition: pwavfile.h:462
PUInt16l bitsPerSample P_PACKED
Bits Per Sample, eg 16.
Definition: pwavfile.h:76
PUInt16l bytesPerSample P_PACKED
Bytes Per Sample, eg 2.
Definition: pwavfile.h:75
PUInt32l sampleRate P_PACKED
Sample Rate in Hz.
Definition: pwavfile.h:73
PBoolean FileRead(void *buf, PINDEX len)
PFactory< PWAVFileFormat, PCaselessString > PWAVFileFormatByFormatFactory
Definition: pwavfile.h:147
virtual void SetSampleRate(unsigned v)
A-Law 8kHz.
Definition: pwavfile.h:185
virtual PBoolean Write(const void *buf, PINDEX len)
Call PFile::Write() to write out audio data and perform necessary processing such as byte-order swapi...
PBoolean FileWrite(const void *buf, PINDEX len)
PINDEX lastReadCount
Number of byte last read by the Read() function.
Definition: channel.h:721
BOOL PBoolean
Definition: object.h:102
RFC2361.
Definition: pwavfile.h:195
virtual unsigned GetFormat(const PWAVFile &file) const =0
Array of unsigned characters.
Definition: array.h:670
PFACTORY_LOAD(PWAVFileFormatPCM)
bool isValidWAV
Definition: pwavfile.h:454
virtual off_t GetDataLength(PWAVFile &file)=0
off_t lenData
Definition: pwavfile.h:463
ChunkHeader hdr
chunk header (already packed)
Definition: pwavfile.h:70
PBoolean IsValid() const
Determine if the WAV file is a valid wave file.
Definition: pwavfile.h:410
Definition: pwavfile.h:199
bool header_needs_updating
Definition: pwavfile.h:465
PFactory< PWAVFileFormat, unsigned > PWAVFileFormatByIDFactory
Definition: pwavfile.h:148
PBoolean RawWrite(const void *buf, PINDEX len)
FilePositionOrigin
Options for the origin in setting the file position.
Definition: file.h:457
virtual PBoolean SetFormat(unsigned fmt)
Find out the format of the WAV file.
virtual PBoolean Close()
Close the file channel.
PWAVFile(unsigned format=fmt_PCM)
Create a WAV file object but do not open it.
RFC2361.
Definition: pwavfile.h:190
PUInt32l bytesPerSec P_PACKED
Average bytes Per Second.
Definition: pwavfile.h:74
PUInt16l numChannels P_PACKED
Channels 0x01 = mono, 0x02 = stereo.
Definition: pwavfile.h:72
void SetLastWriteCount(PINDEX v)
Definition: pwavfile.h:434
The character string class.
Definition: pstring.h:108
OKI ADPCM.
Definition: pwavfile.h:187
u-Law 8kHz
Definition: pwavfile.h:186
File options depend on the OpenMode parameter.
Definition: file.h:95
Definition: pwavfile.h:47
RFC2361.
Definition: pwavfile.h:194
Microsoft G.723.1.
Definition: pwavfile.h:192
virtual void SetChannels(unsigned v)
Template class for generic factories of an abstract class.
Definition: pfactory.h:144
PBoolean autoConvert
Definition: pwavfile.h:459
virtual off_t GetDataLength()
Find out how many bytes of audio data there are.
virtual off_t GetPosition() const
Get the current active position in the file for the next read or write operation. ...
PBoolean GenerateHeader()
PFactory< PWAVFileConverter, unsigned > PWAVFileConverterFactory
Definition: pwavfile.h:168
unsigned int origFmt
Definition: pwavfile.h:456
virtual unsigned GetSampleSize() const
Find out how may bits there are per sample, eg 8 or 16.
GSM.
Definition: pwavfile.h:189
Abstract factory class for autoconversion of WAV files to/from PCM-16.
Definition: pwavfile.h:155
PUInt16l format P_PACKED
Format.
Definition: pwavfile.h:71
virtual unsigned GetChannels() const
Find out the number of channels the WAV file has.
Set position relative to start of file.
Definition: file.h:459
RFC2361.
Definition: pwavfile.h:193
void SetAutoconvert()
Enable autoconversion between PCM-16 and the native format.
~PWAVFile()
Close the file before destruction.
virtual PBoolean Write(PWAVFile &file, const void *buf, PINDEX len)=0
WaveType
When a file is opened for writing, we can specify if this is a PCM wav file or a G.723.1 wav file.
Definition: pwavfile.h:182
Definition: pwavfile.h:68
PCM, 8kHz, 16 bit, mono.
Definition: pwavfile.h:183
virtual PBoolean SetPosition(off_t pos, FilePositionOrigin origin=Start)
Set the current active position in the file for the next read or write operation. ...
OpenMode
When a file is opened, it may restrict the access available to operations on the object instance...
Definition: file.h:77
virtual unsigned GetBytesPerSecond() const
Find out how may bytes there are per second.