spa: make events and commands as objects

So we can serialize and introspect them more easily
This commit is contained in:
Wim Taymans 2017-03-15 16:21:05 +01:00
parent 4c4c0f2a7f
commit c951264fff
26 changed files with 423 additions and 327 deletions

View file

@ -171,9 +171,15 @@ spa_videotestsrc_node_set_props (SpaNode *node,
if (props == NULL) {
reset_videotestsrc_props (&this->props);
} else {
SpaPODProp *pr;
SpaPOD *p;
SPA_POD_OBJECT_BODY_FOREACH (&props->body, props->pod.size, pr) {
SPA_POD_OBJECT_BODY_FOREACH (&props->body, props->pod.size, p) {
SpaPODProp *pr;
if (p->type != SPA_POD_TYPE_PROP)
continue;
pr = (SpaPODProp *) p;
switch (pr->body.key) {
case PROP_ID_LIVE:
this->props.live = ((SpaPODBool*)&pr->body.value)->value;
@ -196,14 +202,11 @@ spa_videotestsrc_node_set_props (SpaNode *node,
static SpaResult
send_have_output (SpaVideoTestSrc *this)
{
SpaNodeEvent event;
if (this->event_cb) {
event.type = SPA_NODE_EVENT_TYPE_HAVE_OUTPUT;
event.size = sizeof (event);
SpaNodeEvent event = SPA_NODE_EVENT_INIT (SPA_NODE_EVENT_HAVE_OUTPUT);
this->event_cb (&this->node, &event, this->user_data);
}
return SPA_RESULT_OK;
}
@ -289,7 +292,7 @@ spa_videotestsrc_node_send_command (SpaNode *node,
this = SPA_CONTAINER_OF (node, SpaVideoTestSrc, node);
switch (command->type) {
switch (SPA_NODE_COMMAND_TYPE (command)) {
case SPA_NODE_COMMAND_INVALID:
return SPA_RESULT_INVALID_COMMAND;