mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
config.h needs to be consistently included before any standard headers if we ever want to set feature test macros (like _GNU_SOURCE or whatever) inside. It can lead to hard-to-debug issues without that. It can also be problematic just for our own HAVE_* that it may define if it's not consistently made available before our own headers. Just always include it first, before everything. We already did this in many files, just not consistently.
49 lines
1 KiB
C
49 lines
1 KiB
C
/* Spa V4l2 support */
|
|
/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
|
|
/* SPDX-License-Identifier: MIT */
|
|
|
|
#include "config.h"
|
|
|
|
#include <errno.h>
|
|
|
|
#include <spa/support/plugin.h>
|
|
#include <spa/support/log.h>
|
|
|
|
#include "v4l2.h"
|
|
|
|
extern const struct spa_handle_factory spa_v4l2_source_factory;
|
|
extern const struct spa_handle_factory spa_v4l2_udev_factory;
|
|
extern const struct spa_handle_factory spa_v4l2_device_factory;
|
|
|
|
SPA_LOG_TOPIC_DEFINE(v4l2_log_topic, "spa.v4l2");
|
|
|
|
SPA_LOG_TOPIC_ENUM_DEFINE_REGISTERED;
|
|
|
|
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_v4l2_source_factory;
|
|
break;
|
|
case 1:
|
|
#ifdef HAVE_LIBUDEV
|
|
*factory = &spa_v4l2_udev_factory;
|
|
break;
|
|
#else
|
|
(*index)++;
|
|
SPA_FALLTHROUGH;
|
|
#endif
|
|
case 2:
|
|
*factory = &spa_v4l2_device_factory;
|
|
break;
|
|
default:
|
|
return 0;
|
|
}
|
|
(*index)++;
|
|
return 1;
|
|
}
|