Improve default source state

Default source state should be SUSPENDED
This commit is contained in:
Wim Taymans 2015-07-09 11:34:34 +02:00
parent 4199d5652e
commit 53bc0f7848
4 changed files with 14 additions and 12 deletions

View file

@ -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;
/**

View file

@ -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;

View file

@ -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;

View file

@ -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 *