More hacking

Add spa based v4l2 pinos module
Add allocation params to port_alloc_buffers
Let the app do allocation for handles.
This commit is contained in:
Wim Taymans 2016-07-13 18:29:55 +02:00
parent 4c7cee6b28
commit 6ab8af91e0
41 changed files with 4733 additions and 351 deletions

View file

@ -1,9 +1,11 @@
executable('test-mixer', 'test-mixer.c',
include_directories : inc,
dependencies : [dl_lib, pthread_lib],
link_with : spalib,
install : false)
executable('test-v4l2', 'test-v4l2.c',
include_directories : inc,
dependencies : [dl_lib, sdl_dep, pthread_lib],
link_with : spalib,
install : false)

View file

@ -75,7 +75,8 @@ make_node (SpaHandle **handle, const SpaNode **node, const char *lib, const char
if (strcmp (factory->name, name))
continue;
if ((res = factory->instantiate (factory, handle)) < 0) {
*handle = calloc (1, factory->size);
if ((res = factory->init (factory, *handle)) < 0) {
printf ("can't make factory instance: %d\n", res);
return res;
}
@ -200,8 +201,8 @@ make_nodes (AppData *data)
printf ("got get_props error %d\n", res);
value.type = SPA_PROP_TYPE_STRING;
value.size = strlen ("hw:1")+1;
value.value = "hw:1";
value.value = "hw:0";
value.size = strlen (value.value)+1;
props->set_prop (props, spa_props_index_for_name (props, "device"), &value);
if ((res = data->sink_node->set_props (data->sink, props)) < 0)

View file

@ -29,9 +29,10 @@
#include <SDL2/SDL.h>
#include <spa/node.h>
#include <spa/debug.h>
#include <spa/video/format.h>
#define USE_BUFFER
#undef USE_BUFFER
#define MAX_BUFFERS 8
@ -87,7 +88,8 @@ make_node (SpaHandle **handle, const SpaNode **node, const char *lib, const char
if (strcmp (factory->name, name))
continue;
if ((res = factory->instantiate (factory, handle)) < 0) {
*handle = calloc (1, factory->size);
if ((res = factory->init (factory, *handle)) < 0) {
printf ("can't make factory instance: %d\n", res);
return res;
}
@ -309,14 +311,7 @@ negotiate_formats (AppData *data)
if ((res = data->source_node->port_get_info (data->source, 0, &info)) < 0)
return res;
printf ("flags: %d\n", info->flags);
printf ("minsize: %zd\n", info->minsize);
printf ("stride: %zd\n", info->stride);
printf ("min_buffers: %d\n", info->min_buffers);
printf ("max_buffers: %d\n", info->max_buffers);
printf ("align: %d\n", info->align);
printf ("maxbuffering: %d\n", info->maxbuffering);
printf ("latency: %lu\n", info->latency);
spa_debug_port_info (info);
#ifdef USE_BUFFER
alloc_buffers (data);