remove READY state on context

Now that we don't need to register anymore to the daemon we can just
remove this state.
This commit is contained in:
Wim Taymans 2016-05-19 11:29:11 +02:00
parent 5f10a933a1
commit 89f8f41045
7 changed files with 16 additions and 22 deletions

View file

@ -384,8 +384,7 @@ on_daemon_connected (GObject *source_object,
{ {
PinosContext *context = user_data; PinosContext *context = user_data;
context_set_state (context, PINOS_CONTEXT_STATE_REGISTERING, NULL); context_set_state (context, PINOS_CONTEXT_STATE_CONNECTED, NULL);
context_set_state (context, PINOS_CONTEXT_STATE_READY, NULL);
} }
static void static void
@ -646,7 +645,7 @@ on_node_proxy (GObject *source_object,
PinosContext *context = g_task_get_source_object (task); PinosContext *context = g_task_get_source_object (task);
GError *error = NULL; GError *error = NULL;
GDBusProxy *proxy; GDBusProxy *proxy;
PinosNode *node; PinosClientNode *node;
proxy = pinos_subscribe_get_proxy_finish (context->priv->subscribe, proxy = pinos_subscribe_get_proxy_finish (context->priv->subscribe,
res, res,

View file

@ -60,11 +60,10 @@ typedef enum {
/** /**
* PinosContextState: * PinosContextState:
* @PINOS_CONTEXT_STATE_ERROR: context is in error
* @PINOS_CONTEXT_STATE_UNCONNECTED: not connected * @PINOS_CONTEXT_STATE_UNCONNECTED: not connected
* @PINOS_CONTEXT_STATE_CONNECTING: connecting to daemon * @PINOS_CONTEXT_STATE_CONNECTING: connecting to daemon
* @PINOS_CONTEXT_STATE_REGISTERING: registering with daemon * @PINOS_CONTEXT_STATE_CONNECTED: context is connected and ready
* @PINOS_CONTEXT_STATE_READY: context is ready
* @PINOS_CONTEXT_STATE_ERROR: context is in error
* *
* The state of a #PinosContext * The state of a #PinosContext
*/ */
@ -72,8 +71,7 @@ typedef enum {
PINOS_CONTEXT_STATE_ERROR = -1, PINOS_CONTEXT_STATE_ERROR = -1,
PINOS_CONTEXT_STATE_UNCONNECTED = 0, PINOS_CONTEXT_STATE_UNCONNECTED = 0,
PINOS_CONTEXT_STATE_CONNECTING = 1, PINOS_CONTEXT_STATE_CONNECTING = 1,
PINOS_CONTEXT_STATE_REGISTERING = 2, PINOS_CONTEXT_STATE_CONNECTED = 2,
PINOS_CONTEXT_STATE_READY = 3,
} PinosContextState; } PinosContextState;
const gchar * pinos_context_state_as_string (PinosContextState state); const gchar * pinos_context_state_as_string (PinosContextState state);

View file

@ -616,7 +616,7 @@ pinos_stream_connect (PinosStream *stream,
priv = stream->priv; priv = stream->priv;
context = priv->context; context = priv->context;
g_return_val_if_fail (pinos_context_get_state (context) == PINOS_CONTEXT_STATE_READY, FALSE); g_return_val_if_fail (pinos_context_get_state (context) == PINOS_CONTEXT_STATE_CONNECTED, FALSE);
g_return_val_if_fail (pinos_stream_get_state (stream) == PINOS_STREAM_STATE_UNCONNECTED, FALSE); g_return_val_if_fail (pinos_stream_get_state (stream) == PINOS_STREAM_STATE_UNCONNECTED, FALSE);
priv->direction = direction; priv->direction = direction;
@ -681,7 +681,7 @@ pinos_stream_connect_provide (PinosStream *stream,
priv = stream->priv; priv = stream->priv;
context = priv->context; context = priv->context;
g_return_val_if_fail (pinos_context_get_state (context) == PINOS_CONTEXT_STATE_READY, FALSE); g_return_val_if_fail (pinos_context_get_state (context) == PINOS_CONTEXT_STATE_CONNECTED, FALSE);
if (priv->possible_formats) if (priv->possible_formats)
g_bytes_unref (priv->possible_formats); g_bytes_unref (priv->possible_formats);
@ -810,7 +810,7 @@ pinos_stream_disconnect (PinosStream *stream)
g_return_val_if_fail (priv->state >= PINOS_STREAM_STATE_READY, FALSE); g_return_val_if_fail (priv->state >= PINOS_STREAM_STATE_READY, FALSE);
g_return_val_if_fail (priv->node != NULL, FALSE); g_return_val_if_fail (priv->node != NULL, FALSE);
context = priv->context; context = priv->context;
g_return_val_if_fail (pinos_context_get_state (context) >= PINOS_CONTEXT_STATE_READY, FALSE); g_return_val_if_fail (pinos_context_get_state (context) >= PINOS_CONTEXT_STATE_CONNECTED, FALSE);
g_return_val_if_fail (!priv->disconnecting, FALSE); g_return_val_if_fail (!priv->disconnecting, FALSE);
priv->disconnecting = TRUE; priv->disconnecting = TRUE;

View file

@ -380,7 +380,7 @@ gst_pinos_device_provider_probe (GstDeviceProvider * provider)
goto failed; goto failed;
} }
if (state == PINOS_CONTEXT_STATE_READY) if (state == PINOS_CONTEXT_STATE_CONNECTED)
break; break;
/* Wait until something happens */ /* Wait until something happens */
@ -442,10 +442,9 @@ context_state_notify (GObject *gobject,
switch (state) { switch (state) {
case PINOS_CONTEXT_STATE_CONNECTING: case PINOS_CONTEXT_STATE_CONNECTING:
case PINOS_CONTEXT_STATE_REGISTERING:
break; break;
case PINOS_CONTEXT_STATE_UNCONNECTED: case PINOS_CONTEXT_STATE_UNCONNECTED:
case PINOS_CONTEXT_STATE_READY: case PINOS_CONTEXT_STATE_CONNECTED:
break; break;
case PINOS_CONTEXT_STATE_ERROR: case PINOS_CONTEXT_STATE_ERROR:
GST_ERROR_OBJECT (self, "context error: %s", GST_ERROR_OBJECT (self, "context error: %s",
@ -512,7 +511,7 @@ gst_pinos_device_provider_start (GstDeviceProvider * provider)
goto not_running; goto not_running;
} }
if (state == PINOS_CONTEXT_STATE_READY) if (state == PINOS_CONTEXT_STATE_CONNECTED)
break; break;
/* Wait until something happens */ /* Wait until something happens */

View file

@ -673,8 +673,7 @@ on_context_notify (GObject *gobject,
switch (state) { switch (state) {
case PINOS_CONTEXT_STATE_UNCONNECTED: case PINOS_CONTEXT_STATE_UNCONNECTED:
case PINOS_CONTEXT_STATE_CONNECTING: case PINOS_CONTEXT_STATE_CONNECTING:
case PINOS_CONTEXT_STATE_REGISTERING: case PINOS_CONTEXT_STATE_CONNECTED:
case PINOS_CONTEXT_STATE_READY:
break; break;
case PINOS_CONTEXT_STATE_ERROR: case PINOS_CONTEXT_STATE_ERROR:
GST_ELEMENT_ERROR (pinossink, RESOURCE, FAILED, GST_ELEMENT_ERROR (pinossink, RESOURCE, FAILED,
@ -706,7 +705,7 @@ gst_pinos_sink_open (GstPinosSink * pinossink)
while (TRUE) { while (TRUE) {
PinosContextState state = pinos_context_get_state (pinossink->ctx); PinosContextState state = pinos_context_get_state (pinossink->ctx);
if (state == PINOS_CONTEXT_STATE_READY) if (state == PINOS_CONTEXT_STATE_CONNECTED)
break; break;
if (state == PINOS_CONTEXT_STATE_ERROR) if (state == PINOS_CONTEXT_STATE_ERROR)

View file

@ -906,8 +906,7 @@ on_context_notify (GObject *gobject,
switch (state) { switch (state) {
case PINOS_CONTEXT_STATE_UNCONNECTED: case PINOS_CONTEXT_STATE_UNCONNECTED:
case PINOS_CONTEXT_STATE_CONNECTING: case PINOS_CONTEXT_STATE_CONNECTING:
case PINOS_CONTEXT_STATE_REGISTERING: case PINOS_CONTEXT_STATE_CONNECTED:
case PINOS_CONTEXT_STATE_READY:
break; break;
case PINOS_CONTEXT_STATE_ERROR: case PINOS_CONTEXT_STATE_ERROR:
GST_ELEMENT_ERROR (pinossrc, RESOURCE, FAILED, GST_ELEMENT_ERROR (pinossrc, RESOURCE, FAILED,
@ -954,7 +953,7 @@ gst_pinos_src_open (GstPinosSrc * pinossrc)
while (TRUE) { while (TRUE) {
PinosContextState state = pinos_context_get_state (pinossrc->ctx); PinosContextState state = pinos_context_get_state (pinossrc->ctx);
if (state == PINOS_CONTEXT_STATE_READY) if (state == PINOS_CONTEXT_STATE_CONNECTED)
break; break;
if (state == PINOS_CONTEXT_STATE_ERROR) if (state == PINOS_CONTEXT_STATE_ERROR)

View file

@ -133,7 +133,7 @@ on_state_notify (GObject *gobject,
case PINOS_CONTEXT_STATE_ERROR: case PINOS_CONTEXT_STATE_ERROR:
g_main_loop_quit (loop); g_main_loop_quit (loop);
break; break;
case PINOS_CONTEXT_STATE_READY: case PINOS_CONTEXT_STATE_CONNECTED:
{ {
PinosStream *stream; PinosStream *stream;
GBytes *format; GBytes *format;