mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-18 13:25:56 +00:00
gst-qa: add seek-tests option
The seek-tests does a simple seeking after the pipeline has started so that seeking checks can be performed by the monitors
This commit is contained in:
parent
c3c1d2e68c
commit
7de70978cf
1 changed files with 31 additions and 2 deletions
|
@ -2,12 +2,22 @@
|
|||
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
|
||||
static gboolean
|
||||
bus_callback (GstBus * bus, GstMessage * message, gpointer data)
|
||||
{
|
||||
|
@ -27,6 +37,24 @@ 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;
|
||||
}
|
||||
|
@ -39,13 +67,13 @@ main (int argc, gchar ** argv)
|
|||
{
|
||||
GError *err = NULL;
|
||||
GOptionEntry options[] = {
|
||||
{"seek-test", '\0', 0, G_OPTION_ARG_NONE, &seek_tests,
|
||||
"Perform the seeking use case", NULL},
|
||||
{NULL}
|
||||
};
|
||||
GOptionContext *ctx;
|
||||
GMainLoop *mainloop;
|
||||
gchar **argvn;
|
||||
GstQaRunner *runner;
|
||||
GstElement *pipeline;
|
||||
GstBus *bus;
|
||||
|
||||
ctx = g_option_context_new ("- runs QA tests for a pipeline.");
|
||||
|
@ -79,6 +107,7 @@ main (int argc, gchar ** argv)
|
|||
gst_bus_add_watch (bus, bus_callback, mainloop);
|
||||
gst_object_unref (bus);
|
||||
|
||||
g_print ("Starting pipeline\n");
|
||||
if (gst_element_set_state (pipeline,
|
||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE)
|
||||
goto exit;
|
||||
|
|
Loading…
Reference in a new issue