[pulseaudio-commits] 4 commits - man/pactl.1.xml.in src/daemon src/pulsecore src/utils
Colin Guthrie
colin at kemper.freedesktop.org
Tue Aug 16 03:02:27 PDT 2011
man/pactl.1.xml.in | 5 +++++
src/daemon/default.pa.in | 2 +-
src/daemon/main.c | 5 +++++
src/pulsecore/core.c | 4 ++--
src/pulsecore/sink.c | 8 ++++++++
src/pulsecore/source.c | 8 ++++++++
src/utils/pactl.c | 28 +++++++++++++++++++++++++++-
7 files changed, 56 insertions(+), 4 deletions(-)
New commits:
commit 98ae74e052bfc6e44a4843e0d8a2e01d0e8e8107
Author: Colin Guthrie <colin at mageia.org>
Date: Tue Aug 16 10:54:24 2011 +0100
core: Unload the modules and cached samples before unref'ing the core.
As various modules can subscribe to unlink callbacks unloading some modules
may trigger hooks in other modules.
The callbacks associated with these hooks could in turn need to use the core
in some capacity (e.g. perhaps they are module loading modules
(e.g. *-discover, filter-apply or gconf etc. and need to use the core to
unload modules they've loaded).
This change simply ensures that all modules and cached samples are unloaded
before freeing the core.
diff --git a/src/daemon/main.c b/src/daemon/main.c
index 55726fd..1d0a65e 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -1156,6 +1156,11 @@ finish:
#endif
if (c) {
+ /* Ensure all the modules/samples are unloaded when the core is still ref'ed,
+ * as unlink callback hooks in modules may need the core to be ref'ed */
+ pa_module_unload_all(c);
+ pa_scache_free_all(c);
+
pa_core_unref(c);
pa_log_info(_("Daemon terminated."));
}
diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c
index 2a68fdf..0e53b9d 100644
--- a/src/pulsecore/core.c
+++ b/src/pulsecore/core.c
@@ -166,8 +166,8 @@ static void core_free(pa_object *o) {
c->state = PA_CORE_SHUTDOWN;
- pa_module_unload_all(c);
- pa_scache_free_all(c);
+ /* Note: All modules and samples in the cache should be unloaded before
+ * we get here */
pa_assert(pa_idxset_isempty(c->scache));
pa_idxset_free(c->scache, NULL, NULL);
commit 0d349462c776eee50a13e743bdc4a3ac220b086a
Author: Maarten Bosmans <mkbosmans at gmail.com>
Date: Mon Aug 15 22:05:41 2011 +0200
pactl: Add set-source-output-mute command
diff --git a/man/pactl.1.xml.in b/man/pactl.1.xml.in
index f0060fb..688ac38 100644
--- a/man/pactl.1.xml.in
+++ b/man/pactl.1.xml.in
@@ -218,6 +218,11 @@ USA.
</option>
<option>
+ <p><opt>set-source-output-mute</opt> <arg>INPUT</arg> <arg>1|0</arg></p>
+ <optdesc><p>Set the mute status of the specified source output (identified by its numerical index).</p></optdesc>
+ </option>
+
+ <option>
<p><opt>set-sink-formats</opt> <arg>SINK</arg> <arg>FORMATS</arg></p>
<optdesc><p>Set the supported formats of the specified sink (identified by its numerical index) if supported by the sink.
<arg>FORMATS</arg> is specified as a semi-colon (;) separated list of formats in the form
diff --git a/src/utils/pactl.c b/src/utils/pactl.c
index 21ceece..b35e397 100644
--- a/src/utils/pactl.c
+++ b/src/utils/pactl.c
@@ -114,6 +114,7 @@ static enum {
SET_SINK_MUTE,
SET_SOURCE_MUTE,
SET_SINK_INPUT_MUTE,
+ SET_SOURCE_OUTPUT_MUTE,
SET_SINK_FORMATS,
SUBSCRIBE
} action = NONE;
@@ -1160,6 +1161,10 @@ static void context_state_callback(pa_context *c, void *userdata) {
pa_operation_unref(pa_context_set_sink_input_mute(c, sink_input_idx, mute, simple_callback, NULL));
break;
+ case SET_SOURCE_OUTPUT_MUTE:
+ pa_operation_unref(pa_context_set_source_output_mute(c, source_output_idx, mute, simple_callback, NULL));
+ break;
+
case SET_SINK_VOLUME:
if ((volume_flags & VOL_RELATIVE) == VOL_RELATIVE) {
pa_operation_unref(pa_context_get_sink_info_by_name(c, sink_name, get_sink_volume_callback, NULL));
@@ -1316,7 +1321,7 @@ static void help(const char *argv0) {
printf("%s %s %s %s\n", argv0, _("[options]"), "set-(sink|source)-volume", _("NAME|#N VOLUME"));
printf("%s %s %s %s\n", argv0, _("[options]"), "set-(sink-input|source-output)-volume", _("#N VOLUME"));
printf("%s %s %s %s\n", argv0, _("[options]"), "set-(sink|source)-mute", _("NAME|#N 1|0"));
- printf("%s %s %s %s\n", argv0, _("[options]"), "set-sink-input-mute", _("#N 1|0"));
+ printf("%s %s %s %s\n", argv0, _("[options]"), "set-(sink-input|source-output)-mute", _("#N 1|0"));
printf("%s %s %s %s\n", argv0, _("[options]"), "set-sink-formats", _("#N FORMATS"));
printf("%s %s %s\n", argv0, _("[options]"), "subscribe");
@@ -1706,6 +1711,27 @@ int main(int argc, char *argv[]) {
mute = b;
+ } else if (pa_streq(argv[optind], "set-source-output-mute")) {
+ int b;
+ action = SET_SOURCE_OUTPUT_MUTE;
+
+ if (argc != optind+3) {
+ pa_log(_("You have to specify a source output index and a mute boolean"));
+ goto quit;
+ }
+
+ if (pa_atou(argv[optind+1], &source_output_idx) < 0) {
+ pa_log(_("Invalid source output index specification"));
+ goto quit;
+ }
+
+ if ((b = pa_parse_boolean(argv[optind+2])) < 0) {
+ pa_log(_("Invalid mute specification"));
+ goto quit;
+ }
+
+ mute = b;
+
} else if (pa_streq(argv[optind], "subscribe"))
action = SUBSCRIBE;
commit 1c7e29ef32e5047b6a7771db0862b595d2c188ef
Author: Maarten Bosmans <mkbosmans at gmail.com>
Date: Mon Aug 15 21:38:45 2011 +0200
default.pa: Update rtp null sink line
The description argument has been removed in favour of the more general sink_properties.
diff --git a/src/daemon/default.pa.in b/src/daemon/default.pa.in
index 95af191..b9290dd 100755
--- a/src/daemon/default.pa.in
+++ b/src/daemon/default.pa.in
@@ -112,7 +112,7 @@ ifelse(@OS_IS_WIN32@, 0, [dnl
#load-module module-rtp-recv
### Load the RTP sender module (also configured via paprefs, see above)
-#load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 description="RTP Multicast Sink"
+#load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 sink_properties="device.description='RTP Multicast Sink'"
#load-module module-rtp-send source=rtp.monitor
### Load additional modules from GConf settings. This can be configured with the paprefs tool.
commit 9256d9b7be25c2e08cae01a44e0caf179cf1f880
Author: Maarten Bosmans <mkbosmans at gmail.com>
Date: Mon Aug 15 20:19:40 2011 +0200
Initialise write_volume
The callback should also be reset in reset_calbacks().
The extra check in _volume_change_apply() is needed because when the sink is unlinked the callbacks are reset,
but there still may be pending volume changes.
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 6277698..e6e410c 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -174,6 +174,7 @@ static void reset_callbacks(pa_sink *s) {
s->set_state = NULL;
s->get_volume = NULL;
s->set_volume = NULL;
+ s->write_volume = NULL;
s->get_mute = NULL;
s->set_mute = NULL;
s->request_rewind = NULL;
@@ -3350,6 +3351,13 @@ pa_bool_t pa_sink_volume_change_apply(pa_sink *s, pa_usec_t *usec_to_next) {
pa_bool_t ret = FALSE;
pa_assert(s);
+
+ if (!PA_SINK_IS_LINKED(s->state)) {
+ if (usec_to_next)
+ *usec_to_next = 0;
+ return ret;
+ }
+
pa_assert(s->write_volume);
while (s->thread_info.volume_changes && now >= s->thread_info.volume_changes->at) {
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 31ce39d..ae9528f 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -144,6 +144,7 @@ static void reset_callbacks(pa_source *s) {
s->set_state = NULL;
s->get_volume = NULL;
s->set_volume = NULL;
+ s->write_volume = NULL;
s->get_mute = NULL;
s->set_mute = NULL;
s->update_requested_latency = NULL;
@@ -2533,6 +2534,13 @@ pa_bool_t pa_source_volume_change_apply(pa_source *s, pa_usec_t *usec_to_next) {
pa_bool_t ret = FALSE;
pa_assert(s);
+
+ if (!PA_SOURCE_IS_LINKED(s->state)) {
+ if (usec_to_next)
+ *usec_to_next = 0;
+ return ret;
+ }
+
pa_assert(s->write_volume);
while (s->thread_info.volume_changes && now >= s->thread_info.volume_changes->at) {
More information about the pulseaudio-commits
mailing list