summaryrefslogtreecommitdiffstats
path: root/libao2
diff options
context:
space:
mode:
Diffstat (limited to 'libao2')
-rw-r--r--libao2/ao_pulse.c12
-rw-r--r--libao2/audio_out.c5
-rw-r--r--libao2/audio_out.h3
3 files changed, 15 insertions, 5 deletions
diff --git a/libao2/ao_pulse.c b/libao2/ao_pulse.c
index 659a2bc907..ddaf35716c 100644
--- a/libao2/ao_pulse.c
+++ b/libao2/ao_pulse.c
@@ -30,6 +30,7 @@
#include "libaf/af_format.h"
#include "mp_msg.h"
#include "audio_out.h"
+#include "input/input.h"
#define PULSE_CLIENT_NAME "mplayer2"
@@ -84,6 +85,7 @@ static void stream_request_cb(pa_stream *s, size_t length, void *userdata)
{
struct ao *ao = userdata;
struct priv *priv = ao->priv;
+ mp_input_wakeup(ao->input_ctx);
pa_threaded_mainloop_signal(priv->mainloop, 0);
}
@@ -263,8 +265,14 @@ static int init(struct ao *ao, char *params)
pa_stream_set_write_callback(priv->stream, stream_request_cb, ao);
pa_stream_set_latency_update_callback(priv->stream,
stream_latency_update_cb, ao);
-
- if (pa_stream_connect_playback(priv->stream, sink, NULL,
+ pa_buffer_attr bufattr = {
+ .maxlength = -1,
+ .tlength = pa_usec_to_bytes(1000000, &ss),
+ .prebuf = -1,
+ .minreq = -1,
+ .fragsize = -1,
+ };
+ if (pa_stream_connect_playback(priv->stream, sink, &bufattr,
PA_STREAM_INTERPOLATE_TIMING
| PA_STREAM_AUTO_TIMING_UPDATE, NULL,
NULL) < 0)
diff --git a/libao2/audio_out.c b/libao2/audio_out.c
index a91a0d6d72..6130e2ed33 100644
--- a/libao2/audio_out.c
+++ b/libao2/audio_out.c
@@ -136,10 +136,11 @@ void list_audio_out(void)
mp_msg(MSGT_GLOBAL, MSGL_INFO,"\n");
}
-struct ao *ao_create(void)
+struct ao *ao_create(struct MPOpts *opts, struct input_ctx *input)
{
struct ao *r = talloc(NULL, struct ao);
- *r = (struct ao){.outburst = OUTBURST, .buffersize = -1};
+ *r = (struct ao){.outburst = OUTBURST, .buffersize = -1,
+ .opts = opts, .input_ctx = input };
return r;
}
diff --git a/libao2/audio_out.h b/libao2/audio_out.h
index cbd913656b..1c472565a0 100644
--- a/libao2/audio_out.h
+++ b/libao2/audio_out.h
@@ -81,6 +81,7 @@ struct ao {
const struct ao_driver *driver;
void *priv;
struct MPOpts *opts;
+ struct input_ctx *input_ctx;
};
extern char *ao_subdevice;
@@ -109,7 +110,7 @@ typedef struct ao_control_vol {
float right;
} ao_control_vol_t;
-struct ao *ao_create(void);
+struct ao *ao_create(struct MPOpts *opts, struct input_ctx *input);
void ao_init(struct ao *ao, char **ao_list);
void ao_uninit(struct ao *ao, bool cut_audio);
int ao_play(struct ao *ao, void *data, int len, int flags);