]> code.delx.au - pulseaudio/blobdiff - polyp/cmdline.c
Make the whole stuff LGPL only
[pulseaudio] / polyp / cmdline.c
index d429256f7b13dac0633a6b187d98018aebcd0831..0c381f8c476955f0ceba84dee5ecb0b1d95fc54c 100644 (file)
@@ -4,7 +4,7 @@
   This file is part of polypaudio.
  
   polypaudio is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published
+  it under the terms of the GNU Lesser General Public License as published
   by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
@@ -13,7 +13,7 @@
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   General Public License for more details.
  
-  You should have received a copy of the GNU General Public License
+  You should have received a copy of the GNU Lesser General Public License
   along with polypaudio; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
   USA.
@@ -52,6 +52,7 @@ enum {
     ARG_LOAD,
     ARG_FILE,
     ARG_DL_SEARCH_PATH,
+    ARG_RESAMPLE_METHOD
 };
 
 static struct option long_options[] = {
@@ -71,10 +72,10 @@ 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}
 };
 
-
 void pa_cmdline_help(const char *argv0) {
     const char *e;
 
@@ -83,7 +84,7 @@ void pa_cmdline_help(const char *argv0) {
     else
         e = argv0;
     
-    printf("%s [options]\n"
+    printf("%s [options]\n\n"
            "  -h, --help                            Show this help\n"
            "      --version                         Show version\n"
            "      --dump-conf                       Dump default configuration\n"
@@ -98,7 +99,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"
@@ -107,7 +109,7 @@ void pa_cmdline_help(const char *argv0) {
            "  -n                                    Don't load default script file\n", e);
 }
 
-int pa_cmdline_parse(struct pa_conf *conf, int argc, char *const argv [], int *d) {
+int pa_cmdline_parse(struct pa_daemon_conf *conf, int argc, char *const argv [], int *d) {
     struct pa_strbuf *buf = NULL;
     int c;
     assert(conf && argc && argv);
@@ -198,15 +200,7 @@ int pa_cmdline_parse(struct pa_conf *conf, int argc, char *const argv [], int *d
                 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;
                 }
@@ -223,6 +217,13 @@ int pa_cmdline_parse(struct pa_conf *conf, int argc, char *const argv [], int *d
             case ARG_SCACHE_IDLE_TIME:
                 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;