+ sink->min_input_count = minimum;
+end:
+ return ret;
+}
+
+enum bt_component_status bt_component_sink_set_maximum_input_count(
+ struct bt_component *component,
+ unsigned int maximum)
+{
+ 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->max_input_count = maximum;
+end:
+ return ret;
+}
+
+enum bt_component_status
+bt_component_sink_get_input_count(struct bt_component *component,
+ unsigned int *count)
+{
+ struct bt_component_sink *sink;
+ enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
+
+ if (!component || !count) {
+ ret = BT_COMPONENT_STATUS_INVALID;
+ goto end;
+ }
+
+ if (bt_component_get_type(component) != BT_COMPONENT_TYPE_SINK) {
+ ret = BT_COMPONENT_STATUS_UNSUPPORTED;
+ goto end;
+ }
+
+ sink = container_of(component, struct bt_component_sink, parent);
+ *count = (unsigned int) sink->inputs->len;
+end:
+ return ret;
+}
+
+enum bt_component_status
+bt_component_sink_get_input_iterator(struct bt_component *component,
+ unsigned int input, struct bt_notification_iterator **iterator)
+{
+ struct bt_component_sink *sink;
+ enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
+
+ if (!component || !iterator) {
+ ret = BT_COMPONENT_STATUS_INVALID;
+ goto end;
+ }
+
+ if (bt_component_get_type(component) != BT_COMPONENT_TYPE_SINK) {
+ ret = BT_COMPONENT_STATUS_UNSUPPORTED;
+ goto end;
+ }
+
+ sink = container_of(component, struct bt_component_sink, parent);
+ if (input >= (unsigned int) sink->inputs->len) {
+ ret = BT_COMPONENT_STATUS_INVALID;
+ goto end;
+ }
+
+ *iterator = bt_get(g_ptr_array_index(sink->inputs, input));
+end:
+ return ret;
+}
+
+enum bt_component_status
+bt_component_sink_add_iterator(struct bt_component *component,
+ struct bt_notification_iterator *iterator)
+{
+ struct bt_component_sink *sink;
+ enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
+
+ if (!component || !iterator) {
+ ret = BT_COMPONENT_STATUS_INVALID;
+ goto end;
+ }
+
+ if (bt_component_get_type(component) != BT_COMPONENT_TYPE_SINK) {
+ ret = BT_COMPONENT_STATUS_UNSUPPORTED;
+ goto end;
+ }
+
+ sink = container_of(component, struct bt_component_sink, parent);
+ if (sink->inputs->len == sink->max_input_count) {
+ ret = BT_COMPONENT_STATUS_UNSUPPORTED;
+ goto end;
+ }
+
+ if (sink->add_iterator) {
+ ret = sink->add_iterator(component, iterator);
+ if (ret != BT_COMPONENT_STATUS_OK) {
+ goto end;
+ }
+ }
+
+ g_ptr_array_add(sink->inputs, bt_get(iterator));