资源简介
C语言MP3播放器源代码,不要积分,送人啦
代码片段和文件信息
#include
#include
#include
#include “common.h“
char *layer_names[3] = { “I“ “II“ “III“ };
int bitrate[3][15] = {
{0326496128160192224256288320352384416448}
{0324856648096112128160192224256320384}
{032404856648096112128160192224256320}
};
double s_freq[4] = {44.1 48 32 0};
char *mode_names[4] = { “stereo“ “j-stereo“ “dual-ch“ “single-ch“ };
FILE *OpenTableFile(char *name)
{
char fulname[80];
FILE *f;
fulname[0] = ‘\0‘;
strcat(fulname name);
if( (f=fopen(fulname“r“))==NULL ) {
fprintf(stderr“\nOpenTable: could not find %s\n“ fulname);
}
return f;
}
void WriteHdr(frame_params *fr_ps)
{
layer *info = fr_ps->header;
printf(“HDR: sync=FFF id=%X layer=%X ep=%X br=%X sf=%X pd=%X “
info->version info->lay !info->error_protection
info->bitrate_index info->sampling_frequency info->padding);
printf(“pr=%X m=%X js=%X c=%X o=%X e=%X\n“
info->extension info->mode info->mode_ext
info->copyright info->original info->emphasis);
printf(“layer=%s tot bitrate=%d sfrq=%.1f mode=%s “
layer_names[info->lay-1] bitrate[info->lay-1][info->bitrate_index]
s_freq[info->sampling_frequency] mode_names[info->mode]);
printf(“sblim=%d jsbd=%d ch=%d\n“
fr_ps->sblimit fr_ps->jsbound fr_ps->stereo);
}
void *mem_alloc(unsigned long block char *item)
{
void *ptr;
ptr = (void *)malloc((unsigned long)block);
if (ptr != NULL)
memset(ptr 0 block);
else{
printf(“Unable to allocate %s\n“ item);
exit(0);
}
return ptr;
}
/*open and initialize the buffer; */
void alloc_buffer(Bit_stream_struc *bs int size)
{
bs->buf = (unsigned char *) mem_alloc(size*sizeof(unsigned char) “buffer“);
bs->buf_size = size;
}
void desalloc_buffer(Bit_stream_struc *bs)
{
free(bs->buf);
}
/* open the device to read the bit stream from it */
void open_bit_stream_r(Bit_stream_struc *bs char *bs_filenam int size)
{
register unsigned char flag = 1;
if ((bs->pt = fopen(bs_filenam “rb“)) == NULL) {
printf(“Could not find \“%s\“.\n“ bs_filenam);
exit(1);
}
bs->format = BINARY;
alloc_buffer(bs size);
bs->buf_byte_idx=0;
bs->buf_bit_idx=0;
bs->totbit=0;
bs->mode = READ_MODE;
bs->eob = FALSE;
bs->eobs = FALSE;
}
void close_bit_stream_r(Bit_stream_struc *bs)
{
fclose(bs->pt);
desalloc_buffer(bs);
}
/*return the status of the bit stream*/
/* returns 1 if end of bit stream was reached */
/* returns 0 if end of bit stream was not reached */
int end_bs(Bit_stream_struc *bs)
{
return(bs->eobs);
}
/*return the current bit stream length (in bits)*/
unsigned long sstell(Bit_stream_struc *bs)
{
return(bs->totbit);
}
void refill_buffer(Bit_stream_struc *bs)
{
register int i=bs->buf_size-2-bs->buf_byte_idx;
register unsigned long n=1;
while ((i>=0) && (!bs->eob)) {
n=fread(&bs->buf[
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2003-03-04 22:53 mp3_source
目录 0 2003-03-04 22:53 mp3_source\mp3解码源码
文件 1364 1999-03-22 16:20 mp3_source\mp3解码源码\windowing.c
文件 8953 1999-03-22 16:20 mp3_source\mp3解码源码\fastimdct.c
文件 5475 1999-03-22 16:20 mp3_source\mp3解码源码\fastsb.c
文件 9515 1999-03-22 16:20 mp3_source\mp3解码源码\huff.c
文件 19029 1999-03-22 16:20 mp3_source\mp3解码源码\huffman.h
文件 56613 1999-03-22 16:20 mp3_source\mp3解码源码\mp3dec.c
文件 12117 1999-03-22 16:20 mp3_source\mp3解码源码\mp3dec.h
文件 6053 1999-03-22 16:20 mp3_source\mp3解码源码\mp3dec_d.h
文件 4015 1999-03-22 16:20 mp3_source\mp3解码源码\appendxd.htm
目录 0 2003-03-04 22:53 mp3_source\la
目录 0 2003-03-04 22:53 mp3_source\la
文件 7463 1999-01-28 13:27 mp3_source\la
文件 4036 1999-01-28 13:59 mp3_source\la
文件 29648 1999-02-07 23:37 mp3_source\la
文件 1671 1999-01-28 14:09 mp3_source\la
文件 4568 1999-02-07 23:38 mp3_source\la
文件 6006 1999-01-28 09:20 mp3_source\la
文件 2089 1999-01-28 09:19 mp3_source\la
文件 4554 1990-02-02 20:37 mp3_source\la
文件 535 1999-02-07 23:37 mp3_source\la
文件 59587 1999-01-28 16:23 mp3_source\la
文件 18948 1994-08-11 19:04 mp3_source\la
文件 10621 1994-08-11 19:04 mp3_source\la
----------- --------- ---------- ----- ----
273078 26
评论
共有 条评论