module.h
Go to the documentation of this file.
/* PipeWire
*
* Copyright © 2018 Wim Taymans
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef PIPEWIRE_MODULE_H
#define PIPEWIRE_MODULE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/defs.h>
#include <spa/utils/hook.h>
#include <pipewire/proxy.h>
#define PW_TYPE_INTERFACE_Module PW_TYPE_INFO_INTERFACE_BASE "Module"
#define PW_VERSION_MODULE 3
struct pw_module;
struct pw_module_info {
uint32_t id;
const char *name;
const char *filename;
const char *args;
#define PW_MODULE_CHANGE_MASK_PROPS (1 << 0)
#define PW_MODULE_CHANGE_MASK_ALL ((1 << 1)-1)
uint64_t change_mask;
struct spa_dict *props;
};
struct pw_module_info *
pw_module_info_update(struct pw_module_info *info,
const struct pw_module_info *update);
struct pw_module_info *
pw_module_info_merge(struct pw_module_info *info,
const struct pw_module_info *update, bool reset);
void pw_module_info_free(struct pw_module_info *info);
#define PW_MODULE_EVENT_INFO 0
#define PW_MODULE_EVENT_NUM 1
struct pw_module_events {
#define PW_VERSION_MODULE_EVENTS 0
uint32_t version;
void (*info) (void *object, const struct pw_module_info *info);
};
#define PW_MODULE_METHOD_ADD_LISTENER 0
#define PW_MODULE_METHOD_NUM 1
struct pw_module_methods {
#define PW_VERSION_MODULE_METHODS 0
uint32_t version;
int (*add_listener) (void *object,
struct spa_hook *listener,
const struct pw_module_events *events,
void *data);
};
#define pw_module_method(o,method,version,...) \
({ \
int _res = -ENOTSUP; \
spa_interface_call_res((struct spa_interface*)o, \
struct pw_module_methods, _res, \
method, version, ##__VA_ARGS__); \
_res; \
})
#define pw_module_add_listener(c,...) pw_module_method(c,add_listener,0,__VA_ARGS__)
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* PIPEWIRE_MODULE_H */
defs.h
spa/utils/defs.h
pw_module_info_free
void pw_module_info_free(struct pw_module_info *info)
Free a pw_module_info.
Definition: introspect.c:399
pw_module_info_merge
struct pw_module_info * pw_module_info_merge(struct pw_module_info *info, const struct pw_module_info *update, bool reset)
Merge and existing pw_module_info with update.
Definition: introspect.c:363
pw_module_info_update
struct pw_module_info * pw_module_info_update(struct pw_module_info *info, const struct pw_module_info *update)
Update and existing pw_module_info with update with reset.
Definition: introspect.c:392
hook.h
spa/utils/hook.h
proxy.h
pipewire/proxy.h
pw_module_events
Module events.
Definition: module.h:88
pw_module_events::version
uint32_t version
Definition: module.h:91
pw_module_events::info
void(* info)(void *object, const struct pw_module_info *info)
Notify module info.
Definition: module.h:97
pw_module_info
The module information.
Definition: module.h:58
pw_module_info::id
uint32_t id
id of the global
Definition: module.h:59
pw_module_info::filename
const char * filename
filename of the module
Definition: module.h:61
pw_module_info::args
const char * args
arguments passed to the module
Definition: module.h:62
pw_module_info::change_mask
uint64_t change_mask
bitfield of changed fields since last call
Definition: module.h:67
pw_module_methods
Module methods.
Definition: module.h:106
pw_module_methods::version
uint32_t version
Definition: module.h:109
pw_module_methods::add_listener
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_module_events *events, void *data)
Definition: module.h:111
pw_module
spa_dict
Definition: dict.h:59
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:342