Add audioconvert2

This commit is contained in:
Wim Taymans 2022-02-23 17:14:14 +01:00
parent 2d060a5a72
commit 7f9ddd0f15
7 changed files with 1865 additions and 12 deletions

View file

@ -484,7 +484,7 @@ static int configure_convert(struct impl *this, uint32_t mode)
return spa_node_set_param(this->convert, SPA_PARAM_PortConfig, 0, param);
}
extern const struct spa_handle_factory spa_audioconvert_factory;
extern const struct spa_handle_factory spa_audioconvert2_factory;
static const struct spa_node_events follower_node_events;
@ -494,7 +494,7 @@ static int reconfigure_mode(struct impl *this, bool passthrough,
int res = 0;
struct spa_hook l;
spa_log_debug(this->log, "%p: passthrough mode %d", this, passthrough);
spa_log_info(this->log, "%p: passthrough mode %d", this, passthrough);
if (this->passthrough != passthrough) {
if (passthrough) {
@ -852,6 +852,12 @@ static void convert_node_info(void *data, const struct spa_node_info *info)
uint32_t idx;
switch (info->params[i].id) {
case SPA_PARAM_EnumPortConfig:
idx = IDX_EnumPortConfig;
break;
case SPA_PARAM_PortConfig:
idx = IDX_PortConfig;
break;
case SPA_PARAM_PropInfo:
idx = IDX_PropInfo;
break;
@ -1516,7 +1522,7 @@ impl_get_size(const struct spa_handle_factory *factory,
{
size_t size;
size = spa_handle_factory_get_size(&spa_audioconvert_factory, params);
size = spa_handle_factory_get_size(&spa_audioconvert2_factory, params);
size += sizeof(struct impl);
return size;
@ -1565,7 +1571,7 @@ impl_init(const struct spa_handle_factory *factory,
&impl_node, this);
this->hnd_convert = SPA_PTROFF(this, sizeof(struct impl), struct spa_handle);
spa_handle_factory_init(&spa_audioconvert_factory,
spa_handle_factory_init(&spa_audioconvert2_factory,
this->hnd_convert,
info, support, n_support);

File diff suppressed because it is too large Load diff

View file

@ -37,9 +37,6 @@
#include "channelmix-ops.h"
#include "hilbert.h"
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT log_topic
struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.channelmix");
#define _M(ch) (1UL << SPA_AUDIO_CHANNEL_ ## ch)
#define MASK_MONO _M(FC)|_M(MONO)|_M(UNKNOWN)

View file

@ -29,10 +29,6 @@
#include <spa/utils/string.h>
#include <spa/param/audio/raw.h>
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT log_topic
extern struct spa_log_topic *log_topic;
#include "crossover.h"
#include "delay.h"

View file

@ -44,6 +44,9 @@
#include "channelmix-ops.h"
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT log_topic
struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.channelmix");
#define DEFAULT_RATE 48000
#define DEFAULT_CHANNELS 2

View file

@ -1,5 +1,6 @@
audioconvert_sources = ['audioadapter.c',
'audioconvert.c',
'audioconvert2.c',
'fmtconvert.c',
'channelmix.c',
'merger.c',

View file

@ -27,6 +27,7 @@
#include <spa/support/plugin.h>
extern const struct spa_handle_factory spa_audioconvert_factory;
extern const struct spa_handle_factory spa_audioconvert2_factory;
extern const struct spa_handle_factory spa_fmtconvert_factory;
extern const struct spa_handle_factory spa_channelmix_factory;
extern const struct spa_handle_factory spa_resample_factory;
@ -42,7 +43,7 @@ int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t
switch (*index) {
case 0:
*factory = &spa_audioconvert_factory;
*factory = &spa_audioconvert2_factory;
break;
case 1:
*factory = &spa_fmtconvert_factory;
@ -62,6 +63,9 @@ int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t
case 6:
*factory = &spa_audioadapter_factory;
break;
case 7:
*factory = &spa_audioconvert_factory;
break;
default:
return 0;
}