port: add wp_port_get_direction()

This commit is contained in:
George Kiagiadakis 2020-04-21 17:08:10 +03:00
parent 72ff4577c5
commit 33e67f2189
3 changed files with 26 additions and 12 deletions

View file

@ -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

View file

@ -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;
}

View file

@ -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