annotate subopt-helper.h @ 29938:eb6c70e2cbea

Very preliminary code to allow selecting the OpenGL backend at runtime. Works in the currently supported cases for only Win32 and only X11, the mixed case is not working yet though. But applied anyway since the code is slightly less messy than the current one.
author reimar
date Tue, 08 Dec 2009 06:42:46 +0000
parents 0f1b5b68af32
children 1772a5171ac7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25535
diff changeset
1 #ifndef MPLAYER_SUBOPT_HELPER_H
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25535
diff changeset
2 #define MPLAYER_SUBOPT_HELPER_H
14281
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
3
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
4 /**
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
5 * \file subopt-helper.h
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
6 *
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28827
diff changeset
7 * \brief Datatype and functions declarations for usage
14281
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
8 * of the suboption parser.
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
9 *
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
10 */
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
11
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
12 #define OPT_ARG_BOOL 0
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
13 #define OPT_ARG_INT 1
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
14 #define OPT_ARG_STR 2
14538
00c3c4111017 New suboption type: malloc'ed, zero terminated string
reimar
parents: 14285
diff changeset
15 #define OPT_ARG_MSTRZ 3 ///< A malloced, zero terminated string, use free()!
16720
f73adf296f1e support float arguments in subopt helper.
joey
parents: 15734
diff changeset
16 #define OPT_ARG_FLOAT 4
14281
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
17
14285
6c3241503d9b Add a type name for the test function
reimar
parents: 14281
diff changeset
18 typedef int (*opt_test_f)(void *);
6c3241503d9b Add a type name for the test function
reimar
parents: 14281
diff changeset
19
14281
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
20 /** simple structure for defining the option name, type and storage location */
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
21 typedef struct opt_s
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
22 {
19194
5949a654e2d4 marks some read-only char* inside structs as const, patch by Stefan Huehner, stefan At huehner-org
reynaldo
parents: 19104
diff changeset
23 const char * name; ///< string that identifies the option
14281
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
24 int type; ///< option type as defined in subopt-helper.h
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
25 void * valp; ///< pointer to the mem where the value should be stored
14285
6c3241503d9b Add a type name for the test function
reimar
parents: 14281
diff changeset
26 opt_test_f test; ///< argument test func ( optional )
14281
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
27 } opt_t;
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
28
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
29 /** parses the string for the options specified in opt */
28827
2b021e3e1000 Get rid of the "set" member of the subopt-parser struct, it made
reimar
parents: 26029
diff changeset
30 int subopt_parse( char const * const str, const opt_t * opts );
14281
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
31
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
32
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
33 /*------------------ arg specific types and declaration -------------------*/
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
34 typedef struct strarg_s
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
35 {
14538
00c3c4111017 New suboption type: malloc'ed, zero terminated string
reimar
parents: 14285
diff changeset
36 int len; ///< length of the string determined by the parser
14281
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
37 char const * str; ///< pointer to position inside the parse string
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
38 } strarg_t;
577c16f551ad suboption parser for vo and ao modules
al
parents:
diff changeset
39
14736
2ef20aa3623b Move generic tests to a common place.
al
parents: 14538
diff changeset
40
2ef20aa3623b Move generic tests to a common place.
al
parents: 14538
diff changeset
41 int int_non_neg( int * i );
2ef20aa3623b Move generic tests to a common place.
al
parents: 14538
diff changeset
42 int int_pos( int * i );
2ef20aa3623b Move generic tests to a common place.
al
parents: 14538
diff changeset
43
19104
2ec2301183cd marks several read-only string parameters which aren't modified inside the called function as const. Patch by Stefan Huehner, stefan AT huehner-org
reynaldo
parents: 16720
diff changeset
44 int strargcmp(strarg_t *arg, const char *str);
15734
7e4fa8fc255c helper functions for comparing strarg_t "strings".
reimar
parents: 14736
diff changeset
45 int strargcasecmp(strarg_t *arg, char *str);
7e4fa8fc255c helper functions for comparing strarg_t "strings".
reimar
parents: 14736
diff changeset
46
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25535
diff changeset
47 #endif /* MPLAYER_SUBOPT_HELPER_H */