summaryrefslogtreecommitdiff
path: root/pipewire/server/link.h
blob: a1d98e6675066aa15990ea8bc9289cf180efa671 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/* PipeWire
 * Copyright (C) 2015 Wim Taymans <wim.taymans@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef __PIPEWIRE_LINK_H__
#define __PIPEWIRE_LINK_H__

#ifdef __cplusplus
extern "C" {
#endif

#include <spa/ringbuffer.h>

#include <pipewire/client/mem.h>

#include <pipewire/server/core.h>
#include <pipewire/server/port.h>
#include <pipewire/server/main-loop.h>

/** \page page_link Link
 *
 * \section page_link_overview Overview
 *
 * A link is the connection between 2 nodes (\ref page_node). Nodes are
 * linked together on ports.
 *
 * The link is responsible for negotiating the format and buffers for
 * the nodes.
 */

/** \class pw_link
 *
 * PipeWire link interface.
 */
struct pw_link {
	struct pw_core *core;		/**< core object */
	struct spa_list link;		/**< link in core link_list */
	struct pw_global *global;	/**< global for this link */

	struct pw_properties *properties;	/**< extra link properties */

        struct pw_link_info info;		/**< introspectable link info */

	enum pw_link_state state;	/**< link state */
	char *error;			/**< error message when state error */
	/** Emited when the link state changed */
	PW_SIGNAL(state_changed, (struct pw_listener *listener,
				  struct pw_link *link,
				  enum pw_link_state old, enum pw_link_state state));

	/** Emited when the link is destroyed */
	PW_SIGNAL(destroy_signal, (struct pw_listener *, struct pw_link *));
	/** Emited when the object is freed */
	PW_SIGNAL(free_signal, (struct pw_listener *, struct pw_link *));

	struct spa_list resource_list;	/**< list of bound resources */

	struct pw_port *output;		/**< output port */
	struct spa_list output_link;	/**< link in output port links */
	struct pw_port *input;		/**< input port */
	struct spa_list input_link;	/**< link in input port links */
	/** Emited when the port is unlinked */
	PW_SIGNAL(port_unlinked, (struct pw_listener *listener,
				  struct pw_link *link, struct pw_port *port));

	struct {
		struct pw_port *input;
		struct pw_port *output;
		struct spa_list input_link;
		struct spa_list output_link;
	} rt;
};


struct pw_link *
pw_link_new(struct pw_core *core,
	    struct pw_port *output,
	    struct pw_port *input,
	    struct spa_format *format_filter,
	    struct pw_properties *properties);

void
pw_link_destroy(struct pw_link *link);

bool
pw_link_activate(struct pw_link *link);

bool
pw_link_deactivate(struct pw_link *link);

#ifdef __cplusplus
}
#endif

#endif /* __PIPEWIRE_LINK_H__ */