summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-07-21 22:13:11 +0200
committerwm4 <wm4@nowhere>2013-07-21 23:27:31 +0200
commitce89ba6d75ccd3258fda779b8855cf1bfd5de59e (patch)
tree5142b19c13fe90d39d5e5b1d8239895118120e47 /audio
parent3cdf4cf14d48bfb2eff2806da96f684175a71eb8 (diff)
downloadmpv-ce89ba6d75ccd3258fda779b8855cf1bfd5de59e.tar.bz2
mpv-ce89ba6d75ccd3258fda779b8855cf1bfd5de59e.tar.xz
ao_pulse: use new option API
Untested, but should be fine.
Diffstat (limited to 'audio')
-rw-r--r--audio/out/ao_pulse.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/audio/out/ao_pulse.c b/audio/out/ao_pulse.c
index 2c9f3734c6..0f31e7996c 100644
--- a/audio/out/ao_pulse.c
+++ b/audio/out/ao_pulse.c
@@ -52,6 +52,9 @@ struct priv {
bool broken_pause;
int retval;
+
+ char *cfg_host;
+ char *cfg_sink;
};
#define GENERIC_ERR_MSG(ctx, str) \
@@ -229,25 +232,13 @@ static int init(struct ao *ao, char *params)
{
struct pa_sample_spec ss;
struct pa_channel_map map;
- char *devarg = NULL;
- char *host = NULL;
- char *sink = NULL;
+ struct priv *priv = ao->priv;
+ char *host = priv->cfg_host && priv->cfg_host[0] ? priv->cfg_host : NULL;
+ char *sink = priv->cfg_sink && priv->cfg_sink[0] ? priv->cfg_sink : NULL;
const char *version = pa_get_library_version();
- struct priv *priv = talloc_zero(ao, struct priv);
- ao->priv = priv;
-
ao->per_application_mixer = true;
- if (params) {
- devarg = strdup(params);
- sink = strchr(devarg, ':');
- if (sink)
- *sink++ = 0;
- if (devarg[0])
- host = devarg;
- }
-
priv->broken_pause = false;
/* not sure which versions are affected, assume 0.9.11* to 0.9.14*
* known bad: 0.9.14, 0.9.13
@@ -340,7 +331,6 @@ static int init(struct ao *ao, char *params)
pa_threaded_mainloop_unlock(priv->mainloop);
- free(devarg);
return 0;
unlock_and_fail:
@@ -354,7 +344,6 @@ fail:
&& ao->probing))
GENERIC_ERR_MSG(priv->context, "Init failed");
}
- free(devarg);
uninit(ao, true);
return -1;
}
@@ -585,6 +574,8 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg)
}
}
+#define OPT_BASE_STRUCT struct priv
+
const struct ao_driver audio_out_pulse = {
.info = &(const struct ao_info) {
"PulseAudio audio output",
@@ -601,4 +592,10 @@ const struct ao_driver audio_out_pulse = {
.get_delay = get_delay,
.pause = pause,
.resume = resume,
+ .priv_size = sizeof(struct priv),
+ .options = (const struct m_option[]) {
+ OPT_STRING("host", cfg_host, 0),
+ OPT_STRING("sink", cfg_sink, 0),
+ {0}
+ },
};