mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-11 13:30:07 -05:00
node: improve callbacks
Make separate callbacks for events and RT notifications.
This commit is contained in:
parent
fb0919b8b7
commit
3b33e3d362
32 changed files with 557 additions and 481 deletions
|
|
@ -1,4 +1,4 @@
|
|||
/* Simple Plugin API
|
||||
/* Pinos
|
||||
* Copyright (C) 2016 Wim Taymans <wim.taymans@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Simple Plugin API
|
||||
/* Pinos
|
||||
* Copyright (C) 2016 Wim Taymans <wim.taymans@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Simple Plugin API
|
||||
/* Pinos
|
||||
* Copyright (C) 2016 Wim Taymans <wim.taymans@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
|
@ -233,7 +233,7 @@ typedef struct {
|
|||
uint32_t seq,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaPortFormatFlags flags,
|
||||
uint32_t flags,
|
||||
const SpaFormat *format);
|
||||
void (*set_property) (void *object,
|
||||
uint32_t seq,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Simple Plugin API
|
||||
/* Pinos
|
||||
* Copyright (C) 2016 Wim Taymans <wim.taymans@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Simple Plugin API
|
||||
/* Pinos
|
||||
* Copyright (C) 2016 Wim Taymans <wim.taymans@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
|
|
|||
|
|
@ -378,7 +378,7 @@ static inline void
|
|||
send_have_output (PinosStream *stream)
|
||||
{
|
||||
PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this);
|
||||
SpaEvent ho = SPA_EVENT_INIT (stream->context->type.event_node.HaveOutput);
|
||||
SpaEvent ho = SPA_EVENT_INIT (stream->context->type.event_transport.HaveOutput);
|
||||
uint64_t cmd = 1;
|
||||
|
||||
pinos_transport_add_event (impl->trans, &ho);
|
||||
|
|
@ -483,7 +483,7 @@ handle_rtnode_event (PinosStream *stream,
|
|||
PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this);
|
||||
PinosContext *context = impl->this.context;
|
||||
|
||||
if (SPA_EVENT_TYPE (event) == context->type.event_node.HaveOutput) {
|
||||
if (SPA_EVENT_TYPE (event) == context->type.event_transport.HaveOutput) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < impl->trans->area->n_inputs; i++) {
|
||||
|
|
@ -498,7 +498,7 @@ handle_rtnode_event (PinosStream *stream,
|
|||
}
|
||||
send_need_input (stream);
|
||||
}
|
||||
else if (SPA_EVENT_TYPE (event) == context->type.event_node.NeedInput) {
|
||||
else if (SPA_EVENT_TYPE (event) == context->type.event_transport.NeedInput) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < impl->trans->area->n_outputs; i++) {
|
||||
|
|
@ -516,8 +516,8 @@ handle_rtnode_event (PinosStream *stream,
|
|||
pinos_signal_emit (&stream->need_buffer, stream);
|
||||
impl->in_need_buffer = false;
|
||||
}
|
||||
else if (SPA_EVENT_TYPE (event) == context->type.event_node.ReuseBuffer) {
|
||||
SpaEventNodeReuseBuffer *p = (SpaEventNodeReuseBuffer *) event;
|
||||
else if (SPA_EVENT_TYPE (event) == context->type.event_transport.ReuseBuffer) {
|
||||
PinosEventTransportReuseBuffer *p = (PinosEventTransportReuseBuffer *) event;
|
||||
|
||||
if (p->body.port_id.value != impl->port_id)
|
||||
return;
|
||||
|
|
@ -699,12 +699,12 @@ client_node_remove_port (void *object,
|
|||
}
|
||||
|
||||
static void
|
||||
client_node_set_format (void *object,
|
||||
uint32_t seq,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaPortFormatFlags flags,
|
||||
const SpaFormat *format)
|
||||
client_node_set_format (void *object,
|
||||
uint32_t seq,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const SpaFormat *format)
|
||||
{
|
||||
PinosProxy *proxy = object;
|
||||
PinosStream *stream = proxy->user_data;
|
||||
|
|
@ -1138,8 +1138,8 @@ pinos_stream_recycle_buffer (PinosStream *stream,
|
|||
uint32_t id)
|
||||
{
|
||||
PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this);
|
||||
SpaEventNodeReuseBuffer rb = SPA_EVENT_NODE_REUSE_BUFFER_INIT (stream->context->type.event_node.ReuseBuffer,
|
||||
impl->port_id, id);
|
||||
PinosEventTransportReuseBuffer rb = PINOS_EVENT_TRANSPORT_REUSE_BUFFER_INIT
|
||||
(stream->context->type.event_transport.ReuseBuffer, impl->port_id, id);
|
||||
BufferId *bid;
|
||||
uint64_t cmd = 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Simple Plugin API
|
||||
/* Pinos
|
||||
* Copyright (C) 2016 Wim Taymans <wim.taymans@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
|
@ -83,6 +83,46 @@ SpaResult pinos_transport_next_event (PinosTransport *trans,
|
|||
SpaResult pinos_transport_parse_event (PinosTransport *trans,
|
||||
void *event);
|
||||
|
||||
#define PINOS_TYPE_EVENT__Transport SPA_TYPE_EVENT_BASE "Transport"
|
||||
#define PINOS_TYPE_EVENT_TRANSPORT_BASE PINOS_TYPE_EVENT__Transport ":"
|
||||
|
||||
#define PINOS_TYPE_EVENT_TRANSPORT__HaveOutput PINOS_TYPE_EVENT_TRANSPORT_BASE "HaveOutput"
|
||||
#define PINOS_TYPE_EVENT_TRANSPORT__NeedInput PINOS_TYPE_EVENT_TRANSPORT_BASE "NeedInput"
|
||||
#define PINOS_TYPE_EVENT_TRANSPORT__ReuseBuffer PINOS_TYPE_EVENT_TRANSPORT_BASE "ReuseBuffer"
|
||||
|
||||
typedef struct {
|
||||
uint32_t HaveOutput;
|
||||
uint32_t NeedInput;
|
||||
uint32_t ReuseBuffer;
|
||||
} PinosTypeEventTransport;
|
||||
|
||||
static inline void
|
||||
pinos_type_event_transport_map (SpaTypeMap *map, PinosTypeEventTransport *type)
|
||||
{
|
||||
if (type->HaveOutput == 0) {
|
||||
type->HaveOutput = spa_type_map_get_id (map, PINOS_TYPE_EVENT_TRANSPORT__HaveOutput);
|
||||
type->NeedInput = spa_type_map_get_id (map, PINOS_TYPE_EVENT_TRANSPORT__NeedInput);
|
||||
type->ReuseBuffer = spa_type_map_get_id (map, PINOS_TYPE_EVENT_TRANSPORT__ReuseBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
SpaPODObjectBody body;
|
||||
SpaPODInt port_id;
|
||||
SpaPODInt buffer_id;
|
||||
} PinosEventTransportReuseBufferBody;
|
||||
|
||||
typedef struct {
|
||||
SpaPOD pod;
|
||||
PinosEventTransportReuseBufferBody body;
|
||||
} PinosEventTransportReuseBuffer;
|
||||
|
||||
#define PINOS_EVENT_TRANSPORT_REUSE_BUFFER_INIT(type,port_id,buffer_id) \
|
||||
SPA_EVENT_INIT_COMPLEX (sizeof (PinosEventTransportReuseBufferBody), type, \
|
||||
SPA_POD_INT_INIT (port_id), \
|
||||
SPA_POD_INT_INIT (buffer_id))
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ pinos_type_init (PinosType *type)
|
|||
spa_type_alloc_param_buffers_map (type->map, &type->alloc_param_buffers);
|
||||
spa_type_alloc_param_meta_enable_map (type->map, &type->alloc_param_meta_enable);
|
||||
spa_type_alloc_param_video_padding_map (type->map, &type->alloc_param_video_padding);
|
||||
|
||||
pinos_type_event_transport_map (type->map, &type->event_transport);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
|||
|
|
@ -24,13 +24,15 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <pinos/client/map.h>
|
||||
#include <spa/include/spa/type-map.h>
|
||||
#include <spa/include/spa/event-node.h>
|
||||
#include <spa/include/spa/command-node.h>
|
||||
#include <spa/include/spa/monitor.h>
|
||||
#include <spa/include/spa/alloc-param.h>
|
||||
|
||||
#include <pinos/client/map.h>
|
||||
#include <pinos/client/transport.h>
|
||||
|
||||
typedef struct _PinosType PinosType;
|
||||
|
||||
/**
|
||||
|
|
@ -64,6 +66,7 @@ struct _PinosType {
|
|||
SpaTypeAllocParamBuffers alloc_param_buffers;
|
||||
SpaTypeAllocParamMetaEnable alloc_param_meta_enable;
|
||||
SpaTypeAllocParamVideoPadding alloc_param_video_padding;
|
||||
PinosTypeEventTransport event_transport;
|
||||
};
|
||||
|
||||
void pinos_type_init (PinosType *type);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Simple Plugin API
|
||||
/* Pinos
|
||||
* Copyright (C) 2016 Wim Taymans <wim.taymans@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue