Data Structures | |
| struct | rte_context |
| struct | rte_context_class |
| struct | rte_backend_class |
Defines | |
| #define | RTE_OPTION_BOUNDS_INITIALIZER_(type_, def_, min_, max_, step_) { type_ = def_ }, { type_ = min_ }, { type_ = max_ }, { type_ = step_ } |
| #define | RTE_OPTION_BOOL_INITIALIZER(key_, label_, def_, tip_) |
| #define | RTE_OPTION_INT_RANGE_INITIALIZER(key_, label_, def_, min_, max_, step_, tip_) |
| #define | RTE_OPTION_INT_MENU_INITIALIZER(key_, label_, def_,menu_, entries_, tip_) |
| #define | RTE_OPTION_REAL_RANGE_INITIALIZER(key_, label_, def_, min_, max_, step_, tip_) |
| #define | RTE_OPTION_REAL_MENU_INITIALIZER(key_, label_, def_,menu_, entries_, tip_) |
| #define | RTE_OPTION_STRING_INITIALIZER(key_, label_, def_, tip_) |
| #define | RTE_OPTION_STRING_MENU_INITIALIZER(key_, label_, def_,menu_, entries_, tip_) |
| #define | RTE_OPTION_MENU_INITIALIZER(key_, label_, def_, menu_,entries_, tip_) |
| #define | RTE_OPTION_ARG(type, min, max) |
| #define | RTE_OPTION_ARG_MENU(menu) RTE_OPTION_ARG(int, 0, sizeof(menu) / sizeof(menu[0])) |
| #define | RTE_OPTION_ARG_SAT(type, min, max) |
| #define | RTE_2(x) #x |
| #define | RTE_1(x) RTE_2(x) |
| #define | nullcheck(X, whattodo) |
Typedefs | |
| typedef struct rte_context_class | rte_context_class |
| typedef struct rte_backend_class | rte_backend_class |
Enumerations | |
| enum | rte_state { RTE_STATE_NEW = 0, RTE_STATE_PARAM, RTE_STATE_READY, RTE_STATE_RUNNING, RTE_STATE_PAUSED } |
| enum | rte_io_method { RTE_CALLBACK_MASTER = 1, RTE_CALLBACK_SLAVE, RTE_PUSH_MASTER, RTE_PUSH_SLAVE, RTE_FIFO, RTE_FILE, RTE_STDIO, RTE_DISCARD } |
Functions | |
| void | rte_unknown_option (rte_context *context, rte_codec *codec, const char *keyword) |
| void | rte_invalid_option (rte_context *context, rte_codec *codec, const char *keyword,...) |
| void | rte_asprintf (char **errstr, const char *templ,...) |
| char * | rte_strdup (rte_context *context, char **d, const char *s) |
| unsigned int | rte_closest_int (const int *vec, unsigned int len, int val) |
| unsigned int | rte_closest_double (const double *vec, unsigned int len, double val) |
| rte_bool | rte_option_string (rte_context *context, rte_codec *codec, const char *optstr) |
| static_inline int | rte_closest_int_val (const int *vec, unsigned int len, int val) |
| static_inline double | rte_closest_double_val (const double *vec, unsigned int len, double val) |
| static_inline void | rte_error_reset (rte_context *context) |
These, together with the public RTE structures, are the definitions of the RTE backend interface from rtepriv.h. Only backends use this, not RTE clients.
| #define RTE_OPTION_BOOL_INITIALIZER | ( | key_, | |||
| label_, | |||||
| def_, | |||||
| tip_ | ) |
{ RTE_OPTION_BOOL, key_, label_, RTE_OPTION_BOUNDS_INITIALIZER_( \
.num, def_, 0, 1, 1), { .num = NULL }, tip_ }
Helper macro for backends to build option lists. Use like this:
rte_option_info myinfo = RTE_OPTION_BOOL_INITIALIZER ("mute", N_("Switch sound on/off"), FALSE, N_("I am a tooltip"));
N_() marks the string for i18n, see info gettext for details.
| #define RTE_OPTION_INT_RANGE_INITIALIZER | ( | key_, | |||
| label_, | |||||
| def_, | |||||
| min_, | |||||
| max_, | |||||
| step_, | |||||
| tip_ | ) |
{ RTE_OPTION_INT, key_, label_, \
RTE_OPTION_BOUNDS_INITIALIZER_(.num, def_, min_, max_, step_), \
{ .num = NULL }, tip_ }
Helper macro for backends to build option lists. Use like this:
rte_option_info myinfo = RTE_OPTION_INT_RANGE_INITIALIZER ("sampling", N_("Sampling rate"), 44100, 8000, 48000, 100, NULL);
Here we have no tooltip (NULL).
| #define RTE_OPTION_INT_MENU_INITIALIZER | ( | key_, | |||
| label_, | |||||
| def_, | |||||
| menu_, | |||||
| entries_, | |||||
| tip_ | ) |
{ RTE_OPTION_INT, key_, label_, \
RTE_OPTION_BOUNDS_INITIALIZER_(.num, def_, 0, (entries_) - 1, 1), \
{ .num = menu_ }, tip_ }
Helper macro for backends to build option lists. Use like this:
int mymenu[] = { 29, 30, 31 }; rte_option_info myinfo = RTE_OPTION_INT_MENU_INITIALIZER ("days", NULL, 1, mymenu, 3, NULL);
No label and tooltip (NULL), i. e. this option is not to be listed in the user interface. Default is entry 1 ("30") of 3 entries.
| #define RTE_OPTION_REAL_RANGE_INITIALIZER | ( | key_, | |||
| label_, | |||||
| def_, | |||||
| min_, | |||||
| max_, | |||||
| step_, | |||||
| tip_ | ) |
{ RTE_OPTION_REAL, key_, label_, \
RTE_OPTION_BOUNDS_INITIALIZER_(.dbl, def_, min_, max_, step_), \
{ .dbl = NULL }, tip_ }
Helper macro for backends to build option lists. Use like RTE_OPTION_INT_RANGE_INITIALIZER(), just with doubles but ints.
| #define RTE_OPTION_REAL_MENU_INITIALIZER | ( | key_, | |||
| label_, | |||||
| def_, | |||||
| menu_, | |||||
| entries_, | |||||
| tip_ | ) |
{ RTE_OPTION_REAL, key_, label_, \
RTE_OPTION_BOUNDS_INITIALIZER_(.num, def_, 0, (entries_) - 1, 1), \
{ .dbl = menu_ }, tip_ }
Helper macro for backends to build option lists. Use like RTE_OPTION_INT_MENU_INITIALIZER(), just with an array of doubles but ints.
| #define RTE_OPTION_STRING_INITIALIZER | ( | key_, | |||
| label_, | |||||
| def_, | |||||
| tip_ | ) |
{ RTE_OPTION_STRING, key_, label_, RTE_OPTION_BOUNDS_INITIALIZER_( \
.str, def_, NULL, NULL, NULL), { .str = NULL }, tip_ }
Helper macro for backends to build option lists. Use like this:
rte_option_info myinfo = RTE_OPTION_STRING_INITIALIZER ("comment", N_("Comment"), "bububaba", "Please enter a string");
| #define RTE_OPTION_STRING_MENU_INITIALIZER | ( | key_, | |||
| label_, | |||||
| def_, | |||||
| menu_, | |||||
| entries_, | |||||
| tip_ | ) |
{ RTE_OPTION_STRING, key_, label_, \
RTE_OPTION_BOUNDS_INITIALIZER_(.str, def_, 0, (entries_) - 1, 1), \
{ .str = menu_ }, tip_ }
Helper macro for backends to build option lists. Use like this:
char *mymenu[] = { "txt", "html" }; rte_option_info myinfo = RTE_OPTION_STRING_MENU_INITIALIZER ("extension", "Ext", 0, mymenu, 2, N_("Select an extension"));
Remember this is like RTE_OPTION_STRING_INITIALIZER() in the sense that the rte client can pass any string as option value, not just those proposed in the menu. In contrast a plain menu option as with RTE_OPTION_MENU_INITIALIZER() expects menu indices as input.
| #define RTE_OPTION_MENU_INITIALIZER | ( | key_, | |||
| label_, | |||||
| def_, | |||||
| menu_, | |||||
| entries_, | |||||
| tip_ | ) |
{ RTE_OPTION_MENU, key_, label_, \
RTE_OPTION_BOUNDS_INITIALIZER_(.num, def_, 0, (entries_) - 1, 1), \
{ .str = menu_ }, tip_ }
Helper macro for backends to build option lists. Use like this:
char *mymenu[] = { N_("Monday"), N_("Tuesday") }; rte_option_info myinfo = RTE_OPTION_MENU_INITIALIZER ("weekday", "Weekday, 0, mymenu, 2, N_("Select a weekday"));
| #define RTE_OPTION_ARG | ( | type, | |||
| min, | |||||
| max | ) |
({ \
type val = va_arg(args, type); \
\
if (val < (min) || val > (max)) { \
rte_invalid_option(context, codec, keyword, val); \
goto failed; \
} \
val; \
})
Helper macro for backends to parse options. Use like this:
myfunc (va_list args)
{
int myval = RTE_OPTION_ARG (int, -100, +200);
:
failed:
return FALSE;
}
| #define RTE_OPTION_ARG_MENU | ( | menu | ) | RTE_OPTION_ARG(int, 0, sizeof(menu) / sizeof(menu[0])) |
Helper macro for backends to parse options. Use like this:
char *mymenu[] = { N_("Monday"), N_("Tuesday") }; myfunc (va_list args) { int myval = RTE_OPTION_ARG_MENU (mymenu); // fails if not 0 ... 1 : failed: return FALSE; }
| #define RTE_OPTION_ARG_SAT | ( | type, | |||
| min, | |||||
| max | ) |
({ \
type val = va_arg(args, type); \
\
if (val < (min)) val = min; \
else if (val > (max)) val = max; \
val; \
})
Helper macro for backends to parse options. Same as RTE_OPTION_ARG(), but saturates argument to min...max instead of failing.
| #define nullcheck | ( | X, | |||
| whattodo | ) |
do { \ if ((X) == NULL) { \ const char *s = "rte:" __FILE__ ":" RTE_1(__LINE__) \ ":%s: " #X " == NULL.\n"; \ if (context) \ rte_error_printf(context, s, \ __PRETTY_FUNCTION__); \ else \ fprintf(stderr, s, __PRETTY_FUNCTION__); \ whattodo; \ } \ } while (0)
| typedef struct rte_context_class rte_context_class |
Part of the backend interface.
| enum rte_state |
Context or codec state. The state field in rte_context and rte_codec must be set by the context and codec functions as documented below.
| enum rte_io_method |
| void rte_unknown_option | ( | rte_context * | context, | |
| rte_codec * | codec, | |||
| const char * | keyword | |||
| ) |
| context | Initialized rte_context as returned by rte_context_new(). | |
| codec | Pointer to rte_codec if this refers to a codec option, NULL if context option. | |
| keyword | Keyword of the option, can be NULL or "". |
RTE internal helper function for backends.
Sets the context error string.
| void rte_invalid_option | ( | rte_context * | context, | |
| rte_codec * | codec, | |||
| const char * | keyword, | |||
| ... | ||||
| ) |
| context | Initialized rte_context as returned by rte_context_new(). | |
| codec | Pointer to rte_codec if this refers to a codec option, NULL if context option. | |
| keyword | Keyword of the option, can be NULL or "". | |
| ... | If the option is known, the invalid data (int, double, char *). |
RTE internal helper function for backends.
Sets the context error string.
| void rte_asprintf | ( | char ** | errstr, | |
| const char * | templ, | |||
| ... | ||||
| ) |
| errstr | Place to store the allocated string or NULL. | |
| templ | See printf(). | |
| ... | See printf(). |
RTE internal helper function for backends.
Identical to GNU or BSD libc asprintf().
| char* rte_strdup | ( | rte_context * | context, | |
| char ** | d, | |||
| const char * | s | |||
| ) |
| context | Initialized rte_context as returned by rte_context_new(). | |
| d | If non-zero, store pointer to allocated string here. When *d is non-zero, free(*d) the old string first. | |
| s | String to be duplicated. |
RTE internal helper function for backends.
Same as the libc strdup(), except for d argument and setting the context error string on failure.
NULL on failure, pointer to malloc()ed string otherwise. | unsigned int rte_closest_int | ( | const int * | vec, | |
| unsigned int | len, | |||
| int | val | |||
| ) |
| vec | Vector of int values. | |
| len | Length of the vector. | |
| val | Value to be compared. |
RTE internal helper function for backends.
Find in a vector of int values the entry closest to val and return its index, 0 ... n.
| unsigned int rte_closest_double | ( | const double * | vec, | |
| unsigned int | len, | |||
| double | val | |||
| ) |
| vec | Vector of double values. | |
| len | Length of the vector. | |
| val | Value to be compared. |
RTE internal helper function for backends.
Find in a vector of double values the entry closest to val and return its index, 0 ... n.
1.6.1