mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
Param: add process latency param and info
This commit is contained in:
parent
8c77713a7b
commit
79866a93cd
7 changed files with 97 additions and 4 deletions
|
|
@ -112,6 +112,52 @@ spa_latency_build(struct spa_pod_builder *builder, uint32_t id, const struct spa
|
|||
SPA_PARAM_LATENCY_maxNs, SPA_POD_Long(info->max_ns));
|
||||
}
|
||||
|
||||
struct spa_process_latency_info {
|
||||
float quantum;
|
||||
uint32_t rate;
|
||||
uint64_t ns;
|
||||
};
|
||||
|
||||
#define SPA_PROCESS_LATENCY_INFO_INIT(...) (struct spa_process_latency_info) { __VA_ARGS__ }
|
||||
|
||||
static inline int
|
||||
spa_process_latency_parse(const struct spa_pod *latency, struct spa_process_latency_info *info)
|
||||
{
|
||||
int res;
|
||||
spa_zero(*info);
|
||||
if ((res = spa_pod_parse_object(latency,
|
||||
SPA_TYPE_OBJECT_ParamProcessLatency, NULL,
|
||||
SPA_PARAM_PROCESS_LATENCY_quantum, SPA_POD_OPT_Float(&info->quantum),
|
||||
SPA_PARAM_PROCESS_LATENCY_rate, SPA_POD_OPT_Int(&info->rate),
|
||||
SPA_PARAM_PROCESS_LATENCY_ns, SPA_POD_OPT_Long(&info->ns))) < 0)
|
||||
return res;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline struct spa_pod *
|
||||
spa_process_latency_build(struct spa_pod_builder *builder, uint32_t id,
|
||||
const struct spa_process_latency_info *info)
|
||||
{
|
||||
return (struct spa_pod *)spa_pod_builder_add_object(builder,
|
||||
SPA_TYPE_OBJECT_ParamProcessLatency, id,
|
||||
SPA_PARAM_PROCESS_LATENCY_quantum, SPA_POD_Float(info->quantum),
|
||||
SPA_PARAM_PROCESS_LATENCY_rate, SPA_POD_Int(info->rate),
|
||||
SPA_PARAM_PROCESS_LATENCY_ns, SPA_POD_Long(info->ns));
|
||||
}
|
||||
|
||||
static inline int
|
||||
spa_process_latency_info_add(const struct spa_process_latency_info *process,
|
||||
struct spa_latency_info *info)
|
||||
{
|
||||
info->min_quantum += process->quantum;
|
||||
info->max_quantum += process->quantum;
|
||||
info->min_rate += process->rate;
|
||||
info->max_rate += process->rate;
|
||||
info->min_ns += process->ns;
|
||||
info->max_ns += process->ns;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ enum spa_param_type {
|
|||
SPA_PARAM_Route, /**< routing configuration as SPA_TYPE_OBJECT_ParamRoute */
|
||||
SPA_PARAM_Control, /**< Control parameter, a SPA_TYPE_Sequence */
|
||||
SPA_PARAM_Latency, /**< latency reporting, a SPA_TYPE_OBJECT_ParamLatency */
|
||||
SPA_PARAM_ProcessLatency, /**< processing latency, a SPA_TYPE_OBJECT_ParamProcessLatency */
|
||||
};
|
||||
|
||||
/** information about a parameter */
|
||||
|
|
@ -185,6 +186,14 @@ enum spa_param_latency {
|
|||
SPA_PARAM_LATENCY_maxNs, /**< max latency (Long) in nanoseconds */
|
||||
};
|
||||
|
||||
/** properties for SPA_TYPE_OBJECT_ParamProcessLatency */
|
||||
enum spa_param_process_latency {
|
||||
SPA_PARAM_PROCESS_LATENCY_START,
|
||||
SPA_PARAM_PROCESS_LATENCY_quantum, /**< latency relative to quantum (Float) */
|
||||
SPA_PARAM_PROCESS_LATENCY_rate, /**< latency (Int) relative to rate */
|
||||
SPA_PARAM_PROCESS_LATENCY_ns, /**< latency (Long) in nanoseconds */
|
||||
};
|
||||
|
||||
/**
|
||||
* \}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ static const struct spa_type_info spa_type_param[] = {
|
|||
{ SPA_PARAM_Route, SPA_TYPE_OBJECT_ParamRoute, SPA_TYPE_INFO_PARAM_ID_BASE "Route", NULL },
|
||||
{ SPA_PARAM_Control, SPA_TYPE_Sequence, SPA_TYPE_INFO_PARAM_ID_BASE "Control", NULL },
|
||||
{ SPA_PARAM_Latency, SPA_TYPE_OBJECT_ParamLatency, SPA_TYPE_INFO_PARAM_ID_BASE "Latency", NULL },
|
||||
{ SPA_PARAM_ProcessLatency, SPA_TYPE_OBJECT_ParamProcessLatency, SPA_TYPE_INFO_PARAM_ID_BASE "ProcessLatency", NULL },
|
||||
{ 0, 0, NULL, NULL },
|
||||
};
|
||||
|
||||
|
|
@ -385,7 +386,7 @@ static const struct spa_type_info spa_type_profiler[] = {
|
|||
};
|
||||
|
||||
#define SPA_TYPE_INFO_PARAM_Latency SPA_TYPE_INFO_PARAM_BASE "Latency"
|
||||
#define SPA_TYPE_INFO_PARAM_LATENCY_BASE SPA_TYPE_INFO_PARAM_Latency ":"
|
||||
#define SPA_TYPE_INFO_PARAM_LATENCY_BASE SPA_TYPE_INFO_PARAM_Latency ":"
|
||||
|
||||
static const struct spa_type_info spa_type_param_latency[] = {
|
||||
{ SPA_PARAM_LATENCY_START, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_LATENCY_BASE, spa_type_param, },
|
||||
|
|
@ -399,6 +400,17 @@ static const struct spa_type_info spa_type_param_latency[] = {
|
|||
{ 0, 0, NULL, NULL },
|
||||
};
|
||||
|
||||
#define SPA_TYPE_INFO_PARAM_ProcessLatency SPA_TYPE_INFO_PARAM_BASE "ProcessLatency"
|
||||
#define SPA_TYPE_INFO_PARAM_PROCESS_LATENCY_BASE SPA_TYPE_INFO_PARAM_ProcessLatency ":"
|
||||
|
||||
static const struct spa_type_info spa_type_param_process_latency[] = {
|
||||
{ SPA_PARAM_PROCESS_LATENCY_START, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_LATENCY_BASE, spa_type_param, },
|
||||
{ SPA_PARAM_PROCESS_LATENCY_quantum, SPA_TYPE_Float, SPA_TYPE_INFO_PARAM_PROCESS_LATENCY_BASE "quantum", NULL, },
|
||||
{ SPA_PARAM_PROCESS_LATENCY_rate, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_PROCESS_LATENCY_BASE "rate", NULL, },
|
||||
{ SPA_PARAM_PROCESS_LATENCY_ns, SPA_TYPE_Long, SPA_TYPE_INFO_PARAM_PROCESS_LATENCY_BASE "ns", NULL, },
|
||||
{ 0, 0, NULL, NULL },
|
||||
};
|
||||
|
||||
/**
|
||||
* \}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ static const struct spa_type_info spa_types[] = {
|
|||
{ SPA_TYPE_OBJECT_ParamRoute, SPA_TYPE_Object, SPA_TYPE_INFO_PARAM_Route, spa_type_param_route },
|
||||
{ SPA_TYPE_OBJECT_Profiler, SPA_TYPE_Object, SPA_TYPE_INFO_Profiler, spa_type_profiler },
|
||||
{ SPA_TYPE_OBJECT_ParamLatency, SPA_TYPE_Object, SPA_TYPE_INFO_PARAM_Latency, spa_type_param_latency },
|
||||
{ SPA_TYPE_OBJECT_ParamProcessLatency, SPA_TYPE_Object, SPA_TYPE_INFO_PARAM_ProcessLatency, spa_type_param_process_latency },
|
||||
|
||||
{ 0, 0, NULL, NULL }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ enum {
|
|||
SPA_TYPE_OBJECT_ParamRoute,
|
||||
SPA_TYPE_OBJECT_Profiler,
|
||||
SPA_TYPE_OBJECT_ParamLatency,
|
||||
SPA_TYPE_OBJECT_ParamProcessLatency,
|
||||
_SPA_TYPE_OBJECT_LAST, /**< not part of ABI */
|
||||
|
||||
/* vendor extensions */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue