Lines Matching refs:buf
65 int (*proc) (pa_core *c, pa_tokenizer*t, pa_strbuf *buf, bool *fail);
84 static int pa_cli_command_exit(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
85 static int pa_cli_command_help(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
86 static int pa_cli_command_modules(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
87 static int pa_cli_command_clients(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
88 static int pa_cli_command_cards(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
89 static int pa_cli_command_sinks(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
90 static int pa_cli_command_sources(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
91 static int pa_cli_command_sink_inputs(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
92 static int pa_cli_command_source_outputs(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
93 static int pa_cli_command_stat(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
94 static int pa_cli_command_info(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
95 static int pa_cli_command_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
96 static int pa_cli_command_unload(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
97 static int pa_cli_command_describe(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
98 static int pa_cli_command_sink_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
99 static int pa_cli_command_sink_input_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
100 static int pa_cli_command_source_output_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
101 static int pa_cli_command_source_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
102 static int pa_cli_command_sink_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
103 static int pa_cli_command_source_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
104 static int pa_cli_command_sink_input_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
105 static int pa_cli_command_source_output_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
106 static int pa_cli_command_sink_default(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
107 static int pa_cli_command_source_default(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
108 static int pa_cli_command_kill_client(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
109 static int pa_cli_command_kill_sink_input(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
110 static int pa_cli_command_kill_source_output(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
111 static int pa_cli_command_scache_play(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
112 static int pa_cli_command_scache_remove(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
113 static int pa_cli_command_scache_list(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
114 static int pa_cli_command_scache_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
115 static int pa_cli_command_scache_load_dir(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
116 static int pa_cli_command_play_file(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
117 static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
118 static int pa_cli_command_list_shared_props(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
119 static int pa_cli_command_move_sink_input(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
120 static int pa_cli_command_move_source_output(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
121 static int pa_cli_command_vacuum(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
122 static int pa_cli_command_suspend_sink(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
123 static int pa_cli_command_suspend_source(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
124 static int pa_cli_command_suspend(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
125 static int pa_cli_command_log_target(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
126 static int pa_cli_command_log_level(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
127 static int pa_cli_command_log_meta(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
128 static int pa_cli_command_log_time(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
129 static int pa_cli_command_log_backtrace(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
130 static int pa_cli_command_update_sink_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
131 static int pa_cli_command_update_source_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
132 static int pa_cli_command_update_sink_input_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
133 static int pa_cli_command_update_source_output_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
134 static int pa_cli_command_card_profile(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
135 static int pa_cli_command_sink_port(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
136 static int pa_cli_command_source_port(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
137 static int pa_cli_command_port_offset(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
138 static int pa_cli_command_dump_volumes(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
139 static int pa_cli_command_send_message_to_object(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail);
218 static int pa_cli_command_exit(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
221 pa_assert(buf);
225 pa_strbuf_puts(buf, "Not allowed to terminate daemon.\n");
230 static int pa_cli_command_help(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
235 pa_assert(buf);
238 pa_strbuf_puts(buf, "Available commands:\n");
242 pa_strbuf_printf(buf, " %-25s %s\n", command->name, command->help);
246 static int pa_cli_command_modules(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
251 pa_assert(buf);
255 pa_strbuf_puts(buf, s);
260 static int pa_cli_command_clients(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
265 pa_assert(buf);
269 pa_strbuf_puts(buf, s);
274 static int pa_cli_command_cards(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
279 pa_assert(buf);
283 pa_strbuf_puts(buf, s);
288 static int pa_cli_command_sinks(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
293 pa_assert(buf);
297 pa_strbuf_puts(buf, s);
302 static int pa_cli_command_sources(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
307 pa_assert(buf);
311 pa_strbuf_puts(buf, s);
316 static int pa_cli_command_sink_inputs(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
321 pa_assert(buf);
325 pa_strbuf_puts(buf, s);
330 static int pa_cli_command_source_outputs(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
335 pa_assert(buf);
339 pa_strbuf_puts(buf, s);
344 static int pa_cli_command_stat(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
362 pa_assert(buf);
367 pa_strbuf_printf(buf, "Memory blocks currently allocated: %u, size: %s.\n",
371 pa_strbuf_printf(buf, "Memory blocks allocated during the whole lifetime: %u, size: %s.\n",
375 pa_strbuf_printf(buf, "Memory blocks imported from other processes: %u, size: %s.\n",
379 pa_strbuf_printf(buf, "Memory blocks exported to other processes: %u, size: %s.\n",
383 pa_strbuf_printf(buf, "Total sample cache size: %s.\n",
386 pa_strbuf_printf(buf, "Default sample spec: %s\n",
389 pa_strbuf_printf(buf, "Default channel map: %s\n",
392 pa_strbuf_printf(buf, "Default sink name: %s\n"
398 pa_strbuf_printf(buf,
407 static int pa_cli_command_info(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
410 pa_assert(buf);
413 pa_cli_command_stat(c, t, buf, fail);
414 pa_cli_command_modules(c, t, buf, fail);
415 pa_cli_command_sinks(c, t, buf, fail);
416 pa_cli_command_sources(c, t, buf, fail);
417 pa_cli_command_clients(c, t, buf, fail);
418 pa_cli_command_cards(c, t, buf, fail);
419 pa_cli_command_sink_inputs(c, t, buf, fail);
420 pa_cli_command_source_outputs(c, t, buf, fail);
421 pa_cli_command_scache_list(c, t, buf, fail);
425 static int pa_cli_command_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
432 pa_assert(buf);
436 pa_strbuf_puts(buf, "You need to specify the module name and optionally arguments.\n");
442 pa_strbuf_puts(buf, "Module already loaded; ignoring.\n");
444 pa_strbuf_puts(buf, "Module load failed.\n");
452 static int pa_cli_command_unload(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
460 pa_assert(buf);
464 pa_strbuf_puts(buf, "You need to specify the module index or name.\n");
470 pa_strbuf_puts(buf, "Invalid module index.\n");
484 pa_strbuf_printf(buf, "Module %s not loaded.\n", i);
492 static int pa_cli_command_describe(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
498 pa_assert(buf);
502 pa_strbuf_puts(buf, "You need to specify the module name.\n");
508 pa_strbuf_printf(buf, "Name: %s\n", name);
511 pa_strbuf_printf(buf, "No module information available\n");
514 pa_strbuf_printf(buf, "Version: %s\n", i->version);
516 pa_strbuf_printf(buf, "Description: %s\n", i->description);
518 pa_strbuf_printf(buf, "Author: %s\n", i->author);
520 pa_strbuf_printf(buf, "Usage: %s\n", i->usage);
521 pa_strbuf_printf(buf, "Load Once: %s\n", pa_yes_no(i->load_once));
523 pa_strbuf_printf(buf, "Warning, deprecated: %s\n", i->deprecated);
528 pa_strbuf_puts(buf, "Failed to open module.\n");
533 static int pa_cli_command_sink_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
541 pa_assert(buf);
545 pa_strbuf_puts(buf, "You need to specify a sink either by its name or its index.\n");
550 pa_strbuf_puts(buf, "You need to specify a volume >= 0. (0 is muted, 0x10000 is normal volume)\n");
555 pa_strbuf_puts(buf, "Failed to parse volume.\n");
560 pa_strbuf_puts(buf, "Volume outside permissible range.\n");
565 pa_strbuf_puts(buf, "No sink found by this name or index.\n");
574 static int pa_cli_command_sink_input_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
583 pa_assert(buf);
587 pa_strbuf_puts(buf, "You need to specify a sink input by its index.\n");
592 pa_strbuf_puts(buf, "Failed to parse index.\n");
597 pa_strbuf_puts(buf, "You need to specify a volume >= 0. (0 is muted, 0x10000 is normal volume)\n");
602 pa_strbuf_puts(buf, "Failed to parse volume.\n");
607 pa_strbuf_puts(buf, "Volume outside permissible range.\n");
612 pa_strbuf_puts(buf, "No sink input found with this index.\n");
617 pa_strbuf_puts(buf, "This sink input's volume can't be changed.\n");
626 static int pa_cli_command_source_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
634 pa_assert(buf);
638 pa_strbuf_puts(buf, "You need to specify a source either by its name or its index.\n");
643 pa_strbuf_puts(buf, "You need to specify a volume >= 0. (0 is muted, 0x10000 is normal volume)\n");
648 pa_strbuf_puts(buf, "Failed to parse volume.\n");
653 pa_strbuf_puts(buf, "Volume outside permissible range.\n");
658 pa_strbuf_puts(buf, "No source found by this name or index.\n");
667 static int pa_cli_command_source_output_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
676 pa_assert(buf);
680 pa_strbuf_puts(buf, "You need to specify a source output by its index.\n");
685 pa_strbuf_puts(buf, "Failed to parse index.\n");
690 pa_strbuf_puts(buf, "You need to specify a volume >= 0. (0 is muted, 0x10000 is normal volume)\n");
695 pa_strbuf_puts(buf, "Failed to parse volume.\n");
700 pa_strbuf_puts(buf, "Volume outside permissible range.\n");
705 pa_strbuf_puts(buf, "No source output found with this index.\n");
710 pa_strbuf_puts(buf, "This source output's volume can't be changed.\n");
719 static int pa_cli_command_sink_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
726 pa_assert(buf);
730 pa_strbuf_puts(buf, "You need to specify a sink either by its name or its index.\n");
735 pa_strbuf_puts(buf, "You need to specify a mute switch setting (0/1).\n");
740 pa_strbuf_puts(buf, "Failed to parse mute switch.\n");
745 pa_strbuf_puts(buf, "No sink found by this name or index.\n");
753 static int pa_cli_command_source_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
760 pa_assert(buf);
764 pa_strbuf_puts(buf, "You need to specify a source either by its name or its index.\n");
769 pa_strbuf_puts(buf, "You need to specify a mute switch setting (0/1).\n");
774 pa_strbuf_puts(buf, "Failed to parse mute switch.\n");
779 pa_strbuf_puts(buf, "No sink found by this name or index.\n");
787 static int pa_cli_command_update_sink_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
794 pa_assert(buf);
798 pa_strbuf_puts(buf, "You need to specify a sink either by its name or its index.\n");
803 pa_strbuf_puts(buf, "You need to specify a \"key=value\" argument.\n");
808 pa_strbuf_puts(buf, "No sink found by this name or index.\n");
813 pa_strbuf_puts(buf, "Failed to parse proplist.\n");
824 static int pa_cli_command_update_source_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
831 pa_assert(buf);
835 pa_strbuf_puts(buf, "You need to specify a source either by its name or its index.\n");
840 pa_strbuf_puts(buf, "You need to specify a \"key=value\" argument.\n");
845 pa_strbuf_puts(buf, "No source found by this name or index.\n");
850 pa_strbuf_puts(buf, "Failed to parse proplist.\n");
861 static int pa_cli_command_update_sink_input_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
869 pa_assert(buf);
873 pa_strbuf_puts(buf, "You need to specify a sink input either by index.\n");
878 pa_strbuf_puts(buf, "Failed to parse index.\n");
883 pa_strbuf_puts(buf, "You need to specify a \"key=value\" argument.\n");
888 pa_strbuf_puts(buf, "No sink input found with this index.\n");
893 pa_strbuf_puts(buf, "Failed to parse proplist.\n");
904 static int pa_cli_command_update_source_output_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
912 pa_assert(buf);
916 pa_strbuf_puts(buf, "You need to specify a source output by its index.\n");
921 pa_strbuf_puts(buf, "Failed to parse index.\n");
926 pa_strbuf_puts(buf, "You need to specify a \"key=value\" argument.\n");
931 pa_strbuf_puts(buf, "No source output found with this index.\n");
936 pa_strbuf_puts(buf, "Failed to parse proplist.\n");
947 static int pa_cli_command_sink_input_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
955 pa_assert(buf);
959 pa_strbuf_puts(buf, "You need to specify a sink input by its index.\n");
964 pa_strbuf_puts(buf, "Failed to parse index.\n");
969 pa_strbuf_puts(buf, "You need to specify a mute switch setting (0/1).\n");
974 pa_strbuf_puts(buf, "Failed to parse mute switch.\n");
979 pa_strbuf_puts(buf, "No sink input found with this index.\n");
987 static int pa_cli_command_source_output_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
995 pa_assert(buf);
999 pa_strbuf_puts(buf, "You need to specify a source output by its index.\n");
1004 pa_strbuf_puts(buf, "Failed to parse index.\n");
1009 pa_strbuf_puts(buf, "You need to specify a mute switch setting (0/1).\n");
1014 pa_strbuf_puts(buf, "Failed to parse mute switch.\n");
1019 pa_strbuf_puts(buf, "No source output found with this index.\n");
1027 static int pa_cli_command_sink_default(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1033 pa_assert(buf);
1037 pa_strbuf_puts(buf, "You need to specify a sink either by its name or its index.\n");
1044 pa_strbuf_printf(buf, "Sink %s does not exist.\n", n);
1049 static int pa_cli_command_source_default(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1055 pa_assert(buf);
1059 pa_strbuf_puts(buf, "You need to specify a source either by its name or its index.\n");
1066 pa_strbuf_printf(buf, "Source %s does not exist.\n", n);
1070 static int pa_cli_command_kill_client(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1077 pa_assert(buf);
1081 pa_strbuf_puts(buf, "You need to specify a client by its index.\n");
1086 pa_strbuf_puts(buf, "Failed to parse index.\n");
1091 pa_strbuf_puts(buf, "No client found by this index.\n");
1099 static int pa_cli_command_kill_sink_input(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1106 pa_assert(buf);
1110 pa_strbuf_puts(buf, "You need to specify a sink input by its index.\n");
1115 pa_strbuf_puts(buf, "Failed to parse index.\n");
1120 pa_strbuf_puts(buf, "No sink input found by this index.\n");
1128 static int pa_cli_command_kill_source_output(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1135 pa_assert(buf);
1139 pa_strbuf_puts(buf, "You need to specify a source output by its index.\n");
1144 pa_strbuf_puts(buf, "Failed to parse index.\n");
1149 pa_strbuf_puts(buf, "No source output found by this index.\n");
1157 static int pa_cli_command_scache_list(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1162 pa_assert(buf);
1166 pa_strbuf_puts(buf, s);
1172 static int pa_cli_command_scache_play(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1179 pa_assert(buf);
1183 pa_strbuf_puts(buf, "You need to specify a sample name and a sink name.\n");
1188 pa_strbuf_puts(buf, "No sink by that name.\n");
1193 pa_strbuf_puts(buf, "Failed to play sample.\n");
1197 pa_strbuf_printf(buf, "Playing on sink input #%i\n", idx);
1202 static int pa_cli_command_scache_remove(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1207 pa_assert(buf);
1211 pa_strbuf_puts(buf, "You need to specify a sample name.\n");
1216 pa_strbuf_puts(buf, "Failed to remove sample.\n");
1223 static int pa_cli_command_scache_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1229 pa_assert(buf);
1233 pa_strbuf_puts(buf, "You need to specify a file name and a sample name.\n");
1243 pa_strbuf_puts(buf, "Failed to load sound file.\n");
1248 static int pa_cli_command_scache_load_dir(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1253 pa_assert(buf);
1257 pa_strbuf_puts(buf, "You need to specify a path name.\n");
1262 pa_strbuf_puts(buf, "Failed to load directory.\n");
1269 static int pa_cli_command_play_file(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1275 pa_assert(buf);
1279 pa_strbuf_puts(buf, "You need to specify a file name and a sink name.\n");
1284 pa_strbuf_puts(buf, "No sink by that name.\n");
1289 pa_strbuf_puts(buf, "Failed to play sound file.\n");
1298 static int pa_cli_command_list_shared_props(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1301 pa_assert(buf);
1304 pa_shared_dump(c, buf);
1308 static int pa_cli_command_vacuum(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1311 pa_assert(buf);
1319 static int pa_cli_command_move_sink_input(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1327 pa_assert(buf);
1331 pa_strbuf_puts(buf, "You need to specify a sink input by its index.\n");
1336 pa_strbuf_puts(buf, "Failed to parse index.\n");
1341 pa_strbuf_puts(buf, "You need to specify a sink.\n");
1346 pa_strbuf_puts(buf, "No sink input found with this index.\n");
1351 pa_strbuf_puts(buf, "No sink found by this name or index.\n");
1356 pa_strbuf_puts(buf, "Moved failed.\n");
1362 static int pa_cli_command_move_source_output(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1370 pa_assert(buf);
1374 pa_strbuf_puts(buf, "You need to specify a source output by its index.\n");
1379 pa_strbuf_puts(buf, "Failed to parse index.\n");
1384 pa_strbuf_puts(buf, "You need to specify a source.\n");
1389 pa_strbuf_puts(buf, "No source output found with this index.\n");
1394 pa_strbuf_puts(buf, "No source found by this name or index.\n");
1399 pa_strbuf_puts(buf, "Moved failed.\n");
1405 static int pa_cli_command_suspend_sink(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1412 pa_assert(buf);
1416 pa_strbuf_puts(buf, "You need to specify a sink either by its name or its index.\n");
1421 pa_strbuf_puts(buf, "You need to specify a suspend switch setting (0/1).\n");
1426 pa_strbuf_puts(buf, "Failed to parse suspend switch.\n");
1431 pa_strbuf_puts(buf, "No sink found by this name or index.\n");
1438 pa_strbuf_printf(buf, "Failed to resume/suspend sink: %s\n", pa_strerror(r));
1443 static int pa_cli_command_suspend_source(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1450 pa_assert(buf);
1454 pa_strbuf_puts(buf, "You need to specify a source either by its name or its index.\n");
1459 pa_strbuf_puts(buf, "You need to specify a suspend switch setting (0/1).\n");
1464 pa_strbuf_puts(buf, "Failed to parse suspend switch.\n");
1469 pa_strbuf_puts(buf, "No source found by this name or index.\n");
1476 pa_strbuf_printf(buf, "Failed to resume/suspend source: %s\n", pa_strerror(r));
1481 static int pa_cli_command_suspend(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1487 pa_assert(buf);
1491 pa_strbuf_puts(buf, "You need to specify a suspend switch setting (0/1).\n");
1496 pa_strbuf_puts(buf, "Failed to parse suspend switch.\n");
1503 pa_strbuf_printf(buf, "Failed to resume/suspend all sinks: %s\n", pa_strerror(r));
1506 pa_strbuf_printf(buf, "Failed to resume/suspend all sources: %s\n", pa_strerror(r));
1511 static int pa_cli_command_log_target(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1517 pa_assert(buf);
1521 pa_strbuf_puts(buf, "You need to specify a log target (null|auto|syslog|stderr|file:PATH|newfile:PATH).\n");
1532 pa_strbuf_puts(buf, "Invalid log target.\n");
1538 pa_strbuf_puts(buf, "Failed to set log target.\n");
1548 static int pa_cli_command_log_level(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1554 pa_assert(buf);
1558 pa_strbuf_puts(buf, "You need to specify a log level (0..4).\n");
1563 pa_strbuf_puts(buf, "Failed to parse log level.\n");
1572 static int pa_cli_command_log_meta(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1578 pa_assert(buf);
1582 pa_strbuf_puts(buf, "You need to specify a boolean.\n");
1587 pa_strbuf_puts(buf, "Failed to parse log meta switch.\n");
1596 static int pa_cli_command_log_time(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1602 pa_assert(buf);
1606 pa_strbuf_puts(buf, "You need to specify a boolean.\n");
1611 pa_strbuf_puts(buf, "Failed to parse log meta switch.\n");
1620 static int pa_cli_command_log_backtrace(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1626 pa_assert(buf);
1630 pa_strbuf_puts(buf, "You need to specify a backtrace level.\n");
1635 pa_strbuf_puts(buf, "Failed to parse backtrace level.\n");
1644 static int pa_cli_command_card_profile(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1651 pa_assert(buf);
1655 pa_strbuf_puts(buf, "You need to specify a card either by its name or its index.\n");
1660 pa_strbuf_puts(buf, "You need to specify a profile by its name.\n");
1665 pa_strbuf_puts(buf, "No card found by this name or index.\n");
1670 pa_strbuf_printf(buf, "No such profile: %s\n", p);
1675 pa_strbuf_printf(buf, "Failed to set card profile to '%s'.\n", p);
1682 static int pa_cli_command_sink_port(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1688 pa_assert(buf);
1692 pa_strbuf_puts(buf, "You need to specify a sink either by its name or its index.\n");
1697 pa_strbuf_puts(buf, "You need to specify a profile by its name.\n");
1702 pa_strbuf_puts(buf, "No sink found by this name or index.\n");
1707 pa_strbuf_printf(buf, "Failed to set sink port to '%s'.\n", p);
1714 static int pa_cli_command_source_port(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1720 pa_assert(buf);
1724 pa_strbuf_puts(buf, "You need to specify a source either by its name or its index.\n");
1729 pa_strbuf_puts(buf, "You need to specify a profile by its name.\n");
1734 pa_strbuf_puts(buf, "No source found by this name or index.\n");
1739 pa_strbuf_printf(buf, "Failed to set source port to '%s'.\n", p);
1746 static int pa_cli_command_port_offset(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1754 pa_assert(buf);
1758 pa_strbuf_puts(buf, "You need to specify a card either by its name or its index.\n");
1763 pa_strbuf_puts(buf, "You need to specify a port by its name.\n");
1768 pa_strbuf_puts(buf, "You need to specify a latency offset.\n");
1773 pa_strbuf_puts(buf, "Failed to parse the latency offset.\n");
1778 pa_strbuf_puts(buf, "No card found by this name or index.\n");
1783 pa_strbuf_puts(buf, "No port found by this name.\n");
1792 static int pa_cli_command_send_message_to_object(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1799 pa_assert(buf);
1804 pa_strbuf_puts(buf, "You need to specify an object path as recipient for the message.\n");
1809 pa_strbuf_puts(buf, "You need to specify a message name.\n");
1819 pa_strbuf_printf(buf, "Send message failed: %s\n", pa_strerror(ret));
1824 pa_strbuf_puts(buf, response);
1825 pa_strbuf_puts(buf, "\n");
1833 static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1847 pa_assert(buf);
1853 pa_strbuf_printf(buf, "### Configuration dump generated at %s\n", ctime_r(&now, txt));
1855 pa_strbuf_printf(buf, "### Configuration dump generated at %s\n", ctime(&now));
1860 pa_strbuf_printf(buf, "load-module %s", m->name);
1863 pa_strbuf_printf(buf, " %s", m->argument);
1865 pa_strbuf_puts(buf, "\n");
1872 pa_strbuf_puts(buf, "\n");
1876 pa_strbuf_printf(buf, "set-sink-volume %s 0x%03x\n", sink->name, pa_cvolume_max(pa_sink_get_volume(sink, false)));
1877 pa_strbuf_printf(buf, "set-sink-mute %s %s\n", sink->name, pa_yes_no(pa_sink_get_mute(sink, false)));
1878 pa_strbuf_printf(buf, "suspend-sink %s %s\n", sink->name, pa_yes_no(sink->state == PA_SINK_SUSPENDED));
1885 pa_strbuf_puts(buf, "\n");
1889 pa_strbuf_printf(buf, "set-source-volume %s 0x%03x\n", source->name, pa_cvolume_max(pa_source_get_volume(source, false)));
1890 pa_strbuf_printf(buf, "set-source-mute %s %s\n", source->name, pa_yes_no(pa_source_get_mute(source, false)));
1891 pa_strbuf_printf(buf, "suspend-source %s %s\n", source->name, pa_yes_no(source->state == PA_SOURCE_SUSPENDED));
1898 pa_strbuf_puts(buf, "\n");
1902 pa_strbuf_printf(buf, "set-card-profile %s %s\n", card->name, card->active_profile->name);
1908 pa_strbuf_puts(buf, "\n");
1912 pa_strbuf_printf(buf, "set-default-sink %s\n", c->default_sink->name);
1917 pa_strbuf_puts(buf, "\n");
1919 pa_strbuf_printf(buf, "set-default-source %s\n", c->default_source->name);
1922 pa_strbuf_puts(buf, "\n### EOF\n");
1927 static int pa_cli_command_dump_volumes(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
1938 pa_assert(buf);
1943 pa_strbuf_printf(buf, "Sink %d: ", s_idx);
1944 pa_strbuf_printf(buf,
1951 pa_strbuf_printf(buf,
1958 pa_strbuf_printf(buf, "soft = %s, ", pa_cvolume_snprint_verbose(v_str, sizeof(v_str), &s->soft_volume, map, true));
1959 pa_strbuf_printf(buf,
1966 pa_strbuf_printf(buf, "save = %s\n", pa_yes_no(s->save_volume));
1970 pa_strbuf_printf(buf, "\tInput %d: ", i_idx);
1971 pa_strbuf_printf(buf, "volume = %s, ", pa_cvolume_snprint_verbose(v_str, sizeof(v_str), &i->volume, map, true));
1972 pa_strbuf_printf(buf,
1975 pa_strbuf_printf(buf,
1978 pa_strbuf_printf(buf, "soft = %s, ", pa_cvolume_snprint_verbose(v_str, sizeof(v_str), &i->soft_volume, map, true));
1979 pa_strbuf_printf(buf,
1982 pa_strbuf_printf(buf,
1989 pa_strbuf_printf(buf, "save = %s\n", pa_yes_no(i->save_volume));
1995 pa_strbuf_printf(buf, "Source %d: ", s_idx);
1996 pa_strbuf_printf(buf,
2003 pa_strbuf_printf(buf,
2010 pa_strbuf_printf(buf, "soft = %s, ", pa_cvolume_snprint_verbose(v_str, sizeof(v_str), &so->soft_volume, map, true));
2011 pa_strbuf_printf(buf,
2018 pa_strbuf_printf(buf, "save = %s\n", pa_yes_no(so->save_volume));
2022 pa_strbuf_printf(buf, "\tOutput %d: ", i_idx);
2023 pa_strbuf_printf(buf, "volume = %s, ", pa_cvolume_snprint_verbose(v_str, sizeof(v_str), &o->volume, map, true));
2024 pa_strbuf_printf(buf,
2027 pa_strbuf_printf(buf,
2030 pa_strbuf_printf(buf, "soft = %s, ", pa_cvolume_snprint_verbose(v_str, sizeof(v_str), &o->soft_volume, map, true));
2031 pa_strbuf_printf(buf,
2034 pa_strbuf_printf(buf,
2041 pa_strbuf_printf(buf, "save = %s\n", pa_yes_no(o->save_volume));
2048 int pa_cli_command_execute_line_stateful(pa_core *c, const char *s, pa_strbuf *buf, bool *fail, int *ifstate) {
2053 pa_assert(buf);
2062 pa_strbuf_printf(buf, "Meta command %s is not valid in this context\n", cs);
2071 pa_strbuf_printf(buf, "Meta command %s is not valid in this context\n", cs);
2155 if (pa_cli_command_execute_file(c, sorted_files[i], buf, fail) < 0 && *fail)
2168 } else if (pa_cli_command_execute_file(c, filename, buf, fail) < 0 && *fail) {
2176 pa_strbuf_printf(buf, "Meta command %s is not valid in this context\n", cs);
2179 pa_strbuf_printf(buf, "Nested %s commands not supported\n", cs);
2186 pa_strbuf_printf(buf, "Invalid meta command: %s\n", cs);
2205 ret = command->proc(c, t, buf, fail);
2216 pa_strbuf_printf(buf, "Unknown command: %s\n", cs);
2225 int pa_cli_command_execute_line(pa_core *c, const char *s, pa_strbuf *buf, bool *fail) {
2226 return pa_cli_command_execute_line_stateful(c, s, buf, fail, NULL);
2229 int pa_cli_command_execute_file_stream(pa_core *c, FILE *f, pa_strbuf *buf, bool *fail) {
2237 pa_assert(buf);
2245 if (pa_cli_command_execute_line_stateful(c, line, buf, fail, &ifstate) < 0 && *fail)
2256 int pa_cli_command_execute_file(pa_core *c, const char *fn, pa_strbuf *buf, bool *fail) {
2263 pa_assert(buf);
2269 pa_strbuf_printf(buf, "open('%s') failed: %s\n", fn, pa_cstrerror(errno));
2276 ret = pa_cli_command_execute_file_stream(c, f, buf, fail);
2285 int pa_cli_command_execute(pa_core *c, const char *s, pa_strbuf *buf, bool *fail) {
2292 pa_assert(buf);
2302 if (pa_cli_command_execute_line_stateful(c, line, buf, fail, &ifstate) < 0 && *fail) {