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

@ -25,6 +25,7 @@ extern "C" {
#endif
typedef struct _SpaBuffer SpaBuffer;
typedef struct _SpaBufferGroup SpaBufferGroup;
#include <spa/defs.h>
@ -37,6 +38,7 @@ typedef enum {
SPA_META_TYPE_INVALID = 0,
SPA_META_TYPE_HEADER,
SPA_META_TYPE_POINTER,
SPA_META_TYPE_VIDEO_CROP,
} SpaMetaType;
/**
@ -72,6 +74,18 @@ typedef struct {
void *ptr;
} SpaMetaPointer;
/**
* SpaMetaVideoCrop:
* @x:
* @y:
* @width:
* @height
*/
typedef struct {
int x, y;
int width, height;
} SpaMetaVideoCrop;
/**
* SpaMeta:
* @type: metadata type

View file

@ -34,7 +34,7 @@ typedef struct _SpaEvent SpaEvent;
* @SPA_EVENT_TYPE_STARTED: emited when the START command completes
* @SPA_EVENT_TYPE_STOPPED: emited when the STOP command completes
* @SPA_EVENT_TYPE_CAN_PULL_OUTPUT: emited when an async node has output that can be pulled
* @SPA_EVENT_TYPE_CAN_PUSH_INTPUT: emited when more data can be pushed to an async node
* @SPA_EVENT_TYPE_CAN_PUSH_INPUT: emited when more data can be pushed to an async node
* @SPA_EVENT_TYPE_PULL_INPUT: emited when data needs to be provided on an input
* @SPA_EVENT_TYPE_ALLOC_OUTPUT: emited when an output buffer needs to be allocated
* @SPA_EVENT_TYPE_ADD_POLL: emited when a pollfd should be added
@ -49,7 +49,7 @@ typedef enum {
SPA_EVENT_TYPE_STARTED,
SPA_EVENT_TYPE_STOPPED,
SPA_EVENT_TYPE_CAN_PULL_OUTPUT,
SPA_EVENT_TYPE_CAN_PUSH_INTPUT,
SPA_EVENT_TYPE_CAN_PUSH_INPUT,
SPA_EVENT_TYPE_PULL_INPUT,
SPA_EVENT_TYPE_ALLOC_OUTPUT,
SPA_EVENT_TYPE_ADD_POLL,

View file

@ -320,6 +320,8 @@ struct _SpaNode {
uint32_t n_buffers);
SpaResult (*port_alloc_buffers) (SpaHandle *handle,
uint32_t port_id,
SpaAllocParam **params,
uint32_t n_params,
SpaBuffer **buffers,
uint32_t *n_buffers);

View file

@ -78,20 +78,27 @@ struct _SpaHandleFactory {
* Extra information about the handles of this factory.
*/
const SpaProps * info;
/**
* SpaHandleFactory::size
*
* The size of handles from this factory
*/
const size_t size;
/**
* SpaHandleFactory::instantiate
* SpaHandleFactory::init
* @factory: a #SpaHandleFactory
* @handle: a pointer to hold the result
* @handle: a pointer to memory
*
* Make an instance of this factory.
* Initialize an instance of this factory. The caller should allocate
* memory at least SpaHandleFactory::size bytes and pass this as @handle.
*
* Returns: #SPA_RESULT_OK on success
* #SPA_RESULT_NOT_IMPLEMENTED when an instance can't be made
* #SPA_RESULT_INVALID_ARGUMENTS when factory or handle are %NULL
*/
SpaResult (*instantiate) (const SpaHandleFactory *factory,
SpaHandle **handle);
SpaResult (*init) (const SpaHandleFactory *factory,
SpaHandle *handle);
/**
* SpaHandle::enum_interface_info:
* @factory: a #SpaHandleFactory

View file

@ -25,6 +25,48 @@ extern "C" {
#endif
#include <spa/defs.h>
#include <spa/buffer.h>
/**
* SpaAllocParamType:
* @SPA_ALLOC_PARAM_TYPE_INVALID: invalid type, should be ignored
* @SPA_ALLOC_PARAM_TYPE_META_ENABLE: enable a certain metadata on buffers
* @SPA_ALLOC_PARAM_TYPE_VIDEO_PADDING: do specialized video padding
*/
typedef enum {
SPA_ALLOC_PARAM_TYPE_INVALID,
SPA_ALLOC_PARAM_TYPE_BUFFERS,
SPA_ALLOC_PARAM_TYPE_META_ENABLE,
SPA_ALLOC_PARAM_TYPE_VIDEO_PADDING,
} SpaAllocParamType;
typedef struct {
uint32_t type;
size_t size;
} SpaAllocParam;
typedef struct {
SpaAllocParam param;
size_t minsize;
size_t stride;
uint32_t min_buffers;
uint32_t max_buffers;
uint32_t align;
} SpaAllocParamBuffers;
typedef struct {
SpaAllocParam param;
SpaMetaType type;
} SpaAllocParamMetaEnable;
typedef struct {
SpaAllocParam param;
unsigned int padding_top;
unsigned int padding_bottom;
unsigned int padding_left;
unsigned int padding_right;
unsigned int stride_align[4];
} SpaAllocParamVideoPadding;
/**
* SpaPortInfoFlags:
@ -58,18 +100,17 @@ typedef enum {
* @maxbuffering: the maximum amount of bytes that the element will keep
* around internally
* @latency: latency on this port in nanoseconds
* @params: extra allocation parameters
* @n_params: number of elements in @params;
* @features: NULL terminated array of extra port features
*
*/
typedef struct {
SpaPortInfoFlags flags;
size_t minsize;
size_t stride;
uint32_t min_buffers;
uint32_t max_buffers;
uint32_t align;
unsigned int maxbuffering;
uint64_t latency;
SpaAllocParam **params;
uint32_t n_params;
const char **features;
} SpaPortInfo;