mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-12-19 08:57:00 -05:00
implement "pactl move-source-output"
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1185 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
e52436b6c4
commit
ad95c96a72
1 changed files with 20 additions and 4 deletions
|
|
@ -46,8 +46,8 @@
|
||||||
static pa_context *context = NULL;
|
static pa_context *context = NULL;
|
||||||
static pa_mainloop_api *mainloop_api = NULL;
|
static pa_mainloop_api *mainloop_api = NULL;
|
||||||
|
|
||||||
static char *device = NULL, *sample_name = NULL, *sink_name = NULL;
|
static char *device = NULL, *sample_name = NULL, *sink_name = NULL, *source_name = NULL;
|
||||||
static uint32_t sink_input_idx = PA_INVALID_INDEX;
|
static uint32_t sink_input_idx = PA_INVALID_INDEX, source_output_idx = PA_INVALID_INDEX;
|
||||||
|
|
||||||
static SNDFILE *sndfile = NULL;
|
static SNDFILE *sndfile = NULL;
|
||||||
static pa_stream *sample_stream = NULL;
|
static pa_stream *sample_stream = NULL;
|
||||||
|
|
@ -66,7 +66,8 @@ static enum {
|
||||||
PLAY_SAMPLE,
|
PLAY_SAMPLE,
|
||||||
REMOVE_SAMPLE,
|
REMOVE_SAMPLE,
|
||||||
LIST,
|
LIST,
|
||||||
MOVE_SINK_INPUT
|
MOVE_SINK_INPUT,
|
||||||
|
MOVE_SOURCE_OUTPUT
|
||||||
} action = NONE;
|
} action = NONE;
|
||||||
|
|
||||||
static void quit(int ret) {
|
static void quit(int ret) {
|
||||||
|
|
@ -587,6 +588,10 @@ static void context_state_callback(pa_context *c, void *userdata) {
|
||||||
pa_operation_unref(pa_context_move_sink_input_by_name(c, sink_input_idx, sink_name, simple_callback, NULL));
|
pa_operation_unref(pa_context_move_sink_input_by_name(c, sink_input_idx, sink_name, simple_callback, NULL));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MOVE_SOURCE_OUTPUT:
|
||||||
|
pa_operation_unref(pa_context_move_source_output_by_name(c, source_output_idx, source_name, simple_callback, NULL));
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
@ -615,7 +620,8 @@ static void help(const char *argv0) {
|
||||||
"%s [options] exit\n"
|
"%s [options] exit\n"
|
||||||
"%s [options] upload-sample FILENAME [NAME]\n"
|
"%s [options] upload-sample FILENAME [NAME]\n"
|
||||||
"%s [options] play-sample NAME [SINK]\n"
|
"%s [options] play-sample NAME [SINK]\n"
|
||||||
"%s [options] move-sink-input NAME [SINK]\n"
|
"%s [options] move-sink-input ID SINK\n"
|
||||||
|
"%s [options] move-source-output ID SOURCE\n"
|
||||||
"%s [options] remove-sample NAME\n\n"
|
"%s [options] remove-sample NAME\n\n"
|
||||||
" -h, --help Show this help\n"
|
" -h, --help Show this help\n"
|
||||||
" --version Show version\n\n"
|
" --version Show version\n\n"
|
||||||
|
|
@ -747,6 +753,15 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
sink_input_idx = atoi(argv[optind+1]);
|
sink_input_idx = atoi(argv[optind+1]);
|
||||||
sink_name = pa_xstrdup(argv[optind+2]);
|
sink_name = pa_xstrdup(argv[optind+2]);
|
||||||
|
} else if (!strcmp(argv[optind], "move-source-output")) {
|
||||||
|
action = MOVE_SOURCE_OUTPUT;
|
||||||
|
if (optind+2 >= argc) {
|
||||||
|
fprintf(stderr, "You have to specify a source output index and a source\n");
|
||||||
|
goto quit;
|
||||||
|
}
|
||||||
|
|
||||||
|
source_output_idx = atoi(argv[optind+1]);
|
||||||
|
source_name = pa_xstrdup(argv[optind+2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -801,6 +816,7 @@ quit:
|
||||||
pa_xfree(device);
|
pa_xfree(device);
|
||||||
pa_xfree(sample_name);
|
pa_xfree(sample_name);
|
||||||
pa_xfree(sink_name);
|
pa_xfree(sink_name);
|
||||||
|
pa_xfree(source_name);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue