pipewire/spa/plugins/libcamera/libcamera.c

39 lines
790 B
C
Raw Permalink Normal View History

/* Spa libcamera support */
/* SPDX-FileCopyrightText: Copyright © 2020 collabora */
/* SPDX-License-Identifier: MIT */
2020-04-20 12:26:50 +05:30
#include <errno.h>
#include <spa/support/plugin.h>
2021-10-03 12:26:00 +02:00
#include <spa/support/log.h>
2020-04-20 12:26:50 +05:30
#include "libcamera.h"
2020-04-20 12:26:50 +05:30
2023-12-23 21:07:45 +02:00
SPA_LOG_TOPIC_DEFINE(libcamera_log_topic, "spa.libcamera");
SPA_LOG_TOPIC_ENUM_DEFINE_REGISTERED;
2021-10-03 12:26:00 +02:00
2020-04-20 12:26:50 +05:30
SPA_EXPORT
int spa_handle_factory_enum(const struct spa_handle_factory **factory,
uint32_t *index)
{
spa_return_val_if_fail(factory != NULL, -EINVAL);
spa_return_val_if_fail(index != NULL, -EINVAL);
switch (*index) {
case 0:
*factory = &spa_libcamera_manager_factory;
2020-04-20 12:26:50 +05:30
break;
case 1:
*factory = &spa_libcamera_device_factory;
2020-04-20 12:26:50 +05:30
break;
case 2:
*factory = &spa_libcamera_source_factory;
2020-04-20 12:26:50 +05:30
break;
default:
return 0;
}
(*index)++;
return 1;
}