validate: Add a method to get action->scenario in a thread safe way

API:
  gst_validate_action_get_scenario
This commit is contained in:
Thibault Saunier 2015-07-25 10:54:19 +02:00
parent 386b91522c
commit df76ce5812
3 changed files with 29 additions and 2 deletions

View file

@ -46,6 +46,8 @@ gst_validate_list_scenarios
gst_validate_register_action_type gst_validate_register_action_type
gst_validate_action_get_clocktime gst_validate_action_get_clocktime
gst_validate_scenario_execute_seek gst_validate_scenario_execute_seek
gst_validate_action_set_done
gst_validate_action_get_scenario
GstValidateActionType GstValidateActionType
<SUBSECTION Private> <SUBSECTION Private>
gst_validate_scenario_factory_create gst_validate_scenario_factory_create

View file

@ -2923,9 +2923,16 @@ _action_set_done (GstValidateAction * action)
execute_next_action (action->scenario); execute_next_action (action->scenario);
} }
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
} }
/* gst_validate_action_set_done:
* @action: The action that is done executing
*
* Sets @action as "done" meaning that the next action can
* now be executed.
*/
void void
gst_validate_action_set_done (GstValidateAction * action) gst_validate_action_set_done (GstValidateAction * action)
{ {
@ -2953,6 +2960,20 @@ gst_validate_action_set_done (GstValidateAction * action)
(GDestroyNotify) gst_validate_action_unref); (GDestroyNotify) gst_validate_action_unref);
} }
/* gst_validate_action_get_scenario:
* @action: The action from which to retrieve the scenario
*
* Retrieve the scenario from which @action is executed.
*
* Returns: (transfer full): The scenario from which the action
* is being executed.
*/
GstValidateScenario *
gst_validate_action_get_scenario (GstValidateAction * action)
{
return g_weak_ref_get (&action->priv->scenario);
}
/** /**
* gst_validate_register_action_type: * gst_validate_register_action_type:
* @type_name: The name of the new action type to add * @type_name: The name of the new action type to add

View file

@ -88,7 +88,10 @@ typedef struct _GstValidateActionPrivate GstValidateActionPrivate;
* #gst_validate_register_action_type * #gst_validate_register_action_type
* @name: The name of the action, set from the user in the scenario * @name: The name of the action, set from the user in the scenario
* @structure: the #GstStructure defining the action * @structure: the #GstStructure defining the action
* @scenario: The scenario for this action * @scenario: The scenario for this action. This is not thread
* safe and should be accessed exculsively from the main thread.
* If you need to access it from another thread use the
* #gst_validate_action_get_scenario method
* *
* The GstValidateAction defined to be executed as part of a scenario * The GstValidateAction defined to be executed as part of a scenario
* *
@ -115,6 +118,7 @@ struct _GstValidateAction
}; };
void gst_validate_action_set_done (GstValidateAction *action); void gst_validate_action_set_done (GstValidateAction *action);
GstValidateScenario * gst_validate_action_get_scenario (GstValidateAction *action);
#define GST_TYPE_VALIDATE_ACTION (gst_validate_action_get_type ()) #define GST_TYPE_VALIDATE_ACTION (gst_validate_action_get_type ())
#define GST_IS_VALIDATE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_ACTION)) #define GST_IS_VALIDATE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_ACTION))