resample: add quality property

This commit is contained in:
Wim Taymans 2020-02-14 20:16:50 +01:00
parent 0023aac9b9
commit 3fab544d3d
3 changed files with 8 additions and 1 deletions

View file

@ -64,6 +64,7 @@ enum spa_prop {
SPA_PROP_periodEvent, SPA_PROP_periodEvent,
SPA_PROP_live, SPA_PROP_live,
SPA_PROP_rate, SPA_PROP_rate,
SPA_PROP_quality,
SPA_PROP_START_Audio = 0x10000, /**< audio related properties */ SPA_PROP_START_Audio = 0x10000, /**< audio related properties */
SPA_PROP_waveType, SPA_PROP_waveType,

View file

@ -79,6 +79,7 @@ static const struct spa_type_info spa_type_props[] = {
{ SPA_PROP_periodEvent, SPA_TYPE_Bool, SPA_TYPE_INFO_PROPS_BASE "periodEvent", NULL }, { SPA_PROP_periodEvent, SPA_TYPE_Bool, SPA_TYPE_INFO_PROPS_BASE "periodEvent", NULL },
{ SPA_PROP_live, SPA_TYPE_Bool, SPA_TYPE_INFO_PROPS_BASE "live", NULL }, { SPA_PROP_live, SPA_TYPE_Bool, SPA_TYPE_INFO_PROPS_BASE "live", NULL },
{ SPA_PROP_rate, SPA_TYPE_Double, SPA_TYPE_INFO_PROPS_BASE "rate", NULL }, { SPA_PROP_rate, SPA_TYPE_Double, SPA_TYPE_INFO_PROPS_BASE "rate", NULL },
{ SPA_PROP_quality, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "quality", NULL },
{ SPA_PROP_waveType, SPA_TYPE_Id, SPA_TYPE_INFO_PROPS_BASE "waveType", NULL }, { SPA_PROP_waveType, SPA_TYPE_Id, SPA_TYPE_INFO_PROPS_BASE "waveType", NULL },
{ SPA_PROP_frequency, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "frequency", NULL }, { SPA_PROP_frequency, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "frequency", NULL },

View file

@ -55,11 +55,13 @@ struct impl;
struct props { struct props {
double rate; double rate;
int quality;
}; };
static void props_reset(struct props *props) static void props_reset(struct props *props)
{ {
props->rate = 1.0; props->rate = 1.0;
props->quality = RESAMPLE_DEFAULT_QUALITY;
} }
struct buffer { struct buffer {
@ -161,7 +163,7 @@ static int setup_convert(struct impl *this,
this->resample.i_rate = src_info->info.raw.rate; this->resample.i_rate = src_info->info.raw.rate;
this->resample.o_rate = dst_info->info.raw.rate; this->resample.o_rate = dst_info->info.raw.rate;
this->resample.log = this->log; this->resample.log = this->log;
this->resample.quality = RESAMPLE_DEFAULT_QUALITY; this->resample.quality = this->props.quality;
if (this->peaks) if (this->peaks)
err = impl_peaks_init(&this->resample); err = impl_peaks_init(&this->resample);
@ -191,6 +193,9 @@ static int apply_props(struct impl *this, const struct spa_pod *param)
resample_update_rate(&this->resample, p->rate); resample_update_rate(&this->resample, p->rate);
} }
break; break;
case SPA_PROP_quality:
spa_pod_get_int(&prop->value, &p->quality);
break;
default: default:
break; break;
} }