port.h
Go to the documentation of this file.
/* 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_PORT_H__
#define __PIPEWIRE_PORT_H__
#ifdef __cplusplus
extern "C" {
#endif
#define PW_TYPE__Port "PipeWire:Object:Port"
#define PW_TYPE_PORT_BASE PW_TYPE__Port ":"
#include <spa/utils/hook.h>
struct pw_port;
struct pw_link;
struct pw_control;
#include <pipewire/core.h>
#include <pipewire/introspect.h>
#include <pipewire/node.h>
enum pw_port_state {
PW_PORT_STATE_ERROR = -1,
PW_PORT_STATE_INIT = 0,
PW_PORT_STATE_CONFIGURE = 1,
PW_PORT_STATE_READY = 2,
PW_PORT_STATE_PAUSED = 3,
PW_PORT_STATE_STREAMING = 4,
};
struct pw_port_events {
#define PW_VERSION_PORT_EVENTS 0
uint32_t version;
void (*destroy) (void *data);
void (*free) (void *data);
void (*info_changed) (void *data, struct pw_port_info *info);
void (*link_added) (void *data, struct pw_link *link);
void (*link_removed) (void *data, struct pw_link *link);
void (*state_changed) (void *data, enum pw_port_state state);
void (*control_added) (void *data, struct pw_control *control);
void (*control_removed) (void *data, struct pw_control *control);
};
enum pw_direction pw_port_get_direction(struct pw_port *port);
const struct pw_properties *pw_port_get_properties(struct pw_port *port);
int pw_port_update_properties(struct pw_port *port, const struct spa_dict *dict);
uint32_t pw_port_get_id(struct pw_port *port);
struct pw_node *pw_port_get_node(struct pw_port *port);
void pw_port_add_listener(struct pw_port *port,
struct spa_hook *listener,
const struct pw_port_events *events,
void *data);
#ifdef __cplusplus
}
#endif
#endif /* __PIPEWIRE_PORT_H__ */
pw_properties
A collection of key/value pairs.
Definition: properties.h:38
node.h
pw_port_update_properties
int pw_port_update_properties(struct pw_port *port, const struct spa_dict *dict)
Update the port properties.
Definition: port.c:252
pw_port_get_id
uint32_t pw_port_get_id(struct pw_port *port)
Get the port id.
Definition: port.c:240
introspect.h
pw_port_events::link_added
void(* link_added)(void *data, struct pw_link *link)
a new link is added on this port
Definition: port.h:74
pw_link
PipeWire link object.
pw_properties::dict
struct spa_dict dict
Definition: properties.h:39
core.h
PW_PORT_STATE_CONFIGURE
the port is ready for format negotiation
Definition: port.h:53
pw_port_add_listener
void pw_port_add_listener(struct pw_port *port, struct spa_hook *listener, const struct pw_port_events *events, void *data)
Add an event listener on the port.
Definition: port.c:284
pw_port_info
Definition: introspect.h:168
pw_control
The control object.
pw_port_events::version
uint32_t version
Definition: port.h:62
pw_port_get_properties
const struct pw_properties * pw_port_get_properties(struct pw_port *port)
Get the port properties.
Definition: port.c:246
pw_port_events
Port events, use pw_port_add_listener.
Definition: port.h:60
PW_PORT_STATE_ERROR
the port is in error
Definition: port.h:51
pw_port_state
pw_port_state
Definition: port.h:50
PW_PORT_STATE_STREAMING
the port is streaming
Definition: port.h:56
PW_PORT_STATE_PAUSED
the port is paused
Definition: port.h:55
pw_port_events::free
void(* free)(void *data)
The port is freed.
Definition: port.h:68
PW_PORT_STATE_READY
the port is ready for buffer allocation
Definition: port.h:54
pw_port_events::info_changed
void(* info_changed)(void *data, struct pw_port_info *info)
the port info changed
Definition: port.h:71
pw_port_events::state_changed
void(* state_changed)(void *data, enum pw_port_state state)
the state of the port changed
Definition: port.h:80
pw_port_events::destroy
void(* destroy)(void *data)
The port is destroyed.
Definition: port.h:65
pw_port_get_direction
enum pw_direction pw_port_get_direction(struct pw_port *port)
Get the port direction.
Definition: port.c:234
pw_node
PipeWire node class.
pw_port_get_node
struct pw_node * pw_port_get_node(struct pw_port *port)
Get the port parent node or NULL when not yet set.
Definition: port.c:278
PW_PORT_STATE_INIT
the port is being created
Definition: port.h:52
pw_port_events::link_removed
void(* link_removed)(void *data, struct pw_link *link)
a link is removed from this port
Definition: port.h:77
pw_port
The port object.
pw_port_events::control_added
void(* control_added)(void *data, struct pw_control *control)
a control was added to the port
Definition: port.h:83
pw_port_events::control_removed
void(* control_removed)(void *data, struct pw_control *control)
a control was removed from the port
Definition: port.h:86
pw_direction
pw_direction
The direction of a port.
Definition: introspect.h:47