]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
specify the three grab modes as values in grab_client.ggo
authorAndre <maan@p133.(none)>
Mon, 27 Mar 2006 08:50:08 +0000 (10:50 +0200)
committerAndre <maan@p133.(none)>
Mon, 27 Mar 2006 08:50:08 +0000 (10:50 +0200)
That makes gengetopt check that the argument to the --mode
option is one of sloppy, pedantic, or aggressive, so get rid of
E_INVALID_GRAB_MODE, the gc_modes array and of the error check in
grab_client.c.

Another nice side-effect is that also "s", "p", "a" work as
abreviations for the grab mode argument.

Reformat grab_client.ggo as we are at it.

error.h
grab_client.c
grab_client.ggo
grab_client.h

diff --git a/error.h b/error.h
index 805077530168b4605578e290248a303335651bd0..c72bdae4fd12cc1df36f96f9ca9ba1678affb66a 100644 (file)
--- a/error.h
+++ b/error.h
@@ -135,7 +135,6 @@ extern const char **para_errlist[];
 #define GRAB_CLIENT_ERRORS \
        PARA_ERROR(PEDANTIC_GRAB, "fd not ready and pedantic grab requested"), \
        PARA_ERROR(GC_WRITE, "grab client write error"), \
-       PARA_ERROR(INVALID_GRAB_MODE, "invalid grab client mode"), \
        PARA_ERROR(BAD_GC_SLOT, "invalid slot requested by grab client"), \
        PARA_ERROR(BAD_GC_FILTER_NUM, "invalid filter number given"), \
        PARA_ERROR(GC_SYNTAX, "grab client syntax error"), \
index 5fb9a83b54294960eb6f4df8ccd371aa5d998f3a..2dfb295b8ce87fcb5f165bcfd4b3c25f3bdb5b50 100644 (file)
 #include "error.h"
 #include "string.h"
 
-
-/** this maps the enum to the text used at the command line */
-static const char *gc_modes[] = {
-       [GRAB_PEDANTIC] = "pedantic",
-       [GRAB_SLOPPY] = "sloppy",
-       [GRAB_AGGRESSIVE] = "aggressive",
-       NULL
-};
-
 /** grab clients that are not yet attached to a filter node */
 struct list_head inactive_grab_client_list;
 
@@ -99,13 +90,12 @@ static int check_gc_args(struct grab_client *gc)
 {
        int i;
        struct grab_client_args_info *conf = gc->conf;
+       char **mv = grab_client_cmdline_parser_mode_values;
 
        PARA_INFO_LOG("filter_num: %d\n", gc->conf->filter_num_arg);
-       for (i = 0; gc_modes[i]; i++)
-               if (!strcmp(conf->mode_arg, gc_modes[i]))
+       for (i = 0; mv[i]; i++)
+               if (!strcmp(conf->mode_arg, mv[i]))
                        break;
-       if (!gc_modes[i])
-               return -E_INVALID_GRAB_MODE;
        gc->mode = i;
        if (conf->audio_format_given) {
                gc->audio_format_num = get_audio_format_num(conf->audio_format_arg);
index c48b7ef565dcb799e8b8ed1cc0210c7bddae4b4f..ded7ee75758682e1763f581b37eb31654d2e344c 100644 (file)
@@ -1,6 +1,35 @@
-option "filter_num" f "point of filter chain to grab" int typestr="num" default="1" optional
-option "slot" s "only grab this slot; grab any slot if negative" int typestr="num" default="-1" optional
-option "mode" m "sloppy, pedantic, or aggressive" string typestr="grab_mode" default="sloppy" optional
-option "audio_format" a "only grab this type of input stream; grab any if empty" string typestr="name" default="" optional
-option "input_grab" i "grab the filter input instead of its output" flag off optional
-option "one_shot" o "stop grabbing if audio file changes" flag off optional
+option "filter_num" f
+       "point of filter chain to grab"
+       int typestr="num"
+       default="1"
+       optional
+
+option "slot" s
+       "only grab this slot; grab any slot if negative"
+       int typestr="num"
+       default="-1"
+       optional
+
+option "audio_format" a
+       "only grab this type of input stream;
+       grab any if empty"
+       string typestr="name"
+       default=""
+       optional
+
+option "input_grab" i
+       "grab the filter input instead of its output"
+       flag off
+       optional
+
+option "one_shot" o
+       "stop grabbing if audio file changes"
+       flag off
+       optional
+
+option "mode" m
+       "select grab mode"
+       typestr="grab_mode"
+       values="sloppy","aggressive","pedantic"
+       default="sloppy"
+       optional
index e66e9b2473fbad067742278dbaac5c6f770b7c28..8cc0a20331b3ea781d671a2b64fdcdcb1fb306e4 100644 (file)
@@ -27,7 +27,7 @@
  * - aggressive: write anyway (default)
  *
  */
-enum grab_mode {GRAB_PEDANTIC, GRAB_SLOPPY, GRAB_AGGRESSIVE};
+enum grab_mode {GRAB_SLOPPY, GRAB_AGGRESSIVE, GRAB_PEDANTIC};
 
 /** describes one active grab client
  *