00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef RIFF_H
00021 #define RIFF_H
00022
00023 #include "ESR_ReturnCode.h"
00024 #include "plog.h"
00025 #include "passert.h"
00026 #include "pmemory.h"
00027 #include "SR_EventLogPrefix.h"
00028
00029 #define AURORA_BYTES_SEC 5600
00030
00031
00032 #define WAVEFORMAT_PCM 0x01
00033 #define WAVEFORMAT_ALAW 0x06
00034 #define WAVEFORMAT_MULAW 0x07
00035
00036
00037 #define WAVEFORMAT_AURORA 0x99
00038 #define WAVEFORMAT_ES_202_050 0x9A
00039
00043 typedef struct
00044 {
00048 unsigned short nFormatTag;
00052 unsigned short nChannels;
00056 unsigned int nSamplesPerSec;
00060 unsigned int nAvgBytesPerSec;
00064 unsigned short nBlockAlign;
00068 unsigned short wBitsPerSample;
00069 }
00070 WaveFormat;
00071
00075 typedef struct
00076 {
00080 char ckString[4];
00084 int ckLength;
00085 }
00086 ChunkInfoStruct;
00087
00091 typedef struct
00092 {
00096 char riffString[4];
00100 unsigned int riffChunkLength;
00104 char waveString[4];
00108 char fmtString[4];
00112 unsigned int fmtChunkLength;
00116 WaveFormat waveinfo;
00120 char dataString[4];
00124 unsigned int dataLength;
00125 }
00126 RiffHeaderStruct;
00127
00131 typedef struct
00132 {
00136 int pos;
00140 int len;
00144 int type;
00145 }
00146 RiffAudioTuple;
00147
00151 typedef struct
00152 {
00156 int num_tuples;
00160 RiffAudioTuple *tuples;
00161 }
00162 SwiRiffAudio;
00163
00167 typedef struct
00168 {
00172 char *key;
00176 char *value;
00177 }
00178 RiffKVPair;
00179
00183 typedef struct
00184 {
00188 int num_pairs;
00192 RiffKVPair *kvpairs;
00193 }
00194 SwiRiffKeyVals;
00195
00199 typedef struct
00200 {
00204 SwiRiffAudio segs;
00208 SwiRiffKeyVals kvals;
00209 }
00210 SwiRiffStruct;
00211
00212
00213 SREC_EVENTLOG_API int isLittleEndian(void);
00214
00215 SREC_EVENTLOG_API ESR_ReturnCode riffReadWave2L16(
00216 FILE *f,
00217 double from,
00218 double to,
00219 short **samples,
00220 int *rate,
00221 int *length,
00222 SwiRiffStruct *swichunk);
00223
00224 SREC_EVENTLOG_API ESR_ReturnCode convertBuf2Riff(
00225 unsigned char *waveform,
00226 unsigned int num_bytes,
00227 wchar_t *audio_type,
00228 int rate,
00229 int bytes_per_sample,
00230 SwiRiffStruct *swichunk,
00231 unsigned char **buf,
00232 unsigned int *buflen);
00233
00234 SREC_EVENTLOG_API ESR_ReturnCode readRiff2Buf(
00235 FILE *f,
00236 void **waveform,
00237 unsigned int *num_bytes,
00238 const wchar_t **audio_type,
00239 SwiRiffStruct *swichunk);
00240
00241 SREC_EVENTLOG_API int isRiffFile(FILE *fp);
00242 SREC_EVENTLOG_API void free_swiRiff(SwiRiffStruct *swichunk);
00243 SREC_EVENTLOG_API char *getSwiRiffKVal(SwiRiffStruct *swichunk, char *key);
00244 #endif
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254