validate:scenario: Properly check that remaining actions are not 'ending' ones
authorThibault Saunier <tsaunier@gnome.org>
Wed, 23 Jul 2014 12:51:43 +0000 (14:51 +0200)
committerThibault Saunier <tsaunier@gnome.org>
Wed, 23 Jul 2014 15:49:44 +0000 (17:49 +0200)
When checking that all action were executed, we need to make sure that
actions such as EOS or stop are not taken into account as we might have
shorter medias than the duration of the scenario, and that should not be
fatal.

+ Plug a leak on the way

validate/gst/validate/gst-validate-scenario.c

index b9dd381..88dfa03 100644 (file)
@@ -1073,15 +1073,20 @@ message_cb (GstBus * bus, GstMessage * message, GstValidateScenario * scenario)
 
         for (tmp = scenario->priv->actions; tmp; tmp = tmp->next) {
           GstValidateAction *action = ((GstValidateAction *) tmp->data);
+          gchar *action_string;
           tmpconcat = actions;
 
-          if (g_strcmp0 (action->name, "eos"))
+          action_string = gst_structure_to_string (action->structure);
+          if (g_regex_match_simple ("eos|stop", action_string, 0, 0)) {
+            g_free (action_string);
             continue;
+          }
 
           nb_actions++;
-          actions = g_strdup_printf ("%s\n%*s%s",
-              actions, 20, "", gst_structure_to_string (action->structure));
+          actions =
+              g_strdup_printf ("%s\n%*s%s", actions, 20, "", action_string);
           g_free (tmpconcat);
+          g_free (action_string);
 
         }