summaryrefslogtreecommitdiffstats
path: root/libao2/audio_out.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-05-05 21:34:17 +0300
committerUoti Urpala <uau@mplayer2.org>2011-05-05 21:34:17 +0300
commit40f6ab5064a628dc11b79b5e571dc9444efac093 (patch)
treed5217e4e08b5a8ebd16c323c69df2b45c85222ed /libao2/audio_out.c
parent2fae42d00e7f8a4a8e0e39bd5e84836a26d3755a (diff)
downloadmpv-40f6ab5064a628dc11b79b5e571dc9444efac093.tar.bz2
mpv-40f6ab5064a628dc11b79b5e571dc9444efac093.tar.xz
ao_pcm, core: use new API in ao_pcm, change timing with it
Change ao_pcm to use the new audio output driver API and clean up some of the code. Rewrite the logic controlling how playback timing works when using -ao pcm. Deprecate the "fast" suboption; its only effect now is to print a warning, but it's still accepted so that specifying it is not an error. Before, timing with -ao pcm and video enabled had two possible modes. In the default mode playback speed was rather arbitrary - not realtime, but not particularly fast. -ao pcm:fast tried to play back at maximum video playback speed - mostly succeeding, but not quite guaranteed to work in all cases. Now the default is to play at realtime speed. The -benchmark option can now be used to get faster playback (same as the video-only case). In the audio-only case playback is always maximum speed.
Diffstat (limited to 'libao2/audio_out.c')
-rw-r--r--libao2/audio_out.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/libao2/audio_out.c b/libao2/audio_out.c
index da471f0cc7..699ae7071b 100644
--- a/libao2/audio_out.c
+++ b/libao2/audio_out.c
@@ -236,6 +236,10 @@ int ao_control(struct ao *ao, int cmd, void *arg)
double ao_get_delay(struct ao *ao)
{
+ if (!ao->driver->get_delay) {
+ assert(ao->untimed);
+ return 0;
+ }
return ao->driver->get_delay(ao);
}
@@ -246,17 +250,20 @@ int ao_get_space(struct ao *ao)
void ao_reset(struct ao *ao)
{
- ao->driver->reset(ao);
+ if (ao->driver->reset)
+ ao->driver->reset(ao);
}
void ao_pause(struct ao *ao)
{
- ao->driver->pause(ao);
+ if (ao->driver->pause)
+ ao->driver->pause(ao);
}
void ao_resume(struct ao *ao)
{
- ao->driver->resume(ao);
+ if (ao->driver->resume)
+ ao->driver->resume(ao);
}