clean up types

This commit is contained in:
Wim Taymans 2017-03-23 21:15:52 +01:00
parent d9a51b5d14
commit acedfe71c0
64 changed files with 756 additions and 752 deletions

View file

@ -57,7 +57,7 @@ struct _SpaALSAMonitor {
SpaLog *log;
SpaLoop *main_loop;
SpaMonitorEventCallback event_cb;
SpaEventMonitorCallback event_cb;
void *user_data;
struct udev* udev;
@ -283,13 +283,13 @@ alsa_on_fd_events (SpaSource *source)
spa_pod_builder_object (&b, &f[0], 0, type,
SPA_POD_TYPE_POD, this->uitem.item);
event = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaMonitorEvent);
event = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaEventMonitor);
this->event_cb (&this->monitor, event, this->user_data);
}
static SpaResult
spa_alsa_monitor_set_event_callback (SpaMonitor *monitor,
SpaMonitorEventCallback callback,
SpaEventMonitorCallback callback,
void *user_data)
{
SpaResult res;
@ -435,11 +435,11 @@ alsa_monitor_init (const SpaHandleFactory *factory,
this = (SpaALSAMonitor *) handle;
for (i = 0; i < n_support; i++) {
if (strcmp (support[i].uri, SPA_ID_MAP_URI) == 0)
if (strcmp (support[i].uri, SPA_TYPE__IDMap) == 0)
this->map = support[i].data;
else if (strcmp (support[i].uri, SPA_LOG_URI) == 0)
else if (strcmp (support[i].uri, SPA_TYPE__Log) == 0)
this->log = support[i].data;
else if (strcmp (support[i].uri, SPA_LOOP__MainLoop) == 0)
else if (strcmp (support[i].uri, SPA_TYPE_LOOP__MainLoop) == 0)
this->main_loop = support[i].data;
}
if (this->map == NULL) {
@ -450,7 +450,7 @@ alsa_monitor_init (const SpaHandleFactory *factory,
spa_log_error (this->log, "a main-loop is needed");
return SPA_RESULT_ERROR;
}
this->uri.handle_factory = spa_id_map_get_id (this->map, SPA_HANDLE_FACTORY_URI);
this->uri.handle_factory = spa_id_map_get_id (this->map, SPA_TYPE__HandleFactory);
spa_monitor_types_map (this->map, &this->uri.monitor_types);
this->monitor = alsamonitor;
@ -460,7 +460,7 @@ alsa_monitor_init (const SpaHandleFactory *factory,
static const SpaInterfaceInfo alsa_monitor_interfaces[] =
{
{ SPA_MONITOR_URI, },
{ SPA_TYPE__Monitor, },
};
static SpaResult

View file

@ -147,8 +147,8 @@ do_command (SpaLoop *loop,
SpaResult res;
SpaCommand *cmd = data;
if (SPA_COMMAND_TYPE (cmd) == this->uri.node_commands.Start ||
SPA_COMMAND_TYPE (cmd) == this->uri.node_commands.Pause) {
if (SPA_COMMAND_TYPE (cmd) == this->uri.command_node.Start ||
SPA_COMMAND_TYPE (cmd) == this->uri.command_node.Pause) {
res = spa_node_port_send_command (&this->node,
SPA_DIRECTION_INPUT,
0,
@ -158,7 +158,7 @@ do_command (SpaLoop *loop,
res = SPA_RESULT_NOT_IMPLEMENTED;
if (async) {
SpaNodeEventAsyncComplete ac = SPA_NODE_EVENT_ASYNC_COMPLETE_INIT (this->uri.node_events.AsyncComplete,
SpaEventNodeAsyncComplete ac = SPA_EVENT_NODE_ASYNC_COMPLETE_INIT (this->uri.event_node.AsyncComplete,
seq, res);
spa_loop_invoke (this->main_loop,
do_send_event,
@ -181,8 +181,8 @@ spa_alsa_sink_node_send_command (SpaNode *node,
this = SPA_CONTAINER_OF (node, SpaALSASink, node);
if (SPA_COMMAND_TYPE (command) == this->uri.node_commands.Start ||
SPA_COMMAND_TYPE (command) == this->uri.node_commands.Pause) {
if (SPA_COMMAND_TYPE (command) == this->uri.command_node.Start ||
SPA_COMMAND_TYPE (command) == this->uri.command_node.Pause) {
if (!this->have_format)
return SPA_RESULT_NO_FORMAT;
@ -203,7 +203,7 @@ spa_alsa_sink_node_send_command (SpaNode *node,
static SpaResult
spa_alsa_sink_node_set_event_callback (SpaNode *node,
SpaNodeEventCallback event,
SpaEventNodeCallback event,
void *user_data)
{
SpaALSASink *this;
@ -612,12 +612,12 @@ spa_alsa_sink_node_port_send_command (SpaNode *node,
if (port_id != 0)
return SPA_RESULT_INVALID_PORT;
if (SPA_COMMAND_TYPE (command) == this->uri.node_commands.Pause) {
if (SPA_COMMAND_TYPE (command) == this->uri.command_node.Pause) {
if (SPA_RESULT_IS_OK (res = spa_alsa_pause (this, false))) {
update_state (this, SPA_NODE_STATE_PAUSED);
}
}
else if (SPA_COMMAND_TYPE (command) == this->uri.node_commands.Start) {
else if (SPA_COMMAND_TYPE (command) == this->uri.command_node.Start) {
if (SPA_RESULT_IS_OK (res = spa_alsa_start (this, false))) {
update_state (this, SPA_NODE_STATE_STREAMING);
}
@ -753,13 +753,13 @@ alsa_sink_init (const SpaHandleFactory *factory,
this = (SpaALSASink *) handle;
for (i = 0; i < n_support; i++) {
if (strcmp (support[i].uri, SPA_ID_MAP_URI) == 0)
if (strcmp (support[i].uri, SPA_TYPE__IDMap) == 0)
this->map = support[i].data;
else if (strcmp (support[i].uri, SPA_LOG_URI) == 0)
else if (strcmp (support[i].uri, SPA_TYPE__Log) == 0)
this->log = support[i].data;
else if (strcmp (support[i].uri, SPA_LOOP__DataLoop) == 0)
else if (strcmp (support[i].uri, SPA_TYPE_LOOP__DataLoop) == 0)
this->data_loop = support[i].data;
else if (strcmp (support[i].uri, SPA_LOOP__MainLoop) == 0)
else if (strcmp (support[i].uri, SPA_TYPE_LOOP__MainLoop) == 0)
this->main_loop = support[i].data;
}
if (this->map == NULL) {
@ -787,7 +787,7 @@ alsa_sink_init (const SpaHandleFactory *factory,
static const SpaInterfaceInfo alsa_sink_interfaces[] =
{
{ SPA_NODE_URI, },
{ SPA_TYPE__Node, },
};
static SpaResult

View file

@ -154,7 +154,7 @@ do_start (SpaLoop *loop,
}
if (async) {
SpaNodeEventAsyncComplete ac = SPA_NODE_EVENT_ASYNC_COMPLETE_INIT (this->uri.node_events.AsyncComplete,
SpaEventNodeAsyncComplete ac = SPA_EVENT_NODE_ASYNC_COMPLETE_INIT (this->uri.event_node.AsyncComplete,
seq, res);
spa_loop_invoke (this->main_loop,
do_send_event,
@ -182,7 +182,7 @@ do_pause (SpaLoop *loop,
}
if (async) {
SpaNodeEventAsyncComplete ac = SPA_NODE_EVENT_ASYNC_COMPLETE_INIT (this->uri.node_events.AsyncComplete,
SpaEventNodeAsyncComplete ac = SPA_EVENT_NODE_ASYNC_COMPLETE_INIT (this->uri.event_node.AsyncComplete,
seq, res);
spa_loop_invoke (this->main_loop,
do_send_event,
@ -205,7 +205,7 @@ spa_alsa_source_node_send_command (SpaNode *node,
this = SPA_CONTAINER_OF (node, SpaALSASource, node);
if (SPA_COMMAND_TYPE (command) == this->uri.node_commands.Start) {
if (SPA_COMMAND_TYPE (command) == this->uri.command_node.Start) {
if (!this->have_format)
return SPA_RESULT_NO_FORMAT;
@ -219,7 +219,7 @@ spa_alsa_source_node_send_command (SpaNode *node,
NULL,
this);
}
else if (SPA_COMMAND_TYPE (command) == this->uri.node_commands.Pause) {
else if (SPA_COMMAND_TYPE (command) == this->uri.command_node.Pause) {
if (!this->have_format)
return SPA_RESULT_NO_FORMAT;
@ -241,7 +241,7 @@ spa_alsa_source_node_send_command (SpaNode *node,
static SpaResult
spa_alsa_source_node_set_event_callback (SpaNode *node,
SpaNodeEventCallback event,
SpaEventNodeCallback event,
void *user_data)
{
SpaALSASource *this;
@ -671,11 +671,11 @@ spa_alsa_source_node_port_send_command (SpaNode *node,
if (port_id != 0)
return SPA_RESULT_INVALID_PORT;
if (SPA_COMMAND_TYPE (command) == this->uri.node_commands.Pause) {
if (SPA_COMMAND_TYPE (command) == this->uri.command_node.Pause) {
if (SPA_RESULT_IS_OK (res = spa_alsa_pause (this, false))) {
update_state (this, SPA_NODE_STATE_PAUSED);
}
} else if (SPA_COMMAND_TYPE (command) == this->uri.node_commands.Start) {
} else if (SPA_COMMAND_TYPE (command) == this->uri.command_node.Start) {
if (SPA_RESULT_IS_OK (res = spa_alsa_start (this, false))) {
update_state (this, SPA_NODE_STATE_STREAMING);
}
@ -818,13 +818,13 @@ alsa_source_init (const SpaHandleFactory *factory,
this = (SpaALSASource *) handle;
for (i = 0; i < n_support; i++) {
if (strcmp (support[i].uri, SPA_ID_MAP_URI) == 0)
if (strcmp (support[i].uri, SPA_TYPE__IDMap) == 0)
this->map = support[i].data;
else if (strcmp (support[i].uri, SPA_LOG_URI) == 0)
else if (strcmp (support[i].uri, SPA_TYPE__Log) == 0)
this->log = support[i].data;
else if (strcmp (support[i].uri, SPA_LOOP__DataLoop) == 0)
else if (strcmp (support[i].uri, SPA_TYPE_LOOP__DataLoop) == 0)
this->data_loop = support[i].data;
else if (strcmp (support[i].uri, SPA_LOOP__MainLoop) == 0)
else if (strcmp (support[i].uri, SPA_TYPE_LOOP__MainLoop) == 0)
this->main_loop = support[i].data;
}
if (this->map == NULL) {
@ -854,8 +854,8 @@ alsa_source_init (const SpaHandleFactory *factory,
static const SpaInterfaceInfo alsa_source_interfaces[] =
{
{ SPA_NODE_URI, },
{ SPA_CLOCK_URI, },
{ SPA_TYPE__Node, },
{ SPA_TYPE__Clock, },
};
static SpaResult

View file

@ -270,7 +270,7 @@ pull_frames_queue (SpaALSAState *state,
snd_pcm_uframes_t frames)
{
if (spa_list_is_empty (&state->ready)) {
SpaEvent event = SPA_EVENT_INIT (state->uri.node_events.NeedInput);
SpaEvent event = SPA_EVENT_INIT (state->uri.event_node.NeedInput);
state->event_cb (&state->node, &event, state->user_data);
}
if (!spa_list_is_empty (&state->ready)) {
@ -294,7 +294,7 @@ pull_frames_queue (SpaALSAState *state,
state->ready_offset += n_bytes;
if (state->ready_offset >= size) {
SpaNodeEventReuseBuffer rb = SPA_NODE_EVENT_REUSE_BUFFER_INIT (state->uri.node_events.ReuseBuffer,
SpaEventNodeReuseBuffer rb = SPA_EVENT_NODE_REUSE_BUFFER_INIT (state->uri.event_node.ReuseBuffer,
0, b->outbuf->id);
spa_list_remove (&b->link);
@ -349,7 +349,7 @@ pull_frames_ringbuffer (SpaALSAState *state,
b->outstanding = true;
{
SpaNodeEventReuseBuffer rb = SPA_NODE_EVENT_REUSE_BUFFER_INIT (state->uri.node_events.ReuseBuffer,
SpaEventNodeReuseBuffer rb = SPA_EVENT_NODE_REUSE_BUFFER_INIT (state->uri.event_node.ReuseBuffer,
0, b->outbuf->id);
state->event_cb (&state->node, (SpaEvent*)&rb, state->user_data);
}
@ -498,7 +498,7 @@ mmap_read (SpaALSAState *state)
output->status = SPA_RESULT_OK;
}
{
SpaEvent event = SPA_EVENT_INIT (state->uri.node_events.HaveOutput);
SpaEvent event = SPA_EVENT_INIT (state->uri.event_node.HaveOutput);
state->event_cb (&state->node, &event, state->user_data);
}
}

View file

@ -76,8 +76,8 @@ typedef struct {
SpaMediaSubtypesAudio media_subtypes_audio;
SpaPropAudio prop_audio;
SpaAudioFormats audio_formats;
SpaNodeEvents node_events;
SpaNodeCommands node_commands;
SpaEventNode event_node;
SpaCommandNode command_node;
SpaAllocParamBuffers alloc_param_buffers;
SpaAllocParamMetaEnable alloc_param_meta_enable;
} URI;
@ -85,24 +85,24 @@ typedef struct {
static inline void
init_uri (URI *uri, SpaIDMap *map)
{
uri->node = spa_id_map_get_id (map, SPA_NODE_URI);
uri->clock = spa_id_map_get_id (map, SPA_CLOCK_URI);
uri->format = spa_id_map_get_id (map, SPA_FORMAT_URI);
uri->props = spa_id_map_get_id (map, SPA_PROPS_URI);
uri->prop_device = spa_id_map_get_id (map, SPA_PROPS__device);
uri->prop_device_name = spa_id_map_get_id (map, SPA_PROPS__deviceName);
uri->prop_card_name = spa_id_map_get_id (map, SPA_PROPS__cardName);
uri->prop_period_size = spa_id_map_get_id (map, SPA_PROPS__periodSize);
uri->prop_periods = spa_id_map_get_id (map, SPA_PROPS__periods);
uri->prop_period_event = spa_id_map_get_id (map, SPA_PROPS__periodEvent);
uri->node = spa_id_map_get_id (map, SPA_TYPE__Node);
uri->clock = spa_id_map_get_id (map, SPA_TYPE__Clock);
uri->format = spa_id_map_get_id (map, SPA_TYPE__Format);
uri->props = spa_id_map_get_id (map, SPA_TYPE__Props);
uri->prop_device = spa_id_map_get_id (map, SPA_TYPE_PROPS__device);
uri->prop_device_name = spa_id_map_get_id (map, SPA_TYPE_PROPS__deviceName);
uri->prop_card_name = spa_id_map_get_id (map, SPA_TYPE_PROPS__cardName);
uri->prop_period_size = spa_id_map_get_id (map, SPA_TYPE_PROPS__periodSize);
uri->prop_periods = spa_id_map_get_id (map, SPA_TYPE_PROPS__periods);
uri->prop_period_event = spa_id_map_get_id (map, SPA_TYPE_PROPS__periodEvent);
spa_media_types_fill (&uri->media_types, map);
spa_media_subtypes_map (map, &uri->media_subtypes);
spa_media_subtypes_audio_map (map, &uri->media_subtypes_audio);
spa_prop_audio_map (map, &uri->prop_audio);
spa_audio_formats_map (map, &uri->audio_formats);
spa_node_events_map (map, &uri->node_events);
spa_node_commands_map (map, &uri->node_commands);
spa_event_node_map (map, &uri->event_node);
spa_command_node_map (map, &uri->command_node);
spa_alloc_param_buffers_map (map, &uri->alloc_param_buffers);
spa_alloc_param_meta_enable_map (map, &uri->alloc_param_meta_enable);
}
@ -123,7 +123,7 @@ struct _SpaALSAState {
snd_pcm_stream_t stream;
snd_output_t *output;
SpaNodeEventCallback event_cb;
SpaEventNodeCallback event_cb;
void *user_data;
uint8_t props_buffer[1024];