mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
indent
This commit is contained in:
parent
d1a06ae247
commit
5b037661d9
154 changed files with 21017 additions and 23044 deletions
|
|
@ -32,209 +32,208 @@
|
|||
#include <lib/mapper.h>
|
||||
|
||||
struct type {
|
||||
uint32_t node;
|
||||
uint32_t clock;
|
||||
uint32_t node;
|
||||
uint32_t clock;
|
||||
};
|
||||
|
||||
struct data {
|
||||
struct type type;
|
||||
struct type type;
|
||||
|
||||
struct spa_support support[4];
|
||||
uint32_t n_support;
|
||||
struct spa_type_map *map;
|
||||
struct spa_log *log;
|
||||
struct spa_loop loop;
|
||||
struct spa_support support[4];
|
||||
uint32_t n_support;
|
||||
struct spa_type_map *map;
|
||||
struct spa_log *log;
|
||||
struct spa_loop loop;
|
||||
};
|
||||
|
||||
static void
|
||||
inspect_port (struct data *data, struct spa_node *node, enum spa_direction direction, uint32_t port_id)
|
||||
inspect_port(struct data *data, struct spa_node *node, enum spa_direction direction,
|
||||
uint32_t port_id)
|
||||
{
|
||||
int res;
|
||||
struct spa_format *format;
|
||||
uint32_t index;
|
||||
int res;
|
||||
struct spa_format *format;
|
||||
uint32_t index;
|
||||
|
||||
for (index = 0; ; index++) {
|
||||
if ((res = spa_node_port_enum_formats (node, direction, port_id, &format, NULL, index)) < 0) {
|
||||
if (res != SPA_RESULT_ENUM_END)
|
||||
printf ("got error %d\n", res);
|
||||
break;
|
||||
}
|
||||
if (format)
|
||||
spa_debug_format (format, data->map);
|
||||
}
|
||||
for (index = 0;; index++) {
|
||||
if ((res =
|
||||
spa_node_port_enum_formats(node, direction, port_id, &format, NULL,
|
||||
index)) < 0) {
|
||||
if (res != SPA_RESULT_ENUM_END)
|
||||
printf("got error %d\n", res);
|
||||
break;
|
||||
}
|
||||
if (format)
|
||||
spa_debug_format(format, data->map);
|
||||
}
|
||||
|
||||
|
||||
for (index = 0; ; index++) {
|
||||
struct spa_param *param;
|
||||
for (index = 0;; index++) {
|
||||
struct spa_param *param;
|
||||
|
||||
if ((res = spa_node_port_enum_params (node, direction, port_id, index, ¶m)) < 0) {
|
||||
if (res != SPA_RESULT_ENUM_END)
|
||||
printf ("port_enum_params error: %d\n", res);
|
||||
break;
|
||||
}
|
||||
spa_debug_param (param, data->map);
|
||||
}
|
||||
if ((res = spa_node_port_enum_params(node, direction, port_id, index, ¶m)) < 0) {
|
||||
if (res != SPA_RESULT_ENUM_END)
|
||||
printf("port_enum_params error: %d\n", res);
|
||||
break;
|
||||
}
|
||||
spa_debug_param(param, data->map);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
inspect_node (struct data *data, struct spa_node *node)
|
||||
static void inspect_node(struct data *data, struct spa_node *node)
|
||||
{
|
||||
int res;
|
||||
uint32_t i, n_input, max_input, n_output, max_output;
|
||||
uint32_t *in_ports, *out_ports;
|
||||
struct spa_props *props;
|
||||
int res;
|
||||
uint32_t i, n_input, max_input, n_output, max_output;
|
||||
uint32_t *in_ports, *out_ports;
|
||||
struct spa_props *props;
|
||||
|
||||
if ((res = spa_node_get_props (node, &props)) < 0)
|
||||
printf ("can't get properties: %d\n", res);
|
||||
else
|
||||
spa_debug_props (props, data->map);
|
||||
if ((res = spa_node_get_props(node, &props)) < 0)
|
||||
printf("can't get properties: %d\n", res);
|
||||
else
|
||||
spa_debug_props(props, data->map);
|
||||
|
||||
if ((res = spa_node_get_n_ports (node, &n_input, &max_input, &n_output, &max_output)) < 0) {
|
||||
printf ("can't get n_ports: %d\n", res);
|
||||
return;
|
||||
}
|
||||
printf ("supported ports:\n");
|
||||
printf ("input ports: %d/%d\n", n_input, max_input);
|
||||
printf ("output ports: %d/%d\n", n_output, max_output);
|
||||
if ((res = spa_node_get_n_ports(node, &n_input, &max_input, &n_output, &max_output)) < 0) {
|
||||
printf("can't get n_ports: %d\n", res);
|
||||
return;
|
||||
}
|
||||
printf("supported ports:\n");
|
||||
printf("input ports: %d/%d\n", n_input, max_input);
|
||||
printf("output ports: %d/%d\n", n_output, max_output);
|
||||
|
||||
in_ports = alloca (n_input * sizeof (uint32_t));
|
||||
out_ports = alloca (n_output * sizeof (uint32_t));
|
||||
in_ports = alloca(n_input * sizeof(uint32_t));
|
||||
out_ports = alloca(n_output * sizeof(uint32_t));
|
||||
|
||||
if ((res = spa_node_get_port_ids (node, n_input, in_ports, n_output, out_ports)) < 0)
|
||||
printf ("can't get port ids: %d\n", res);
|
||||
if ((res = spa_node_get_port_ids(node, n_input, in_ports, n_output, out_ports)) < 0)
|
||||
printf("can't get port ids: %d\n", res);
|
||||
|
||||
for (i = 0; i < n_input; i++) {
|
||||
printf (" input port: %08x\n", in_ports[i]);
|
||||
inspect_port (data, node, SPA_DIRECTION_INPUT, in_ports[i]);
|
||||
}
|
||||
for (i = 0; i < n_input; i++) {
|
||||
printf(" input port: %08x\n", in_ports[i]);
|
||||
inspect_port(data, node, SPA_DIRECTION_INPUT, in_ports[i]);
|
||||
}
|
||||
|
||||
for (i = 0; i < n_output; i++) {
|
||||
printf (" output port: %08x\n", out_ports[i]);
|
||||
inspect_port (data, node, SPA_DIRECTION_OUTPUT, out_ports[i]);
|
||||
}
|
||||
for (i = 0; i < n_output; i++) {
|
||||
printf(" output port: %08x\n", out_ports[i]);
|
||||
inspect_port(data, node, SPA_DIRECTION_OUTPUT, out_ports[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
inspect_factory (struct data *data, const struct spa_handle_factory *factory)
|
||||
static void inspect_factory(struct data *data, const struct spa_handle_factory *factory)
|
||||
{
|
||||
int res;
|
||||
struct spa_handle *handle;
|
||||
void *interface;
|
||||
uint32_t index = 0;
|
||||
int res;
|
||||
struct spa_handle *handle;
|
||||
void *interface;
|
||||
uint32_t index = 0;
|
||||
|
||||
printf ("factory name:\t\t'%s'\n", factory->name);
|
||||
printf ("factory info:\n");
|
||||
if (factory->info)
|
||||
spa_debug_dict (factory->info);
|
||||
else
|
||||
printf (" none\n");
|
||||
printf("factory name:\t\t'%s'\n", factory->name);
|
||||
printf("factory info:\n");
|
||||
if (factory->info)
|
||||
spa_debug_dict(factory->info);
|
||||
else
|
||||
printf(" none\n");
|
||||
|
||||
handle = calloc (1, factory->size);
|
||||
if ((res = spa_handle_factory_init (factory, handle, NULL, data->support, data->n_support)) < 0) {
|
||||
printf ("can't make factory instance: %d\n", res);
|
||||
return;
|
||||
}
|
||||
handle = calloc(1, factory->size);
|
||||
if ((res =
|
||||
spa_handle_factory_init(factory, handle, NULL, data->support, data->n_support)) < 0) {
|
||||
printf("can't make factory instance: %d\n", res);
|
||||
return;
|
||||
}
|
||||
|
||||
printf ("factory interfaces:\n");
|
||||
printf("factory interfaces:\n");
|
||||
|
||||
while (true) {
|
||||
const struct spa_interface_info *info;
|
||||
uint32_t interface_id;
|
||||
while (true) {
|
||||
const struct spa_interface_info *info;
|
||||
uint32_t interface_id;
|
||||
|
||||
if ((res = spa_handle_factory_enum_interface_info (factory, &info, index)) < 0) {
|
||||
if (res == SPA_RESULT_ENUM_END)
|
||||
break;
|
||||
else
|
||||
printf ("can't enumerate interfaces: %d\n", res);
|
||||
}
|
||||
index++;
|
||||
printf (" interface: '%s'\n", info->type);
|
||||
if ((res = spa_handle_factory_enum_interface_info(factory, &info, index)) < 0) {
|
||||
if (res == SPA_RESULT_ENUM_END)
|
||||
break;
|
||||
else
|
||||
printf("can't enumerate interfaces: %d\n", res);
|
||||
}
|
||||
index++;
|
||||
printf(" interface: '%s'\n", info->type);
|
||||
|
||||
interface_id = spa_type_map_get_id (data->map, info->type);
|
||||
interface_id = spa_type_map_get_id(data->map, info->type);
|
||||
|
||||
if ((res = spa_handle_get_interface (handle, interface_id, &interface)) < 0) {
|
||||
printf ("can't get interface: %d\n", res);
|
||||
continue;
|
||||
}
|
||||
if ((res = spa_handle_get_interface(handle, interface_id, &interface)) < 0) {
|
||||
printf("can't get interface: %d\n", res);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (interface_id == data->type.node)
|
||||
inspect_node (data, interface);
|
||||
else
|
||||
printf ("skipping unknown interface\n");
|
||||
}
|
||||
if (interface_id == data->type.node)
|
||||
inspect_node(data, interface);
|
||||
else
|
||||
printf("skipping unknown interface\n");
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
do_add_source (struct spa_loop *loop,
|
||||
struct spa_source *source)
|
||||
static int do_add_source(struct spa_loop *loop, struct spa_source *source)
|
||||
{
|
||||
return SPA_RESULT_OK;
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
static int
|
||||
do_update_source (struct spa_source *source)
|
||||
|
||||
static int do_update_source(struct spa_source *source)
|
||||
{
|
||||
return SPA_RESULT_OK;
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
static void
|
||||
do_remove_source (struct spa_source *source)
|
||||
|
||||
static void do_remove_source(struct spa_source *source)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct data data;
|
||||
int res;
|
||||
void *handle;
|
||||
spa_handle_factory_enum_func_t enum_func;
|
||||
uint32_t index = 0;
|
||||
struct data data;
|
||||
int res;
|
||||
void *handle;
|
||||
spa_handle_factory_enum_func_t enum_func;
|
||||
uint32_t index = 0;
|
||||
|
||||
if (argc < 2) {
|
||||
printf ("usage: %s <plugin.so>\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
if (argc < 2) {
|
||||
printf("usage: %s <plugin.so>\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
data.map = spa_type_map_get_default();
|
||||
data.log = NULL;
|
||||
data.loop.size = sizeof (struct spa_loop);
|
||||
data.loop.add_source = do_add_source;
|
||||
data.loop.update_source = do_update_source;
|
||||
data.loop.remove_source = do_remove_source;
|
||||
data.map = spa_type_map_get_default();
|
||||
data.log = NULL;
|
||||
data.loop.size = sizeof(struct spa_loop);
|
||||
data.loop.add_source = do_add_source;
|
||||
data.loop.update_source = do_update_source;
|
||||
data.loop.remove_source = do_remove_source;
|
||||
|
||||
data.support[0].type = SPA_TYPE__TypeMap;
|
||||
data.support[0].data = data.map;
|
||||
data.support[1].type = SPA_TYPE__Log;
|
||||
data.support[1].data = data.log;
|
||||
data.support[2].type = SPA_TYPE_LOOP__MainLoop;
|
||||
data.support[2].data = &data.loop;
|
||||
data.support[3].type = SPA_TYPE_LOOP__DataLoop;
|
||||
data.support[3].data = &data.loop;
|
||||
data.n_support = 4;
|
||||
data.support[0].type = SPA_TYPE__TypeMap;
|
||||
data.support[0].data = data.map;
|
||||
data.support[1].type = SPA_TYPE__Log;
|
||||
data.support[1].data = data.log;
|
||||
data.support[2].type = SPA_TYPE_LOOP__MainLoop;
|
||||
data.support[2].data = &data.loop;
|
||||
data.support[3].type = SPA_TYPE_LOOP__DataLoop;
|
||||
data.support[3].data = &data.loop;
|
||||
data.n_support = 4;
|
||||
|
||||
data.type.node = spa_type_map_get_id (data.map, SPA_TYPE__Node);
|
||||
data.type.clock = spa_type_map_get_id (data.map, SPA_TYPE__Clock);
|
||||
data.type.node = spa_type_map_get_id(data.map, SPA_TYPE__Node);
|
||||
data.type.clock = spa_type_map_get_id(data.map, SPA_TYPE__Clock);
|
||||
|
||||
if ((handle = dlopen (argv[1], RTLD_NOW)) == NULL) {
|
||||
printf ("can't load %s\n", argv[1]);
|
||||
return -1;
|
||||
}
|
||||
if ((enum_func = dlsym (handle, SPA_HANDLE_FACTORY_ENUM_FUNC_NAME)) == NULL) {
|
||||
printf ("can't find function\n");
|
||||
return -1;
|
||||
}
|
||||
if ((handle = dlopen(argv[1], RTLD_NOW)) == NULL) {
|
||||
printf("can't load %s\n", argv[1]);
|
||||
return -1;
|
||||
}
|
||||
if ((enum_func = dlsym(handle, SPA_HANDLE_FACTORY_ENUM_FUNC_NAME)) == NULL) {
|
||||
printf("can't find function\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
const struct spa_handle_factory *factory;
|
||||
while (true) {
|
||||
const struct spa_handle_factory *factory;
|
||||
|
||||
if ((res = enum_func (&factory, index)) < 0) {
|
||||
if (res != SPA_RESULT_ENUM_END)
|
||||
printf ("can't enumerate factories: %d\n", res);
|
||||
break;
|
||||
}
|
||||
inspect_factory (&data, factory);
|
||||
index++;
|
||||
}
|
||||
if ((res = enum_func(&factory, index)) < 0) {
|
||||
if (res != SPA_RESULT_ENUM_END)
|
||||
printf("can't enumerate factories: %d\n", res);
|
||||
break;
|
||||
}
|
||||
inspect_factory(&data, factory);
|
||||
index++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue