control: clean up some control includes

Remove control from channelmix, it's not used
Add control metadata
Add OSC control type
Improve some docs
This commit is contained in:
Wim Taymans 2019-09-16 15:49:46 +02:00
parent 8b85cc225e
commit 4381e79632
14 changed files with 20 additions and 57 deletions

View file

@ -40,7 +40,6 @@
#include <spa/param/param.h>
#include <spa/param/props.h>
#include <spa/param/audio/format-utils.h>
#include <spa/control/control.h>
#include <spa/utils/names.h>
#define M_PI_M2 ( M_PI + M_PI )

View file

@ -30,6 +30,7 @@ extern "C" {
#endif
#include <spa/utils/defs.h>
#include <spa/pod/pod.h>
/** \page page_meta Metadata
*
@ -42,6 +43,8 @@ enum spa_meta_type {
SPA_META_VideoDamage,
SPA_META_Bitmap,
SPA_META_Cursor,
SPA_META_Control, /**< metadata contains a spa_pod_sequence
* associated with the data */
SPA_META_LAST, /**< not part of ABI/API */
};
@ -134,6 +137,11 @@ struct spa_meta_cursor {
* struct spa_meta_bitmap at the offset. */
};
/** a timed set of events associated with the buffer */
struct spa_meta_control {
struct spa_pod_sequence sequence;
};
#ifdef __cplusplus
} /* extern "C" */
#endif

View file

@ -39,8 +39,10 @@ extern "C" {
/** Different Control types */
enum spa_control_type {
SPA_CONTROL_Invalid,
SPA_CONTROL_Properties,
SPA_CONTROL_Midi,
SPA_CONTROL_Properties, /**< data contains a SPA_TYPE_OBJECT_Props */
SPA_CONTROL_Midi, /**< data contains a spa_pod_bytes with raw midi data */
SPA_CONTROL_OSC, /**< data contains a spa_pod_bytes with an OSC packet */
SPA_CONTROL_LAST, /**< not part of ABI */
};

View file

@ -41,6 +41,7 @@ static const struct spa_type_info spa_type_control[] = {
{ SPA_CONTROL_Invalid, SPA_TYPE_Int, SPA_TYPE_INFO_CONTROL_BASE "Invalid", NULL },
{ SPA_CONTROL_Properties, SPA_TYPE_Int, SPA_TYPE_INFO_CONTROL_BASE "Properties", NULL },
{ SPA_CONTROL_Midi, SPA_TYPE_Int, SPA_TYPE_INFO_CONTROL_BASE "Midi", NULL },
{ SPA_CONTROL_OSC, SPA_TYPE_Int, SPA_TYPE_INFO_CONTROL_BASE "OSC", NULL },
{ 0, 0, NULL, NULL },
};

View file

@ -46,8 +46,12 @@ enum spa_io_type {
SPA_IO_Range, /**< expected byte range */
SPA_IO_Clock, /**< area to update clock information */
SPA_IO_Latency, /**< latency reporting */
SPA_IO_Control, /**< area for control messages */
SPA_IO_Notify, /**< area for notify messages */
SPA_IO_Control, /**< area for control messages, control messages
* contain an input spa_pod_sequence of timed
* events. */
SPA_IO_Notify, /**< area for notify messages, notify messages
* contain an output spa_pod_sequence of timed
* events to be sent to listeners. */
SPA_IO_Position, /**< position information in the graph */
SPA_IO_RateMatch, /**< rate matching between nodes */
};
@ -104,7 +108,7 @@ struct spa_io_latency {
uint64_t max; /**< max latency */
};
/** control stream */
/** control stream, io area for SPA_IO_Control and SPA_IO_Notify */
struct spa_io_sequence {
struct spa_pod_sequence sequence; /**< sequence of timed events */
};

View file

@ -10,7 +10,6 @@
#include <spa/pod/filter.h>
#include <spa/support/system.h>
#include <spa/control/control.h>
#include "alsa-utils.h"

View file

@ -896,12 +896,6 @@ impl_node_port_enum_params(void *object, int seq,
SPA_PARAM_IO_size, SPA_POD_Int(sizeof(struct spa_io_buffers)));
break;
case 1:
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_ParamIO, id,
SPA_PARAM_IO_id, SPA_POD_Id(SPA_IO_Control),
SPA_PARAM_IO_size, SPA_POD_Int(sizeof(struct spa_io_sequence)));
break;
case 2:
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_ParamIO, id,
SPA_PARAM_IO_id, SPA_POD_Id(SPA_IO_RateMatch),
@ -1032,9 +1026,6 @@ impl_node_port_set_io(void *object,
case SPA_IO_RateMatch:
res = spa_node_port_set_io(this->resample, direction, 0, id, data, size);
break;
case SPA_IO_Control:
res = spa_node_port_set_io(this->channelmix, direction, 0, id, data, size);
break;
default:
if (IS_MONITOR_PORT(this, direction, port_id))
target = this->fmt[SPA_DIRECTION_INPUT];

View file

@ -36,7 +36,6 @@
#include <spa/param/audio/format-utils.h>
#include <spa/param/param.h>
#include <spa/pod/filter.h>
#include <spa/control/control.h>
#include <spa/debug/types.h>
#include "channelmix-ops.h"
@ -90,7 +89,6 @@ struct port {
struct spa_param_info params[8];
struct spa_io_buffers *io;
struct spa_io_sequence *control;
bool have_format;
struct spa_audio_info format;
@ -604,12 +602,6 @@ impl_node_port_enum_params(void *object, int seq,
SPA_PARAM_IO_id, SPA_POD_Id(SPA_IO_Buffers),
SPA_PARAM_IO_size, SPA_POD_Int(sizeof(struct spa_io_buffers)));
break;
case 1:
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_ParamIO, id,
SPA_PARAM_IO_id, SPA_POD_Id(SPA_IO_Control),
SPA_PARAM_IO_size, SPA_POD_Int(sizeof(struct spa_io_sequence)));
break;
default:
return 0;
}
@ -800,9 +792,6 @@ impl_node_port_set_io(void *object,
case SPA_IO_Buffers:
port->io = data;
break;
case SPA_IO_Control:
port->control = data;
break;
default:
return -ENOENT;
}
@ -848,22 +837,6 @@ static int impl_node_port_reuse_buffer(void *object, uint32_t port_id, uint32_t
return 0;
}
static int process_control(struct impl *this, struct port *port, struct spa_pod_sequence *sequence)
{
struct spa_pod_control *c;
SPA_POD_SEQUENCE_FOREACH(sequence, c) {
switch (c->type) {
case SPA_CONTROL_Properties:
apply_props(this, (const struct spa_pod *) &c->value);
break;
default:
break;
}
}
return 0;
}
static int impl_node_process(void *object)
{
struct impl *this = object;
@ -884,9 +857,6 @@ static int impl_node_process(void *object)
spa_log_trace_fp(this->log, NAME " %p: status %d %d", this, inio->status, outio->status);
if (outport->control)
process_control(this, outport, &outport->control->sequence);
if (outio->status == SPA_STATUS_HAVE_DATA)
goto done;

View file

@ -36,7 +36,6 @@
#include <spa/param/audio/format-utils.h>
#include <spa/param/param.h>
#include <spa/pod/filter.h>
#include <spa/control/control.h>
#include <spa/debug/types.h>
#define NAME "test-source"

View file

@ -416,12 +416,6 @@ impl_node_port_enum_params(void *object, int seq,
SPA_PARAM_IO_id, SPA_POD_Id(SPA_IO_Buffers),
SPA_PARAM_IO_size, SPA_POD_Int(sizeof(struct spa_io_buffers)));
break;
case 1:
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_ParamIO, id,
SPA_PARAM_IO_id, SPA_POD_Id(SPA_IO_Control),
SPA_PARAM_IO_size, SPA_POD_Int(sizeof(struct spa_io_sequence)));
break;
default:
return 0;
}

View file

@ -41,7 +41,6 @@
#include <spa/param/video/format-utils.h>
#include <spa/param/param.h>
#include <spa/pod/filter.h>
#include <spa/control/control.h>
#include <spa/debug/pod.h>
#include "v4l2.h"

View file

@ -25,7 +25,6 @@
#include <spa/buffer/alloc.h>
#include <spa/buffer/buffer.h>
#include <spa/buffer/meta.h>
#include <spa/control/control.h>
#include <spa/debug/buffer.h>
#include <spa/debug/dict.h>
#include <spa/debug/format.h>

View file

@ -30,7 +30,6 @@
#include <spa/param/props.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
#include <spa/control/control.h>
#include <spa/pod/filter.h>
#include <spa/debug/format.h>
#include <spa/debug/pod.h>

View file

@ -34,7 +34,6 @@
#include <spa/node/utils.h>
#include <spa/utils/ringbuffer.h>
#include <spa/pod/filter.h>
#include <spa/control/control.h>
#include <spa/debug/format.h>
#include <spa/debug/types.h>
#include <spa/debug/pod.h>