mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	props: add container property to PROP_INFO
So we can mark a property should be inside a container. Use this info in pw_stream to construct properties.
This commit is contained in:
		
							parent
							
								
									e995d3a832
								
							
						
					
					
						commit
						73e0bb255a
					
				
					 4 changed files with 10 additions and 7 deletions
				
			
		| 
						 | 
					@ -42,6 +42,7 @@ enum spa_prop_info {
 | 
				
			||||||
					  *  is of the type of the property, the second
 | 
										  *  is of the type of the property, the second
 | 
				
			||||||
					  *  one is a string with a user readable label
 | 
										  *  one is a string with a user readable label
 | 
				
			||||||
					  *  for the value. */
 | 
										  *  for the value. */
 | 
				
			||||||
 | 
						SPA_PROP_INFO_container,	/**< type of container if any */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** predefined properties for SPA_TYPE_OBJECT_Props */
 | 
					/** predefined properties for SPA_TYPE_OBJECT_Props */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -117,6 +117,7 @@ static const struct spa_type_info spa_type_prop_info[] = {
 | 
				
			||||||
	{ SPA_PROP_INFO_name, SPA_TYPE_String, SPA_TYPE_INFO_PROP_INFO_BASE "name", NULL },
 | 
						{ SPA_PROP_INFO_name, SPA_TYPE_String, SPA_TYPE_INFO_PROP_INFO_BASE "name", NULL },
 | 
				
			||||||
	{ SPA_PROP_INFO_type, SPA_TYPE_Pod, SPA_TYPE_INFO_PROP_INFO_BASE "type", NULL },
 | 
						{ SPA_PROP_INFO_type, SPA_TYPE_Pod, SPA_TYPE_INFO_PROP_INFO_BASE "type", NULL },
 | 
				
			||||||
	{ SPA_PROP_INFO_labels, SPA_TYPE_Struct, SPA_TYPE_INFO_PROP_INFO_BASE "labels", NULL },
 | 
						{ SPA_PROP_INFO_labels, SPA_TYPE_Struct, SPA_TYPE_INFO_PROP_INFO_BASE "labels", NULL },
 | 
				
			||||||
 | 
						{ SPA_PROP_INFO_container, SPA_TYPE_Id, SPA_TYPE_INFO_PROP_INFO_BASE "container", NULL },
 | 
				
			||||||
	{ 0, 0, NULL, NULL },
 | 
						{ 0, 0, NULL, NULL },
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -345,14 +345,16 @@ static int impl_node_enum_params(void *object, int seq,
 | 
				
			||||||
				SPA_TYPE_OBJECT_PropInfo, id,
 | 
									SPA_TYPE_OBJECT_PropInfo, id,
 | 
				
			||||||
				SPA_PROP_INFO_id,   SPA_POD_Id(SPA_PROP_channelVolumes),
 | 
									SPA_PROP_INFO_id,   SPA_POD_Id(SPA_PROP_channelVolumes),
 | 
				
			||||||
				SPA_PROP_INFO_name, SPA_POD_String("Channel Volumes"),
 | 
									SPA_PROP_INFO_name, SPA_POD_String("Channel Volumes"),
 | 
				
			||||||
				SPA_PROP_INFO_type, SPA_POD_CHOICE_RANGE_Float(p->volume, 0.0, 10.0));
 | 
									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;
 | 
								break;
 | 
				
			||||||
		case 3:
 | 
							case 3:
 | 
				
			||||||
			param = spa_pod_builder_add_object(&b,
 | 
								param = spa_pod_builder_add_object(&b,
 | 
				
			||||||
				SPA_TYPE_OBJECT_PropInfo, id,
 | 
									SPA_TYPE_OBJECT_PropInfo, id,
 | 
				
			||||||
				SPA_PROP_INFO_id,   SPA_POD_Id(SPA_PROP_channelMap),
 | 
									SPA_PROP_INFO_id,   SPA_POD_Id(SPA_PROP_channelMap),
 | 
				
			||||||
				SPA_PROP_INFO_name, SPA_POD_String("Channel Map"),
 | 
									SPA_PROP_INFO_name, SPA_POD_String("Channel Map"),
 | 
				
			||||||
				SPA_PROP_INFO_type, SPA_POD_Id(SPA_AUDIO_CHANNEL_UNKNOWN));
 | 
									SPA_PROP_INFO_type, SPA_POD_Id(SPA_AUDIO_CHANNEL_UNKNOWN),
 | 
				
			||||||
 | 
									SPA_PROP_INFO_container, SPA_POD_Id(SPA_TYPE_Array));
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		default:
 | 
							default:
 | 
				
			||||||
			return 0;
 | 
								return 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -909,9 +909,8 @@ static int node_event_param(void *object, int seq,
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		struct control *c;
 | 
							struct control *c;
 | 
				
			||||||
		const struct spa_pod *type, *pod;
 | 
							const struct spa_pod *type, *pod;
 | 
				
			||||||
		uint32_t iid, choice, n_vals;
 | 
							uint32_t iid, choice, n_vals, container = SPA_ID_INVALID;
 | 
				
			||||||
		float *vals, bool_range[3] = { 1.0, 0.0, 1.0 };
 | 
							float *vals, bool_range[3] = { 1.0, 0.0, 1.0 };
 | 
				
			||||||
		const struct spa_type_info *tinfo;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (spa_pod_parse_object(param,
 | 
							if (spa_pod_parse_object(param,
 | 
				
			||||||
					SPA_TYPE_OBJECT_PropInfo, NULL,
 | 
										SPA_TYPE_OBJECT_PropInfo, NULL,
 | 
				
			||||||
| 
						 | 
					@ -932,7 +931,8 @@ static int node_event_param(void *object, int seq,
 | 
				
			||||||
		if (spa_pod_parse_object(c->info,
 | 
							if (spa_pod_parse_object(c->info,
 | 
				
			||||||
					SPA_TYPE_OBJECT_PropInfo, NULL,
 | 
										SPA_TYPE_OBJECT_PropInfo, NULL,
 | 
				
			||||||
					SPA_PROP_INFO_name, SPA_POD_String(&c->control.name),
 | 
										SPA_PROP_INFO_name, SPA_POD_String(&c->control.name),
 | 
				
			||||||
					SPA_PROP_INFO_type, SPA_POD_PodChoice(&type)) < 0) {
 | 
										SPA_PROP_INFO_type, SPA_POD_PodChoice(&type),
 | 
				
			||||||
 | 
										SPA_PROP_INFO_container, SPA_POD_OPT_Id(&container)) < 0) {
 | 
				
			||||||
			free(c);
 | 
								free(c);
 | 
				
			||||||
			return -EINVAL;
 | 
								return -EINVAL;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -953,8 +953,7 @@ static int node_event_param(void *object, int seq,
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			return -ENOTSUP;
 | 
								return -ENOTSUP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		tinfo = spa_debug_type_find(spa_type_props, iid);
 | 
							c->container = container != SPA_ID_INVALID ? container : c->type;
 | 
				
			||||||
		c->container = tinfo ? tinfo->parent : c->type;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		switch (choice) {
 | 
							switch (choice) {
 | 
				
			||||||
		case SPA_CHOICE_None:
 | 
							case SPA_CHOICE_None:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue