mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-08 13:30:08 -05:00
Implement protocol extensions
Add hooks that contain protocol specific interfaces that can be used to extend the protocol. This makes it possible to add new interfaces to the protocol and implement the protocol specific data transport. Move these protocol specific extension to the extensions directory.
This commit is contained in:
parent
267547c884
commit
465f12241e
43 changed files with 661 additions and 471 deletions
|
|
@ -30,8 +30,8 @@ extern "C" {
|
|||
#include <spa/param-alloc.h>
|
||||
#include <spa/node.h>
|
||||
|
||||
#define PIPEWIRE_TYPE__ClientNode PIPEWIRE_TYPE_NODE_BASE "Client"
|
||||
#define PIPEWIRE_TYPE_CLIENT_NODE_BASE PIPEWIRE_TYPE__ClientNode ":"
|
||||
#define PW_TYPE__ClientNode PW_TYPE_NODE_BASE "Client"
|
||||
#define PW_TYPE_CLIENT_NODE_BASE PW_TYPE__ClientNode ":"
|
||||
|
||||
/** information about a buffer */
|
||||
struct pw_client_node_buffer {
|
||||
|
|
|
|||
75
src/extensions/protocol-native.h
Normal file
75
src/extensions/protocol-native.h
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
/* PipeWire
|
||||
* Copyright (C) 2017 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_EXT_PROTOCOL_NATIVE_H__
|
||||
#define __PIPEWIRE_EXT_PROTOCOL_NATIVE_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <spa/defs.h>
|
||||
#include <spa/props.h>
|
||||
#include <spa/format.h>
|
||||
#include <spa/param-alloc.h>
|
||||
#include <spa/node.h>
|
||||
|
||||
#define PW_TYPE_PROTOCOL__Native PW_TYPE_PROTOCOL_BASE "Native"
|
||||
#define PW_TYPE_PROTOCOL_NATIVE_BASE PW_TYPE_PROTOCOL__Native ":"
|
||||
|
||||
/** \ref pw_protocol_native_ext methods */
|
||||
struct pw_protocol_native_ext {
|
||||
#define PW_VERSION_PROTOCOL_NATIVE_EXT 0
|
||||
uint32_t version;
|
||||
|
||||
struct spa_pod_builder * (*begin_proxy) (struct pw_proxy *proxy,
|
||||
uint8_t opcode);
|
||||
|
||||
uint32_t (*add_proxy_fd) (struct pw_proxy *proxy, int fd);
|
||||
int (*get_proxy_fd) (struct pw_proxy *proxy, uint32_t index);
|
||||
|
||||
void (*end_proxy) (struct pw_proxy *proxy,
|
||||
struct spa_pod_builder *builder);
|
||||
|
||||
struct spa_pod_builder * (*begin_resource) (struct pw_resource *resource,
|
||||
uint8_t opcode);
|
||||
|
||||
uint32_t (*add_resource_fd) (struct pw_resource *resource, int fd);
|
||||
int (*get_resource_fd) (struct pw_resource *resource, uint32_t index);
|
||||
|
||||
void (*end_resource) (struct pw_resource *resource,
|
||||
struct spa_pod_builder *builder);
|
||||
|
||||
};
|
||||
|
||||
#define pw_protocol_native_begin_proxy(p,...) pw_protocol_ext((p)->remote->conn->protocol,struct pw_protocol_native_ext,begin_proxy,p,__VA_ARGS__)
|
||||
#define pw_protocol_native_add_proxy_fd(p,...) pw_protocol_ext((p)->remote->conn->protocol,struct pw_protocol_native_ext,add_proxy_fd,p,__VA_ARGS__)
|
||||
#define pw_protocol_native_get_proxy_fd(p,...) pw_protocol_ext((p)->remote->conn->protocol,struct pw_protocol_native_ext,get_proxy_fd,p,__VA_ARGS__)
|
||||
#define pw_protocol_native_end_proxy(p,...) pw_protocol_ext((p)->remote->conn->protocol,struct pw_protocol_native_ext,end_proxy,p,__VA_ARGS__)
|
||||
|
||||
#define pw_protocol_native_begin_resource(r,...) pw_protocol_ext((r)->client->protocol,struct pw_protocol_native_ext,begin_resource,r,__VA_ARGS__)
|
||||
#define pw_protocol_native_add_resource_fd(r,...) pw_protocol_ext((r)->client->protocol,struct pw_protocol_native_ext,add_resource_fd,r,__VA_ARGS__)
|
||||
#define pw_protocol_native_get_resource_fd(r,...) pw_protocol_ext((r)->client->protocol,struct pw_protocol_native_ext,get_resource_fd,r,__VA_ARGS__)
|
||||
#define pw_protocol_native_end_resource(r,...) pw_protocol_ext((r)->client->protocol,struct pw_protocol_native_ext,end_resource,r,__VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* __PIPEWIRE_EXT_PROTOCOL_NATIVE_H__ */
|
||||
Loading…
Add table
Add a link
Reference in a new issue