Loading...
Searching...
No Matches
link.h
Go to the documentation of this file.
/* PipeWire */
/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
/* SPDX-License-Identifier: MIT */
#ifndef PIPEWIRE_LINK_H
#define PIPEWIRE_LINK_H
#include <spa/utils/defs.h>
#include <spa/utils/hook.h>
#include <pipewire/proxy.h>
#ifdef __cplusplus
extern "C" {
#endif
#define PW_TYPE_INTERFACE_Link PW_TYPE_INFO_INTERFACE_BASE "Link"
#define PW_LINK_PERM_MASK PW_PERM_R | PW_PERM_X
#define PW_VERSION_LINK 3
struct pw_link;
#ifndef PW_API_LINK_IMPL
#define PW_API_LINK_IMPL static inline
#endif
enum pw_link_state {
PW_LINK_STATE_ERROR = -2,
PW_LINK_STATE_UNLINKED = -1,
PW_LINK_STATE_INIT = 0,
PW_LINK_STATE_NEGOTIATING = 1,
PW_LINK_STATE_ALLOCATING = 2,
PW_LINK_STATE_PAUSED = 3,
PW_LINK_STATE_ACTIVE = 4,
};
const char * pw_link_state_as_string(enum pw_link_state state);
struct pw_link_info {
uint32_t id;
uint32_t output_node_id;
uint32_t output_port_id;
uint32_t input_node_id;
uint32_t input_port_id;
#define PW_LINK_CHANGE_MASK_STATE (1 << 0)
#define PW_LINK_CHANGE_MASK_FORMAT (1 << 1)
#define PW_LINK_CHANGE_MASK_PROPS (1 << 2)
#define PW_LINK_CHANGE_MASK_ALL ((1 << 3)-1)
uint64_t change_mask;
enum pw_link_state state;
const char *error;
struct spa_pod *format;
struct spa_dict *props;
};
struct pw_link_info *
pw_link_info_update(struct pw_link_info *info,
const struct pw_link_info *update);
struct pw_link_info *
pw_link_info_merge(struct pw_link_info *info,
const struct pw_link_info *update, bool reset);
void
pw_link_info_free(struct pw_link_info *info);
#define PW_LINK_EVENT_INFO 0
#define PW_LINK_EVENT_NUM 1
struct pw_link_events {
#define PW_VERSION_LINK_EVENTS 0
uint32_t version;
void (*info) (void *data, const struct pw_link_info *info);
};
#define PW_LINK_METHOD_ADD_LISTENER 0
#define PW_LINK_METHOD_NUM 1
struct pw_link_methods {
#define PW_VERSION_LINK_METHODS 0
uint32_t version;
int (*add_listener) (void *object,
struct spa_hook *listener,
const struct pw_link_events *events,
void *data);
};
PW_API_LINK_IMPL int pw_link_add_listener(struct pw_link *object,
struct spa_hook *listener,
const struct pw_link_events *events,
void *data)
{
return spa_api_method_r(int, -ENOTSUP,
pw_link, (struct spa_interface*)object, add_listener, 0,
listener, events, data);
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* PIPEWIRE_LINK_H */
defs.h
spa/utils/defs.h
id
uint32_t id
Definition core.h:432
pw_link_state_as_string
const char * pw_link_state_as_string(enum pw_link_state state)
Convert a pw_link_state to a readable string.
Definition introspect.c:45
pw_link_info_merge
struct pw_link_info * pw_link_info_merge(struct pw_link_info *info, const struct pw_link_info *update, bool reset)
Definition introspect.c:522
pw_link_info_free
void pw_link_info_free(struct pw_link_info *info)
Definition introspect.c:568
pw_link_info_update
struct pw_link_info * pw_link_info_update(struct pw_link_info *info, const struct pw_link_info *update)
Definition introspect.c:561
pw_link_state
pw_link_state
The different link states.
Definition link.h:54
PW_API_LINK_IMPL
#define PW_API_LINK_IMPL
Definition link.h:49
pw_link_add_listener
PW_API_LINK_IMPL int pw_link_add_listener(struct pw_link *object, struct spa_hook *listener, const struct pw_link_events *events, void *data)
Definition link.h:137
PW_LINK_STATE_ACTIVE
@ PW_LINK_STATE_ACTIVE
the link is active
Definition link.h:61
PW_LINK_STATE_ERROR
@ PW_LINK_STATE_ERROR
the link is in error
Definition link.h:55
PW_LINK_STATE_UNLINKED
@ PW_LINK_STATE_UNLINKED
the link is unlinked
Definition link.h:56
PW_LINK_STATE_PAUSED
@ PW_LINK_STATE_PAUSED
the link is paused
Definition link.h:60
PW_LINK_STATE_NEGOTIATING
@ PW_LINK_STATE_NEGOTIATING
the link is negotiating formats
Definition link.h:58
PW_LINK_STATE_INIT
@ PW_LINK_STATE_INIT
the link is initialized
Definition link.h:57
PW_LINK_STATE_ALLOCATING
@ PW_LINK_STATE_ALLOCATING
the link is allocating buffers
Definition link.h:59
spa_api_method_r
#define spa_api_method_r(rtype, def, type, o, method, version,...)
Definition hook.h:291
hook.h
spa/utils/hook.h
proxy.h
pipewire/proxy.h
pw_link_events
Link events.
Definition link.h:106
pw_link_events::version
uint32_t version
Definition link.h:109
pw_link_info
The link information.
Definition link.h:67
pw_link_info::output_port_id
uint32_t output_port_id
output port id
Definition link.h:70
pw_link_info::change_mask
uint64_t change_mask
bitfield of changed fields since last call
Definition link.h:81
pw_link_info::output_node_id
uint32_t output_node_id
server side output node id
Definition link.h:69
pw_link_info::state
enum pw_link_state state
the current state of the link
Definition link.h:82
pw_link_info::error
const char * error
an error reason if state is error
Definition link.h:83
pw_link_info::input_node_id
uint32_t input_node_id
server side input node id
Definition link.h:71
pw_link_info::format
struct spa_pod * format
format over link
Definition link.h:84
pw_link_info::input_port_id
uint32_t input_port_id
input port id
Definition link.h:72
pw_link_methods
Link methods.
Definition link.h:124
pw_link_methods::version
uint32_t version
Definition link.h:127
pw_link_methods::add_listener
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_link_events *events, void *data)
Definition link.h:129
pw_link
spa_dict
Definition dict.h:51
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:427
spa_interface
Definition hook.h:148
spa_pod
Definition pod.h:57