00001
00005 #ifndef CODEC_H
00006 #define CODEC_H
00007
00008 #include <vstypes.h>
00009 #ifndef ASM
00010 #if 0
00011 #include "matrixer.h"
00012 #else
00013 #define MAX_SOURCE_CHANNELS 6
00014 #endif
00015 #endif
00016
00026 #define CODEC_VERSION 0x0105
00027
00037 #define FS_CODEC_SERVICES_VERSION 0x0125
00038
00039
00040 #define FS_CODSER_COMMENT_END_OF_LINE 0x4000U
00041 #define FS_CODSER_COMMENT_END_OF_COMMENTS ((u_int16)(0x8000U))
00042
00043 #ifndef ASM
00044
00053 struct CodecServices {
00056 u_int16 version;
00061 u_int16 (*Read)(struct CodecServices *cs, u_int16 *ptr,
00062 u_int16 firstOdd, u_int16 bytes);
00064 u_int32 (*Skip)(struct CodecServices *cs, u_int32 bytes);
00068 s_int16 (*Seek)(struct CodecServices *cs, s_int32 offset, s_int16 whence);
00070 s_int32 (*Tell)(struct CodecServices *cs);
00075 s_int16 (*Output)(struct CodecServices *cs, s_int16 *data, s_int16 n);
00078 void (*Comment)(struct CodecServices *cs, u_int16 c);
00080 void (*Spectrum)(struct CodecServices *cs, s_int16 __y *data, s_int16 n,
00081 s_int16 ch);
00084 u_int32 fileSize;
00087 u_int32 fileLeft;
00099 u_int16 goTo;
00105 s_int16 cancel;
00108 s_int32 playTimeSeconds;
00111 s_int32 playTimeSamples;
00115 u_int32 playTimeTotal;
00117 u_int32 sampleRate;
00119 u_int16 channels;
00121 enum ChannelMatrix matrix[MAX_SOURCE_CHANNELS];
00123 u_int32 avgBitRate;
00125 u_int32 currBitRate;
00128 u_int32 peakBitRate;
00130 s_int16 gain;
00134 u_int16 fastForward;
00135 };
00136
00137
00138
00139
00140
00142 enum CodecError {
00143 ceFastForward = -1,
00144 ceOk = 0,
00145 ceFormatNotFound,
00146 ceFormatNotSupported,
00147 ceUnexpectedFileEnd,
00148 ceCancelled,
00149 ceOtherError
00150 };
00151
00152
00154 struct Codec {
00157 u_int16 version;
00159 struct Codec *(*Create)(void);
00163 enum CodecError (*Decode)(struct Codec *cod, struct CodecServices *cs,
00164 const char **errorString);
00166 void (*Delete)(struct Codec *cod);
00168 struct CodecServices *cs;
00169 };
00170
00171 #endif
00172
00173 #define CS_VERSION_OFFSET 0
00174 #define CS_READ_OFFSET 1
00175 #define CS_SKIP_OFFSET 2
00176 #define CS_SEEK_OFFSET 3
00177 #define CS_TELL_OFFSET 4
00178 #define CS_OUTPUT_OFFSET 5
00179 #define CS_COMMENT_OFFSET 6
00180 #define CS_SPECTRUM_OFFSET 7
00181 #define CS_FILE_SIZE_OFFSET 8
00182 #define CS_FILE_LEFT_OFFSET 10
00183 #define CS_GO_TO_OFFSET 12
00184 #define CS_CANCEL_OFFSET 13
00185 #define CS_PLAY_TIME_SECONDS_OFFSET 14
00186 #define CS_PLAY_TIME_SAMPLES_OFFSET 16
00187 #define CS_PLAY_TIME_TOTAL_OFFSET 18
00188 #define CS_SAMPLE_RATE_OFFSET 20
00189 #define CS_CHANNELS_OFFSET 22
00190 #define CS_MATRIX_OFFSET 23
00191 #define CS_AVG_BIT_RATE_OFFSET 29
00192 #define CS_CURR_BIT_RATE_OFFSET 31
00193 #define CS_PEAK_BIT_RATE_OFFSET 33
00194 #define CS_GAIN_OFFSET 35
00195 #define CS_FAST_FORWARD_OFFSET 36
00196
00197 #define CODEC_VERSION_OFFSET 0
00198 #define CODEC_CREATE_OFFSET 1
00199 #define CODEC_DECODE_OFFSET 2
00200 #define CODEC_DELETE_OFFSET 3
00201 #define CODEC_CS_OFFSET 4
00202
00203 #endif