mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
add --resample-method argument
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@214 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
95612b6b1c
commit
08953564bb
8 changed files with 67 additions and 45 deletions
5
doc/todo
5
doc/todo
|
|
@ -2,10 +2,7 @@
|
|||
|
||||
*** 0.5 ***
|
||||
- more complete pactl/parec
|
||||
- fix tcp/native in regard to latencies
|
||||
- add client config file
|
||||
- remove autospawn stuff in conf.c
|
||||
- make resampler configurable
|
||||
- fix tcp/native in regard to latencies (i.e. latency interpolation)
|
||||
|
||||
*** 0.6 ****
|
||||
- per-channel volume
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ struct pa_client_conf *pa_client_conf_new(void) {
|
|||
struct pa_client_conf *c = pa_xmemdup(&default_conf, sizeof(default_conf));
|
||||
|
||||
c->daemon_binary = pa_xstrdup(POLYPAUDIO_BINARY);
|
||||
c->extra_arguments = pa_xstrdup("--daemonize=yes --log-target=syslog");
|
||||
c->extra_arguments = pa_xstrdup("--log-target=syslog --exit-idle-time=5");
|
||||
|
||||
return c;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,19 +21,19 @@
|
|||
## commented out. Use either ; or # for commenting
|
||||
|
||||
## Path to the polypaudio daemon to run when autospawning.
|
||||
; daemon_binary = @POLYPAUDIO_BINARY@
|
||||
; daemon-binary = @POLYPAUDIO_BINARY@
|
||||
|
||||
## Extra arguments to pass to the polypaudio daemon
|
||||
; extra_arguments = --daemonize=yes --log-target=syslog
|
||||
; extra-arguments = --log-target=syslog --exit-idle-time=5
|
||||
|
||||
## The default sink to connect to
|
||||
; default_sink =
|
||||
; default-sink =
|
||||
|
||||
## The default source to connect to
|
||||
; default_source =
|
||||
; default-source =
|
||||
|
||||
## The default sever to connect to
|
||||
; default_server =
|
||||
; default-server =
|
||||
|
||||
## Autospawn daemons?
|
||||
; autospawn = 0
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ enum {
|
|||
ARG_LOAD,
|
||||
ARG_FILE,
|
||||
ARG_DL_SEARCH_PATH,
|
||||
ARG_RESAMPLE_METHOD
|
||||
};
|
||||
|
||||
static struct option long_options[] = {
|
||||
|
|
@ -71,6 +72,7 @@ static struct option long_options[] = {
|
|||
{"load", 1, 0, ARG_LOAD},
|
||||
{"file", 1, 0, ARG_FILE},
|
||||
{"dl-search-path", 1, 0, ARG_DL_SEARCH_PATH},
|
||||
{"resample-method", 1, 0, ARG_RESAMPLE_METHOD},
|
||||
{NULL, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
|
@ -98,7 +100,8 @@ void pa_cmdline_help(const char *argv0) {
|
|||
" --module-idle-time=SECS Unload autoloaded modules when idle and this time passed\n"
|
||||
" --scache-idle-time=SECS Unload autoloaded samples when idle and this time passed\n"
|
||||
" --log-target={auto,syslog,stderr} Specify the log target\n"
|
||||
" -p, --dl-search-path=PATH Set the search path for dynamic shared objects (plugins)\n\n"
|
||||
" -p, --dl-search-path=PATH Set the search path for dynamic shared objects (plugins)\n"
|
||||
" --resample-method=[METHOD] Use the specified resampling method\n\n"
|
||||
|
||||
" -L, --load=\"MODULE ARGUMENTS\" Load the specified plugin module with the specified argument\n"
|
||||
" -F, --file=FILENAME Run the specified script\n"
|
||||
|
|
@ -198,15 +201,7 @@ int pa_cmdline_parse(struct pa_daemon_conf *conf, int argc, char *const argv [],
|
|||
break;
|
||||
|
||||
case ARG_LOG_TARGET:
|
||||
if (!strcmp(optarg, "syslog")) {
|
||||
conf->auto_log_target = 0;
|
||||
conf->log_target = PA_LOG_SYSLOG;
|
||||
} else if (!strcmp(optarg, "stderr")) {
|
||||
conf->auto_log_target = 0;
|
||||
conf->log_target = PA_LOG_STDERR;
|
||||
} else if (!strcmp(optarg, "auto"))
|
||||
conf->auto_log_target = 1;
|
||||
else {
|
||||
if (pa_daemon_conf_set_log_target(conf, optarg) < 0) {
|
||||
pa_log(__FILE__": Invalid log target: use either 'syslog', 'stderr' or 'auto'.\n");
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -224,6 +219,13 @@ int pa_cmdline_parse(struct pa_daemon_conf *conf, int argc, char *const argv [],
|
|||
conf->scache_idle_time = atoi(optarg);
|
||||
break;
|
||||
|
||||
case ARG_RESAMPLE_METHOD:
|
||||
if (pa_daemon_conf_set_resample_method(conf, optarg) < 0) {
|
||||
pa_log(__FILE__": Invalid resample method '%s'.\n", optarg);
|
||||
goto fail;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
goto fail;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,19 +110,48 @@ void pa_daemon_conf_free(struct pa_daemon_conf *c) {
|
|||
pa_xfree(c);
|
||||
}
|
||||
|
||||
int pa_daemon_conf_set_log_target(struct pa_daemon_conf *c, const char *string) {
|
||||
assert(c && string);
|
||||
|
||||
if (!strcmp(string, "auto"))
|
||||
c->auto_log_target = 1;
|
||||
else if (!strcmp(string, "syslog")) {
|
||||
c->auto_log_target = 0;
|
||||
c->log_target = PA_LOG_SYSLOG;
|
||||
} else if (!strcmp(string, "stderr")) {
|
||||
c->auto_log_target = 0;
|
||||
c->log_target = PA_LOG_STDERR;
|
||||
} else
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int pa_daemon_conf_set_resample_method(struct pa_daemon_conf *c, const char *string) {
|
||||
assert(c && string);
|
||||
|
||||
if (!strcmp(string, "sinc-best-quality"))
|
||||
c->resample_method = SRC_SINC_BEST_QUALITY;
|
||||
else if (!strcmp(string, "sinc-medium-quality"))
|
||||
c->resample_method = SRC_SINC_MEDIUM_QUALITY;
|
||||
else if (!strcmp(string, "sinc-fastest"))
|
||||
c->resample_method = SRC_SINC_FASTEST;
|
||||
else if (!strcmp(string, "zero-order-hold"))
|
||||
c->resample_method = SRC_ZERO_ORDER_HOLD;
|
||||
else if (!strcmp(string, "linear"))
|
||||
c->resample_method = SRC_LINEAR;
|
||||
else
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int parse_log_target(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) {
|
||||
struct pa_daemon_conf *c = data;
|
||||
assert(filename && lvalue && rvalue && data);
|
||||
|
||||
if (!strcmp(rvalue, "auto"))
|
||||
c->auto_log_target = 1;
|
||||
else if (!strcmp(rvalue, "syslog")) {
|
||||
c->auto_log_target = 0;
|
||||
c->log_target = PA_LOG_SYSLOG;
|
||||
} else if (!strcmp(rvalue, "stderr")) {
|
||||
c->auto_log_target = 0;
|
||||
c->log_target = PA_LOG_STDERR;
|
||||
} else {
|
||||
if (pa_daemon_conf_set_log_target(c, rvalue) < 0) {
|
||||
pa_log(__FILE__": [%s:%u] Invalid log target '%s'.\n", filename, line, rvalue);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -134,17 +163,7 @@ int parse_resample_method(const char *filename, unsigned line, const char *lvalu
|
|||
struct pa_daemon_conf *c = data;
|
||||
assert(filename && lvalue && rvalue && data);
|
||||
|
||||
if (!strcmp(rvalue, "sinc-best-quality"))
|
||||
c->resample_method = SRC_SINC_BEST_QUALITY;
|
||||
else if (!strcmp(rvalue, "sinc-medium-quality"))
|
||||
c->resample_method = SRC_SINC_MEDIUM_QUALITY;
|
||||
else if (!strcmp(rvalue, "sinc-fastest"))
|
||||
c->resample_method = SRC_SINC_FASTEST;
|
||||
else if (!strcmp(rvalue, "zero-order-hold"))
|
||||
c->resample_method = SRC_ZERO_ORDER_HOLD;
|
||||
else if (!strcmp(rvalue, "linear"))
|
||||
c->resample_method = SRC_LINEAR;
|
||||
else {
|
||||
if (pa_daemon_conf_set_resample_method(c, rvalue) < 0) {
|
||||
pa_log(__FILE__": [%s:%u] Inavalid resample method '%s'.\n", filename, line, rvalue);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,4 +55,7 @@ int pa_daemon_conf_load(struct pa_daemon_conf *c, const char *filename);
|
|||
char *pa_daemon_conf_dump(struct pa_daemon_conf *c);
|
||||
int pa_daemon_conf_env(struct pa_daemon_conf *c);
|
||||
|
||||
int pa_daemon_conf_set_log_target(struct pa_daemon_conf *c, const char *string);
|
||||
int pa_daemon_conf_set_resample_method(struct pa_daemon_conf *c, const char *string);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -432,9 +432,10 @@ static int context_connect_spawn(struct pa_context *c, const struct pa_spawn_api
|
|||
putenv(t);
|
||||
|
||||
argv[n++] = c->conf->daemon_binary;
|
||||
argv[n++] = "--daemonize=yes";
|
||||
|
||||
snprintf(t, sizeof(t), "-Lmodule-native-protocol-fd fd=%i", fds[1]);
|
||||
argv[n++] = pa_xstrdup(t);
|
||||
argv[n++] = t;
|
||||
|
||||
while (n < MAX_ARGS) {
|
||||
char *a;
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@ char *pa_split_spaces(const char *c, const char **state) {
|
|||
const char *current = *state ? *state : c;
|
||||
size_t l;
|
||||
|
||||
if (*current)
|
||||
if (!*current)
|
||||
return NULL;
|
||||
|
||||
current += strspn(current, WHITESPACE);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue