mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	v0: improve compatibility
Implement RequestClockUpdate event and ClockUpdate message for old clients.
This commit is contained in:
		
							parent
							
								
									c12f2276c4
								
							
						
					
					
						commit
						293932d4ec
					
				
					 7 changed files with 152 additions and 21 deletions
				
			
		| 
						 | 
				
			
			@ -350,16 +350,9 @@ const char * pw_protocol_native0_name_from_v2(struct pw_impl_client *client, uin
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
SPA_EXPORT
 | 
			
		||||
uint32_t pw_protocol_native0_type_to_v2(struct pw_impl_client *client,
 | 
			
		||||
		const struct spa_type_info *info, uint32_t type)
 | 
			
		||||
uint32_t pw_protocol_native0_name_to_v2(struct pw_impl_client *client, const char *name)
 | 
			
		||||
{
 | 
			
		||||
	uint32_t i;
 | 
			
		||||
	const char *name;
 | 
			
		||||
 | 
			
		||||
	/** find full name of type in type_info */
 | 
			
		||||
	if ((name = spa_debug_type_find_name(info, type)) == NULL)
 | 
			
		||||
		return SPA_ID_INVALID;
 | 
			
		||||
 | 
			
		||||
	/* match name to type table and return index */
 | 
			
		||||
	for (i = 0; i < SPA_N_ELEMENTS(type_map); i++) {
 | 
			
		||||
		if (type_map[i].name != NULL && !strcmp(type_map[i].name, name))
 | 
			
		||||
| 
						 | 
				
			
			@ -368,6 +361,19 @@ uint32_t pw_protocol_native0_type_to_v2(struct pw_impl_client *client,
 | 
			
		|||
	return SPA_ID_INVALID;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SPA_EXPORT
 | 
			
		||||
uint32_t pw_protocol_native0_type_to_v2(struct pw_impl_client *client,
 | 
			
		||||
		const struct spa_type_info *info, uint32_t type)
 | 
			
		||||
{
 | 
			
		||||
	const char *name;
 | 
			
		||||
 | 
			
		||||
	/** find full name of type in type_info */
 | 
			
		||||
	if ((name = spa_debug_type_find_name(info, type)) == NULL)
 | 
			
		||||
		return SPA_ID_INVALID;
 | 
			
		||||
 | 
			
		||||
	return pw_protocol_native0_name_to_v2(client, name);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct spa_pod_prop_body0 {
 | 
			
		||||
        uint32_t key;
 | 
			
		||||
#define SPA_POD_PROP0_RANGE_NONE         0       /**< no range */
 | 
			
		||||
| 
						 | 
				
			
			@ -540,7 +546,8 @@ static int remap_to_v2(struct pw_impl_client *client, const struct spa_type_info
 | 
			
		|||
		ti = spa_debug_type_find(info, b->type);
 | 
			
		||||
		ii = ti ? spa_debug_type_find(ti->values, 0) : NULL;
 | 
			
		||||
 | 
			
		||||
		if (b->type == SPA_TYPE_COMMAND_Node) {
 | 
			
		||||
		if (b->type == SPA_TYPE_COMMAND_Node ||
 | 
			
		||||
		    b->type == SPA_TYPE_EVENT_Node) {
 | 
			
		||||
			spa_pod_builder_push_object(builder, &f[0], 0,
 | 
			
		||||
				pw_protocol_native0_type_to_v2(client, ii ? ii->values : NULL, b->id));
 | 
			
		||||
		} else {
 | 
			
		||||
| 
						 | 
				
			
			@ -654,7 +661,6 @@ struct spa_pod * pw_protocol_native0_pod_from_v2(struct pw_impl_client *client,
 | 
			
		|||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
	copy = spa_pod_copy(b.data);
 | 
			
		||||
	spa_debug_pod(0, NULL, copy);
 | 
			
		||||
	return copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue