comparison libao2/ao_oss.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 1a87fe45bd4e
children 6927fabaef92
comparison
equal deleted inserted replaced
17565:dc65faaadb04 17566:f580a7755ac5
421 close(audio_fd); 421 close(audio_fd);
422 audio_fd = -1; 422 audio_fd = -1;
423 } 423 }
424 424
425 // stop playing and empty buffers (for seeking/pause) 425 // stop playing and empty buffers (for seeking/pause)
426 static void reset(){ 426 static void reset(void){
427 int oss_format; 427 int oss_format;
428 uninit(1); 428 uninit(1);
429 audio_fd=open(dsp, O_WRONLY); 429 audio_fd=open(dsp, O_WRONLY);
430 if(audio_fd < 0){ 430 if(audio_fd < 0){
431 mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_CantReopen, strerror(errno)); 431 mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_CantReopen, strerror(errno));
448 ioctl (audio_fd, SNDCTL_DSP_SPEED, &ao_data.samplerate); 448 ioctl (audio_fd, SNDCTL_DSP_SPEED, &ao_data.samplerate);
449 } 449 }
450 } 450 }
451 451
452 // stop playing, keep buffers (for pause) 452 // stop playing, keep buffers (for pause)
453 static void audio_pause() 453 static void audio_pause(void)
454 { 454 {
455 uninit(1); 455 uninit(1);
456 } 456 }
457 457
458 // resume playing, after audio_pause() 458 // resume playing, after audio_pause()
459 static void audio_resume() 459 static void audio_resume(void)
460 { 460 {
461 reset(); 461 reset();
462 } 462 }
463 463
464 464
465 // return: how many bytes can be played without blocking 465 // return: how many bytes can be played without blocking
466 static int get_space(){ 466 static int get_space(void){
467 int playsize=ao_data.outburst; 467 int playsize=ao_data.outburst;
468 468
469 #ifdef SNDCTL_DSP_GETOSPACE 469 #ifdef SNDCTL_DSP_GETOSPACE
470 if(ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &zz)!=-1){ 470 if(ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &zz)!=-1){
471 // calculate exact buffer space: 471 // calculate exact buffer space:
501 } 501 }
502 502
503 static int audio_delay_method=2; 503 static int audio_delay_method=2;
504 504
505 // return: delay in seconds between first and last sample in buffer 505 // return: delay in seconds between first and last sample in buffer
506 static float get_delay(){ 506 static float get_delay(void){
507 /* Calculate how many bytes/second is sent out */ 507 /* Calculate how many bytes/second is sent out */
508 if(audio_delay_method==2){ 508 if(audio_delay_method==2){
509 #ifdef SNDCTL_DSP_GETODELAY 509 #ifdef SNDCTL_DSP_GETODELAY
510 int r=0; 510 int r=0;
511 if(ioctl(audio_fd, SNDCTL_DSP_GETODELAY, &r)!=-1) 511 if(ioctl(audio_fd, SNDCTL_DSP_GETODELAY, &r)!=-1)