#include <stdio.h>
#include <sys/mman.h>
#include <signal.h>
#include <spa/param/video/format-utils.h>
struct data {
const char *library;
const char *factory;
const char *path;
};
static int make_device(struct data *data)
{
if (factory == NULL)
return -1;
NULL,
return 0;
}
static void on_core_error(
void *data, uint32_t
id,
int seq,
int res,
const char *
message)
{
struct data *d = data;
}
.error = on_core_error,
};
static void do_quit(void *data, int signal_number)
{
struct data *d = data;
}
int main(int argc, char *argv[])
{
struct data data = { 0, };
if (argc < 3) {
fprintf(stderr, "usage: %s <library> <factory>\n\n"
"\texample: %s v4l2/libspa-v4l2 api.v4l2.device\n\n",
argv[0], argv[0]);
return -1;
}
data.library = argv[1];
data.factory = argv[2];
if (data.core == NULL) {
return -1;
}
if (make_device(&data) < 0) {
return -1;
}
return 0;
}
void pw_context_destroy(struct pw_context *context)
destroy a context object, all resources except the main_loop will be destroyed
Definition context.c:522
struct pw_context * pw_context_new(struct pw_loop *main_loop, struct pw_properties *props, size_t user_data_size)
Make a new context object for a given main_loop.
Definition context.c:310
#define PW_ID_CORE
default ID for the core object after connect
Definition core.h:73
struct pw_core * pw_context_connect(struct pw_context *context, struct pw_properties *properties, size_t user_data_size)
Connect to a PipeWire instance.
Definition core.c:410
PW_API_CORE_IMPL int pw_core_add_listener(struct pw_core *object, struct spa_hook *listener, const struct pw_core_events *events, void *data)
Definition core.h:389
uint32_t int seq
Definition core.h:432
struct pw_proxy * pw_core_export(struct pw_core *core, const char *type, const struct spa_dict *props, void *object, size_t user_data_size)
Export an object into the PipeWire instance associated with core.
Definition core.c:285
uint32_t int int const char * message
Definition core.h:433
uint32_t int int res
Definition core.h:433
#define PW_VERSION_CORE_EVENTS
Definition core.h:141
#define PW_TYPE_INTERFACE_Device
Definition device.h:31
#define PW_VERSION_DEVICE
Definition device.h:37
struct spa_device * pw_impl_device_get_implementation(struct pw_impl_device *device)
Get the device implementation.
Definition impl-device.c:1004
void * pw_impl_factory_create_object(struct pw_impl_factory *factory, struct pw_resource *resource, const char *type, uint32_t version, struct pw_properties *properties, uint32_t new_id)
Definition impl-factory.c:248
struct pw_impl_factory * pw_context_find_factory(struct pw_context *context, const char *name)
Find a factory by name.
Definition impl-factory.c:274
struct pw_impl_module * pw_context_load_module(struct pw_context *context, const char *name, const char *args, struct pw_properties *properties)
Load a module.
Definition impl-module.c:139
#define pw_log_error(...)
Definition log.h:178
PW_API_LOOP_IMPL struct spa_source * pw_loop_add_signal(struct pw_loop *object, int signal_number, spa_source_signal_func_t func, void *data)
Definition loop.h:141
int pw_main_loop_quit(struct pw_main_loop *loop)
Quit a main loop.
Definition main-loop.c:108
void pw_main_loop_destroy(struct pw_main_loop *loop)
Destroy a loop.
Definition main-loop.c:73
int pw_main_loop_run(struct pw_main_loop *loop)
Run a main loop.
Definition main-loop.c:122
struct pw_main_loop * pw_main_loop_new(const struct spa_dict *props)
Create a new main loop.
Definition main-loop.c:63
struct pw_loop * pw_main_loop_get_loop(struct pw_main_loop *loop)
Get the loop implementation.
Definition main-loop.c:96
void pw_init(int *argc, char **argv[])
Initialize PipeWire.
Definition pipewire.c:488
struct pw_properties * pw_properties_new(const char *key,...)
Make a new properties object.
Definition properties.c:97
#define SPA_TYPE_INTERFACE_Device
Definition device.h:46
#define SPA_KEY_FACTORY_NAME
the name of a factory
Definition plugin.h:242
#define SPA_KEY_LIBRARY_NAME
the name of a library.
Definition plugin.h:251
SPA_API_RESULT const char * spa_strerror(int err)
Definition result.h:61
#define SPA_ID_INVALID
Definition defs.h:250
Core events.
Definition core.h:139
Definition properties.h:39
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:427