#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"), \
#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;
{
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);
-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
* - 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
*