www.pudn.com > wav_mp3_recorder.rar > types.h
#ifndef TYPES_H #define TYPES_H #include#include #include #include #include #include #include #include #include #include #include #define RATE 8000 #define BITWIDTH 16 #define CHANNELS 1 #define BITRATE 48 #define sizes 500 #define MP3_FRAME_LEN 500 #define MPEG2_5 0 #define MPEG2 2 #define MPEG1 3 #define MODE_STEREO 0 #define MODE_MS_STEREO 1 #define MODE_DUAL_CHANNEL 2 #define MODE_MONO 3 #define LAYER_3 1 #define LAYER_2 2 #define LAYER_1 3 #define samp_per_frame 1152 #define samp_per_frame2 576 #define PCM_FRAME_LEN1 1152 #define PCM_FRAME_LEN2 576 #define HAN_SIZE 512 #define SBLIMIT 32 //short buf[samp_per_frame2]; //1152 int cutoff; int fd; int mixerhander; int raw; int mono_from_stereo; typedef struct { FILE *file; int type; int channels; int bits; long samplerate; long total_samples; long length; } wave_t; typedef struct { FILE *file; int type; int layr; int mode; int bitr; int psyc; int emph; int padding; long samples_per_frame; long bits_per_frame; long bits_per_slot; long total_frames; int bitrate_index; int samplerate_index; int crc; int ext; int mode_ext; int copyright; int original; int channels; int granules; int resv_limit; } mpeg_t; typedef struct { time_t start_time; char* infile; wave_t wave; char* outfile; mpeg_t mpeg; } config_t; extern config_t config; #define HUFFBITS unsigned long int #define HTN 34 #define MXOFF 250 struct huffcodetab { unsigned int xlen; /*max. x-index+ */ unsigned int ylen; /*max. y-index+ */ unsigned int linbits; /*number of linbits */ unsigned int linmax; /*max number to be stored in linbits */ HUFFBITS *table; /*pointer to array[xlen][ylen] */ unsigned char *hlen; /*pointer to array[xlen][ylen] */ }; extern struct huffcodetab ht[HTN];/* global memory block */ /* array of all huffcodtable headers */ /* 0..31 Huffman code table 0..31 */ /* 32,33 count1-tables */ /* Side information */ typedef struct { unsigned part2_3_length; unsigned big_values; unsigned count1; unsigned global_gain; unsigned table_select[3]; unsigned region0_count; unsigned region1_count; unsigned count1table_select; unsigned address1; unsigned address2; unsigned address3; int quantizerStepSize; } gr_info; typedef struct { int main_data_begin; struct { struct { gr_info tt; } ch[2]; } gr[2]; int resv_drain; } L3_side_info_t; /* function prototypes */ void error(char* s); /* bitstream.c */ void open_bit_stream(void); void close_bit_stream(void); int L3_format_bitstream(int l3_enc[samp_per_frame2], L3_side_info_t *l3_side, unsigned char* audio); /* l3loop.c */ void L3_iteration_loop(long mdct_freq_org[samp_per_frame2], L3_side_info_t *side_info, int l3_enc[samp_per_frame2], int mean_bits); /* layer3.c */ void Mp3_Encode_Initial(void); int Mp3_Encode(short* pcm_data, unsigned char* mp3_data); /* wave.c */ void wave_open(int raw, int mono_from_stereo); unsigned long int *wave_get(short* buffer); void wave_close(void); /* coder.c */ void L3_window_filter_subband(unsigned long **buffer, long s[SBLIMIT], int k); void L3_mdct_sub(long sb_sample[2][18][SBLIMIT], long mdct_freq[samp_per_frame2]); /* utils.c */ long mul(int x, int y); long muls(int x, int y); long mulr(int x, int y); long mulsr(int x, int y); /* audio.c */ //void get_mp3_header_info(mp3_header* info); void wave_initial(void); int Mp3_Initial(void); #endif