pipewire/spa/plugins/libcamera/libcamera.c

38 lines
815 B
C
Raw 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
2021-10-03 12:26:00 +02:00
struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.libcamera");
struct spa_log_topic *libcamera_log_topic = &log_topic;
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;
}