Implement SYNC message

A sync message returns a notify-done after all request are finished and
can be used to wait for completion of a bunch of commands. Use it wait
for all proxy BIND requests to complete so that we can look at the
info immediately.
Copy the default value of unset properties.
This commit is contained in:
Wim Taymans 2017-02-01 17:48:12 +01:00
parent b38ecafe81
commit fd54471249
5 changed files with 37 additions and 16 deletions

View file

@ -81,11 +81,7 @@ connection_add_fd (PinosConnection *conn,
return index;
}
#if 1
#define PINOS_DEBUG_MESSAGE(format,args...) pinos_log_debug(format,##args)
#else
#define PINOS_DEBUG_MESSAGE(format,args...)
#endif
#define PINOS_DEBUG_MESSAGE(format,args...) pinos_log_trace(format,##args)
static void
connection_parse_client_update (PinosConnection *conn, PinosMessageClientUpdate *m)

View file

@ -132,8 +132,17 @@ core_dispatch_func (void *object,
{
PinosMessageNotifyDone *nd = message;
if (nd->seq == 0)
if (nd->seq == 0) {
PinosMessageSync sync;
sync.seq = 1;
pinos_proxy_send_message (this->core_proxy,
PINOS_MESSAGE_SYNC,
&sync,
true);
} else if (nd->seq == 1) {
context_set_state (this, PINOS_CONTEXT_STATE_CONNECTED, NULL);
}
break;
}
case PINOS_MESSAGE_ERROR:
@ -776,7 +785,8 @@ do_list (PinosContext *context,
if (proxy->type != type)
continue;
cb (context, SPA_RESULT_OK, proxy->user_data, user_data);
if (proxy->user_data)
cb (context, SPA_RESULT_OK, proxy->user_data, user_data);
}
cb (context, SPA_RESULT_ENUM_END, NULL, user_data);
}

View file

@ -202,7 +202,7 @@ new_node (const PinosNodeInfo *info)
GstPinosDeviceType type;
int i;
caps = gst_caps_new_empty();
caps = gst_caps_new_empty ();
if (info->max_inputs > 0 && info->max_outputs == 0) {
type = GST_PINOS_DEVICE_TYPE_SINK;

View file

@ -101,6 +101,19 @@ core_dispatch_func (void *object,
m->props);
break;
}
case PINOS_MESSAGE_SYNC:
{
PinosMessageSync *m = message;
PinosMessageNotifyDone r;
r.seq = m->seq;
pinos_client_send_message (client,
resource,
PINOS_MESSAGE_NOTIFY_DONE,
&r,
true);
break;
}
case PINOS_MESSAGE_GET_REGISTRY:
{

View file

@ -80,25 +80,27 @@ spa_props_copy_values (const SpaProps *src,
SpaProps *dest)
{
int i;
SpaResult res;
if (src == dest)
return SPA_RESULT_OK;
for (i = 0; i < dest->n_prop_info; i++) {
const SpaPropInfo *info = &dest->prop_info[i];
SpaPropValue value;
const SpaPropInfo *dinfo = &dest->prop_info[i];
const SpaPropInfo *sinfo;
unsigned int idx;
if (!(info->flags & SPA_PROP_FLAG_WRITABLE))
if (!(dinfo->flags & SPA_PROP_FLAG_WRITABLE))
continue;
if ((res = spa_props_get_value (src, spa_props_index_for_id (src, info->id), &value)) < 0)
if ((idx = spa_props_index_for_id (src, dinfo->id)) == SPA_IDX_INVALID)
continue;
if (value.size > info->maxsize)
sinfo = &src->prop_info[idx];
if (sinfo->maxsize > dinfo->maxsize)
return SPA_RESULT_WRONG_PROPERTY_SIZE;
memcpy (SPA_MEMBER (dest, info->offset, void), value.value, value.size);
memcpy (SPA_MEMBER (dest, dinfo->offset, void), SPA_MEMBER (src, sinfo->offset, void), sinfo->maxsize);
SPA_PROPS_INDEX_SET (dest, i);
if (!SPA_PROPS_INDEX_IS_UNSET (src, idx))
SPA_PROPS_INDEX_SET (dest, i);
}
return SPA_RESULT_OK;
}