stream: improve stream API

Simplify the stream API. make just 2 methods to queue and dequeue
buffers. Make just one callback when new buffers can be dequeued.
Add support for driver nodes such as the video-src.
Pass a pw_buffer structure to add/remove_buffer and make it possible
to attach metadata to it. This makes it a lot easier to implement
the gstreamer pipewire pool.
Call the stream process function from the main loop and use a lockfree
ringbuffer to pass buffers between the threads. Make it possible to
also call process from the RT thread.
unmap the buffer data when needed.
This commit is contained in:
Wim Taymans 2018-03-22 16:40:27 +01:00
parent 97547d726f
commit f9ceedb714
11 changed files with 451 additions and 508 deletions

View file

@ -39,14 +39,29 @@ G_BEGIN_DECLS
#define GST_PIPEWIRE_POOL_GET_CLASS(klass) \
(G_TYPE_INSTANCE_GET_CLASS ((klass), GST_TYPE_PIPEWIRE_POOL, GstPipeWirePoolClass))
typedef struct _GstPipeWirePoolData GstPipeWirePoolData;
typedef struct _GstPipeWirePool GstPipeWirePool;
typedef struct _GstPipeWirePoolClass GstPipeWirePoolClass;
struct _GstPipeWirePoolData {
GstPipeWirePool *pool;
void *owner;
struct spa_meta_header *header;
guint flags;
goffset offset;
struct pw_buffer *b;
GstBuffer *buf;
};
struct _GstPipeWirePool {
GstBufferPool parent;
struct pw_stream *stream;
GQueue available;
struct pw_type *t;
GstAllocator *fd_allocator;
GstAllocator *dmabuf_allocator;
GCond cond;
};
@ -58,8 +73,12 @@ GType gst_pipewire_pool_get_type (void);
GstPipeWirePool * gst_pipewire_pool_new (void);
gboolean gst_pipewire_pool_add_buffer (GstPipeWirePool *pool, GstBuffer *buffer);
gboolean gst_pipewire_pool_remove_buffer (GstPipeWirePool *pool, GstBuffer *buffer);
void gst_pipewire_pool_wrap_buffer (GstPipeWirePool *pool, struct pw_buffer *buffer);
GstPipeWirePoolData *gst_pipewire_pool_get_data (GstBuffer *buffer);
//gboolean gst_pipewire_pool_add_buffer (GstPipeWirePool *pool, GstBuffer *buffer);
//gboolean gst_pipewire_pool_remove_buffer (GstPipeWirePool *pool, GstBuffer *buffer);
G_END_DECLS