Use remote to join nodes on remote graphs

Make a new method that can take a local node and run it in a remote
pipeline. This basically replaces all functionality of the streams
and more.
Add 2 examples for exporting a sink and a v4l2 node
Make some more things const
Cleanups
Make it possible to do things when the node needs scheduling. The
default node will schedule the local pipeline but the remote node might
also schedule the remote pipeline.
This commit is contained in:
Wim Taymans 2017-07-25 19:52:31 +02:00
parent 589e3d977c
commit 3d9f28c676
40 changed files with 1591 additions and 138 deletions

View file

@ -88,7 +88,7 @@ static int impl_node_set_props(struct spa_node *node, const struct spa_props *pr
return SPA_RESULT_OK;
}
static int do_send_done(struct spa_loop *loop, bool async, uint32_t seq, size_t size, void *data, void *user_data)
static int do_send_done(struct spa_loop *loop, bool async, uint32_t seq, size_t size, const void *data, void *user_data)
{
struct state *this = user_data;
@ -97,11 +97,11 @@ static int do_send_done(struct spa_loop *loop, bool async, uint32_t seq, size_t
return SPA_RESULT_OK;
}
static int do_command(struct spa_loop *loop, bool async, uint32_t seq, size_t size, void *data, void *user_data)
static int do_command(struct spa_loop *loop, bool async, uint32_t seq, size_t size, const void *data, void *user_data)
{
struct state *this = user_data;
int res;
struct spa_command *cmd = data;
const struct spa_command *cmd = data;
if (SPA_COMMAND_TYPE(cmd) == this->type.command_node.Start ||
SPA_COMMAND_TYPE(cmd) == this->type.command_node.Pause) {
@ -121,7 +121,7 @@ static int do_command(struct spa_loop *loop, bool async, uint32_t seq, size_t si
return res;
}
static int impl_node_send_command(struct spa_node *node, struct spa_command *command)
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
{
struct state *this;
@ -513,7 +513,7 @@ static int impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id,
static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction, uint32_t port_id, struct spa_command *command)
enum spa_direction direction, uint32_t port_id, const struct spa_command *command)
{
struct state *this;
int res;

View file

@ -90,7 +90,7 @@ static int impl_node_set_props(struct spa_node *node, const struct spa_props *pr
return SPA_RESULT_OK;
}
static int do_send_done(struct spa_loop *loop, bool async, uint32_t seq, size_t size, void *data, void *user_data)
static int do_send_done(struct spa_loop *loop, bool async, uint32_t seq, size_t size, const void *data, void *user_data)
{
struct state *this = user_data;
@ -99,7 +99,7 @@ static int do_send_done(struct spa_loop *loop, bool async, uint32_t seq, size_t
return SPA_RESULT_OK;
}
static int do_start(struct spa_loop *loop, bool async, uint32_t seq, size_t size, void *data, void *user_data)
static int do_start(struct spa_loop *loop, bool async, uint32_t seq, size_t size, const void *data, void *user_data)
{
struct state *this = user_data;
int res;
@ -118,7 +118,7 @@ static int do_start(struct spa_loop *loop, bool async, uint32_t seq, size_t size
return res;
}
static int do_pause(struct spa_loop *loop, bool async, uint32_t seq, size_t size, void *data, void *user_data)
static int do_pause(struct spa_loop *loop, bool async, uint32_t seq, size_t size, const void *data, void *user_data)
{
struct state *this = user_data;
int res;
@ -137,7 +137,7 @@ static int do_pause(struct spa_loop *loop, bool async, uint32_t seq, size_t size
return res;
}
static int impl_node_send_command(struct spa_node *node, struct spa_command *command)
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
{
struct state *this;
@ -533,7 +533,7 @@ static int impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id,
static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction, uint32_t port_id, struct spa_command *command)
enum spa_direction direction, uint32_t port_id, const struct spa_command *command)
{
struct state *this;
int res;

View file

@ -145,7 +145,7 @@ static int impl_node_set_props(struct spa_node *node, const struct spa_props *pr
return SPA_RESULT_NOT_IMPLEMENTED;
}
static int impl_node_send_command(struct spa_node *node, struct spa_command *command)
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
{
struct impl *this;
@ -622,7 +622,7 @@ static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
struct spa_command *command)
const struct spa_command *command)
{
return SPA_RESULT_NOT_IMPLEMENTED;
}

View file

@ -355,7 +355,7 @@ static void on_output(struct spa_source *source)
this->callbacks->have_output(&this->node, this->user_data);
}
static int impl_node_send_command(struct spa_node *node, struct spa_command *command)
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
{
struct impl *this;
@ -838,7 +838,7 @@ static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
struct spa_command *command)
const struct spa_command *command)
{
return SPA_RESULT_NOT_IMPLEMENTED;
}

View file

@ -90,7 +90,7 @@ static int spa_ffmpeg_dec_node_set_props(struct spa_node *node, const struct spa
return SPA_RESULT_NOT_IMPLEMENTED;
}
static int spa_ffmpeg_dec_node_send_command(struct spa_node *node, struct spa_command *command)
static int spa_ffmpeg_dec_node_send_command(struct spa_node *node, const struct spa_command *command)
{
struct impl *this;
@ -424,7 +424,7 @@ static int
spa_ffmpeg_dec_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
struct spa_command *command)
const struct spa_command *command)
{
return SPA_RESULT_NOT_IMPLEMENTED;
}

View file

@ -94,7 +94,7 @@ static int spa_ffmpeg_enc_node_set_props(struct spa_node *node, const struct spa
return SPA_RESULT_NOT_IMPLEMENTED;
}
static int spa_ffmpeg_enc_node_send_command(struct spa_node *node, struct spa_command *command)
static int spa_ffmpeg_enc_node_send_command(struct spa_node *node, const struct spa_command *command)
{
struct impl *this;
@ -390,7 +390,7 @@ spa_ffmpeg_enc_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id, u
static int
spa_ffmpeg_enc_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id, struct spa_command *command)
uint32_t port_id, const struct spa_command *command)
{
return SPA_RESULT_NOT_IMPLEMENTED;
}

View file

@ -195,7 +195,7 @@ loop_invoke(struct spa_loop *loop,
spa_invoke_func_t func,
uint32_t seq,
size_t size,
void *data,
const void *data,
bool block,
void *user_data)
{

View file

@ -270,7 +270,7 @@ static void on_input(struct spa_source *source)
consume_buffer(this);
}
static int impl_node_send_command(struct spa_node *node, struct spa_command *command)
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
{
struct impl *this;
@ -640,7 +640,7 @@ static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
struct spa_command *command)
const struct spa_command *command)
{
return SPA_RESULT_NOT_IMPLEMENTED;
}

View file

@ -282,7 +282,7 @@ static void on_output(struct spa_source *source)
this->callbacks->have_output(&this->node, this->user_data);
}
static int impl_node_send_command(struct spa_node *node, struct spa_command *command)
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
{
struct impl *this;
@ -687,7 +687,7 @@ static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
struct spa_command *command)
const struct spa_command *command)
{
return SPA_RESULT_NOT_IMPLEMENTED;
}

View file

@ -228,7 +228,7 @@ static int do_pause_done(struct spa_loop *loop,
bool async,
uint32_t seq,
size_t size,
void *data,
const void *data,
void *user_data)
{
struct impl *this = user_data;
@ -246,12 +246,12 @@ static int do_pause(struct spa_loop *loop,
bool async,
uint32_t seq,
size_t size,
void *data,
const void *data,
void *user_data)
{
struct impl *this = user_data;
int res;
struct spa_command *cmd = data;
const struct spa_command *cmd = data;
res = spa_node_port_send_command(&this->node, SPA_DIRECTION_OUTPUT, 0, cmd);
@ -271,7 +271,7 @@ static int do_start_done(struct spa_loop *loop,
bool async,
uint32_t seq,
size_t size,
void *data,
const void *data,
void *user_data)
{
struct impl *this = user_data;
@ -286,12 +286,12 @@ static int do_start(struct spa_loop *loop,
bool async,
uint32_t seq,
size_t size,
void *data,
const void *data,
void *user_data)
{
struct impl *this = user_data;
int res;
struct spa_command *cmd = data;
const struct spa_command *cmd = data;
res = spa_node_port_send_command(&this->node, SPA_DIRECTION_OUTPUT, 0, cmd);
@ -307,7 +307,7 @@ static int do_start(struct spa_loop *loop,
return SPA_RESULT_OK;
}
static int impl_node_send_command(struct spa_node *node, struct spa_command *command)
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
{
struct impl *this;
@ -774,7 +774,7 @@ static int impl_node_port_reuse_buffer(struct spa_node *node,
static int impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
struct spa_command *command)
const struct spa_command *command)
{
struct impl *this;
int res;

View file

@ -969,7 +969,8 @@ static int spa_v4l2_use_buffers(struct impl *this, struct spa_buffer **buffers,
} else if (d[0].type == this->type.data.DmaBuf) {
state->memtype = V4L2_MEMORY_DMABUF;
} else {
spa_log_error(state->log, "v4l2: can't use buffers of type %d", d[0].type);
spa_log_error(state->log, "v4l2: can't use buffers of type %s (%d)",
spa_type_map_get_type (this->map, d[0].type), d[0].type);
return SPA_RESULT_ERROR;
}
}

View file

@ -306,7 +306,7 @@ static void on_output(struct spa_source *source)
this->callbacks->have_output(&this->node, this->user_data);
}
static int impl_node_send_command(struct spa_node *node, struct spa_command *command)
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
{
struct impl *this;
@ -782,7 +782,7 @@ static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
struct spa_command *command)
const struct spa_command *command)
{
return SPA_RESULT_NOT_IMPLEMENTED;
}

View file

@ -188,7 +188,7 @@ static int impl_node_set_props(struct spa_node *node, const struct spa_props *pr
return SPA_RESULT_OK;
}
static int impl_node_send_command(struct spa_node *node, struct spa_command *command)
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
{
struct impl *this;
@ -627,7 +627,7 @@ static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
struct spa_command *command)
const struct spa_command *command)
{
return SPA_RESULT_NOT_IMPLEMENTED;
}