input: provide accessor routine for (struct sr_input *)->module
Add a public API routine which allows applications to query the sr_input_module from an sr_input.
This commit is contained in:
parent
83df004be1
commit
c83bdde9da
|
@ -170,6 +170,7 @@ SR_API struct sr_input *sr_input_new(const struct sr_input_module *imod,
|
||||||
GHashTable *options);
|
GHashTable *options);
|
||||||
SR_API int sr_input_scan_buffer(GString *buf, const struct sr_input **in);
|
SR_API int sr_input_scan_buffer(GString *buf, const struct sr_input **in);
|
||||||
SR_API int sr_input_scan_file(const char *filename, const struct sr_input **in);
|
SR_API int sr_input_scan_file(const char *filename, const struct sr_input **in);
|
||||||
|
SR_API const struct sr_input_module *sr_input_module_get(const struct sr_input *in);
|
||||||
SR_API struct sr_dev_inst *sr_input_dev_inst_get(const struct sr_input *in);
|
SR_API struct sr_dev_inst *sr_input_dev_inst_get(const struct sr_input *in);
|
||||||
SR_API int sr_input_send(const struct sr_input *in, GString *buf);
|
SR_API int sr_input_send(const struct sr_input *in, GString *buf);
|
||||||
SR_API int sr_input_end(const struct sr_input *in);
|
SR_API int sr_input_end(const struct sr_input *in);
|
||||||
|
|
|
@ -532,6 +532,22 @@ SR_API int sr_input_scan_file(const char *filename, const struct sr_input **in)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the input instance's module "class". This can be used to find out
|
||||||
|
* which input module handles a specific input file. This is especially
|
||||||
|
* useful when an application did not create the input stream by specifying
|
||||||
|
* an input module, but instead some shortcut or convenience wrapper did.
|
||||||
|
*
|
||||||
|
* @since 0.6.0
|
||||||
|
*/
|
||||||
|
SR_API const struct sr_input_module *sr_input_module_get(const struct sr_input *in)
|
||||||
|
{
|
||||||
|
if (!in)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return in->module;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the input instance's (virtual) device instance. This can be
|
* Return the input instance's (virtual) device instance. This can be
|
||||||
* used to find out the number of channels and other information.
|
* used to find out the number of channels and other information.
|
||||||
|
|
Loading…
Reference in New Issue