diff --git a/lib/wp/endpoint.h b/lib/wp/endpoint.h index 91464ebee87958671c8298abfc39296f5c0d4068..bfaeda1e283febdb3a902e718f625bba4e335cd1 100644 --- a/lib/wp/endpoint.h +++ b/lib/wp/endpoint.h @@ -11,23 +11,12 @@ #include "spa-pod.h" #include "proxy.h" +#include "port.h" #include "endpoint-stream.h" #include "iterator.h" G_BEGIN_DECLS -/** - * WpDirection: - * @WP_DIRECTION_INPUT: a sink, consuming input - * @WP_DIRECTION_OUTPUT: a source, producing output - * - * The different directions the endpoint can have - */ -typedef enum { - WP_DIRECTION_INPUT, - WP_DIRECTION_OUTPUT, -} WpDirection; - /** * WpEndpointFeatures: * @WP_ENDPOINT_FEATURE_STREAMS: caches information about streams, enabling diff --git a/lib/wp/port.c b/lib/wp/port.c index 735e73373cf9773584d4722bbe69c7c290086139..de1dff95b2ab5b8603702ac381b3cff9e94e804e 100644 --- a/lib/wp/port.c +++ b/lib/wp/port.c @@ -138,3 +138,13 @@ wp_port_class_init (WpPortClass * klass) proxy_class->pw_proxy_created = wp_port_pw_proxy_created; } + +WpDirection +wp_port_get_direction (WpPort * self) +{ + g_return_val_if_fail (WP_IS_PORT (self), 0); + g_return_val_if_fail (wp_proxy_get_features (WP_PROXY (self)) & + WP_PROXY_FEATURE_INFO, 0); + + return (WpDirection) self->info->direction; +} diff --git a/lib/wp/port.h b/lib/wp/port.h index d6d91fc182370b110611c9b92446fc7a5b298590..e9de692df6d237d769efeda70cde23dccf2314e6 100644 --- a/lib/wp/port.h +++ b/lib/wp/port.h @@ -13,6 +13,18 @@ G_BEGIN_DECLS +/** + * WpDirection: + * @WP_DIRECTION_INPUT: a sink, consuming input + * @WP_DIRECTION_OUTPUT: a source, producing output + * + * The different directions the endpoint can have + */ +typedef enum { + WP_DIRECTION_INPUT, + WP_DIRECTION_OUTPUT, +} WpDirection; + /** * WP_TYPE_PORT: * @@ -22,6 +34,9 @@ G_BEGIN_DECLS WP_API G_DECLARE_FINAL_TYPE (WpPort, wp_port, WP, PORT, WpProxy) +WP_API +WpDirection wp_port_get_direction (WpPort * self); + G_END_DECLS #endif