mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
qa: Make it possible to set a scenario from the command line in test apps
This commit is contained in:
parent
382fcc9a01
commit
1e1e0b922e
2 changed files with 18 additions and 25 deletions
|
@ -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 |<presence>, eg:\n"
|
||||
"video/webm:video/x-vp8|<presence>: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) {
|
||||
|
|
|
@ -12,9 +12,6 @@
|
|||
#include <gst/gst.h>
|
||||
#include <gst/qa/qa.h>
|
||||
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue