Mercurial > mplayer.hg
comparison libao2/ao_sun.c @ 7714:6973a985ac2a
- ao_data.bps not set, confuses the A-V sync computation when the audio filters
are in use.
- computation in get_delay() was returning bogus values
author | jkeil |
---|---|
date | Fri, 11 Oct 2002 21:22:55 +0000 |
parents | 52009e5ef4fc |
children | b9da278e4c92 |
comparison
equal
deleted
inserted
replaced
7713:32878695ca8b | 7714:6973a985ac2a |
---|---|
461 if (enable_sample_timing == RTSC_UNKNOWN | 461 if (enable_sample_timing == RTSC_UNKNOWN |
462 && !getenv("AO_SUN_DISABLE_SAMPLE_TIMING")) { | 462 && !getenv("AO_SUN_DISABLE_SAMPLE_TIMING")) { |
463 enable_sample_timing = realtime_samplecounter_available(audio_dev); | 463 enable_sample_timing = realtime_samplecounter_available(audio_dev); |
464 } | 464 } |
465 | 465 |
466 #define AF_FILTER_TEST 0 | |
467 #if AF_FILTER_TEST | |
468 /* test code to force use of the audio filter modules */ | |
469 { | |
470 char *s; | |
471 if (s = getenv("AF_RATE")) | |
472 rate = atoi(s); | |
473 if (s = getenv("AF_CHANNELS")) | |
474 channels = atoi(s); | |
475 if (s = getenv("AF_BITS")) | |
476 format = atoi(s) == 16 ? AFMT_S16_NE : AFMT_U8; | |
477 } | |
478 #endif | |
479 | |
466 // printf("ao2: %d Hz %d chans %s [0x%X]\n", | 480 // printf("ao2: %d Hz %d chans %s [0x%X]\n", |
467 // rate,channels,audio_out_format_name(format),format); | 481 // rate,channels,audio_out_format_name(format),format); |
468 | 482 |
469 audio_fd=open(audio_dev, O_WRONLY); | 483 audio_fd=open(audio_dev, O_WRONLY); |
470 if(audio_fd<0){ | 484 if(audio_fd<0){ |
546 channels, audio_out_format_name(format), rate); | 560 channels, audio_out_format_name(format), rate); |
547 return 0; | 561 return 0; |
548 } | 562 } |
549 | 563 |
550 bytes_per_sample = channels * info.play.precision / 8; | 564 bytes_per_sample = channels * info.play.precision / 8; |
551 byte_per_sec = bytes_per_sample * rate; | 565 ao_data.bps = byte_per_sec = bytes_per_sample * rate; |
552 ao_data.outburst = byte_per_sec > 100000 ? 16384 : 8192; | 566 ao_data.outburst = byte_per_sec > 100000 ? 16384 : 8192; |
553 | 567 |
554 #ifdef __not_used__ | 568 #ifdef __not_used__ |
555 /* | 569 /* |
556 * hmm, ao_data.buffersize is currently not used in this driver, do there's | 570 * hmm, ao_data.buffersize is currently not used in this driver, do there's |
744 ioctl(audio_fd, AUDIO_GETINFO, &info); | 758 ioctl(audio_fd, AUDIO_GETINFO, &info); |
745 #if defined (__OpenBSD__) || defined(__NetBSD__) | 759 #if defined (__OpenBSD__) || defined(__NetBSD__) |
746 return (float) info.play.seek/ (float)byte_per_sec ; | 760 return (float) info.play.seek/ (float)byte_per_sec ; |
747 #else | 761 #else |
748 if (info.play.samples && enable_sample_timing == RTSC_ENABLED) | 762 if (info.play.samples && enable_sample_timing == RTSC_ENABLED) |
749 return (float)(queued_samples - info.play.samples) / (float)byte_per_sec; | 763 return (float)(queued_samples - info.play.samples) / (float)ao_data.samplerate; |
750 else | 764 else |
751 return (float)((queued_bursts - info.play.eof) * ao_data.outburst) / (float)byte_per_sec; | 765 return (float)((queued_bursts - info.play.eof) * ao_data.outburst) / (float)byte_per_sec; |
752 #endif | 766 #endif |
753 } | 767 } |
754 | 768 |