From 1e1e0b922eead2896e9f8805ed09761e4fb3e99d Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Wed, 24 Jul 2013 19:09:14 -0400 Subject: [PATCH] qa: Make it possible to set a scenario from the command line in test apps --- validate/gst/qa/gst-qa-transcoding.c | 11 +++++++++-- validate/gst/qa/gst-qa.c | 32 +++++++++----------------------- 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/validate/gst/qa/gst-qa-transcoding.c b/validate/gst/qa/gst-qa-transcoding.c index fa38640..6ca4c07 100644 --- a/validate/gst/qa/gst-qa-transcoding.c +++ b/validate/gst/qa/gst-qa-transcoding.c @@ -245,6 +245,8 @@ main (int argc, gchar ** argv) GOptionContext *ctx; GError *err = NULL; + const gchar *scenario = NULL; + GOptionEntry options[] = { {"output-format", 'o', 0, G_OPTION_ARG_CALLBACK, &_parse_encoding_profile, "Set the properties to use for the encoding profile " @@ -254,8 +256,10 @@ main (int argc, gchar ** argv) "video/webm:video/x-vp8+mypreset:audio/x-vorbis\n" "The presence property of the profile can be specified with |, eg:\n" "video/webm:video/x-vp8|:audio/x-vorbis\n", - "properties-values"} - , + "properties-values"}, + {"set-scenario", '\0', 0, G_OPTION_ARG_STRING, &scenario, + "Let you set a scanrio, it will override the GST_QA_SCENARIO " + "environment variable", NULL}, {NULL} }; @@ -270,6 +274,9 @@ main (int argc, gchar ** argv) g_option_context_free (ctx); + if (scenario) + g_setenv ("GST_QA_SCENARIO", scenario, TRUE); + gst_init (&argc, &argv); if (argc != 3) { diff --git a/validate/gst/qa/gst-qa.c b/validate/gst/qa/gst-qa.c index 1453d7c..7a732a2 100644 --- a/validate/gst/qa/gst-qa.c +++ b/validate/gst/qa/gst-qa.c @@ -12,9 +12,6 @@ #include #include -static gboolean seek_tests = FALSE; -static gboolean seek_done = FALSE; - static GMainLoop *mainloop; static GstElement *pipeline; @@ -37,24 +34,6 @@ bus_callback (GstBus * bus, GstMessage * message, gpointer data) case GST_MESSAGE_EOS: g_main_loop_quit (loop); break; - case GST_MESSAGE_STATE_CHANGED: - { - GstState new_state; - if (GST_MESSAGE_SRC (message) == (GstObject *) pipeline) { - gst_message_parse_state_changed (message, NULL, &new_state, NULL); - if (new_state == GST_STATE_PLAYING) { - /* pipeline has started, issue seeking */ - /* TODO define where to seek to with arguments? */ - if (seek_tests && !seek_done) { - g_print ("Performing seek\n"); - seek_done = TRUE; - gst_element_seek_simple (pipeline, GST_FORMAT_TIME, - GST_SEEK_FLAG_FLUSH, 5 * GST_SECOND); - } - } - } - } - break; default: break; } @@ -66,9 +45,12 @@ int main (int argc, gchar ** argv) { GError *err = NULL; + const gchar *scenario = NULL; + GOptionEntry options[] = { - {"seek-test", '\0', 0, G_OPTION_ARG_NONE, &seek_tests, - "Perform the seeking use case", NULL}, + {"set-scenario", '\0', 0, G_OPTION_ARG_STRING, &scenario, + "Let you set a scanrio, it will override the GST_QA_SCENARIO " + "environment variable", NULL}, {NULL} }; GOptionContext *ctx; @@ -90,6 +72,10 @@ main (int argc, gchar ** argv) exit (1); } + if (scenario) { + g_setenv ("GST_QA_SCENARIO", scenario, TRUE); + } + g_option_context_free (ctx); gst_init (&argc, &argv); -- 2.7.4