g_slist_free_full(dec->opt_channels, &channel_free);
g_slist_free_full(dec->channels, &channel_free);
+ g_slist_free_full(dec->outputs, g_free);
+ g_slist_free_full(dec->inputs, g_free);
g_free(dec->license);
g_free(dec->desc);
g_free(dec->longname);
* @param d The decoder to use. Must not be NULL.
*
* @return The API version of the decoder, or 0 upon errors.
+ *
+ * @private
*/
SRD_PRIV long srd_decoder_apiver(const struct srd_decoder *d)
{
* PDs of different API versions are incompatible and cannot work.
*/
apiver = srd_decoder_apiver(d);
- if (apiver != 2 && apiver != 3) {
- srd_exception_catch("Only PD API version 2/3 is supported, "
+ if (apiver != 3) {
+ srd_exception_catch("Only PD API version 3 is supported, "
"decoder %s has version %ld", module_name, apiver);
fail_txt = "API version mismatch";
goto err_out;
goto err_out;
}
+ if (py_attr_as_strlist(d->py_dec, "inputs", &(d->inputs)) != SRD_OK) {
+ fail_txt = "missing or malformed 'inputs' attribute";
+ goto err_out;
+ }
+
+ if (py_attr_as_strlist(d->py_dec, "outputs", &(d->outputs)) != SRD_OK) {
+ fail_txt = "missing or malformed 'outputs' attribute";
+ goto err_out;
+ }
+
/* All options and their default values. */
if (get_options(d) != SRD_OK) {
fail_txt = "cannot get options";
return SRD_OK;
except_out:
- if (fail_txt) {
+ /* Don't show a message for the "common" directory, it's not a PD. */
+ if (strcmp(module_name, "common")) {
srd_exception_catch("Failed to load decoder %s: %s",
module_name, fail_txt);
- fail_txt = NULL;
- } else {
- srd_exception_catch("Failed to load decoder %s", module_name);
}
+ fail_txt = NULL;
err_out:
if (fail_txt)
srd_err("Failed to load decoder %s: %s", module_name, fail_txt);