mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 19:42:26 +00:00
scenarios: add a stateless property.
This property enables the user to have actions executed independently of the state of the pipeline. Conflicts: validate/gst/validate/gst-validate-scenario.c
This commit is contained in:
parent
1332e9fc4f
commit
7d4abf31e7
3 changed files with 83 additions and 5 deletions
|
@ -38,11 +38,24 @@
|
|||
* TODO
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_STATELESS,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
#define gst_validate_bin_monitor_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstValidateBinMonitor, gst_validate_bin_monitor,
|
||||
GST_TYPE_VALIDATE_ELEMENT_MONITOR);
|
||||
|
||||
static void
|
||||
gst_validate_bin_monitor_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * pspec);
|
||||
static void
|
||||
gst_validate_bin_monitor_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec);
|
||||
static void
|
||||
gst_validate_bin_monitor_wrap_element (GstValidateBinMonitor * monitor,
|
||||
GstElement * element);
|
||||
static gboolean gst_validate_bin_monitor_setup (GstValidateMonitor * monitor);
|
||||
|
@ -51,6 +64,44 @@ static void
|
|||
_validate_bin_element_added (GstBin * bin, GstElement * pad,
|
||||
GstValidateBinMonitor * monitor);
|
||||
|
||||
static void
|
||||
gst_validate_bin_monitor_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstValidateBinMonitor *monitor;
|
||||
|
||||
monitor = GST_VALIDATE_BIN_MONITOR_CAST (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_STATELESS:
|
||||
monitor->stateless = g_value_get_boolean(value);
|
||||
if (monitor->scenario != NULL)
|
||||
g_object_set(monitor->scenario, "stateless", monitor->stateless, NULL);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_validate_bin_monitor_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstValidateBinMonitor *monitor;
|
||||
|
||||
monitor = GST_VALIDATE_BIN_MONITOR_CAST (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_STATELESS:
|
||||
g_value_set_boolean (value, monitor->stateless);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_validate_bin_monitor_dispose (GObject * object)
|
||||
{
|
||||
|
@ -83,8 +134,15 @@ gst_validate_bin_monitor_class_init (GstValidateBinMonitorClass * klass)
|
|||
gobject_class = G_OBJECT_CLASS (klass);
|
||||
validatemonitor_class = GST_VALIDATE_MONITOR_CLASS_CAST (klass);
|
||||
|
||||
gobject_class->get_property = gst_validate_bin_monitor_get_property;
|
||||
gobject_class->set_property = gst_validate_bin_monitor_set_property;
|
||||
gobject_class->dispose = gst_validate_bin_monitor_dispose;
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_STATELESS,
|
||||
g_param_spec_boolean ("stateless", "Stateless", "True to execute actions as soon as possible, regardless "
|
||||
"of the initial state of the pipeline",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
|
||||
validatemonitor_class->setup = gst_validate_bin_monitor_setup;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ struct _GstValidateBinMonitor {
|
|||
/*< private >*/
|
||||
gulong element_added_id;
|
||||
guint print_pos_srcid;
|
||||
gboolean stateless;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -47,6 +47,7 @@ enum
|
|||
{
|
||||
PROP_0,
|
||||
PROP_RUNNER,
|
||||
PROP_STATELESS,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
|
@ -83,6 +84,8 @@ struct _GstValidateScenarioPrivate
|
|||
|
||||
guint num_actions;
|
||||
|
||||
gboolean stateless;
|
||||
|
||||
guint get_pos_id;
|
||||
guint wait_id;
|
||||
|
||||
|
@ -874,13 +877,12 @@ message_cb (GstBus * bus, GstMessage * message, GstValidateScenario * scenario)
|
|||
|
||||
gst_message_parse_state_changed (message,
|
||||
&pstate, &nstate, NULL);
|
||||
|
||||
if (scenario->priv->target_state == nstate)
|
||||
scenario->priv->changing_state = FALSE;
|
||||
|
||||
if (pstate == GST_STATE_READY && nstate == GST_STATE_PAUSED)
|
||||
_add_get_position_source (scenario);
|
||||
|
||||
if (GST_MESSAGE_SRC (message) == GST_OBJECT(scenario->pipeline)) {
|
||||
if (scenario->priv->target_state == nstate)
|
||||
scenario->priv->changing_state = FALSE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1276,6 +1278,8 @@ static void
|
|||
gst_validate_scenario_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstValidateScenario *self = GST_VALIDATE_SCENARIO (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_RUNNER:
|
||||
/* we assume the runner is valid as long as this scenario is,
|
||||
|
@ -1283,6 +1287,11 @@ gst_validate_scenario_set_property (GObject * object, guint prop_id,
|
|||
gst_validate_reporter_set_runner (GST_VALIDATE_REPORTER (object),
|
||||
g_value_get_object (value));
|
||||
break;
|
||||
case PROP_STATELESS:
|
||||
self->priv->stateless = g_value_get_boolean (value);
|
||||
if (self->priv->stateless)
|
||||
_add_get_position_source (self);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1292,6 +1301,8 @@ static void
|
|||
gst_validate_scenario_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstValidateScenario *self = GST_VALIDATE_SCENARIO (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_RUNNER:
|
||||
/* we assume the runner is valid as long as this scenario is,
|
||||
|
@ -1299,6 +1310,9 @@ gst_validate_scenario_get_property (GObject * object, guint prop_id,
|
|||
g_value_set_object (value,
|
||||
gst_validate_reporter_get_runner (GST_VALIDATE_REPORTER (object)));
|
||||
break;
|
||||
case PROP_STATELESS:
|
||||
g_value_set_boolean(value, self->priv->stateless);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1322,6 +1336,11 @@ gst_validate_scenario_class_init (GstValidateScenarioClass * klass)
|
|||
"The Validate runner to " "report errors to",
|
||||
GST_TYPE_VALIDATE_RUNNER,
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_STATELESS,
|
||||
g_param_spec_boolean ("stateless", "Stateless", "True to execute actions as soon as possible, regardless "
|
||||
"of the initial state of the pipeline",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue