6 #include "wave_class.h"
10 #include "wave_ima_adpcm.h"
11 #include "wave_ms_adpcm.h"
12 #include "wave_alaw.h"
13 #include "wave_ieee_float.h"
14 #include "wave_gsm610.h"
15 #include "wave_g72x.h"
17 DECODERPROTO(DecodeBlocks
);
19 static struct Decoder all_decoders
[] = {
20 { WAVE_FORMAT_PCM
, 0, SetupPCM
, NULL
, DecodePCM
, NULL
},
21 { WAVE_FORMAT_IMA_ADPCM
, 0, SetupIMA_ADPCM
, NULL
, DecodeBlocks
, DecodeIMA_ADPCM
},
22 { WAVE_FORMAT_ADPCM
, 0, SetupMS_ADPCM
, NULL
, DecodeBlocks
, DecodeMS_ADPCM
},
23 { WAVE_FORMAT_IEEE_FLOAT
, 0, SetupIEEE_Float
, NULL
, NULL
, NULL
},
24 { WAVE_FORMAT_ALAW
, 0, SetupALaw
, NULL
, DecodeALaw
, NULL
},
25 { WAVE_FORMAT_MULAW
, 0, SetupALaw
, NULL
, DecodeMuLaw
, NULL
},
27 { WAVE_FORMAT_GSM610
, 0, SetupGSM610
, CleanupGSM610
, DecodeBlocks
, DecodeGSM610
},
30 { WAVE_FORMAT_G721_ADPCM
, 0, SetupG72x
, NULL
, DecodeBlocks
, DecodeG72x
},
31 { WAVE_FORMAT_G723_ADPCM
, 0, SetupG72x
, NULL
, DecodeBlocks
, DecodeG72x
},
36 struct Decoder
* GetDecoder (UWORD fmtTag
) {
38 for (dec
= all_decoders
; dec
->formatTag
; dec
++) {
39 if (dec
->formatTag
== fmtTag
)
45 DECODERPROTO(DecodeBlocks
) {
51 frames_left
= numFrames
;
52 frames
= data
->blockFrames
;
53 blocksize
= fmt
->blockAlign
;
54 while (frames_left
> 0) {
55 if (frames_left
< frames
) frames
= frames_left
;
57 status
= data
->DecodeFrames(data
, fmt
, Src
, Dst
, 1, frames
);
58 if (status
!= frames
) {
59 return numFrames
-frames_left
+status
;
63 frames_left
-= frames
;