mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pod: remove SPA_POD_IS_OBJECT_TYPE
We have a safer version of that in iter.h Use macros to get id and type of an object Use safer checks in plugins.
This commit is contained in:
		
							parent
							
								
									241a6165d2
								
							
						
					
					
						commit
						f7d32e78f2
					
				
					 5 changed files with 5 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -379,14 +379,12 @@ static inline int spa_pod_is_object(const struct spa_pod *pod)
 | 
			
		|||
 | 
			
		||||
static inline bool spa_pod_is_object_type(const struct spa_pod *pod, uint32_t type)
 | 
			
		||||
{
 | 
			
		||||
	return (pod && spa_pod_is_object(pod) &&
 | 
			
		||||
		((const struct spa_pod_object *) pod)->body.type == type);
 | 
			
		||||
	return (pod && spa_pod_is_object(pod) && SPA_POD_OBJECT_TYPE(pod) == type);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline bool spa_pod_is_object_id(const struct spa_pod *pod, uint32_t id)
 | 
			
		||||
{
 | 
			
		||||
	return (pod && spa_pod_is_object(pod) &&
 | 
			
		||||
		((const struct spa_pod_object *) pod)->body.id == id);
 | 
			
		||||
	return (pod && spa_pod_is_object(pod) && SPA_POD_OBJECT_ID(pod) == id);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline int spa_pod_is_sequence(const struct spa_pod *pod)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -160,9 +160,6 @@ struct spa_pod_struct {
 | 
			
		|||
#define SPA_POD_OBJECT_TYPE(obj)	(((struct spa_pod_object*)(obj))->body.type)
 | 
			
		||||
#define SPA_POD_OBJECT_ID(obj)		(((struct spa_pod_object*)(obj))->body.id)
 | 
			
		||||
 | 
			
		||||
#define SPA_POD_IS_OBJECT_TYPE(obj,tp)	(SPA_POD_TYPE(obj) == SPA_TYPE_Object && \
 | 
			
		||||
					 SPA_POD_OBJECT_TYPE(obj) == (tp))
 | 
			
		||||
 | 
			
		||||
struct spa_pod_object_body {
 | 
			
		||||
	uint32_t type;		/**< one of enum spa_type */
 | 
			
		||||
	uint32_t id;		/**< id of the object, depends on the object type */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -710,7 +710,7 @@ static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,
 | 
			
		|||
			return -EINVAL;
 | 
			
		||||
 | 
			
		||||
		if (format) {
 | 
			
		||||
			if (!SPA_POD_IS_OBJECT_TYPE(format, SPA_TYPE_OBJECT_Format))
 | 
			
		||||
			if (!spa_pod_is_object_type(format, SPA_TYPE_OBJECT_Format))
 | 
			
		||||
				return -EINVAL;
 | 
			
		||||
 | 
			
		||||
			if ((res = spa_format_parse(format, &info.media_type, &info.media_subtype)) < 0)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -268,7 +268,7 @@ static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,
 | 
			
		|||
				SPA_PARAM_PORT_CONFIG_format,		SPA_POD_Pod(&format)) < 0)
 | 
			
		||||
			return -EINVAL;
 | 
			
		||||
 | 
			
		||||
		if (!SPA_POD_IS_OBJECT_TYPE(format, SPA_TYPE_OBJECT_Format))
 | 
			
		||||
		if (!spa_pod_is_object_type(format, SPA_TYPE_OBJECT_Format))
 | 
			
		||||
			return -EINVAL;
 | 
			
		||||
 | 
			
		||||
		if (mode != SPA_PARAM_PORT_CONFIG_MODE_dsp)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -258,7 +258,7 @@ static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,
 | 
			
		|||
				SPA_PARAM_PORT_CONFIG_format,		SPA_POD_Pod(&format)) < 0)
 | 
			
		||||
			return -EINVAL;
 | 
			
		||||
 | 
			
		||||
		if (!SPA_POD_IS_OBJECT_TYPE(format, SPA_TYPE_OBJECT_Format))
 | 
			
		||||
		if (!spa_pod_is_object_type(format, SPA_TYPE_OBJECT_Format))
 | 
			
		||||
			return -EINVAL;
 | 
			
		||||
 | 
			
		||||
		if (mode != SPA_PARAM_PORT_CONFIG_MODE_dsp)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue