comparison libao2/ao_sdl.c @ 17566:f580a7755ac5

Patch by Stefan Huehner / stefan % huehner ! org \ patch replaces '()' for the correct '(void)' in function declarations/prototypes which have no parameters. The '()' syntax tell thats there is a variable list of arguments, so that the compiler cannot check this. The extra CFLAG '-Wstrict-declarations' shows those cases. Comments about a similar patch applied to ffmpeg: That in C++ these mean the same, but in ANSI C the semantics are different; function() is an (obsolete) K&R C style forward declaration, it basically means that the function can have any number and any types of parameters, effectively completely preventing the compiler from doing any sort of type checking. -- Erik Slagter Defining functions with unspecified arguments is allowed but bad. With arguments unspecified the compiler can't report an error/warning if the function is called with incorrect arguments. -- M\ns Rullg\rd
author rathann
date Thu, 09 Feb 2006 14:08:03 +0000
parents 44c24de55f9d
children cc6dc96035b8
comparison
equal deleted inserted replaced
17565:dc65faaadb04 17566:f580a7755ac5
65 #endif 65 #endif
66 66
67 // may only be called by mplayer's thread 67 // may only be called by mplayer's thread
68 // return value may change between immediately following two calls, 68 // return value may change between immediately following two calls,
69 // and the real number of free bytes might be larger! 69 // and the real number of free bytes might be larger!
70 static int buf_free() { 70 static int buf_free(void) {
71 int free = read_pos - write_pos - CHUNK_SIZE; 71 int free = read_pos - write_pos - CHUNK_SIZE;
72 if (free < 0) free += BUFFSIZE; 72 if (free < 0) free += BUFFSIZE;
73 return free; 73 return free;
74 } 74 }
75 75
76 // may only be called by SDL's playback thread 76 // may only be called by SDL's playback thread
77 // return value may change between immediately following two calls, 77 // return value may change between immediately following two calls,
78 // and the real number of buffered bytes might be larger! 78 // and the real number of buffered bytes might be larger!
79 static int buf_used() { 79 static int buf_used(void) {
80 int used = write_pos - read_pos; 80 int used = write_pos - read_pos;
81 if (used < 0) used += BUFFSIZE; 81 if (used < 0) used += BUFFSIZE;
82 return used; 82 return used;
83 } 83 }
84 84
281 SDL_CloseAudio(); 281 SDL_CloseAudio();
282 SDL_QuitSubSystem(SDL_INIT_AUDIO); 282 SDL_QuitSubSystem(SDL_INIT_AUDIO);
283 } 283 }
284 284
285 // stop playing and empty buffers (for seeking/pause) 285 // stop playing and empty buffers (for seeking/pause)
286 static void reset(){ 286 static void reset(void){
287 287
288 //printf("SDL: reset called!\n"); 288 //printf("SDL: reset called!\n");
289 289
290 SDL_PauseAudio(1); 290 SDL_PauseAudio(1);
291 /* Reset ring-buffer state */ 291 /* Reset ring-buffer state */
293 write_pos = 0; 293 write_pos = 0;
294 SDL_PauseAudio(0); 294 SDL_PauseAudio(0);
295 } 295 }
296 296
297 // stop playing, keep buffers (for pause) 297 // stop playing, keep buffers (for pause)
298 static void audio_pause() 298 static void audio_pause(void)
299 { 299 {
300 300
301 //printf("SDL: audio_pause called!\n"); 301 //printf("SDL: audio_pause called!\n");
302 SDL_PauseAudio(1); 302 SDL_PauseAudio(1);
303 303
304 } 304 }
305 305
306 // resume playing, after audio_pause() 306 // resume playing, after audio_pause()
307 static void audio_resume() 307 static void audio_resume(void)
308 { 308 {
309 //printf("SDL: audio_resume called!\n"); 309 //printf("SDL: audio_resume called!\n");
310 SDL_PauseAudio(0); 310 SDL_PauseAudio(0);
311 } 311 }
312 312
313 313
314 // return: how many bytes can be played without blocking 314 // return: how many bytes can be played without blocking
315 static int get_space(){ 315 static int get_space(void){
316 return buf_free(); 316 return buf_free();
317 } 317 }
318 318
319 // plays 'len' bytes of 'data' 319 // plays 'len' bytes of 'data'
320 // it should round it down to outburst*n 320 // it should round it down to outburst*n
336 return write_buffer(data, len); 336 return write_buffer(data, len);
337 #endif 337 #endif
338 } 338 }
339 339
340 // return: delay in seconds between first and last sample in buffer 340 // return: delay in seconds between first and last sample in buffer
341 static float get_delay(){ 341 static float get_delay(void){
342 int buffered = BUFFSIZE - CHUNK_SIZE - buf_free(); // could be less 342 int buffered = BUFFSIZE - CHUNK_SIZE - buf_free(); // could be less
343 return (float)(buffered + ao_data.buffersize)/(float)ao_data.bps; 343 return (float)(buffered + ao_data.buffersize)/(float)ao_data.bps;
344 } 344 }
345 345
346 346