validate:scenario: Add a Flag fore ActionType that need clocks sync

And cleanly use it to set the need-clock-sync field in
the scenario properties

https://bugzilla.gnome.org/show_bug.cgi?id=743994
This commit is contained in:
Thibault Saunier 2014-12-13 23:12:30 +01:00
parent ef0f78f600
commit c74f33bd17
2 changed files with 12 additions and 9 deletions

View file

@ -1937,14 +1937,13 @@ _parse_scenario (GFile * f, GKeyFile * kf)
GList *tmp, *structures = structs_parse_from_gfile (f); GList *tmp, *structures = structs_parse_from_gfile (f);
for (tmp = structures; tmp; tmp = tmp->next) { for (tmp = structures; tmp; tmp = tmp->next) {
if (gst_structure_has_name (tmp->data, "description")) { GstValidateActionType *type =
_find_action_type (gst_structure_get_name (tmp->data));
if (gst_structure_has_name (tmp->data, "description"))
desc = gst_structure_copy (tmp->data); desc = gst_structure_copy (tmp->data);
} else if (gst_structure_has_name (tmp->data, "pause") || else if (type && type->flags & GST_VALIDATE_ACTION_TYPE_NEEDS_CLOCK)
(gst_structure_has_name (tmp->data, "set-state") &&
g_strcmp0 (gst_structure_get_string (tmp->data, "state"),
"paused") == 0)) {
needs_clock_sync = TRUE; needs_clock_sync = TRUE;
}
} }
if (needs_clock_sync) { if (needs_clock_sync) {
@ -2401,7 +2400,7 @@ init_scenarios (void)
"Seeks into the stream, example of a seek happening when the stream reaches 5 seconds\n" "Seeks into the stream, example of a seek happening when the stream reaches 5 seconds\n"
"or 1 eighth of its duration and seeks at 10sec or 2 eighth of its duration:\n" "or 1 eighth of its duration and seeks at 10sec or 2 eighth of its duration:\n"
" seek, playback-time=\"min(5.0, (duration/8))\", start=\"min(10, 2*(duration/8))\", flags=accurate+flush", " seek, playback-time=\"min(5.0, (duration/8))\", start=\"min(10, 2*(duration/8))\", flags=accurate+flush",
GST_VALIDATE_ACTION_TYPE_NONE GST_VALIDATE_ACTION_TYPE_NEEDS_CLOCK
); );
REGISTER_ACTION_TYPE ("pause", _execute_pause, REGISTER_ACTION_TYPE ("pause", _execute_pause,
@ -2418,7 +2417,8 @@ init_scenarios (void)
}), }),
"Sets pipeline to PAUSED. You can add a 'duration'\n" "Sets pipeline to PAUSED. You can add a 'duration'\n"
"parametter so the pipeline goes back to playing after that duration\n" "parametter so the pipeline goes back to playing after that duration\n"
"(in second)", GST_VALIDATE_ACTION_TYPE_NONE); "(in second)",
GST_VALIDATE_ACTION_TYPE_NEEDS_CLOCK & GST_VALIDATE_ACTION_TYPE_ASYNC);
REGISTER_ACTION_TYPE ("play", _execute_play, NULL, REGISTER_ACTION_TYPE ("play", _execute_play, NULL,
"Sets the pipeline state to PLAYING", GST_VALIDATE_ACTION_TYPE_NONE); "Sets the pipeline state to PLAYING", GST_VALIDATE_ACTION_TYPE_NONE);
@ -2505,7 +2505,7 @@ init_scenarios (void)
{NULL} {NULL}
}), }),
"Changes the state of the pipeline to any GstState", "Changes the state of the pipeline to any GstState",
GST_VALIDATE_ACTION_TYPE_ASYNC); GST_VALIDATE_ACTION_TYPE_ASYNC & GST_VALIDATE_ACTION_TYPE_NEEDS_CLOCK);
REGISTER_ACTION_TYPE ("set-property", _execute_set_property, REGISTER_ACTION_TYPE ("set-property", _execute_set_property,
((GstValidateActionParameter []) { ((GstValidateActionParameter []) {

View file

@ -113,6 +113,8 @@ typedef struct _GstValidateActionType GstValidateActionType;
* @GST_VALIDATE_ACTION_TYPE_INTERLACED: The action will be executed async * @GST_VALIDATE_ACTION_TYPE_INTERLACED: The action will be executed async
* but without blocking further actions * but without blocking further actions
* to be executed * to be executed
* @GST_VALIDATE_ACTION_TYPE_NEEDS_CLOCK: The pipeline will need to be synchronized with the clock
* for that action type to be used.
*/ */
typedef enum typedef enum
{ {
@ -120,6 +122,7 @@ typedef enum
GST_VALIDATE_ACTION_TYPE_CONFIG = 1 << 1, GST_VALIDATE_ACTION_TYPE_CONFIG = 1 << 1,
GST_VALIDATE_ACTION_TYPE_ASYNC = 1 << 2, GST_VALIDATE_ACTION_TYPE_ASYNC = 1 << 2,
GST_VALIDATE_ACTION_TYPE_INTERLACED = 1 << 3, GST_VALIDATE_ACTION_TYPE_INTERLACED = 1 << 3,
GST_VALIDATE_ACTION_TYPE_NEEDS_CLOCK = 1 << 5,
} GstValidateActionTypeFlags; } GstValidateActionTypeFlags;
struct _GstValidateActionType struct _GstValidateActionType