goto end;
}
- if (component->class->type != BT_COMPONENT_TYPE_SINK) {
+ if (component->class->type != BT_COMPONENT_CLASS_TYPE_SINK) {
ret = BT_COMPONENT_STATUS_INVALID;
goto end;
}
sink = container_of(component, struct bt_component_sink, parent);
- if (!sink->consume) {
- printf_error("Invalid sink component; no notification consumption callback defined.");
- ret = BT_COMPONENT_STATUS_INVALID;
- goto end;
- }
-
ret = component_input_validate(&sink->input);
if (ret) {
goto end;
{
enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
struct bt_component_sink *sink = NULL;
+ struct bt_component_class_sink *sink_class = NULL;
if (!component) {
ret = BT_COMPONENT_STATUS_INVALID;
goto end;
}
- if (bt_component_get_type(component) != BT_COMPONENT_TYPE_SINK) {
+ if (bt_component_get_class_type(component) != BT_COMPONENT_CLASS_TYPE_SINK) {
ret = BT_COMPONENT_STATUS_UNSUPPORTED;
goto end;
}
sink->input.validated = true;
}
- assert(sink->consume);
- ret = sink->consume(component);
+ sink_class = container_of(component->class, struct bt_component_class_sink, parent);
+ assert(sink_class->methods.consume);
+ ret = sink_class->methods.consume(component);
end:
return ret;
}
goto end;
}
- if (bt_component_get_type(component) != BT_COMPONENT_TYPE_SINK) {
+ if (bt_component_get_class_type(component) != BT_COMPONENT_CLASS_TYPE_SINK) {
ret = BT_COMPONENT_STATUS_UNSUPPORTED;
goto end;
}
return ret;
}
*/
-enum bt_component_status bt_component_sink_set_consume_cb(
- struct bt_component *component,
- bt_component_sink_consume_cb consume)
-{
- struct bt_component_sink *sink;
- enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
-
- if (!component) {
- ret = BT_COMPONENT_STATUS_INVALID;
- goto end;
- }
-
- if (bt_component_get_type(component) != BT_COMPONENT_TYPE_SINK) {
- ret = BT_COMPONENT_STATUS_UNSUPPORTED;
- goto end;
- }
-
- if (!component->initializing) {
- ret = BT_COMPONENT_STATUS_INVALID;
- goto end;
- }
-
- sink = container_of(component, struct bt_component_sink, parent);
- sink->consume = consume;
-end:
- return ret;
-}
-
-enum bt_component_status bt_component_sink_set_add_iterator_cb(
- struct bt_component *component,
- bt_component_sink_add_iterator_cb add_iterator)
-{
- struct bt_component_sink *sink;
- enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
-
- if (!component) {
- ret = BT_COMPONENT_STATUS_INVALID;
- goto end;
- }
-
- if (bt_component_get_type(component) != BT_COMPONENT_TYPE_SINK) {
- ret = BT_COMPONENT_STATUS_UNSUPPORTED;
- goto end;
- }
-
- if (!component->initializing) {
- ret = BT_COMPONENT_STATUS_INVALID;
- goto end;
- }
-
- sink = container_of(component, struct bt_component_sink, parent);
- sink->add_iterator = add_iterator;
-end:
- return ret;
-}
enum bt_component_status bt_component_sink_set_minimum_input_count(
struct bt_component *component,
goto end;
}
- if (bt_component_get_type(component) != BT_COMPONENT_TYPE_SINK) {
+ if (bt_component_get_class_type(component) != BT_COMPONENT_CLASS_TYPE_SINK) {
ret = BT_COMPONENT_STATUS_UNSUPPORTED;
goto end;
}
goto end;
}
- if (bt_component_get_type(component) != BT_COMPONENT_TYPE_SINK) {
+ if (bt_component_get_class_type(component) != BT_COMPONENT_CLASS_TYPE_SINK) {
ret = BT_COMPONENT_STATUS_UNSUPPORTED;
goto end;
}
goto end;
}
- if (bt_component_get_type(component) != BT_COMPONENT_TYPE_SINK) {
+ if (bt_component_get_class_type(component) != BT_COMPONENT_CLASS_TYPE_SINK) {
ret = BT_COMPONENT_STATUS_UNSUPPORTED;
goto end;
}
goto end;
}
- if (bt_component_get_type(component) != BT_COMPONENT_TYPE_SINK) {
+ if (bt_component_get_class_type(component) != BT_COMPONENT_CLASS_TYPE_SINK) {
ret = BT_COMPONENT_STATUS_UNSUPPORTED;
goto end;
}
{
struct bt_component_sink *sink;
enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
+ struct bt_component_class_sink *sink_class;
if (!component || !iterator) {
ret = BT_COMPONENT_STATUS_INVALID;
goto end;
}
- if (bt_component_get_type(component) != BT_COMPONENT_TYPE_SINK) {
+ if (bt_component_get_class_type(component) != BT_COMPONENT_CLASS_TYPE_SINK) {
ret = BT_COMPONENT_STATUS_UNSUPPORTED;
goto end;
}
goto end;
}
- if (sink->add_iterator) {
- ret = sink->add_iterator(component, iterator);
+ sink_class = container_of(component->class, struct bt_component_class_sink, parent);
+
+ if (sink_class->methods.add_iterator) {
+ ret = sink_class->methods.add_iterator(component, iterator);
if (ret != BT_COMPONENT_STATUS_OK) {
goto end;
}