⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 common.c

📁 从 IEEE 1394总线接收传输流
💻 C
字号:
/* this file from mpg123 was adapted for mpeg2ts1394dec. Not needed stuff is eliminated */#include <ctype.h>#include <stdlib.h>#include <signal.h>#include <sys/types.h>#include <sys/stat.h>#include <sys/time.h>#include <fcntl.h>#ifdef READ_MMAP#include <sys/mman.h>#ifndef MAP_FAILED#define MAP_FAILED ( (void *) -1 )#endif#endif#include "mpg123.h"/* #include "genre.h" */#include "common.h"int tabsel_123[2][3][16] = {   { {0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,},     {0,32,48,56, 64, 80, 96,112,128,160,192,224,256,320,384,},     {0,32,40,48, 56, 64, 80, 96,112,128,160,192,224,256,320,} },   { {0,32,48,56,64,80,96,112,128,144,160,176,192,224,256,},     {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,},     {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,} }};long freqs[9] = { 44100, 48000, 32000, 22050, 24000, 16000 , 11025 , 12000 , 8000 };/* these 5 variables must be set before playing a frame */struct bitstream_info bsi;unsigned char *bsbuf, *bsbufold;int fsizeold=0,ssize;/* this is needed for audio_oss; it was in buffer.c, but we don't use this here */int outburst = MAXOUTBURST;unsigned char *pcm_sample;int pcm_point = 0;int audiobufsize = AUDIOBUFSIZE;void audio_flush(int outmode, struct audio_info_struct *ai){	if (pcm_point) {		audio_play_samples (ai, pcm_sample, pcm_point);		pcm_point = 0;	}}#if !defined(WIN32) && !defined(GENERIC)void (*catchsignal(int signum, void(*handler)()))(){  struct sigaction new_sa;  struct sigaction old_sa;#ifdef DONT_CATCH_SIGNALS  printf ("Not catching any signals.\n");  return ((void (*)()) -1);#endif  new_sa.sa_handler = handler;  sigemptyset(&new_sa.sa_mask);  new_sa.sa_flags = 0;  if (sigaction(signum, &new_sa, &old_sa) == -1)    return ((void (*)()) -1);  return (old_sa.sa_handler);}#endif/*	is now in mpeg2demux.cppvoid read_frame_init (void){    oldhead = 0;    firsthead = 0;}int head_check(unsigned long head){    if( (head & 0xffe00000) != 0xffe00000)	return FALSE;    if(!((head>>17)&3))	return FALSE;    if( ((head>>12)&0xf) == 0xf)	return FALSE;    if( ((head>>10)&0x3) == 0x3 )	return FALSE;    if ((head & 0xffff0000) == 0xfffe0000)      return FALSE;    return TRUE;}*/void set_pointer(long backstep){  bsi.wordpointer = bsbuf + ssize - backstep;  if (backstep)    memcpy(bsi.wordpointer,bsbufold+fsizeold-backstep,backstep);  bsi.bitindex = 0; }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -