mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
clean up options
make sure we can use -v for verbose mode
This commit is contained in:
parent
1fd5be7101
commit
b87c0a9270
8 changed files with 102 additions and 104 deletions
|
|
@ -63,14 +63,14 @@ struct data {
|
||||||
|
|
||||||
#define OPTIONS "hvr:f:q:"
|
#define OPTIONS "hvr:f:q:"
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
{"help", no_argument, NULL, 'h'},
|
{ "help", no_argument, NULL, 'h'},
|
||||||
{"verbose", no_argument, NULL, 'v'},
|
{ "verbose", no_argument, NULL, 'v'},
|
||||||
|
|
||||||
{"rate", required_argument, NULL, 'r' },
|
{ "rate", required_argument, NULL, 'r' },
|
||||||
{"format", required_argument, NULL, 'f' },
|
{ "format", required_argument, NULL, 'f' },
|
||||||
{"quality", required_argument, NULL, 'q' },
|
{ "quality", required_argument, NULL, 'q' },
|
||||||
|
|
||||||
{NULL, 0, NULL, 0 }
|
{ NULL, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void show_usage(const char *name, bool is_error)
|
static void show_usage(const char *name, bool is_error)
|
||||||
|
|
|
||||||
|
|
@ -43,11 +43,11 @@ static void do_quit(void *data, int signal_number)
|
||||||
static void show_help(const char *name)
|
static void show_help(const char *name)
|
||||||
{
|
{
|
||||||
fprintf(stdout, "%s [options]\n"
|
fprintf(stdout, "%s [options]\n"
|
||||||
" -h, --help Show this help\n"
|
" -h, --help Show this help\n"
|
||||||
" -v, --version Show version\n"
|
" --version Show version\n"
|
||||||
" -n, --name Daemon name (Default %s)\n",
|
" -n, --name Daemon name (Default %s)\n",
|
||||||
name,
|
name,
|
||||||
daemon_name);
|
daemon_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
|
@ -58,21 +58,22 @@ int main(int argc, char *argv[])
|
||||||
struct pw_properties *properties;
|
struct pw_properties *properties;
|
||||||
char *err = NULL;
|
char *err = NULL;
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
{"help", 0, NULL, 'h'},
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{"version", 0, NULL, 'v'},
|
{ "version", no_argument, NULL, 'V' },
|
||||||
{"name", 1, NULL, 'n'},
|
{ "name", required_argument, NULL, 'n' },
|
||||||
{NULL, 0, NULL, 0}
|
|
||||||
|
{ NULL, 0, NULL, 0}
|
||||||
};
|
};
|
||||||
int c, res;
|
int c, res;
|
||||||
|
|
||||||
pw_init(&argc, &argv);
|
pw_init(&argc, &argv);
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv, "hvn:", long_options, NULL)) != -1) {
|
while ((c = getopt_long(argc, argv, "hVn:", long_options, NULL)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'h' :
|
case 'h' :
|
||||||
show_help(argv[0]);
|
show_help(argv[0]);
|
||||||
return 0;
|
return 0;
|
||||||
case 'v' :
|
case 'V' :
|
||||||
fprintf(stdout, "%s\n"
|
fprintf(stdout, "%s\n"
|
||||||
"Compiled with libpipewire %s\n"
|
"Compiled with libpipewire %s\n"
|
||||||
"Linked with libpipewire %s\n",
|
"Linked with libpipewire %s\n",
|
||||||
|
|
|
||||||
|
|
@ -1726,7 +1726,7 @@ static void show_help(const char *name)
|
||||||
|
|
||||||
fprintf(stdout, "%s [options]\n"
|
fprintf(stdout, "%s [options]\n"
|
||||||
" -h, --help Show this help\n"
|
" -h, --help Show this help\n"
|
||||||
" -v, --version Show version\n"
|
" --version Show version\n"
|
||||||
" -e, --enabled Enabled options (default '%s')\n"
|
" -e, --enabled Enabled options (default '%s')\n"
|
||||||
" -d, --disabled Disabled options (default '%s')\n"
|
" -d, --disabled Disabled options (default '%s')\n"
|
||||||
" -p, --properties Extra properties as 'key=value { key=value }'\n",
|
" -p, --properties Extra properties as 'key=value { key=value }'\n",
|
||||||
|
|
@ -1749,24 +1749,24 @@ int main(int argc, char *argv[])
|
||||||
const char *opt_disabled = DEFAULT_DISABLED;
|
const char *opt_disabled = DEFAULT_DISABLED;
|
||||||
const char *opt_properties = NULL;
|
const char *opt_properties = NULL;
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
{"help", 0, NULL, 'h'},
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{"version", 0, NULL, 'v'},
|
{ "version", no_argument, NULL, 'V' },
|
||||||
{"enabled", 1, NULL, 'e'},
|
{ "enabled", required_argument, NULL, 'e' },
|
||||||
{"disabled", 1, NULL, 'd'},
|
{ "disabled", required_argument, NULL, 'd' },
|
||||||
{"properties", 1, NULL, 'p'},
|
{ "properties", required_argument, NULL, 'p' },
|
||||||
{NULL, 0, NULL, 0}
|
{ NULL, 0, NULL, 0}
|
||||||
};
|
};
|
||||||
size_t i;
|
size_t i;
|
||||||
const struct spa_dict_item *item;
|
const struct spa_dict_item *item;
|
||||||
|
|
||||||
pw_init(&argc, &argv);
|
pw_init(&argc, &argv);
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv, "hve:d:p:", long_options, NULL)) != -1) {
|
while ((c = getopt_long(argc, argv, "hVe:d:p:", long_options, NULL)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'h':
|
case 'h':
|
||||||
show_help(argv[0]);
|
show_help(argv[0]);
|
||||||
return 0;
|
return 0;
|
||||||
case 'v':
|
case 'V':
|
||||||
fprintf(stdout, "%s\n"
|
fprintf(stdout, "%s\n"
|
||||||
"Compiled with libpipewire %s\n"
|
"Compiled with libpipewire %s\n"
|
||||||
"Linked with libpipewire %s\n",
|
"Linked with libpipewire %s\n",
|
||||||
|
|
|
||||||
|
|
@ -863,32 +863,32 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
{"help", no_argument, NULL, 'h'},
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{"version", no_argument, NULL, OPT_VERSION},
|
{ "version", no_argument, NULL, OPT_VERSION},
|
||||||
{"verbose", no_argument, NULL, 'v'},
|
{ "verbose", no_argument, NULL, 'v' },
|
||||||
|
|
||||||
{"record", no_argument, NULL, 'r'},
|
{ "record", no_argument, NULL, 'r' },
|
||||||
{"playback", no_argument, NULL, 's'},
|
{ "playback", no_argument, NULL, 's' },
|
||||||
{"midi", no_argument, NULL, 'm'},
|
{ "midi", no_argument, NULL, 'm' },
|
||||||
|
|
||||||
{"remote", required_argument, NULL, 'R'},
|
{ "remote", required_argument, NULL, 'R' },
|
||||||
|
|
||||||
{"media-type", required_argument, NULL, OPT_MEDIA_TYPE },
|
{ "media-type", required_argument, NULL, OPT_MEDIA_TYPE },
|
||||||
{"media-category", required_argument, NULL, OPT_MEDIA_CATEGORY },
|
{ "media-category", required_argument, NULL, OPT_MEDIA_CATEGORY },
|
||||||
{"media-role", required_argument, NULL, OPT_MEDIA_ROLE },
|
{ "media-role", required_argument, NULL, OPT_MEDIA_ROLE },
|
||||||
{"target", required_argument, NULL, OPT_TARGET },
|
{ "target", required_argument, NULL, OPT_TARGET },
|
||||||
{"latency", required_argument, NULL, OPT_LATENCY },
|
{ "latency", required_argument, NULL, OPT_LATENCY },
|
||||||
|
|
||||||
{"rate", required_argument, NULL, OPT_RATE },
|
{ "rate", required_argument, NULL, OPT_RATE },
|
||||||
{"channels", required_argument, NULL, OPT_CHANNELS },
|
{ "channels", required_argument, NULL, OPT_CHANNELS },
|
||||||
{"channel-map", required_argument, NULL, OPT_CHANNELMAP },
|
{ "channel-map", required_argument, NULL, OPT_CHANNELMAP },
|
||||||
{"format", required_argument, NULL, OPT_FORMAT },
|
{ "format", required_argument, NULL, OPT_FORMAT },
|
||||||
{"volume", required_argument, NULL, OPT_VOLUME },
|
{ "volume", required_argument, NULL, OPT_VOLUME },
|
||||||
{"quality", required_argument, NULL, 'q' },
|
{ "quality", required_argument, NULL, 'q' },
|
||||||
|
|
||||||
{"list-targets", no_argument, NULL, OPT_LIST_TARGETS },
|
{ "list-targets", no_argument, NULL, OPT_LIST_TARGETS },
|
||||||
|
|
||||||
{NULL, 0, NULL, 0 }
|
{ NULL, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void show_usage(const char *name, bool is_error)
|
static void show_usage(const char *name, bool is_error)
|
||||||
|
|
@ -902,6 +902,7 @@ static void show_usage(const char *name, bool is_error)
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
" -h, --help Show this help\n"
|
" -h, --help Show this help\n"
|
||||||
" --version Show version\n"
|
" --version Show version\n"
|
||||||
|
" -v, --verbose Enable verbose operations\n"
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
|
|
@ -945,10 +946,6 @@ static void show_usage(const char *name, bool is_error)
|
||||||
" -m, --midi Midi mode\n"
|
" -m, --midi Midi mode\n"
|
||||||
"\n");
|
"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(fp,
|
|
||||||
" -v, --verbose Enable verbose operations\n"
|
|
||||||
"\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int midi_play(struct data *d, void *src, unsigned int n_frames)
|
static int midi_play(struct data *d, void *src, unsigned int n_frames)
|
||||||
|
|
|
||||||
|
|
@ -2748,11 +2748,11 @@ static void do_quit(void *data, int signal_number)
|
||||||
static void show_help(struct data *data, const char *name)
|
static void show_help(struct data *data, const char *name)
|
||||||
{
|
{
|
||||||
fprintf(stdout, "%s [options] [command]\n"
|
fprintf(stdout, "%s [options] [command]\n"
|
||||||
" -h, --help Show this help\n"
|
" -h, --help Show this help\n"
|
||||||
" -v, --version Show version\n"
|
" --version Show version\n"
|
||||||
" -d, --daemon Start as daemon (Default false)\n"
|
" -d, --daemon Start as daemon (Default false)\n"
|
||||||
" -r, --remote Remote daemon name\n\n",
|
" -r, --remote Remote daemon name\n\n",
|
||||||
name);
|
name);
|
||||||
|
|
||||||
do_help(data, "help", "", NULL);
|
do_help(data, "help", "", NULL);
|
||||||
}
|
}
|
||||||
|
|
@ -2765,22 +2765,22 @@ int main(int argc, char *argv[])
|
||||||
char *error;
|
char *error;
|
||||||
bool daemon = false;
|
bool daemon = false;
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
{"help", 0, NULL, 'h'},
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{"version", 0, NULL, 'v'},
|
{ "version", no_argument, NULL, 'V' },
|
||||||
{"daemon", 0, NULL, 'd'},
|
{ "daemon", no_argument, NULL, 'd' },
|
||||||
{"remote", 1, NULL, 'r'},
|
{ "remote", required_argument, NULL, 'r' },
|
||||||
{NULL, 0, NULL, 0}
|
{ NULL, 0, NULL, 0}
|
||||||
};
|
};
|
||||||
int c, i;
|
int c, i;
|
||||||
|
|
||||||
pw_init(&argc, &argv);
|
pw_init(&argc, &argv);
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv, "hvdr:", long_options, NULL)) != -1) {
|
while ((c = getopt_long(argc, argv, "hVdr:", long_options, NULL)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'h':
|
case 'h':
|
||||||
show_help(&data, argv[0]);
|
show_help(&data, argv[0]);
|
||||||
return 0;
|
return 0;
|
||||||
case 'v':
|
case 'V':
|
||||||
fprintf(stdout, "%s\n"
|
fprintf(stdout, "%s\n"
|
||||||
"Compiled with libpipewire %s\n"
|
"Compiled with libpipewire %s\n"
|
||||||
"Linked with libpipewire %s\n",
|
"Linked with libpipewire %s\n",
|
||||||
|
|
|
||||||
|
|
@ -746,15 +746,15 @@ static void do_quit(void *data, int signal_number)
|
||||||
static void show_help(const char *name)
|
static void show_help(const char *name)
|
||||||
{
|
{
|
||||||
fprintf(stdout, "%s [options]\n"
|
fprintf(stdout, "%s [options]\n"
|
||||||
" -h, --help Show this help\n"
|
" -h, --help Show this help\n"
|
||||||
" -v, --version Show version\n"
|
" --version Show version\n"
|
||||||
" -a, --all Show all object types\n"
|
" -a, --all Show all object types\n"
|
||||||
" -s, --smart Show linked objects only\n"
|
" -s, --smart Show linked objects only\n"
|
||||||
" -d, --detail Show all object properties\n"
|
" -d, --detail Show all object properties\n"
|
||||||
" -r, --remote Remote daemon name\n"
|
" -r, --remote Remote daemon name\n"
|
||||||
" -o, --output Output file (Default %s)\n",
|
" -o, --output Output file (Default %s)\n",
|
||||||
name,
|
name,
|
||||||
DEFAULT_DOT_PATH);
|
DEFAULT_DOT_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
|
@ -764,25 +764,25 @@ int main(int argc, char *argv[])
|
||||||
const char *opt_remote = NULL;
|
const char *opt_remote = NULL;
|
||||||
const char *dot_path = DEFAULT_DOT_PATH;
|
const char *dot_path = DEFAULT_DOT_PATH;
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
{"help", 0, NULL, 'h'},
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{"version", 0, NULL, 'v'},
|
{ "version", no_argument, NULL, 'V' },
|
||||||
{"all", 0, NULL, 'a'},
|
{ "all", no_argument, NULL, 'a' },
|
||||||
{"smart", 0, NULL, 's'},
|
{ "smart", no_argument, NULL, 's' },
|
||||||
{"detail", 0, NULL, 'd'},
|
{ "detail", no_argument, NULL, 'd' },
|
||||||
{"remote", 1, NULL, 'r'},
|
{ "remote", required_argument, NULL, 'r' },
|
||||||
{"output", 1, NULL, 'o'},
|
{ "output", required_argument, NULL, 'o' },
|
||||||
{NULL, 0, NULL, 0}
|
{ NULL, 0, NULL, 0}
|
||||||
};
|
};
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
pw_init(&argc, &argv);
|
pw_init(&argc, &argv);
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv, "hvasdr:o:", long_options, NULL)) != -1) {
|
while ((c = getopt_long(argc, argv, "hVasdr:o:", long_options, NULL)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'h' :
|
case 'h' :
|
||||||
show_help(argv[0]);
|
show_help(argv[0]);
|
||||||
return 0;
|
return 0;
|
||||||
case 'v' :
|
case 'V' :
|
||||||
fprintf(stdout, "%s\n"
|
fprintf(stdout, "%s\n"
|
||||||
"Compiled with libpipewire %s\n"
|
"Compiled with libpipewire %s\n"
|
||||||
"Linked with libpipewire %s\n",
|
"Linked with libpipewire %s\n",
|
||||||
|
|
|
||||||
|
|
@ -682,10 +682,10 @@ static void do_quit(void *data, int signal_number)
|
||||||
static void show_help(const char *name)
|
static void show_help(const char *name)
|
||||||
{
|
{
|
||||||
fprintf(stdout, "%s [options]\n"
|
fprintf(stdout, "%s [options]\n"
|
||||||
" -h, --help Show this help\n"
|
" -h, --help Show this help\n"
|
||||||
" -v, --version Show version\n"
|
" --version Show version\n"
|
||||||
" -r, --remote Remote daemon name\n",
|
" -r, --remote Remote daemon name\n",
|
||||||
name);
|
name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
|
@ -694,21 +694,21 @@ int main(int argc, char *argv[])
|
||||||
struct pw_loop *l;
|
struct pw_loop *l;
|
||||||
const char *opt_remote = NULL;
|
const char *opt_remote = NULL;
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
{"help", 0, NULL, 'h'},
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{"version", 0, NULL, 'v'},
|
{ "version", no_argument, NULL, 'V' },
|
||||||
{"remote", 1, NULL, 'r'},
|
{ "remote", required_argument, NULL, 'r' },
|
||||||
{NULL, 0, NULL, 0}
|
{ NULL, 0, NULL, 0}
|
||||||
};
|
};
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
pw_init(&argc, &argv);
|
pw_init(&argc, &argv);
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv, "hvr:", long_options, NULL)) != -1) {
|
while ((c = getopt_long(argc, argv, "hVr:", long_options, NULL)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'h':
|
case 'h':
|
||||||
show_help(argv[0]);
|
show_help(argv[0]);
|
||||||
return 0;
|
return 0;
|
||||||
case 'v':
|
case 'V':
|
||||||
fprintf(stdout, "%s\n"
|
fprintf(stdout, "%s\n"
|
||||||
"Compiled with libpipewire %s\n"
|
"Compiled with libpipewire %s\n"
|
||||||
"Linked with libpipewire %s\n",
|
"Linked with libpipewire %s\n",
|
||||||
|
|
|
||||||
|
|
@ -541,12 +541,12 @@ static void do_quit(void *data, int signal_number)
|
||||||
static void show_help(const char *name)
|
static void show_help(const char *name)
|
||||||
{
|
{
|
||||||
fprintf(stdout, "%s [options]\n"
|
fprintf(stdout, "%s [options]\n"
|
||||||
" -h, --help Show this help\n"
|
" -h, --help Show this help\n"
|
||||||
" -v, --version Show version\n"
|
" --version Show version\n"
|
||||||
" -r, --remote Remote daemon name\n"
|
" -r, --remote Remote daemon name\n"
|
||||||
" -o, --output Profiler output name (default \"%s\")\n",
|
" -o, --output Profiler output name (default \"%s\")\n",
|
||||||
name,
|
name,
|
||||||
DEFAULT_FILENAME);
|
DEFAULT_FILENAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
|
@ -556,22 +556,22 @@ int main(int argc, char *argv[])
|
||||||
const char *opt_remote = NULL;
|
const char *opt_remote = NULL;
|
||||||
const char *opt_output = DEFAULT_FILENAME;
|
const char *opt_output = DEFAULT_FILENAME;
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
{"help", 0, NULL, 'h'},
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{"version", 0, NULL, 'v'},
|
{ "version", no_argument, NULL, 'V' },
|
||||||
{"remote", 1, NULL, 'r'},
|
{ "remote", required_argument, NULL, 'r' },
|
||||||
{"output", 1, NULL, 'o'},
|
{ "output", required_argument, NULL, 'o' },
|
||||||
{NULL, 0, NULL, 0}
|
{ NULL, 0, NULL, 0}
|
||||||
};
|
};
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
pw_init(&argc, &argv);
|
pw_init(&argc, &argv);
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv, "hvr:o:", long_options, NULL)) != -1) {
|
while ((c = getopt_long(argc, argv, "hVr:o:", long_options, NULL)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'h':
|
case 'h':
|
||||||
show_help(argv[0]);
|
show_help(argv[0]);
|
||||||
return 0;
|
return 0;
|
||||||
case 'v':
|
case 'V':
|
||||||
fprintf(stdout, "%s\n"
|
fprintf(stdout, "%s\n"
|
||||||
"Compiled with libpipewire %s\n"
|
"Compiled with libpipewire %s\n"
|
||||||
"Linked with libpipewire %s\n",
|
"Linked with libpipewire %s\n",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue