comparison libao2/ao_pcm.c @ 18092:96fdfbad5b1a

-ao pcm:fast suboption for faster-than-realtime dumping
author reimar
date Fri, 14 Apr 2006 13:18:35 +0000
parents f580a7755ac5
children b23c0e341e3e
comparison
equal deleted inserted replaced
18091:71f9a4e7fd9d 18092:96fdfbad5b1a
25 25
26 extern int vo_pts; 26 extern int vo_pts;
27 27
28 static char *ao_outputfilename = NULL; 28 static char *ao_outputfilename = NULL;
29 static int ao_pcm_waveheader = 1; 29 static int ao_pcm_waveheader = 1;
30 static int fast = 0;
30 31
31 #define WAV_ID_RIFF 0x46464952 /* "RIFF" */ 32 #define WAV_ID_RIFF 0x46464952 /* "RIFF" */
32 #define WAV_ID_WAVE 0x45564157 /* "WAVE" */ 33 #define WAV_ID_WAVE 0x45564157 /* "WAVE" */
33 #define WAV_ID_FMT 0x20746d66 /* "fmt " */ 34 #define WAV_ID_FMT 0x20746d66 /* "fmt " */
34 #define WAV_ID_DATA 0x61746164 /* "data" */ 35 #define WAV_ID_DATA 0x61746164 /* "data" */
81 static int init(int rate,int channels,int format,int flags){ 82 static int init(int rate,int channels,int format,int flags){
82 int bits; 83 int bits;
83 opt_t subopts[] = { 84 opt_t subopts[] = {
84 {"waveheader", OPT_ARG_BOOL, &ao_pcm_waveheader, NULL}, 85 {"waveheader", OPT_ARG_BOOL, &ao_pcm_waveheader, NULL},
85 {"file", OPT_ARG_MSTRZ, &ao_outputfilename, NULL}, 86 {"file", OPT_ARG_MSTRZ, &ao_outputfilename, NULL},
87 {"fast", OPT_ARG_BOOL, &fast, NULL},
86 {NULL} 88 {NULL}
87 }; 89 };
88 // set defaults 90 // set defaults
89 ao_pcm_waveheader = 1; 91 ao_pcm_waveheader = 1;
90 ao_outputfilename = 92 ao_outputfilename =
177 179
178 // return: how many bytes can be played without blocking 180 // return: how many bytes can be played without blocking
179 static int get_space(void){ 181 static int get_space(void){
180 182
181 if(vo_pts) 183 if(vo_pts)
182 return ao_data.pts < vo_pts ? ao_data.outburst : 0; 184 return ao_data.pts < vo_pts + fast * 30000 ? ao_data.outburst : 0;
183 return ao_data.outburst; 185 return ao_data.outburst;
184 } 186 }
185 187
186 // plays 'len' bytes of 'data' 188 // plays 'len' bytes of 'data'
187 // it should round it down to outburst*n 189 // it should round it down to outburst*n