亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? player.c

?? 完成MP3播放功能
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* * madplay - MPEG audio decoder and player * Copyright (C) 2000-2004 Robert Leslie * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA * * $Id: player.c,v 1.68 2004/02/17 02:26:43 rob Exp $ *///************************************************************# define O_RDONLY 1//************************************************************# ifdef HAVE_CONFIG_H#  include "config.h"# endif# include "global.h"# include <stdio.h># include <stdarg.h># include <stdlib.h># ifdef HAVE_SYS_TYPES_H#  include <sys/types.h># endif# include <sys/stat.h># ifdef HAVE_FCNTL_H#  include <fcntl.h># endif# ifdef HAVE_UNISTD_H#  include <unistd.h># endif# include <string.h>//# ifdef HAVE_ERRNO_H**********************************#  include <errno.h>//# endif***********************************************# include <time.h># include <locale.h># include <math.h># ifdef HAVE_TERMIOS_H#  include <termios.h># endif# ifdef _WIN32#  include <windows.h># endif# include <signal.h># ifdef HAVE_ASSERT_H#  include <assert.h># endif# if defined(HAVE_MMAP)#  include <sys/mman.h># endif# if !defined(O_BINARY)#  define O_BINARY  0# endif//# include <mad.h>//# include <id3tag.h># include "mad.h"//# include "id3tag.h"# include "gettext.h"# include "player.h"# include "audio.h"# include "resample.h"# include "filter.h"# define MPEG_BUFSZ	40000	/* 2.5 s at 128 kbps; 1 s at 320 kbps */# define FREQ_TOLERANCE	2	/* percent sampling frequency tolerance */# define TTY_DEVICE	"/dev/tty"# define KEY_CTRL(key)	((key) & 0x1f)enum {  KEY_PAUSE    = 'p',  KEY_STOP     = 's',  KEY_FORWARD  = 'f',  KEY_BACK     = 'b',  KEY_TIME     = 't',  KEY_QUIT     = 'q',  KEY_INFO     = 'i',  KEY_GAINDECR = '-',  KEY_GAININCR = '+',  KEY_GAINZERO = '_',  KEY_GAININFO = '='};static int on_same_line;# if defined(USE_TTY) && !defined(_WIN32)static int tty_fd = -1;static struct termios save_tty;static struct sigaction save_sigtstp, save_sigint;# endif/* * NAME:	player_init() * DESCRIPTION:	initialize player structure */void player_init(struct player *player){  player->verbosity = 0;  player->options = 0;  player->repeat  = 1;  player->control = PLAYER_CONTROL_DEFAULT;  player->playlist.entries = 0;  player->playlist.length  = 0;  player->playlist.current = 0;  player->global_start = mad_timer_zero;  player->global_stop  = mad_timer_zero;  player->fade_in      = mad_timer_zero;  player->fade_out     = mad_timer_zero;  player->gap          = mad_timer_zero;  player->input.path   = 0;  player->input.fd     = -1;# if defined(HAVE_MMAP)  player->input.fdm    = 0;# endif  player->input.data   = 0;  player->input.length = 0;  player->input.eof    = 0;  player->output.mode          = AUDIO_MODE_DITHER;  player->output.voladj_db     = 0;  player->output.attamp_db     = 0;  player->output.gain          = MAD_F_ONE;  player->output.replay_gain   = 0;  player->output.filters       = 0;  player->output.channels_in   = 0;  player->output.channels_out  = 0;  player->output.select        = PLAYER_CHANNEL_DEFAULT;  player->output.speed_in      = 0;  player->output.speed_out     = 0;  player->output.speed_request = 0;  player->output.precision_in  = 0;  player->output.precision_out = 0;  player->output.path          = 0;  player->output.command       = 0;  /* player->output.resample */  player->output.resampled     = 0;  player->ancillary.path       = 0;  player->ancillary.file       = 0;  player->ancillary.buffer     = 0;  player->ancillary.length     = 0;  player->stats.show                  = STATS_SHOW_OVERALL;  player->stats.label                 = 0;  player->stats.total_bytes           = 0;  player->stats.total_time            = mad_timer_zero;  player->stats.global_timer          = mad_timer_zero;  player->stats.absolute_timer        = mad_timer_zero;  player->stats.play_timer            = mad_timer_zero;  player->stats.global_framecount     = 0;  player->stats.absolute_framecount   = 0;  player->stats.play_framecount       = 0;  player->stats.error_frame           = -1;  player->stats.mute_frame            = 0;  player->stats.vbr                   = 0;  player->stats.bitrate               = 0;  player->stats.vbr_frames            = 0;  player->stats.vbr_rate              = 0;  player->stats.nsecs                 = 0;  player->stats.audio.clipped_samples = 0;  player->stats.audio.peak_clipping   = 0;  player->stats.audio.peak_sample     = 0;}/* * NAME:	player_finish() * DESCRIPTION:	destroy a player structure */void player_finish(struct player *player){  if (player->output.filters)    filter_free(player->output.filters);  if (player->output.resampled) {    resample_finish(&player->output.resample[0]);    resample_finish(&player->output.resample[1]);    free(player->output.resampled);    player->output.resampled = 0;  }}/* * NAME:	message() * DESCRIPTION:	show a message, possibly overwriting a previous w/o newline */staticint message(char const *format, ...){  int len, newline, result;  va_list args;  len = strlen(format);  newline = (len > 0 && format[len - 1] == '\n');  if (on_same_line && newline && len > 1)    fputc('\n', stderr);  va_start(args, format);  result = vfprintf(stderr, format, args);  va_end(args);  if (on_same_line && !newline && result < on_same_line) {    unsigned int i;    i = on_same_line - result;    while (i--)      putc(' ', stderr);  }  on_same_line = newline ? 0 : result;  if (!newline) {    fputc('\r', stderr);    fflush(stderr);  }  return result;}/* * NAME:	detail() * DESCRIPTION:	show right-aligned label and line-wrap corresponding text */staticvoid detail(char const *label, char const *format, ...){  char const spaces[] = "               ";  va_list args;# define LINEWRAP  (80 - sizeof(spaces) - 2 - 2)  if (on_same_line)    message("\n");  if (label) {    unsigned int len;    len = strlen(label);    assert(len < sizeof(spaces));    fprintf(stderr, "%s%s: ", &spaces[len], label);  }  else    fprintf(stderr, "%s  ", spaces);  va_start(args, format);  if (format) {    vfprintf(stderr, format, args);    fputc('\n', stderr);  }  else {    char *ptr, *newline, *linebreak;    /* N.B. this argument must be mutable! */    ptr = va_arg(args, char *);    do {      newline = strchr(ptr, '\n');      if (newline)	*newline = 0;      if (strlen(ptr) > LINEWRAP) {	linebreak = ptr + LINEWRAP;	while (linebreak > ptr && *linebreak != ' ')	  --linebreak;	if (*linebreak == ' ') {	  if (newline)	    *newline = '\n';	  *(newline = linebreak) = 0;	}      }      fprintf(stderr, "%s\n", ptr);      if (newline) {	ptr = newline + 1;	fprintf(stderr, "%s  ", spaces);      }    }    while (newline);  }  va_end(args);}/* * NAME:	error() * DESCRIPTION:	show an error using proper interaction with message() */staticvoid error(char const *id, char const *format, ...){  int err;  va_list args;  err = errno;  if (on_same_line)    message("\n");  if (id)    fprintf(stderr, "%s: ", id);  va_start(args, format);  if (*format == ':') {    if (format[1] == 0) {      format = va_arg(args, char const *);      errno = err;      perror(format);    }    else {      errno = err;      perror(format + 1);    }  }  else {    vfprintf(stderr, format, args);    fputc('\n', stderr);  }  va_end(args);}# if defined(HAVE_MMAP)/* * NAME:	map_file() * DESCRIPTION:	map the contents of a file into memory */staticvoid *map_file(int fd, unsigned long length){  void *fdm;  fdm = mmap(0, length, PROT_READ, MAP_SHARED, fd, 0);  if (fdm == MAP_FAILED)    return 0;# if defined(HAVE_MADVISE)  madvise(fdm, length, MADV_SEQUENTIAL);# endif  return fdm;}/* * NAME:	unmap_file() * DESCRIPTION:	undo a file mapping */staticint unmap_file(void *fdm, unsigned long length){  if (munmap(fdm, length) == -1)    return -1;  return 0;}/* * NAME:	decode->input_mmap() * DESCRIPTION:	(re)fill decoder input buffer from a memory map */staticenum mad_flow decode_input_mmap(void *data, struct mad_stream *stream){  struct player *player = data;  struct input *input = &player->input;  if (input->eof)    return MAD_FLOW_STOP;  if (stream->next_frame) {    struct stat stat;    unsigned long posn, left;    if (fstat(input->fd, &stat) == -1)      return MAD_FLOW_BREAK;    posn = stream->next_frame - input->fdm;    /* check for file size change and update map */    if (stat.st_size > input->length) {      if (unmap_file(input->fdm, input->length) == -1) {	input->fdm  = 0;	input->data = 0;	return MAD_FLOW_BREAK;      }      player->stats.total_bytes += stat.st_size - input->length;      input->length = stat.st_size;      input->fdm = map_file(input->fd, input->length);      if (input->fdm == 0) {	input->data = 0;	return MAD_FLOW_BREAK;      }      mad_stream_buffer(stream, input->fdm + posn, input->length - posn);      return MAD_FLOW_CONTINUE;    }    /* end of memory map; append MAD_BUFFER_GUARD zero bytes */    left = input->length - posn;    input->data = malloc(left + MAD_BUFFER_GUARD);    if (input->data == 0)      return MAD_FLOW_BREAK;    input->eof = 1;    memcpy(input->data, input->fdm + posn, left);    memset(input->data + left, 0, MAD_BUFFER_GUARD);    mad_stream_buffer(stream, input->data, left + MAD_BUFFER_GUARD);    return MAD_FLOW_CONTINUE;  }  /* first call */  mad_stream_buffer(stream, input->fdm, input->length);  return MAD_FLOW_CONTINUE;}# endif/* NAME:	decode->input_read() DESCRIPTION:	(re)fill decoder input buffer by reading a file descriptor */static enum mad_flow decode_input_read(void *data, struct mad_stream *stream){ struct player *player = data;	//struct player is defined in player.h  struct input *input = &player->input;  int len;  if (input->eof)    return MAD_FLOW_STOP;  if (stream->next_frame)      memmove(input->data, stream->next_frame,input->length = &input->data[input->length] - stream->next_frame);
             //dest        source			count=40000-下一幀開始的位置  do   {   len = read(input->fd, input->data + input->length,MPEG_BUFSZ - input->length);	      //MPEG_BUFSZ=40000,40000*12倍/2字節/sample/48000/2channel=2.5s,104frame  }  while (len == -1 && errno == EINTR);  if (len == -1)   { error("input", ":read");    return MAD_FLOW_BREAK;  }  else if (len == 0)   { input->eof = 1;    assert(MPEG_BUFSZ - input->length >= MAD_BUFFER_GUARD);    while (len < MAD_BUFFER_GUARD)   input->data[input->length + len++] = 0;  }  mad_stream_buffer(stream, input->data, input->length += len);  return MAD_FLOW_CONTINUE;}/* NAME:	decode->header() DESCRIPTION:	decide whether to continue decoding based on header */static enum mad_flow decode_header(void *data, struct mad_header const *header){ struct player *player = data;  if ((player->options & PLAYER_OPTION_TIMED) && mad_timer_compare(player->stats.global_timer, player->global_stop) > 0)    return MAD_FLOW_STOP;  /* accounting (except first frame) */  if (player->stats.absolute_framecount)   { ++player->stats.absolute_framecount;    mad_timer_add(&player->stats.absolute_timer, header->duration);    ++player->stats.global_framecount;    mad_timer_add(&player->stats.global_timer, header->duration);    if ((player->options & PLAYER_OPTION_SKIP) &&	mad_timer_compare(player->stats.global_timer,player->global_start) < 0)      return MAD_FLOW_IGNORE;  }  return MAD_FLOW_CONTINUE;}/* * NAME:	write_ancillary() * DESCRIPTION:	pack ancillary data into octets and output */staticint write_ancillary(struct ancillary *ancillary,		    struct mad_bitptr ptr, unsigned int length){  if (ancillary->length) {    unsigned int balance;    balance = 8 - ancillary->length;    if (balance > length) {      ancillary->buffer =	(ancillary->buffer << length) | mad_bit_read(&ptr, length);      ancillary->length += length;      return 0;    }    else {      if (fputc((ancillary->buffer << balance) | mad_bit_read(&ptr, balance),		ancillary->file) == EOF) {	error("ancillary", ":fputc");	return -1;      }      ancillary->length = 0;      length -= balance;    }  }  while (length >= 8) {    int byte;    byte = mad_bit_read(&ptr, 8);    if (putc(byte, ancillary->file) == EOF) {      error("ancillary", ":putc");      return -1;    }    length -= 8;  }  if (length) {    ancillary->buffer = mad_bit_read(&ptr, length);    ancillary->length = length;  }  if (fflush(ancillary->file) == EOF) {    error("ancillary", ":fflush");    return -1;  }  return 0;}enum {  GAIN_VOLADJ   = 0x0001,  GAIN_ATTAMP   = 0x0002,  GAIN_RELATIVE = 0x0010};/* * NAME:	set_gain() * DESCRIPTION:	modify player gain information */staticdouble set_gain(struct player *player, int how, double db){  double *gain_db = 0;  if (how & GAIN_ATTAMP)    gain_db = &player->output.attamp_db;  else if (how & GAIN_VOLADJ)    gain_db = &player->output.voladj_db;  if (gain_db) {    if (how & GAIN_RELATIVE)      *gain_db += db;    else      *gain_db  = db;  }  db = player->output.voladj_db + player->output.attamp_db;  if (db > DB_MAX || db < DB_MIN) {    db = (db > DB_MAX) ? DB_MAX : DB_MIN;    player->output.attamp_db = db - player->output.voladj_db;  }  player->output.gain = db ? mad_f_tofixed(pow(10, db / 20)) : MAD_F_ONE;  return db;}/* * NAME:	decode->filter() * DESCRIPTION:	perform filtering on decoded frame */staticenum mad_flow decode_filter(void *data, struct mad_stream const *stream,			    struct mad_frame *frame){

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕一区二区三区在线不卡 | 国产最新精品免费| 日韩一区二区三区电影在线观看 | 在线观看91视频| 亚洲大型综合色站| 欧美一级欧美三级| 福利视频网站一区二区三区| 国产精品短视频| 欧美色综合久久| 另类专区欧美蜜桃臀第一页| 国产亚洲视频系列| 91日韩在线专区| 日韩影院在线观看| 国产欧美一区二区三区在线老狼| 91在线免费视频观看| 午夜私人影院久久久久| 日韩免费电影网站| 97国产一区二区| 日韩av电影免费观看高清完整版 | 国产精品影音先锋| 亚洲精品视频免费看| 91麻豆精品国产91久久久久久| 男女视频一区二区| 国产精品久久看| 欧美一区二区不卡视频| 国产成人免费视| 午夜精品福利视频网站 | 国产精品色在线| 欧美剧在线免费观看网站| 国产精品一区二区久久不卡| 亚洲精品视频自拍| 久久免费电影网| 欧美三级视频在线| 成人午夜在线免费| 日韩一区精品视频| 亚洲欧美综合另类在线卡通| 91精品国产高清一区二区三区| 国产东北露脸精品视频| 亚洲国产视频一区| 国产情人综合久久777777| 欧美亚一区二区| 丰满少妇在线播放bd日韩电影| 视频在线观看91| 亚洲女人小视频在线观看| 精品久久国产老人久久综合| 欧美色涩在线第一页| av成人免费在线| 国产精品自拍毛片| 美女在线视频一区| 午夜欧美2019年伦理| 亚洲精品国产精品乱码不99| 久久精品在线免费观看| 日韩欧美精品三级| 欧美日韩精品专区| 一本色道a无线码一区v| 国产成人亚洲精品青草天美| 美女一区二区视频| 亚洲成av人综合在线观看| 亚洲男同性视频| 国产精品每日更新| 久久亚洲免费视频| 精品欧美乱码久久久久久| 69p69国产精品| 91精选在线观看| 欧美欧美欧美欧美| 欧美三日本三级三级在线播放| 99久久777色| 成人av一区二区三区| 大陆成人av片| 成人激情午夜影院| 成人精品视频.| 成人看片黄a免费看在线| 粉嫩欧美一区二区三区高清影视| 看电视剧不卡顿的网站| 日本va欧美va精品发布| 日本不卡高清视频| 免费久久精品视频| 久久99精品国产91久久来源| 久久精品国产精品亚洲精品| 久久精品国产免费| 国产一区二区影院| 国产成人激情av| bt欧美亚洲午夜电影天堂| 成人黄色免费短视频| 成人av在线播放网址| 91久久一区二区| 欧美人狂配大交3d怪物一区| 欧美一区二区视频在线观看2020| 91精品一区二区三区在线观看| 欧美一区二区三区男人的天堂 | 精品国产一区二区三区忘忧草| 欧美tickling网站挠脚心| 精品99一区二区| 欧美激情中文不卡| 一区二区三区**美女毛片| 亚洲成人动漫在线免费观看| 美女视频黄久久| 国产超碰在线一区| av在线不卡电影| 欧美日韩成人一区| 久久综合九色综合97婷婷| 国产目拍亚洲精品99久久精品| 亚洲欧美日韩成人高清在线一区| 亚洲午夜久久久久久久久电影院 | 欧美一区二区国产| 中文字幕欧美三区| 亚洲国产一区二区三区| 精品一区二区av| 99九九99九九九视频精品| 欧美日本一区二区在线观看| ww亚洲ww在线观看国产| 日韩美女精品在线| 青青草视频一区| 成人高清伦理免费影院在线观看| 欧美主播一区二区三区| 日韩精品中文字幕一区二区三区| 国产精品久久久久久久久免费相片| 亚洲最新视频在线观看| 国内精品免费**视频| 欧美自拍偷拍午夜视频| 2021中文字幕一区亚洲| 一区二区三区影院| 国产伦精品一区二区三区免费| 色婷婷综合中文久久一本| 欧美一级日韩不卡播放免费| 亚洲视频在线观看三级| 另类小说色综合网站| 欧美午夜理伦三级在线观看| 久久久精品免费网站| 午夜精品久久久久影视| av在线不卡电影| 国产网站一区二区| 免费在线视频一区| 色视频一区二区| 国产精品每日更新在线播放网址| 青青草一区二区三区| 欧美综合亚洲图片综合区| 日本一区二区三区免费乱视频 | 成人高清视频在线| 精品对白一区国产伦| 日韩高清在线不卡| 欧美午夜宅男影院| 亚洲精品免费电影| 成人av网站免费| 久久久久国产精品厨房| 蜜桃精品在线观看| 91精品在线麻豆| 亚洲.国产.中文慕字在线| 色婷婷国产精品| 最新久久zyz资源站| 国产电影精品久久禁18| 精品国产一区久久| 经典三级在线一区| 日韩你懂的在线观看| 蜜桃一区二区三区四区| 8v天堂国产在线一区二区| 午夜欧美一区二区三区在线播放| 色综合天天性综合| 亚洲三级视频在线观看| 成人av影视在线观看| 国产精品国产三级国产aⅴ中文| 国产精品69毛片高清亚洲| 精品国产乱码91久久久久久网站| 免费视频最近日韩| 日韩女优视频免费观看| 另类的小说在线视频另类成人小视频在线 | 色婷婷av久久久久久久| 亚洲精品成人精品456| 色综合久久久久综合| 成人免费小视频| 日本韩国欧美在线| 亚洲综合视频网| 欧美日韩色综合| 日韩精品1区2区3区| 欧美白人最猛性xxxxx69交| 国产自产视频一区二区三区| 久久亚洲一区二区三区明星换脸 | aaa国产一区| 国产精品理伦片| 色婷婷av一区二区三区软件 | 中文字幕人成不卡一区| 日本二三区不卡| 日韩成人午夜精品| 精品国免费一区二区三区| 成人性生交大片免费看视频在线 | 夜夜亚洲天天久久| 欧美精品tushy高清| 麻豆精品一二三| 国产欧美日韩视频在线观看| 成人激情免费视频| 亚洲午夜一区二区| 亚洲精品一区二区三区在线观看| 国产一区二区主播在线| 国产精品欧美精品| 欧美精品在线观看播放| 国产一区欧美一区| 亚洲欧美激情在线| 欧美成人一区二区三区片免费| 成人丝袜高跟foot| 亚洲国产一区二区在线播放|