mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
spa: add SPA_LATENCY_INFO_UNSET
Add a initializer for an unset latency info. Use this for combining latency info.
This commit is contained in:
parent
5480a1382f
commit
2393be4543
2 changed files with 13 additions and 13 deletions
|
|
@ -44,28 +44,24 @@ spa_latency_info_compare(const struct spa_latency_info *a, const struct spa_late
|
||||||
SPA_API_LATENCY_UTILS void
|
SPA_API_LATENCY_UTILS void
|
||||||
spa_latency_info_combine_start(struct spa_latency_info *info, enum spa_direction direction)
|
spa_latency_info_combine_start(struct spa_latency_info *info, enum spa_direction direction)
|
||||||
{
|
{
|
||||||
*info = SPA_LATENCY_INFO(direction,
|
*info = SPA_LATENCY_INFO_UNSET(direction);
|
||||||
.min_quantum = FLT_MAX,
|
|
||||||
.max_quantum = FLT_MIN,
|
|
||||||
.min_rate = INT32_MAX,
|
|
||||||
.max_rate = INT32_MIN,
|
|
||||||
.min_ns = INT64_MAX,
|
|
||||||
.max_ns = INT64_MIN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_API_LATENCY_UTILS void
|
SPA_API_LATENCY_UTILS void
|
||||||
spa_latency_info_combine_finish(struct spa_latency_info *info)
|
spa_latency_info_combine_finish(struct spa_latency_info *info)
|
||||||
{
|
{
|
||||||
if (info->min_quantum == FLT_MAX)
|
struct spa_latency_info unset = SPA_LATENCY_INFO_UNSET(info->direction);
|
||||||
|
if (info->min_quantum == unset.min_quantum)
|
||||||
info->min_quantum = 0;
|
info->min_quantum = 0;
|
||||||
if (info->max_quantum == FLT_MIN)
|
if (info->max_quantum == unset.max_quantum)
|
||||||
info->max_quantum = 0;
|
info->max_quantum = 0;
|
||||||
if (info->min_rate == INT32_MAX)
|
if (info->min_rate == unset.min_rate)
|
||||||
info->min_rate = 0;
|
info->min_rate = 0;
|
||||||
if (info->max_rate == INT32_MIN)
|
if (info->max_rate == unset.max_rate)
|
||||||
info->max_rate = 0;
|
info->max_rate = 0;
|
||||||
if (info->min_ns == INT64_MAX)
|
if (info->min_ns == unset.min_ns)
|
||||||
info->min_ns = 0;
|
info->min_ns = 0;
|
||||||
if (info->max_ns == INT64_MIN)
|
if (info->max_ns == unset.max_ns)
|
||||||
info->max_ns = 0;
|
info->max_ns = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,10 @@ struct spa_latency_info {
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SPA_LATENCY_INFO(dir,...) ((struct spa_latency_info) { .direction = (dir), ## __VA_ARGS__ })
|
#define SPA_LATENCY_INFO(dir,...) ((struct spa_latency_info) { .direction = (dir), ## __VA_ARGS__ })
|
||||||
|
#define SPA_LATENCY_INFO_UNSET(dir) SPA_LATENCY_INFO(dir, \
|
||||||
|
.min_quantum = FLT_MAX, .max_quantum = FLT_MIN, \
|
||||||
|
.min_rate = INT32_MAX, .max_rate = INT32_MIN, \
|
||||||
|
.min_ns = INT64_MAX, .max_ns = INT64_MIN)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Properties for SPA_TYPE_OBJECT_ParamProcessLatency
|
* Properties for SPA_TYPE_OBJECT_ParamProcessLatency
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue