summaryrefslogtreecommitdiffstats
path: root/libao2
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2009-12-29 23:57:14 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2009-12-29 23:57:14 +0200
commit67b40bd21988fed2f70b1c4f5aea301b28f78298 (patch)
treed68ea94ae2d712cb2e991496049bc13f19d9ea60 /libao2
parent9fe4f647824b8067ea4e4f6cf7f699e6c8fa67cb (diff)
parentf97fd3eff02bd1048750f350230d9e9192ea3dfd (diff)
downloadmpv-67b40bd21988fed2f70b1c4f5aea301b28f78298.tar.bz2
mpv-67b40bd21988fed2f70b1c4f5aea301b28f78298.tar.xz
Merge svn changes up to r30065
Diffstat (limited to 'libao2')
-rw-r--r--libao2/ao_pulse.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/libao2/ao_pulse.c b/libao2/ao_pulse.c
index b2fdcbb175..a07bf31da0 100644
--- a/libao2/ao_pulse.c
+++ b/libao2/ao_pulse.c
@@ -49,9 +49,6 @@ static struct pa_context *context;
/** Main event loop object */
static struct pa_threaded_mainloop *mainloop;
-/** A temporary variable to store the current volume */
-static pa_cvolume volume;
-
static int broken_pause;
LIBAO_EXTERN(pulse)
@@ -143,7 +140,7 @@ static int init(int rate_hz, int channels, int format, int flags) {
char *devarg = NULL;
char *host = NULL;
char *sink = NULL;
- char *version = pa_get_library_version();
+ const char *version = pa_get_library_version();
if (ao_subdevice) {
devarg = strdup(ao_subdevice);
@@ -189,8 +186,6 @@ static int init(int rate_hz, int channels, int format, int flags) {
pa_channel_map_init_auto(&map, ss.channels, PA_CHANNEL_MAP_ALSA);
ao_data.bps = pa_bytes_per_second(&ss);
- pa_cvolume_reset(&volume, ss.channels);
-
if (!(mainloop = pa_threaded_mainloop_new())) {
mp_msg(MSGT_AO, MSGL_ERR, "AO: [pulse] Failed to allocate main loop\n");
goto fail;
@@ -224,7 +219,7 @@ static int init(int rate_hz, int channels, int format, int flags) {
pa_stream_set_write_callback(stream, stream_request_cb, NULL);
pa_stream_set_latency_update_callback(stream, stream_latency_update_cb, NULL);
- if (pa_stream_connect_playback(stream, sink, NULL, PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE, &volume, NULL) < 0)
+ if (pa_stream_connect_playback(stream, sink, NULL, PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE, NULL, NULL) < 0)
goto unlock_and_fail;
/* Wait until the stream is ready */
@@ -350,13 +345,14 @@ static float get_delay(void) {
* pa_context_get_sink_input_info() operation completes. Saves the
* volume field of the specified structure to the global variable volume. */
static void info_func(struct pa_context *c, const struct pa_sink_input_info *i, int is_last, void *userdata) {
+ struct pa_cvolume *volume = userdata;
if (is_last < 0) {
GENERIC_ERR_MSG(context, "Failed to get sink input info");
return;
}
if (!i)
return;
- volume = i->volume;
+ *volume = i->volume;
pa_threaded_mainloop_signal(mainloop, 0);
}
@@ -365,8 +361,9 @@ static int control(int cmd, void *arg) {
case AOCONTROL_GET_VOLUME: {
ao_control_vol_t *vol = arg;
uint32_t devidx = pa_stream_get_index(stream);
+ struct pa_cvolume volume;
pa_threaded_mainloop_lock(mainloop);
- if (!waitop(pa_context_get_sink_input_info(context, devidx, info_func, NULL))) {
+ if (!waitop(pa_context_get_sink_input_info(context, devidx, info_func, &volume))) {
GENERIC_ERR_MSG(context, "pa_stream_get_sink_input_info() failed");
return CONTROL_ERROR;
}
@@ -384,7 +381,9 @@ static int control(int cmd, void *arg) {
case AOCONTROL_SET_VOLUME: {
const ao_control_vol_t *vol = arg;
pa_operation *o;
+ struct pa_cvolume volume;
+ pa_cvolume_reset(&volume, ao_data.channels);
if (volume.channels != 2)
pa_cvolume_set(&volume, volume.channels, (pa_volume_t)vol->left*PA_VOLUME_NORM/100);
else {