Revert "adapter: removed unused follower_current_format"

This reverts commit 6c963ed933.

This code was meant to set a filter on the format for the follower
but is not implemented yet.

Problem is that the unit tests and wireplumber call this code and would
need to be patched.
This commit is contained in:
Wim Taymans 2022-11-09 16:24:45 +01:00
parent 6c963ed933
commit 85ffe68ea3
2 changed files with 45 additions and 2 deletions

View file

@ -68,6 +68,7 @@ struct impl {
struct spa_node *follower;
struct spa_hook follower_listener;
uint32_t follower_flags;
struct spa_audio_info follower_current_format;
struct spa_audio_info default_format;
struct spa_handle *hnd_convert;
@ -560,10 +561,32 @@ static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,
{
int res = 0, res2 = 0;
struct impl *this = object;
struct spa_audio_info info = { 0 };
spa_log_debug(this->log, "%p: set param %d", this, id);
switch (id) {
case SPA_PARAM_Format:
if (this->started)
return -EIO;
if (param == NULL)
return -EINVAL;
if ((res = spa_format_parse(param, &info.media_type, &info.media_subtype)) < 0)
return res;
if (info.media_type != SPA_MEDIA_TYPE_audio ||
info.media_subtype != SPA_MEDIA_SUBTYPE_raw)
return -EINVAL;
if (spa_format_audio_raw_parse(param, &info.info.raw) < 0)
return -EINVAL;
if (info.info.raw.format == 0 ||
info.info.raw.rate == 0 ||
info.info.raw.channels == 0)
return -EINVAL;
this->follower_current_format = info;
break;
case SPA_PARAM_PortConfig:
{
enum spa_direction dir;
@ -1608,7 +1631,7 @@ impl_init(const struct spa_handle_factory *factory,
this->params[IDX_EnumFormat] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
this->params[IDX_PropInfo] = SPA_PARAM_INFO(SPA_PARAM_PropInfo, SPA_PARAM_INFO_READ);
this->params[IDX_Props] = SPA_PARAM_INFO(SPA_PARAM_Props, SPA_PARAM_INFO_READWRITE);
this->params[IDX_Format] = SPA_PARAM_INFO(SPA_PARAM_Format, SPA_PARAM_INFO_READ);
this->params[IDX_Format] = SPA_PARAM_INFO(SPA_PARAM_Format, SPA_PARAM_INFO_WRITE);
this->params[IDX_EnumPortConfig] = SPA_PARAM_INFO(SPA_PARAM_EnumPortConfig, SPA_PARAM_INFO_READ);
this->params[IDX_PortConfig] = SPA_PARAM_INFO(SPA_PARAM_PortConfig, SPA_PARAM_INFO_READWRITE);
this->params[IDX_Latency] = SPA_PARAM_INFO(SPA_PARAM_Latency, SPA_PARAM_INFO_READWRITE);

View file

@ -68,6 +68,7 @@ struct impl {
struct spa_node *follower;
struct spa_hook follower_listener;
uint32_t follower_flags;
struct spa_video_info follower_current_format;
struct spa_video_info default_format;
struct spa_handle *hnd_convert;
@ -566,10 +567,29 @@ static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,
{
int res = 0, res2 = 0;
struct impl *this = object;
struct spa_video_info info = { 0 };
spa_log_debug(this->log, "%p: set param %d", this, id);
switch (id) {
case SPA_PARAM_Format:
if (this->started)
return -EIO;
if (param == NULL)
return -EINVAL;
if ((res = spa_format_parse(param, &info.media_type, &info.media_subtype)) < 0)
return res;
if (info.media_type != SPA_MEDIA_TYPE_video ||
info.media_subtype != SPA_MEDIA_SUBTYPE_raw)
return -EINVAL;
if (spa_format_video_raw_parse(param, &info.info.raw) < 0)
return -EINVAL;
this->follower_current_format = info;
break;
case SPA_PARAM_PortConfig:
{
enum spa_direction dir;
@ -1594,7 +1614,7 @@ impl_init(const struct spa_handle_factory *factory,
this->params[IDX_EnumFormat] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
this->params[IDX_PropInfo] = SPA_PARAM_INFO(SPA_PARAM_PropInfo, SPA_PARAM_INFO_READ);
this->params[IDX_Props] = SPA_PARAM_INFO(SPA_PARAM_Props, SPA_PARAM_INFO_READWRITE);
this->params[IDX_Format] = SPA_PARAM_INFO(SPA_PARAM_Format, SPA_PARAM_INFO_READ);
this->params[IDX_Format] = SPA_PARAM_INFO(SPA_PARAM_Format, SPA_PARAM_INFO_WRITE);
this->params[IDX_EnumPortConfig] = SPA_PARAM_INFO(SPA_PARAM_EnumPortConfig, SPA_PARAM_INFO_READ);
this->params[IDX_PortConfig] = SPA_PARAM_INFO(SPA_PARAM_PortConfig, SPA_PARAM_INFO_READWRITE);
this->params[IDX_Latency] = SPA_PARAM_INFO(SPA_PARAM_Latency, SPA_PARAM_INFO_READWRITE);