videoconvert: Support setting videoconverter via defines

This commit is contained in:
columbarius 2023-09-24 18:30:54 +02:00
parent 7fd0e8cda5
commit b39feb37c8

View file

@ -28,6 +28,11 @@
#define SPA_LOG_TOPIC_DEFAULT log_topic #define SPA_LOG_TOPIC_DEFAULT log_topic
static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.videoadapter"); static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.videoadapter");
#if 0
#define VIDEOCONVERTER 1
#define VIDEOCONVERTER_FACTORY spa_videoconvert_vulkan_factory
#endif
#define DEFAULT_ALIGN 16 #define DEFAULT_ALIGN 16
#define MAX_PORTS (1+1) #define MAX_PORTS (1+1)
@ -534,7 +539,7 @@ static int configure_convert(struct impl *this, uint32_t mode)
return spa_node_set_param(this->convert, SPA_PARAM_PortConfig, 0, param); return spa_node_set_param(this->convert, SPA_PARAM_PortConfig, 0, param);
} }
extern const struct spa_handle_factory spa_videoconvert_factory; extern const struct spa_handle_factory VIDEOCONVERTER_FACTORY;
static const struct spa_node_events follower_node_events; static const struct spa_node_events follower_node_events;
@ -1642,8 +1647,8 @@ impl_get_size(const struct spa_handle_factory *factory,
{ {
size_t size = 0; size_t size = 0;
#if 0 #if VIDEOCONVERTER
size += spa_handle_factory_get_size(&spa_videoconvert_factory, params); size += spa_handle_factory_get_size(&VIDEOCONVERTER_FACTORY, params);
#endif #endif
size += sizeof(struct impl); size += sizeof(struct impl);
@ -1658,7 +1663,7 @@ impl_init(const struct spa_handle_factory *factory,
uint32_t n_support) uint32_t n_support)
{ {
struct impl *this; struct impl *this;
#if 0 #if VIDEOCONVERTER
void *iface; void *iface;
#endif #endif
const char *str; const char *str;
@ -1694,9 +1699,9 @@ impl_init(const struct spa_handle_factory *factory,
SPA_VERSION_NODE, SPA_VERSION_NODE,
&impl_node, this); &impl_node, this);
#if 0 #if VIDEOCONVERTER
this->hnd_convert = SPA_PTROFF(this, sizeof(struct impl), struct spa_handle); this->hnd_convert = SPA_PTROFF(this, sizeof(struct impl), struct spa_handle);
spa_handle_factory_init(&spa_videoconvert_factory, spa_handle_factory_init(&VIDEOCONVERTER_FACTORY,
this->hnd_convert, this->hnd_convert,
info, support, n_support); info, support, n_support);
@ -1734,8 +1739,8 @@ impl_init(const struct spa_handle_factory *factory,
if (this->direction == SPA_DIRECTION_INPUT) { if (this->direction == SPA_DIRECTION_INPUT) {
// MODE: CONVERT // MODE: CONVERT
// configure_convert(this, SPA_PARAM_PORT_CONFIG_MODE_convert); configure_convert(this, SPA_PARAM_PORT_CONFIG_MODE_convert);
reconfigure_mode(this, true, this->direction, NULL); // reconfigure_mode(this, true, this->direction, NULL);
} else { } else {
// MODE: PASSTHROUGH // MODE: PASSTHROUGH
reconfigure_mode(this, true, this->direction, NULL); reconfigure_mode(this, true, this->direction, NULL);