proxy: add _get_type()

Also return the optional version in resource_get_type()
This commit is contained in:
Wim Taymans 2019-11-29 13:20:36 +01:00
parent 988144dda4
commit b264ef0772
4 changed files with 16 additions and 3 deletions

View file

@ -138,6 +138,14 @@ uint32_t pw_proxy_get_id(struct pw_proxy *proxy)
return proxy->id; return proxy->id;
} }
SPA_EXPORT
uint32_t pw_proxy_get_type(struct pw_proxy *proxy, uint32_t *version)
{
if (version)
*version = proxy->version;
return proxy->type;
}
SPA_EXPORT SPA_EXPORT
struct pw_protocol *pw_proxy_get_protocol(struct pw_proxy *proxy) struct pw_protocol *pw_proxy_get_protocol(struct pw_proxy *proxy)
{ {

View file

@ -148,6 +148,9 @@ void *pw_proxy_get_user_data(struct pw_proxy *proxy);
/** Get the local id of the proxy */ /** Get the local id of the proxy */
uint32_t pw_proxy_get_id(struct pw_proxy *proxy); uint32_t pw_proxy_get_id(struct pw_proxy *proxy);
/** Get the type and version of the proxy */
uint32_t pw_proxy_get_type(struct pw_proxy *proxy, uint32_t *version);
/** Get the protocol used for the proxy */ /** Get the protocol used for the proxy */
struct pw_protocol *pw_proxy_get_protocol(struct pw_proxy *proxy); struct pw_protocol *pw_proxy_get_protocol(struct pw_proxy *proxy);

View file

@ -144,8 +144,10 @@ uint32_t pw_resource_get_permissions(struct pw_resource *resource)
} }
SPA_EXPORT SPA_EXPORT
uint32_t pw_resource_get_type(struct pw_resource *resource) uint32_t pw_resource_get_type(struct pw_resource *resource, uint32_t *version)
{ {
if (version)
*version = resource->version;
return resource->type; return resource->type;
} }

View file

@ -96,8 +96,8 @@ uint32_t pw_resource_get_id(struct pw_resource *resource);
/** Get the permissions of this resource */ /** Get the permissions of this resource */
uint32_t pw_resource_get_permissions(struct pw_resource *resource); uint32_t pw_resource_get_permissions(struct pw_resource *resource);
/** Get the type of this resource */ /** Get the type and optionally the version of this resource */
uint32_t pw_resource_get_type(struct pw_resource *resource); uint32_t pw_resource_get_type(struct pw_resource *resource, uint32_t *version);
/** Get the protocol used for this resource */ /** Get the protocol used for this resource */
struct pw_protocol *pw_resource_get_protocol(struct pw_resource *resource); struct pw_protocol *pw_resource_get_protocol(struct pw_resource *resource);