spa: Improve PropInfo fields

The PropInfo either has a registered id (and then also a name from the
type-info) or a custom name as a string.
In all cases, the description contains a free form text that clarifies
the property.

Use the description in the stream controls name.
This commit is contained in:
Wim Taymans 2022-03-30 17:09:08 +02:00
parent 4ae94a6ca6
commit 2f5bba112f
19 changed files with 43 additions and 43 deletions

View file

@ -81,7 +81,7 @@ static int impl_node_enum_params(void *object, int seq,
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_device),
SPA_PROP_INFO_name, SPA_POD_String("The ALSA device"),
SPA_PROP_INFO_description, SPA_POD_String("The ALSA device"),
SPA_PROP_INFO_type, SPA_POD_Stringn(p->device, sizeof(p->device)));
break;
default:

View file

@ -410,21 +410,21 @@ static int impl_node_enum_params(void *object, int seq,
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_volume),
SPA_PROP_INFO_name, SPA_POD_String("Volume"),
SPA_PROP_INFO_description, SPA_POD_String("Volume"),
SPA_PROP_INFO_type, SPA_POD_CHOICE_RANGE_Float(p->volume, 0.0, 10.0));
break;
case 1:
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_mute),
SPA_PROP_INFO_name, SPA_POD_String("Mute"),
SPA_PROP_INFO_description, SPA_POD_String("Mute"),
SPA_PROP_INFO_type, SPA_POD_CHOICE_Bool(p->channel.mute));
break;
case 2:
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_channelVolumes),
SPA_PROP_INFO_name, SPA_POD_String("Channel Volumes"),
SPA_PROP_INFO_description, SPA_POD_String("Channel Volumes"),
SPA_PROP_INFO_type, SPA_POD_CHOICE_RANGE_Float(p->volume, 0.0, 10.0),
SPA_PROP_INFO_container, SPA_POD_Id(SPA_TYPE_Array));
break;
@ -432,7 +432,7 @@ static int impl_node_enum_params(void *object, int seq,
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_channelMap),
SPA_PROP_INFO_name, SPA_POD_String("Channel Map"),
SPA_PROP_INFO_description, SPA_POD_String("Channel Map"),
SPA_PROP_INFO_type, SPA_POD_Id(SPA_AUDIO_CHANNEL_UNKNOWN),
SPA_PROP_INFO_container, SPA_POD_Id(SPA_TYPE_Array));
break;
@ -440,14 +440,14 @@ static int impl_node_enum_params(void *object, int seq,
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_softMute),
SPA_PROP_INFO_name, SPA_POD_String("Soft Mute"),
SPA_PROP_INFO_description, SPA_POD_String("Soft Mute"),
SPA_PROP_INFO_type, SPA_POD_CHOICE_Bool(p->soft.mute));
break;
case 5:
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_softVolumes),
SPA_PROP_INFO_name, SPA_POD_String("Soft Volumes"),
SPA_PROP_INFO_description, SPA_POD_String("Soft Volumes"),
SPA_PROP_INFO_type, SPA_POD_CHOICE_RANGE_Float(p->volume, 0.0, 10.0),
SPA_PROP_INFO_container, SPA_POD_Id(SPA_TYPE_Array));
break;
@ -455,14 +455,14 @@ static int impl_node_enum_params(void *object, int seq,
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_monitorMute),
SPA_PROP_INFO_name, SPA_POD_String("Monitor Mute"),
SPA_PROP_INFO_description, SPA_POD_String("Monitor Mute"),
SPA_PROP_INFO_type, SPA_POD_CHOICE_Bool(p->monitor.mute));
break;
case 7:
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_monitorVolumes),
SPA_PROP_INFO_name, SPA_POD_String("Monitor Volumes"),
SPA_PROP_INFO_description, SPA_POD_String("Monitor Volumes"),
SPA_PROP_INFO_type, SPA_POD_CHOICE_RANGE_Float(p->volume, 0.0, 10.0),
SPA_PROP_INFO_container, SPA_POD_Id(SPA_TYPE_Array));
break;

View file

@ -216,14 +216,14 @@ static int impl_node_enum_params(void *object, int seq,
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_volume),
SPA_PROP_INFO_name, SPA_POD_String("Volume"),
SPA_PROP_INFO_description, SPA_POD_String("Volume"),
SPA_PROP_INFO_type, SPA_POD_CHOICE_RANGE_Float(p->volume, 0.0, 10.0));
break;
case 1:
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_mute),
SPA_PROP_INFO_name, SPA_POD_String("Mute"),
SPA_PROP_INFO_description, SPA_POD_String("Mute"),
SPA_PROP_INFO_type, SPA_POD_CHOICE_Bool(p->mute));
break;
default:

View file

@ -177,14 +177,14 @@ static int impl_node_enum_params(void *object, int seq,
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_live),
SPA_PROP_INFO_name, SPA_POD_String("Configure live mode of the source"),
SPA_PROP_INFO_description, SPA_POD_String("Configure live mode of the source"),
SPA_PROP_INFO_type, SPA_POD_Bool(p->live));
break;
case 1:
spa_pod_builder_push_object(&b, &f[0], SPA_TYPE_OBJECT_PropInfo, id);
spa_pod_builder_add(&b,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_waveType),
SPA_PROP_INFO_name, SPA_POD_String("Select the waveform"),
SPA_PROP_INFO_description, SPA_POD_String("Select the waveform"),
SPA_PROP_INFO_type, SPA_POD_Int(p->wave),
0);
spa_pod_builder_prop(&b, SPA_PROP_INFO_labels, 0);
@ -200,14 +200,14 @@ static int impl_node_enum_params(void *object, int seq,
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_frequency),
SPA_PROP_INFO_name, SPA_POD_String("Select the frequency"),
SPA_PROP_INFO_description, SPA_POD_String("Select the frequency"),
SPA_PROP_INFO_type, SPA_POD_CHOICE_RANGE_Float(p->freq, 0.0, 50000000.0));
break;
case 3:
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_volume),
SPA_PROP_INFO_name, SPA_POD_String("Select the volume"),
SPA_PROP_INFO_description, SPA_POD_String("Select the volume"),
SPA_PROP_INFO_type, SPA_POD_CHOICE_RANGE_Float(p->volume, 0.0, 10.0));
break;
default:

View file

@ -317,7 +317,7 @@ static int codec_enum_props(void *props, const struct spa_dict *settings, uint32
spa_pod_builder_push_object(b, &f[0], SPA_TYPE_OBJECT_PropInfo, id);
spa_pod_builder_prop(b, SPA_PROP_INFO_id, 0);
spa_pod_builder_id(b, SPA_PROP_quality);
spa_pod_builder_prop(b, SPA_PROP_INFO_name, 0);
spa_pod_builder_prop(b, SPA_PROP_INFO_description, 0);
spa_pod_builder_string(b, "LDAC quality");
spa_pod_builder_prop(b, SPA_PROP_INFO_type, 0);

View file

@ -212,21 +212,21 @@ static int impl_node_enum_params(void *object, int seq,
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_minLatency),
SPA_PROP_INFO_name, SPA_POD_String("The minimum latency"),
SPA_PROP_INFO_description, SPA_POD_String("The minimum latency"),
SPA_PROP_INFO_type, SPA_POD_CHOICE_RANGE_Int(p->min_latency, 1, INT32_MAX));
break;
case 1:
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_maxLatency),
SPA_PROP_INFO_name, SPA_POD_String("The maximum latency"),
SPA_PROP_INFO_description, SPA_POD_String("The maximum latency"),
SPA_PROP_INFO_type, SPA_POD_CHOICE_RANGE_Int(p->max_latency, 1, INT32_MAX));
break;
case 2:
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_latencyOffsetNsec),
SPA_PROP_INFO_name, SPA_POD_String("Latency offset (ns)"),
SPA_PROP_INFO_description, SPA_POD_String("Latency offset (ns)"),
SPA_PROP_INFO_type, SPA_POD_CHOICE_RANGE_Long(0LL, INT64_MIN, INT64_MAX));
break;
default:

View file

@ -206,14 +206,14 @@ static int impl_node_enum_params(void *object, int seq,
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_minLatency),
SPA_PROP_INFO_name, SPA_POD_String("The minimum latency"),
SPA_PROP_INFO_description, SPA_POD_String("The minimum latency"),
SPA_PROP_INFO_type, SPA_POD_CHOICE_RANGE_Int(p->min_latency, 1, INT32_MAX));
break;
case 1:
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_maxLatency),
SPA_PROP_INFO_name, SPA_POD_String("The maximum latency"),
SPA_PROP_INFO_description, SPA_POD_String("The maximum latency"),
SPA_PROP_INFO_type, SPA_POD_CHOICE_RANGE_Int(p->max_latency, 1, INT32_MAX));
break;
default:

View file

