X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Flibsigrok-internal.h;h=741cf34c1f8d98aeaaa0798e870b1dc9b8a1ac0f;hb=090f1e1e5478ea15baa3731fefbd4aff9be78c77;hp=33048562b492f656343b09dab9e7c7d734bde86a;hpb=67070942cc02c8190797922d17c702fe4c526790;p=libsigrok.git diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h index 33048562..741cf34c 100644 --- a/src/libsigrok-internal.h +++ b/src/libsigrok-internal.h @@ -426,6 +426,8 @@ struct sr_input_module { * Check if this input module can load and parse the specified stream. * * @param[in] metadata Metadata the module can use to identify the stream. + * @param[out] confidence "Strength" of the detection. + * Specialized handlers can take precedence over generic/basic support. * * @retval SR_OK This module knows the format. * @retval SR_ERR_NA There wasn't enough data for this module to @@ -434,8 +436,15 @@ struct sr_input_module { * it. This means the stream is either corrupt, or indicates a * feature that the module does not support. * @retval SR_ERR This module does not know the format. + * + * Lower numeric values of 'confidence' mean that the input module + * stronger believes in its capability to handle this specific format. + * This way, multiple input modules can claim support for a format, + * and the application can pick the best match, or try fallbacks + * in case of errors. This approach also copes with formats that + * are unreliable to detect in the absence of magic signatures. */ - int (*format_match) (GHashTable *metadata); + int (*format_match) (GHashTable *metadata, unsigned int *confidence); /** * Initialize the input module.