2023-02-08 18:12:00 +01:00
|
|
|
/* Spa Test plugin */
|
|
|
|
|
/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
|
|
|
|
|
/* SPDX-License-Identifier: MIT */
|
2017-05-19 12:48:51 +02:00
|
|
|
|
2017-11-13 09:41:41 +01:00
|
|
|
#include <errno.h>
|
|
|
|
|
|
2017-11-10 13:36:14 +01:00
|
|
|
#include <spa/support/plugin.h>
|
2024-03-10 17:32:56 +02:00
|
|
|
#include <spa/support/log.h>
|
2017-05-19 12:48:51 +02:00
|
|
|
|
2017-05-25 13:28:15 +02:00
|
|
|
extern const struct spa_handle_factory spa_fakesrc_factory;
|
|
|
|
|
extern const struct spa_handle_factory spa_fakesink_factory;
|
2017-05-19 12:48:51 +02:00
|
|
|
|
2024-03-10 17:32:56 +02:00
|
|
|
SPA_LOG_TOPIC_ENUM_DEFINE_REGISTERED;
|
|
|
|
|
|
2019-02-06 13:24:41 +01:00
|
|
|
SPA_EXPORT
|
|
|
|
|
int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index)
|
2017-05-19 12:48:51 +02:00
|
|
|
{
|
2017-11-13 09:41:41 +01:00
|
|
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
|
|
|
|
spa_return_val_if_fail(index != NULL, -EINVAL);
|
2017-05-19 12:48:51 +02:00
|
|
|
|
2017-11-13 09:41:41 +01:00
|
|
|
switch (*index) {
|
2017-05-25 13:28:15 +02:00
|
|
|
case 0:
|
|
|
|
|
*factory = &spa_fakesrc_factory;
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
*factory = &spa_fakesink_factory;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2017-11-13 09:41:41 +01:00
|
|
|
return 0;
|
2017-05-25 13:28:15 +02:00
|
|
|
}
|
2017-11-13 09:41:41 +01:00
|
|
|
(*index)++;
|
|
|
|
|
return 1;
|
2017-05-19 12:48:51 +02:00
|
|
|
}
|