@ -1523,7 +1523,7 @@ static struct spa_pod *build_prop_info(struct impl *this, struct spa_pod_builder
/* Transport codec */
spa_pod_builder_prop(b, SPA_PROP_INFO_id, 0);
spa_pod_builder_id(b, SPA_PROP_bluetoothAudioCodec);
spa_pod_builder_prop(b, SPA_PROP_INFO_name, 0);
spa_pod_builder_prop(b, SPA_PROP_INFO_description, 0);
spa_pod_builder_string(b, "Air codec");
spa_pod_builder_prop(b, SPA_PROP_INFO_type, 0);
spa_pod_builder_push_choice(b, &f[1], SPA_CHOICE_Enum, 0);

View file

@ -206,14 +206,14 @@ static int impl_node_enum_params(void *object, int seq,
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_minLatency),
SPA_PROP_INFO_name, SPA_POD_String("The minimum latency"),
SPA_PROP_INFO_description, SPA_POD_String("The minimum latency"),
SPA_PROP_INFO_type, SPA_POD_CHOICE_RANGE_Int(p->min_latency, 1, INT32_MAX));
break;
case 1:
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_maxLatency),
SPA_PROP_INFO_name, SPA_POD_String("The maximum latency"),
SPA_PROP_INFO_description, SPA_POD_String("The maximum latency"),
SPA_PROP_INFO_type, SPA_POD_CHOICE_RANGE_Int(p->max_latency, 1, INT32_MAX));
break;
default:

View file

@ -191,14 +191,14 @@ static int impl_node_enum_params(void *object, int seq,
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_minLatency),
SPA_PROP_INFO_name, SPA_POD_String("The minimum latency"),
SPA_PROP_INFO_description, SPA_POD_String("The minimum latency"),
SPA_PROP_INFO_type, SPA_POD_CHOICE_RANGE_Int(p->min_latency, 1, INT32_MAX));
break;
case 1:
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_maxLatency),
SPA_PROP_INFO_name, SPA_POD_String("The maximum latency"),
SPA_PROP_INFO_description, SPA_POD_String("The maximum latency"),
SPA_PROP_INFO_type, SPA_POD_CHOICE_RANGE_Int(p->max_latency, 1, INT32_MAX));
break;
default:

View file

@ -205,14 +205,14 @@ next:
param = (struct spa_pod*)spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_device),
SPA_PROP_INFO_name, SPA_POD_String("The libcamera device"),
SPA_PROP_INFO_description, SPA_POD_String("The libcamera device"),
SPA_PROP_INFO_type, SPA_POD_String(p->device));
break;
case 1:
param = (struct spa_pod*)spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_deviceName),
SPA_PROP_INFO_name, SPA_POD_String("The libcamera device name"),
SPA_PROP_INFO_description, SPA_POD_String("The libcamera device name"),
SPA_PROP_INFO_type, SPA_POD_String(p->device_name));
break;
default:

View file

@ -198,21 +198,21 @@ static int impl_node_enum_params(void *object, int seq,
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_device),
SPA_PROP_INFO_name, SPA_POD_String("The V4L2 device"),
SPA_PROP_INFO_description, SPA_POD_String("The V4L2 device"),
SPA_PROP_INFO_type, SPA_POD_String(p->device));
break;
case 1:
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_deviceName),
SPA_PROP_INFO_name, SPA_POD_String("The V4L2 device name"),
SPA_PROP_INFO_description, SPA_POD_String("The V4L2 device name"),
SPA_PROP_INFO_type, SPA_POD_String(p->device_name));
break;
case 2:
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_deviceFd),
SPA_PROP_INFO_name, SPA_POD_String("The V4L2 fd"),
SPA_PROP_INFO_description, SPA_POD_String("The V4L2 fd"),
SPA_PROP_INFO_type, SPA_POD_Int(p->device_fd));
break;
default:

View file

