pipewire/spa/plugins/videoconvert/plugin.c
Wim Taymans 2cbcdbc579 videoconvert: add an ffmpeg based video converter
To activate:

PIPEWIRE_PROPS='{ video.adapt.converter = video.convert.ffmpeg }' build/src/examples/video-play

This makes it possible to start firefox with mjpg capture and then
video-play and it will decode the mjpeg transparently. Works for other
incompatible video formats as well, as long as they can be mmapped.

Ideally this should use something GPU accelerated and this is what the
vulkan converter will do.
2024-09-06 12:27:02 +02:00

41 lines
987 B
C

/* Spa videoconvert plugin */
/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
/* SPDX-License-Identifier: MIT */
#include <errno.h>
#include <spa/support/plugin.h>
#include <spa/support/log.h>
extern const struct spa_handle_factory spa_videoadapter_factory;
extern const struct spa_handle_factory spa_videoconvert_dummy_factory;
#if HAVE_VIDEOCONVERT_FFMPEG
extern const struct spa_handle_factory spa_videoconvert_ffmpeg_factory;
#endif
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_videoadapter_factory;
break;
case 1:
*factory = &spa_videoconvert_dummy_factory;
break;
#if HAVE_VIDEOCONVERT_FFMPEG
case 2:
*factory = &spa_videoconvert_ffmpeg_factory;
break;
#endif
default:
return 0;
}
(*index)++;
return 1;
}