From 53bc0f78487d555f472badce27ba97fd694933d8 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 9 Jul 2015 11:34:34 +0200 Subject: [PATCH] Improve default source state Default source state should be SUSPENDED --- src/client/introspect.h | 16 ++++++++-------- src/modules/gst/gst-source.c | 2 +- src/server/client-source.c | 2 +- src/server/source.c | 6 ++++-- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/client/introspect.h b/src/client/introspect.h index 761780ada..f4d6543a0 100644 --- a/src/client/introspect.h +++ b/src/client/introspect.h @@ -32,20 +32,20 @@ G_BEGIN_DECLS * @PINOS_SOURCE_STATE_ERROR: the source is in error * @PINOS_SOURCE_STATE_SUSPENDED: the source is suspended, the device might * be closed - * @PINOS_SOURCE_STATE_INIT: the source is initializing, it opens the device - * and gets the device capabilities + * @PINOS_SOURCE_STATE_INITIALIZING: the source is initializing, the device is + * being opened and the capabilities are queried * @PINOS_SOURCE_STATE_IDLE: the source is running but there is no active * source-output - * @PINOS_SOURCE_STATE_RUNNING: the source is running. + * @PINOS_SOURCE_STATE_RUNNING: the source is running * * The different source states */ typedef enum { - PINOS_SOURCE_STATE_ERROR = 0, - PINOS_SOURCE_STATE_SUSPENDED = 1, - PINOS_SOURCE_STATE_INIT = 2, - PINOS_SOURCE_STATE_IDLE = 3, - PINOS_SOURCE_STATE_RUNNING = 4, + PINOS_SOURCE_STATE_ERROR = -1, + PINOS_SOURCE_STATE_SUSPENDED = 0, + PINOS_SOURCE_STATE_INITIALIZING = 1, + PINOS_SOURCE_STATE_IDLE = 2, + PINOS_SOURCE_STATE_RUNNING = 3, } PinosSourceState; /** diff --git a/src/modules/gst/gst-source.c b/src/modules/gst/gst-source.c index ac0a6b661..79b70feed 100644 --- a/src/modules/gst/gst-source.c +++ b/src/modules/gst/gst-source.c @@ -148,7 +148,7 @@ set_state (PinosSource *source, gst_element_set_state (priv->pipeline, GST_STATE_NULL); break; - case PINOS_SOURCE_STATE_INIT: + case PINOS_SOURCE_STATE_INITIALIZING: gst_element_set_state (priv->pipeline, GST_STATE_READY); break; diff --git a/src/server/client-source.c b/src/server/client-source.c index 32e9405f0..089bcfac7 100644 --- a/src/server/client-source.c +++ b/src/server/client-source.c @@ -124,7 +124,7 @@ client_set_state (PinosSource *source, gst_element_set_state (priv->pipeline, GST_STATE_NULL); break; - case PINOS_SOURCE_STATE_INIT: + case PINOS_SOURCE_STATE_INITIALIZING: gst_element_set_state (priv->pipeline, GST_STATE_READY); break; diff --git a/src/server/source.c b/src/server/source.c index d66c4e4ad..990d9260a 100644 --- a/src/server/source.c +++ b/src/server/source.c @@ -315,7 +315,7 @@ pinos_source_class_init (PinosSourceClass * klass) "State", "The state of the source", PINOS_TYPE_SOURCE_STATE, - PINOS_SOURCE_STATE_INIT, + PINOS_SOURCE_STATE_SUSPENDED, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); @@ -338,7 +338,9 @@ pinos_source_class_init (PinosSourceClass * klass) static void pinos_source_init (PinosSource * source) { - source->priv = PINOS_SOURCE_GET_PRIVATE (source); + PinosSourcePrivate *priv = source->priv = PINOS_SOURCE_GET_PRIVATE (source); + + priv->state = PINOS_SOURCE_STATE_SUSPENDED; } GBytes *