@ -1160,14 +1160,14 @@ spa_v4l2_enum_controls(struct impl *this, int seq,
queryctrl.minimum,
queryctrl.maximum,
queryctrl.step),
SPA_PROP_INFO_name, SPA_POD_String(queryctrl.name));
SPA_PROP_INFO_description, SPA_POD_String(queryctrl.name));
break;
case V4L2_CTRL_TYPE_BOOLEAN:
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, SPA_PARAM_PropInfo,
SPA_PROP_INFO_id, SPA_POD_Id(prop_id),
SPA_PROP_INFO_type, SPA_POD_CHOICE_Bool(queryctrl.default_value),
SPA_PROP_INFO_name, SPA_POD_String(queryctrl.name));
SPA_PROP_INFO_description, SPA_POD_String(queryctrl.name));
break;
case V4L2_CTRL_TYPE_MENU:
{
@ -1178,7 +1178,7 @@ spa_v4l2_enum_controls(struct impl *this, int seq,
spa_pod_builder_add(&b,
SPA_PROP_INFO_id, SPA_POD_Id(prop_id),
SPA_PROP_INFO_type, SPA_POD_CHOICE_ENUM_Int(1, queryctrl.default_value),
SPA_PROP_INFO_name, SPA_POD_String(queryctrl.name),
SPA_PROP_INFO_description, SPA_POD_String(queryctrl.name),
0);
spa_zero(querymenu);

View file

@ -158,14 +158,14 @@ static int impl_node_enum_params(void *object, int seq,
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_live),
SPA_PROP_INFO_name, SPA_POD_String("Configure live mode of the source"),
SPA_PROP_INFO_description, SPA_POD_String("Configure live mode of the source"),
SPA_PROP_INFO_type, SPA_POD_Bool(p->live));
break;
case 1:
spa_pod_builder_push_object(&b, &f[0], SPA_TYPE_OBJECT_PropInfo, id);
spa_pod_builder_add(&b,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_patternType),
SPA_PROP_INFO_name, SPA_POD_String("The pattern"),
SPA_PROP_INFO_description, SPA_POD_String("The pattern"),
SPA_PROP_INFO_type, SPA_POD_Int(p->pattern),
0);
spa_pod_builder_prop(&b, SPA_PROP_INFO_labels, 0),

View file

@ -145,14 +145,14 @@ static int impl_node_enum_params(void *object, int seq,
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_volume),
SPA_PROP_INFO_name, SPA_POD_String("The volume"),
SPA_PROP_INFO_description, SPA_POD_String("The volume"),
SPA_PROP_INFO_type, SPA_POD_CHOICE_RANGE_Float(p->volume, 0.0, 10.0));
break;
case 1:
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_mute),
SPA_PROP_INFO_name, SPA_POD_String("Mute"),
SPA_PROP_INFO_description, SPA_POD_String("Mute"),
SPA_PROP_INFO_type, SPA_POD_Bool(p->mute));
break;
default:

View file

@ -155,7 +155,7 @@ static int impl_node_enum_params(void *object, int seq,
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_live),
SPA_PROP_INFO_name, SPA_POD_String("Configure live mode of the source"),
SPA_PROP_INFO_description, SPA_POD_String("Configure live mode of the source"),
SPA_PROP_INFO_type, SPA_POD_Bool(p->live));
break;
default:

View file

@ -1172,7 +1172,7 @@ static int node_event_param(void *object, int seq,
if (spa_pod_parse_object(c->info,
SPA_TYPE_OBJECT_PropInfo, NULL,
SPA_PROP_INFO_name, SPA_POD_String(&c->control.name),
SPA_PROP_INFO_description, SPA_POD_OPT_String(&c->control.name),
SPA_PROP_INFO_type, SPA_POD_PodChoice(&type),
SPA_PROP_INFO_container, SPA_POD_OPT_Id(&container)) < 0) {
free(c);

View file

@ -101,14 +101,14 @@ endpoint_enum_params (void *object, int seq,
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_volume),
SPA_PROP_INFO_name, SPA_POD_String("volume"),
SPA_PROP_INFO_description, SPA_POD_String("volume"),
SPA_PROP_INFO_type, SPA_POD_CHOICE_RANGE_Float(p->volume, 0.0, 1.0));
break;
case 1:
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_PropInfo, id,
SPA_PROP_INFO_id, SPA_POD_Id(SPA_PROP_mute),
SPA_PROP_INFO_name, SPA_POD_String("mute"),
SPA_PROP_INFO_description, SPA_POD_String("mute"),
SPA_PROP_INFO_type, SPA_POD_CHOICE_Bool(p->mute));
break;
default:

View file

@ -1610,7 +1610,7 @@ PWTEST(pod_overflow)
spa_pod_builder_add(&b,
SPA_PROP_INFO_id, SPA_POD_Id(32567359),
SPA_PROP_INFO_type, SPA_POD_CHOICE_ENUM_Int(1, 0),
SPA_PROP_INFO_name, SPA_POD_String("DV Timings"),
SPA_PROP_INFO_description, SPA_POD_String("DV Timings"),
0);
spa_pod_builder_get_state(&b, &state),