summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-09-17 00:14:21 +0200
committerwm4 <wm4@nowhere>2014-09-17 00:14:21 +0200
commitc158e4641ad8be435fd403bc6dc00f2f99e0940e (patch)
treec9335150c390640808a0c4f64bf02d969bf1ee6f
parentf2c46bc1d1c17fb26f1258fef1c7a9aa12e74590 (diff)
downloadmpv-c158e4641ad8be435fd403bc6dc00f2f99e0940e.tar.bz2
mpv-c158e4641ad8be435fd403bc6dc00f2f99e0940e.tar.xz
ao_oss: move code around
More logical, and preparation for the next commit. No functional changes.
-rw-r--r--audio/out/ao_oss.c53
1 files changed, 27 insertions, 26 deletions
diff --git a/audio/out/ao_oss.c b/audio/out/ao_oss.c
index 496259b579..9ed10cf6c1 100644
--- a/audio/out/ao_oss.c
+++ b/audio/out/ao_oss.c
@@ -508,23 +508,6 @@ static void reset(struct ao *ao)
#endif
}
-// return: how many samples can be played without blocking
-static int get_space(struct ao *ao)
-{
- struct priv *p = ao->priv;
-
- audio_buf_info zz = {0};
- if (ioctl(p->audio_fd, SNDCTL_DSP_GETOSPACE, &zz) != -1) {
- // calculate exact buffer space:
- return zz.fragments * zz.fragsize / ao->sstride;
- }
-
- if (p->audio_fd < 0 || device_writable(ao) > 0)
- return p->outburst / ao->sstride;
-
- return 0;
-}
-
// plays 'len' samples of 'data'
// it should round it down to outburst*n
// return: number of samples played
@@ -555,15 +538,6 @@ static int play(struct ao *ao, void **data, int samples, int flags)
return len / ao->sstride;
}
-// resume playing, after audio_pause()
-static void audio_resume(struct ao *ao)
-{
- struct priv *p = ao->priv;
- p->audio_end = 0;
- if (p->prepause_samples > 0)
- ao_play_silence(ao, p->prepause_samples);
-}
-
// return: delay in seconds between first and last sample in buffer
static float get_delay(struct ao *ao)
{
@@ -593,6 +567,24 @@ static float get_delay(struct ao *ao)
return ((float)p->buffersize) / (float)ao->bps;
}
+
+// return: how many samples can be played without blocking
+static int get_space(struct ao *ao)
+{
+ struct priv *p = ao->priv;
+
+ audio_buf_info zz = {0};
+ if (ioctl(p->audio_fd, SNDCTL_DSP_GETOSPACE, &zz) != -1) {
+ // calculate exact buffer space:
+ return zz.fragments * zz.fragsize / ao->sstride;
+ }
+
+ if (p->audio_fd < 0 || device_writable(ao) > 0)
+ return p->outburst / ao->sstride;
+
+ return 0;
+}
+
// stop playing, keep buffers (for pause)
static void audio_pause(struct ao *ao)
{
@@ -605,6 +597,15 @@ static void audio_pause(struct ao *ao)
#endif
}
+// resume playing, after audio_pause()
+static void audio_resume(struct ao *ao)
+{
+ struct priv *p = ao->priv;
+ p->audio_end = 0;
+ if (p->prepause_samples > 0)
+ ao_play_silence(ao, p->prepause_samples);
+}
+
#define OPT_BASE_STRUCT struct priv
const struct ao_driver audio_out_oss = {