X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Finput%2Finput.c;h=2b5e3afbd8bae0f26018cd0a42cadc857fad0287;hb=4fb0a5f8a022b4b551f0dcac5c458c7108ea613c;hp=3c7fd516a309ea7e05aff2da1b3c16a592355d6a;hpb=640982114329b28aaca3390913037eddd8c6d550;p=libsigrok.git diff --git a/src/input/input.c b/src/input/input.c index 3c7fd516..2b5e3afb 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -89,14 +89,14 @@ SR_API const struct sr_input_module **sr_input_list(void) * * @since 0.4.0 */ -SR_API const char *sr_input_id_get(const struct sr_input_module *o) +SR_API const char *sr_input_id_get(const struct sr_input_module *imod) { - if (!o) { + if (!imod) { sr_err("Invalid input module NULL!"); return NULL; } - return o->id; + return imod->id; } /** @@ -104,14 +104,14 @@ SR_API const char *sr_input_id_get(const struct sr_input_module *o) * * @since 0.4.0 */ -SR_API const char *sr_input_name_get(const struct sr_input_module *o) +SR_API const char *sr_input_name_get(const struct sr_input_module *imod) { - if (!o) { + if (!imod) { sr_err("Invalid input module NULL!"); return NULL; } - return o->name; + return imod->name; } /** @@ -119,14 +119,33 @@ SR_API const char *sr_input_name_get(const struct sr_input_module *o) * * @since 0.4.0 */ -SR_API const char *sr_input_description_get(const struct sr_input_module *o) +SR_API const char *sr_input_description_get(const struct sr_input_module *imod) { - if (!o) { + if (!imod) { sr_err("Invalid input module NULL!"); return NULL; } - return o->desc; + return imod->desc; +} + +/** + * Returns the specified input module's file extensions typical for the file + * format, as a NULL terminated array, or returns a NULL pointer if there is + * no preferred extension. + * @note these are a suggestions only. + * + * @since 0.4.0 + */ +SR_API const char *const *sr_input_extensions_get( + const struct sr_input_module *imod) +{ + if (!imod) { + sr_err("Invalid input module NULL!"); + return NULL; + } + + return imod->exts; } /** @@ -210,6 +229,7 @@ SR_API void sr_input_options_free(const struct sr_option **options) * This function is used when a client wants to use a specific input * module to parse a stream. No effort is made to identify the format. * + * @param imod The input module to use. Must not be NULL. * @param options GHashTable consisting of keys corresponding with * the module options \c id field. The values should be GVariant * pointers with sunk references, of the same GVariantType as the option's