+static void get_source_output_info_callback(struct pa_context *c, const struct pa_source_output_info *i, int is_last, void *userdata) {
+ char t[32], k[32], s[PA_SAMPLE_SPEC_SNPRINT_MAX];
+
+ if (is_last < 0) {
+ fprintf(stderr, "Failed to get source output information: %s\n", pa_strerror(pa_context_errno(c)));
+ quit(1);
+ return;
+ }
+
+ if (is_last) {
+ complete_action();
+ return;
+ }
+
+ assert(i);
+
+ if (nl)
+ printf("\n");
+ nl = 1;
+
+ pa_sample_spec_snprint(s, sizeof(s), &i->sample_spec);
+ snprintf(t, sizeof(t), "%u", i->owner_module);
+ snprintf(k, sizeof(k), "%u", i->client);
+
+ printf("*** Source Output #%u ***\n"
+ "Name: %s\n"
+ "Owner Module: %s\n"
+ "Client: %s\n"
+ "Source: %u\n"
+ "Sample Specification: %s\n"
+ "Buffer Latency: %0.0f usec\n"
+ "Source Latency: %0.0f usec\n",
+ i->index,
+ i->name,
+ i->owner_module != PA_INVALID_INDEX ? t : "n/a",
+ i->client != PA_INVALID_INDEX ? k : "n/a",
+ i->source,
+ s,
+ (double) i->buffer_usec,
+ (double) i->source_usec);
+}
+
+static void get_sample_info_callback(struct pa_context *c, const struct pa_sample_info *i, int is_last, void *userdata) {
+ char t[32], s[PA_SAMPLE_SPEC_SNPRINT_MAX];
+
+ if (is_last < 0) {
+ fprintf(stderr, "Failed to get sample information: %s\n", pa_strerror(pa_context_errno(c)));
+ quit(1);
+ return;
+ }
+
+ if (is_last) {
+ complete_action();
+ return;
+ }
+
+ assert(i);
+
+ if (nl)
+ printf("\n");
+ nl = 1;
+
+ pa_sample_spec_snprint(s, sizeof(s), &i->sample_spec);
+ pa_bytes_snprint(t, sizeof(t), i->bytes);
+
+ printf("*** Sample #%u ***\n"
+ "Name: %s\n"
+ "Volume: 0x%03x (%0.2f dB)\n"
+ "Sample Specification: %s\n"
+ "Duration: %0.1fs\n"
+ "Size: %s\n"
+ "Lazy: %s\n"
+ "Filename: %s\n",
+ i->index,
+ i->name,
+ i->volume, pa_volume_to_dB(i->volume),
+ pa_sample_spec_valid(&i->sample_spec) ? s : "n/a",
+ (double) i->duration/1000000,
+ t,
+ i->lazy ? "yes" : "no",
+ i->filename ? i->filename : "n/a");
+}
+
+static void get_autoload_info_callback(struct pa_context *c, const struct pa_autoload_info *i, int is_last, void *userdata) {
+ if (is_last < 0) {
+ fprintf(stderr, "Failed to get autoload information: %s\n", pa_strerror(pa_context_errno(c)));
+ quit(1);
+ return;
+ }
+
+ if (is_last) {
+ complete_action();
+ return;
+ }
+
+ assert(i);
+
+ if (nl)
+ printf("\n");
+ nl = 1;
+
+ printf("*** Autoload Entry #%u ***\n"
+ "Name: %s\n"
+ "Type: %s\n"
+ "Module: %s\n"
+ "Argument: %s\n",
+ i->index,
+ i->name,
+ i->type == PA_AUTOLOAD_SINK ? "sink" : "source",
+ i->module,
+ i->argument);
+}
+
+static void simple_callback(struct pa_context *c, int success, void *userdata) {