mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -05:00
merge glitch-free branch back into trunk
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2445 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
91f092eadc
commit
045c1d602d
189 changed files with 12559 additions and 4959 deletions
|
|
@ -44,6 +44,8 @@
|
|||
#error Invalid PulseAudio API version
|
||||
#endif
|
||||
|
||||
#define CLEAR_LINE "\x1B[K"
|
||||
|
||||
static enum { RECORD, PLAYBACK } mode = PLAYBACK;
|
||||
|
||||
static pa_context *context = NULL;
|
||||
|
|
@ -71,6 +73,8 @@ static int channel_map_set = 0;
|
|||
|
||||
static pa_stream_flags_t flags = 0;
|
||||
|
||||
static size_t latency = 0, process_time=0;
|
||||
|
||||
/* A shortcut for terminating the application */
|
||||
static void quit(int ret) {
|
||||
assert(mainloop_api);
|
||||
|
|
@ -204,17 +208,38 @@ static void stream_suspended_callback(pa_stream *s, void *userdata) {
|
|||
|
||||
if (verbose) {
|
||||
if (pa_stream_is_suspended(s))
|
||||
fprintf(stderr, "Stream device suspended.\n");
|
||||
fprintf(stderr, "Stream device suspended." CLEAR_LINE " \n");
|
||||
else
|
||||
fprintf(stderr, "Stream device resumed.\n");
|
||||
fprintf(stderr, "Stream device resumed." CLEAR_LINE " \n");
|
||||
}
|
||||
}
|
||||
|
||||
static void stream_underflow_callback(pa_stream *s, void *userdata) {
|
||||
assert(s);
|
||||
|
||||
if (verbose)
|
||||
fprintf(stderr, "Stream underrun." CLEAR_LINE " \n");
|
||||
}
|
||||
|
||||
static void stream_overflow_callback(pa_stream *s, void *userdata) {
|
||||
assert(s);
|
||||
|
||||
if (verbose)
|
||||
fprintf(stderr, "Stream overrun." CLEAR_LINE " \n");
|
||||
}
|
||||
|
||||
static void stream_started_callback(pa_stream *s, void *userdata) {
|
||||
assert(s);
|
||||
|
||||
if (verbose)
|
||||
fprintf(stderr, "Stream started." CLEAR_LINE " \n");
|
||||
}
|
||||
|
||||
static void stream_moved_callback(pa_stream *s, void *userdata) {
|
||||
assert(s);
|
||||
|
||||
if (verbose)
|
||||
fprintf(stderr, "Stream moved to device %s (%u, %ssuspended).\n", pa_stream_get_device_name(s), pa_stream_get_device_index(s), pa_stream_is_suspended(s) ? "" : "not ");
|
||||
fprintf(stderr, "Stream moved to device %s (%u, %ssuspended)." CLEAR_LINE " \n", pa_stream_get_device_name(s), pa_stream_get_device_index(s), pa_stream_is_suspended(s) ? "" : "not ");
|
||||
}
|
||||
|
||||
/* This is called whenever the context status changes */
|
||||
|
|
@ -229,12 +254,13 @@ static void context_state_callback(pa_context *c, void *userdata) {
|
|||
|
||||
case PA_CONTEXT_READY: {
|
||||
int r;
|
||||
pa_buffer_attr buffer_attr;
|
||||
|
||||
assert(c);
|
||||
assert(!stream);
|
||||
|
||||
if (verbose)
|
||||
fprintf(stderr, "Connection established.\n");
|
||||
fprintf(stderr, "Connection established." CLEAR_LINE " \n");
|
||||
|
||||
if (!(stream = pa_stream_new(c, stream_name, &sample_spec, channel_map_set ? &channel_map : NULL))) {
|
||||
fprintf(stderr, "pa_stream_new() failed: %s\n", pa_strerror(pa_context_errno(c)));
|
||||
|
|
@ -246,16 +272,26 @@ static void context_state_callback(pa_context *c, void *userdata) {
|
|||
pa_stream_set_read_callback(stream, stream_read_callback, NULL);
|
||||
pa_stream_set_suspended_callback(stream, stream_suspended_callback, NULL);
|
||||
pa_stream_set_moved_callback(stream, stream_moved_callback, NULL);
|
||||
pa_stream_set_underflow_callback(stream, stream_underflow_callback, NULL);
|
||||
pa_stream_set_overflow_callback(stream, stream_overflow_callback, NULL);
|
||||
pa_stream_set_started_callback(stream, stream_started_callback, NULL);
|
||||
|
||||
if (latency > 0) {
|
||||
memset(&buffer_attr, 0, sizeof(buffer_attr));
|
||||
buffer_attr.tlength = latency;
|
||||
buffer_attr.minreq = process_time;
|
||||
flags |= PA_STREAM_ADJUST_LATENCY;
|
||||
}
|
||||
|
||||
if (mode == PLAYBACK) {
|
||||
pa_cvolume cv;
|
||||
if ((r = pa_stream_connect_playback(stream, device, NULL, flags, pa_cvolume_set(&cv, sample_spec.channels, volume), NULL)) < 0) {
|
||||
if ((r = pa_stream_connect_playback(stream, device, latency > 0 ? &buffer_attr : NULL, flags, pa_cvolume_set(&cv, sample_spec.channels, volume), NULL)) < 0) {
|
||||
fprintf(stderr, "pa_stream_connect_playback() failed: %s\n", pa_strerror(pa_context_errno(c)));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
} else {
|
||||
if ((r = pa_stream_connect_record(stream, device, NULL, flags)) < 0) {
|
||||
if ((r = pa_stream_connect_record(stream, device, latency > 0 ? &buffer_attr : NULL, flags)) < 0) {
|
||||
fprintf(stderr, "pa_stream_connect_record() failed: %s\n", pa_strerror(pa_context_errno(c)));
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -407,14 +443,14 @@ static void exit_signal_callback(pa_mainloop_api*m, pa_signal_event *e, int sig,
|
|||
|
||||
/* Show the current latency */
|
||||
static void stream_update_timing_callback(pa_stream *s, int success, void *userdata) {
|
||||
pa_usec_t latency, usec;
|
||||
pa_usec_t l, usec;
|
||||
int negative = 0;
|
||||
|
||||
assert(s);
|
||||
|
||||
if (!success ||
|
||||
pa_stream_get_time(s, &usec) < 0 ||
|
||||
pa_stream_get_latency(s, &latency, &negative) < 0) {
|
||||
pa_stream_get_latency(s, &l, &negative) < 0) {
|
||||
fprintf(stderr, "Failed to get latency: %s\n", pa_strerror(pa_context_errno(context)));
|
||||
quit(1);
|
||||
return;
|
||||
|
|
@ -422,7 +458,7 @@ static void stream_update_timing_callback(pa_stream *s, int success, void *userd
|
|||
|
||||
fprintf(stderr, "Time: %0.3f sec; Latency: %0.0f usec. \r",
|
||||
(float) usec / 1000000,
|
||||
(float) latency * (negative?-1:1));
|
||||
(float) l * (negative?-1:1));
|
||||
}
|
||||
|
||||
/* Someone requested that the latency is shown */
|
||||
|
|
@ -478,6 +514,8 @@ static void help(const char *argv0) {
|
|||
" from the sink the stream is being connected to.\n"
|
||||
" --no-remix Don't upmix or downmix channels.\n"
|
||||
" --no-remap Map channels by index instead of name.\n"
|
||||
" --latency=BYTES Request the specified latency in bytes.\n"
|
||||
" --process-time=BYTES Request the specified process time per request in bytes.\n"
|
||||
,
|
||||
argv0);
|
||||
}
|
||||
|
|
@ -494,7 +532,9 @@ enum {
|
|||
ARG_FIX_RATE,
|
||||
ARG_FIX_CHANNELS,
|
||||
ARG_NO_REMAP,
|
||||
ARG_NO_REMIX
|
||||
ARG_NO_REMIX,
|
||||
ARG_LATENCY,
|
||||
ARG_PROCESS_TIME
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
|
@ -504,26 +544,28 @@ int main(int argc, char *argv[]) {
|
|||
pa_time_event *time_event = NULL;
|
||||
|
||||
static const struct option long_options[] = {
|
||||
{"record", 0, NULL, 'r'},
|
||||
{"playback", 0, NULL, 'p'},
|
||||
{"device", 1, NULL, 'd'},
|
||||
{"server", 1, NULL, 's'},
|
||||
{"client-name", 1, NULL, 'n'},
|
||||
{"stream-name", 1, NULL, ARG_STREAM_NAME},
|
||||
{"version", 0, NULL, ARG_VERSION},
|
||||
{"help", 0, NULL, 'h'},
|
||||
{"verbose", 0, NULL, 'v'},
|
||||
{"volume", 1, NULL, ARG_VOLUME},
|
||||
{"rate", 1, NULL, ARG_SAMPLERATE},
|
||||
{"format", 1, NULL, ARG_SAMPLEFORMAT},
|
||||
{"channels", 1, NULL, ARG_CHANNELS},
|
||||
{"channel-map", 1, NULL, ARG_CHANNELMAP},
|
||||
{"fix-format", 0, NULL, ARG_FIX_FORMAT},
|
||||
{"fix-rate", 0, NULL, ARG_FIX_RATE},
|
||||
{"fix-channels",0, NULL, ARG_FIX_CHANNELS},
|
||||
{"no-remap", 0, NULL, ARG_NO_REMAP},
|
||||
{"no-remix", 0, NULL, ARG_NO_REMIX},
|
||||
{NULL, 0, NULL, 0}
|
||||
{"record", 0, NULL, 'r'},
|
||||
{"playback", 0, NULL, 'p'},
|
||||
{"device", 1, NULL, 'd'},
|
||||
{"server", 1, NULL, 's'},
|
||||
{"client-name", 1, NULL, 'n'},
|
||||
{"stream-name", 1, NULL, ARG_STREAM_NAME},
|
||||
{"version", 0, NULL, ARG_VERSION},
|
||||
{"help", 0, NULL, 'h'},
|
||||
{"verbose", 0, NULL, 'v'},
|
||||
{"volume", 1, NULL, ARG_VOLUME},
|
||||
{"rate", 1, NULL, ARG_SAMPLERATE},
|
||||
{"format", 1, NULL, ARG_SAMPLEFORMAT},
|
||||
{"channels", 1, NULL, ARG_CHANNELS},
|
||||
{"channel-map", 1, NULL, ARG_CHANNELMAP},
|
||||
{"fix-format", 0, NULL, ARG_FIX_FORMAT},
|
||||
{"fix-rate", 0, NULL, ARG_FIX_RATE},
|
||||
{"fix-channels", 0, NULL, ARG_FIX_CHANNELS},
|
||||
{"no-remap", 0, NULL, ARG_NO_REMAP},
|
||||
{"no-remix", 0, NULL, ARG_NO_REMIX},
|
||||
{"latency", 1, NULL, ARG_LATENCY},
|
||||
{"process-time", 1, NULL, ARG_PROCESS_TIME},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
if (!(bn = strrchr(argv[0], '/')))
|
||||
|
|
@ -601,7 +643,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
case ARG_CHANNELMAP:
|
||||
if (!pa_channel_map_parse(&channel_map, optarg)) {
|
||||
fprintf(stderr, "Invalid channel map\n");
|
||||
fprintf(stderr, "Invalid channel map '%s'\n", optarg);
|
||||
goto quit;
|
||||
}
|
||||
|
||||
|
|
@ -628,6 +670,20 @@ int main(int argc, char *argv[]) {
|
|||
flags |= PA_STREAM_NO_REMAP_CHANNELS;
|
||||
break;
|
||||
|
||||
case ARG_LATENCY:
|
||||
if (((latency = atoi(optarg))) <= 0) {
|
||||
fprintf(stderr, "Invalid latency specification '%s'\n", optarg);
|
||||
goto quit;
|
||||
}
|
||||
break;
|
||||
|
||||
case ARG_PROCESS_TIME:
|
||||
if (((process_time = atoi(optarg))) <= 0) {
|
||||
fprintf(stderr, "Invalid process time specification '%s'\n", optarg);
|
||||
goto quit;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
goto quit;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
#include <pulse/error.h>
|
||||
#include <pulse/util.h>
|
||||
#include <pulse/xmalloc.h>
|
||||
|
||||
#include <pulsecore/core-util.h>
|
||||
#include <pulsecore/log.h>
|
||||
|
|
@ -49,6 +50,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {
|
|||
char ibuf[256], obuf[256];
|
||||
size_t ibuf_index, ibuf_length, obuf_index, obuf_length;
|
||||
fd_set ifds, ofds;
|
||||
char *cli;
|
||||
|
||||
if (pa_pid_file_check_running(&pid, "pulseaudio") < 0) {
|
||||
pa_log("no PulseAudio daemon running");
|
||||
|
|
@ -62,7 +64,10 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {
|
|||
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
sa.sun_family = AF_UNIX;
|
||||
pa_runtime_path("cli", sa.sun_path, sizeof(sa.sun_path));
|
||||
|
||||
cli = pa_runtime_path("cli");
|
||||
pa_strlcpy(sa.sun_path, cli, sizeof(sa.sun_path));
|
||||
pa_xfree(cli);
|
||||
|
||||
for (i = 0; i < 5; i++) {
|
||||
int r;
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ static void get_server_info_callback(pa_context *c, const pa_server_info *i, voi
|
|||
|
||||
static void get_sink_info_callback(pa_context *c, const pa_sink_info *i, int is_last, void *userdata) {
|
||||
char s[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
|
||||
char *pl;
|
||||
|
||||
if (is_last < 0) {
|
||||
fprintf(stderr, "Failed to get sink information: %s\n", pa_strerror(pa_context_errno(c)));
|
||||
|
|
@ -179,32 +180,37 @@ static void get_sink_info_callback(pa_context *c, const pa_sink_info *i, int is_
|
|||
printf("*** Sink #%u ***\n"
|
||||
"Name: %s\n"
|
||||
"Driver: %s\n"
|
||||
"Description: %s\n"
|
||||
"Sample Specification: %s\n"
|
||||
"Channel Map: %s\n"
|
||||
"Owner Module: %u\n"
|
||||
"Volume: %s\n"
|
||||
"Monitor Source: %u\n"
|
||||
"Latency: %0.0f usec\n"
|
||||
"Flags: %s%s%s\n",
|
||||
"Monitor Source: %s\n"
|
||||
"Latency: %0.0f usec, configured %0.0f usec\n"
|
||||
"Flags: %s%s%s%s%s%s\n"
|
||||
"Properties:\n%s",
|
||||
i->index,
|
||||
i->name,
|
||||
i->driver,
|
||||
i->description,
|
||||
pa_strnull(i->driver),
|
||||
pa_sample_spec_snprint(s, sizeof(s), &i->sample_spec),
|
||||
pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map),
|
||||
i->owner_module,
|
||||
i->mute ? "muted" : pa_cvolume_snprint(cv, sizeof(cv), &i->volume),
|
||||
i->monitor_source,
|
||||
(double) i->latency,
|
||||
pa_strnull(i->monitor_source_name),
|
||||
(double) i->latency, (double) i->configured_latency,
|
||||
i->flags & PA_SINK_HARDWARE ? "HARDWARE " : "",
|
||||
i->flags & PA_SINK_NETWORK ? "NETWORK " : "",
|
||||
i->flags & PA_SINK_HW_MUTE_CTRL ? "HW_MUTE_CTRL " : "",
|
||||
i->flags & PA_SINK_HW_VOLUME_CTRL ? "HW_VOLUME_CTRL " : "",
|
||||
i->flags & PA_SINK_DECIBEL_VOLUME ? "DECIBEL_VOLUME " : "",
|
||||
i->flags & PA_SINK_LATENCY ? "LATENCY " : "",
|
||||
i->flags & PA_SINK_HARDWARE ? "HARDWARE" : "");
|
||||
pl = pa_proplist_to_string(i->proplist));
|
||||
|
||||
pa_xfree(pl);
|
||||
}
|
||||
|
||||
static void get_source_info_callback(pa_context *c, const pa_source_info *i, int is_last, void *userdata) {
|
||||
char s[PA_SAMPLE_SPEC_SNPRINT_MAX], t[32], cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
|
||||
char s[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
|
||||
char *pl;
|
||||
|
||||
if (is_last < 0) {
|
||||
fprintf(stderr, "Failed to get source information: %s\n", pa_strerror(pa_context_errno(c)));
|
||||
|
|
@ -223,33 +229,35 @@ static void get_source_info_callback(pa_context *c, const pa_source_info *i, int
|
|||
printf("\n");
|
||||
nl = 1;
|
||||
|
||||
snprintf(t, sizeof(t), "%u", i->monitor_of_sink);
|
||||
|
||||
printf("*** Source #%u ***\n"
|
||||
"Name: %s\n"
|
||||
"Driver: %s\n"
|
||||
"Description: %s\n"
|
||||
"Sample Specification: %s\n"
|
||||
"Channel Map: %s\n"
|
||||
"Owner Module: %u\n"
|
||||
"Volume: %s\n"
|
||||
"Monitor of Sink: %s\n"
|
||||
"Latency: %0.0f usec\n"
|
||||
"Flags: %s%s%s\n",
|
||||
"Latency: %0.0f usec, configured %0.0f usec\n"
|
||||
"Flags: %s%s%s%s%s%s\n"
|
||||
"Properties:\n%s",
|
||||
i->index,
|
||||
i->name,
|
||||
i->driver,
|
||||
i->description,
|
||||
pa_strnull(i->driver),
|
||||
pa_sample_spec_snprint(s, sizeof(s), &i->sample_spec),
|
||||
pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map),
|
||||
i->owner_module,
|
||||
i->mute ? "muted" : pa_cvolume_snprint(cv, sizeof(cv), &i->volume),
|
||||
i->monitor_of_sink != PA_INVALID_INDEX ? t : "no",
|
||||
(double) i->latency,
|
||||
i->monitor_of_sink_name ? i->monitor_of_sink_name : "n/a",
|
||||
(double) i->latency, (double) i->configured_latency,
|
||||
i->flags & PA_SOURCE_HARDWARE ? "HARDWARE " : "",
|
||||
i->flags & PA_SOURCE_NETWORK ? "NETWORK " : "",
|
||||
i->flags & PA_SOURCE_HW_MUTE_CTRL ? "HW_MUTE_CTRL " : "",
|
||||
i->flags & PA_SOURCE_HW_VOLUME_CTRL ? "HW_VOLUME_CTRL " : "",
|
||||
i->flags & PA_SOURCE_DECIBEL_VOLUME ? "DECIBEL_VOLUME " : "",
|
||||
i->flags & PA_SOURCE_LATENCY ? "LATENCY " : "",
|
||||
i->flags & PA_SOURCE_HARDWARE ? "HARDWARE" : "");
|
||||
pl = pa_proplist_to_string(i->proplist));
|
||||
|
||||
pa_xfree(pl);
|
||||
}
|
||||
|
||||
static void get_module_info_callback(pa_context *c, const pa_module_info *i, int is_last, void *userdata) {
|
||||
|
|
@ -283,11 +291,12 @@ static void get_module_info_callback(pa_context *c, const pa_module_info *i, int
|
|||
i->name,
|
||||
i->argument ? i->argument : "",
|
||||
i->n_used != PA_INVALID_INDEX ? t : "n/a",
|
||||
i->auto_unload ? "yes" : "no");
|
||||
pa_yes_no(i->auto_unload));
|
||||
}
|
||||
|
||||
static void get_client_info_callback(pa_context *c, const pa_client_info *i, int is_last, void *userdata) {
|
||||
char t[32];
|
||||
char *pl;
|
||||
|
||||
if (is_last < 0) {
|
||||
fprintf(stderr, "Failed to get client information: %s\n", pa_strerror(pa_context_errno(c)));
|
||||
|
|
@ -309,17 +318,20 @@ static void get_client_info_callback(pa_context *c, const pa_client_info *i, int
|
|||
snprintf(t, sizeof(t), "%u", i->owner_module);
|
||||
|
||||
printf("*** Client #%u ***\n"
|
||||
"Name: %s\n"
|
||||
"Driver: %s\n"
|
||||
"Owner Module: %s\n",
|
||||
"Owner Module: %s\n"
|
||||
"Properties:\n%s",
|
||||
i->index,
|
||||
i->name,
|
||||
i->driver,
|
||||
i->owner_module != PA_INVALID_INDEX ? t : "n/a");
|
||||
pa_strnull(i->driver),
|
||||
i->owner_module != PA_INVALID_INDEX ? t : "n/a",
|
||||
pl = pa_proplist_to_string(i->proplist));
|
||||
|
||||
pa_xfree(pl);
|
||||
}
|
||||
|
||||
static void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info *i, int is_last, void *userdata) {
|
||||
char t[32], k[32], s[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
|
||||
char *pl;
|
||||
|
||||
if (is_last < 0) {
|
||||
fprintf(stderr, "Failed to get sink input information: %s\n", pa_strerror(pa_context_errno(c)));
|
||||
|
|
@ -342,7 +354,6 @@ static void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info
|
|||
snprintf(k, sizeof(k), "%u", i->client);
|
||||
|
||||
printf("*** Sink Input #%u ***\n"
|
||||
"Name: %s\n"
|
||||
"Driver: %s\n"
|
||||
"Owner Module: %s\n"
|
||||
"Client: %s\n"
|
||||
|
|
@ -352,10 +363,10 @@ static void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info
|
|||
"Volume: %s\n"
|
||||
"Buffer Latency: %0.0f usec\n"
|
||||
"Sink Latency: %0.0f usec\n"
|
||||
"Resample method: %s\n",
|
||||
"Resample method: %s\n"
|
||||
"Properties:\n%s",
|
||||
i->index,
|
||||
i->name,
|
||||
i->driver,
|
||||
pa_strnull(i->driver),
|
||||
i->owner_module != PA_INVALID_INDEX ? t : "n/a",
|
||||
i->client != PA_INVALID_INDEX ? k : "n/a",
|
||||
i->sink,
|
||||
|
|
@ -364,12 +375,15 @@ static void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info
|
|||
i->mute ? "muted" : pa_cvolume_snprint(cv, sizeof(cv), &i->volume),
|
||||
(double) i->buffer_usec,
|
||||
(double) i->sink_usec,
|
||||
i->resample_method ? i->resample_method : "n/a");
|
||||
}
|
||||
i->resample_method ? i->resample_method : "n/a",
|
||||
pl = pa_proplist_to_string(i->proplist));
|
||||
|
||||
pa_xfree(pl);
|
||||
}
|
||||
|
||||
static void get_source_output_info_callback(pa_context *c, const pa_source_output_info *i, int is_last, void *userdata) {
|
||||
char t[32], k[32], s[PA_SAMPLE_SPEC_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
|
||||
char *pl;
|
||||
|
||||
if (is_last < 0) {
|
||||
fprintf(stderr, "Failed to get source output information: %s\n", pa_strerror(pa_context_errno(c)));
|
||||
|
|
@ -393,7 +407,6 @@ static void get_source_output_info_callback(pa_context *c, const pa_source_outpu
|
|||
snprintf(k, sizeof(k), "%u", i->client);
|
||||
|
||||
printf("*** Source Output #%u ***\n"
|
||||
"Name: %s\n"
|
||||
"Driver: %s\n"
|
||||
"Owner Module: %s\n"
|
||||
"Client: %s\n"
|
||||
|
|
@ -402,10 +415,10 @@ static void get_source_output_info_callback(pa_context *c, const pa_source_outpu
|
|||
"Channel Map: %s\n"
|
||||
"Buffer Latency: %0.0f usec\n"
|
||||
"Source Latency: %0.0f usec\n"
|
||||
"Resample method: %s\n",
|
||||
"Resample method: %s\n"
|
||||
"Properties:\n%s",
|
||||
i->index,
|
||||
i->name,
|
||||
i->driver,
|
||||
pa_strnull(i->driver),
|
||||
i->owner_module != PA_INVALID_INDEX ? t : "n/a",
|
||||
i->client != PA_INVALID_INDEX ? k : "n/a",
|
||||
i->source,
|
||||
|
|
@ -413,11 +426,15 @@ static void get_source_output_info_callback(pa_context *c, const pa_source_outpu
|
|||
pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map),
|
||||
(double) i->buffer_usec,
|
||||
(double) i->source_usec,
|
||||
i->resample_method ? i->resample_method : "n/a");
|
||||
i->resample_method ? i->resample_method : "n/a",
|
||||
pl = pa_proplist_to_string(i->proplist));
|
||||
|
||||
pa_xfree(pl);
|
||||
}
|
||||
|
||||
static void get_sample_info_callback(pa_context *c, const pa_sample_info *i, int is_last, void *userdata) {
|
||||
char t[32], s[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
|
||||
char *pl;
|
||||
|
||||
if (is_last < 0) {
|
||||
fprintf(stderr, "Failed to get sample information: %s\n", pa_strerror(pa_context_errno(c)));
|
||||
|
|
@ -447,7 +464,8 @@ static void get_sample_info_callback(pa_context *c, const pa_sample_info *i, int
|
|||
"Duration: %0.1fs\n"
|
||||
"Size: %s\n"
|
||||
"Lazy: %s\n"
|
||||
"Filename: %s\n",
|
||||
"Filename: %s\n"
|
||||
"Properties:\n%s",
|
||||
i->index,
|
||||
i->name,
|
||||
pa_cvolume_snprint(cv, sizeof(cv), &i->volume),
|
||||
|
|
@ -455,8 +473,11 @@ static void get_sample_info_callback(pa_context *c, const pa_sample_info *i, int
|
|||
pa_sample_spec_valid(&i->sample_spec) ? pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map) : "n/a",
|
||||
(double) i->duration/1000000,
|
||||
t,
|
||||
i->lazy ? "yes" : "no",
|
||||
i->filename ? i->filename : "n/a");
|
||||
pa_yes_no(i->lazy),
|
||||
i->filename ? i->filename : "n/a",
|
||||
pl = pa_proplist_to_string(i->proplist));
|
||||
|
||||
pa_xfree(pl);
|
||||
}
|
||||
|
||||
static void get_autoload_info_callback(pa_context *c, const pa_autoload_info *i, int is_last, void *userdata) {
|
||||
|
|
@ -868,6 +889,10 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
if (argc > optind+2)
|
||||
source_name = pa_xstrdup(argv[optind+1]);
|
||||
} else if (!strcmp(argv[optind], "help")) {
|
||||
help(bn);
|
||||
ret = 0;
|
||||
goto quit;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@
|
|||
#endif
|
||||
|
||||
#include <pulse/pulseaudio.h>
|
||||
#include <pulse/gccmacro.h>
|
||||
#include <pulsecore/llist.h>
|
||||
#include <pulsecore/gccmacro.h>
|
||||
|
||||
/* On some systems SIOCINQ isn't defined, but FIONREAD is just an alias */
|
||||
#if !defined(SIOCINQ) && defined(FIONREAD)
|
||||
|
|
@ -302,7 +302,6 @@ static int padsp_disabled(void) {
|
|||
if (!sym_resolved) {
|
||||
sym = (int*) dlsym(RTLD_DEFAULT, "__padsp_disabled__");
|
||||
sym_resolved = 1;
|
||||
|
||||
}
|
||||
pthread_mutex_unlock(&func_mutex);
|
||||
|
||||
|
|
@ -316,7 +315,7 @@ static int dsp_cloak_enable(void) {
|
|||
if (padsp_disabled() & 1)
|
||||
return 0;
|
||||
|
||||
if (getenv("PADSP_NO_DSP"))
|
||||
if (getenv("PADSP_NO_DSP") || getenv("PULSE_INTERNAL"))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
|
|
@ -326,7 +325,7 @@ static int sndstat_cloak_enable(void) {
|
|||
if (padsp_disabled() & 2)
|
||||
return 0;
|
||||
|
||||
if (getenv("PADSP_NO_SNDSTAT"))
|
||||
if (getenv("PADSP_NO_SNDSTAT") || getenv("PULSE_INTERNAL"))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
|
|
@ -336,7 +335,7 @@ static int mixer_cloak_enable(void) {
|
|||
if (padsp_disabled() & 4)
|
||||
return 0;
|
||||
|
||||
if (getenv("PADSP_NO_MIXER"))
|
||||
if (getenv("PADSP_NO_MIXER") || getenv("PULSE_INTERNAL"))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue