1 /* this file is a part of amp software, (C) tomislav uzelac 1996,1997 2 */ 3 4 /* getbits.h 5 * 6 * Created by: tomislav uzelac Apr 1996 7 */ 8 9 /* gethdr() error codes 10 */ 11 #define GETHDR_ERR 0x1 12 #define GETHDR_NS 0x2 13 #define GETHDR_FL1 0x4 14 #define GETHDR_FL2 0x8 15 #define GETHDR_FF 0x10 16 #define GETHDR_SYN 0x20 17 #define GETHDR_EOF 0x30 18 19 /* buffer for the 'bit reservoir' 20 */ 21 #define BUFFER_SIZE 4096 22 #define BUFFER_AUX 2048 23 extern unsigned char buffer[]; 24 extern int append,data,f_bdirty,bclean_bytes; 25 26 /* exports 27 */ 28 extern int fillbfr(unsigned int advance); 29 extern unsigned int getbits(int n); 30 extern int gethdr(struct AUDIO_HEADER *header); 31 extern void getcrc(); 32 extern void getinfo(struct AUDIO_HEADER *header,struct SIDE_INFO *info); 33 extern int dummy_getinfo(int n); 34 extern int rewind_stream(int nbytes); 35 36 37 #ifdef GETBITS 38 39 /* buffer, AUX is used in case of input buffer "overflow", and its contents 40 * are copied to the beginning of the buffer 41 */ 42 unsigned char buffer[BUFFER_SIZE+BUFFER_AUX+1]; 43 44 /* buffer pointers: append counts in bytes, data in bits 45 */ 46 int append,data; 47 48 /* bit reservoir stuff. f_bdirty must be set to TRUE when starting play! 49 */ 50 int f_bdirty,bclean_bytes; 51 52 /* internal buffer, _bptr holds the position in _bits_ 53 */ 54 static unsigned char _buffer[32]; 55 static int _bptr; 56 57 58 /* buffer and bit manipulation functions 59 */ 60 static inline int _fillbfr(unsigned int size); 61 static inline int readsync(); 62 static inline int get_input(unsigned char* bp, unsigned int size); 63 static inline unsigned int _getbits(int n); 64 int fillbfr(unsigned int advance); 65 unsigned int getbits(int n); 66 int dummy_getinfo(int n); 67 int rewind_stream(int nbytes); 68 69 /* header and side info parsing stuff 70 */ 71 static inline void parse_header(struct AUDIO_HEADER *header); 72 static inline int header_sanity_check(struct AUDIO_HEADER *header); 73 74 int gethdr(struct AUDIO_HEADER *header); 75 void getcrc(); 76 void getinfo(struct AUDIO_HEADER *header,struct SIDE_INFO *info); 77 78 #endif /* GETBITS */ 79 80