if (monitor->scenario)
g_object_unref (monitor->scenario);
+ if (monitor->print_pos_srcid) {
+ if (g_source_remove (monitor->print_pos_srcid))
+ monitor->print_pos_srcid = 0;
+ }
+
g_list_free_full (monitor->element_monitors, g_object_unref);
G_OBJECT_CLASS (parent_class)->dispose (object);
{
}
+static gboolean
+print_position (GstValidateMonitor *monitor)
+{
+ GstQuery *query;
+ gint64 position, duration;
+ GstElement *pipeline = GST_ELEMENT (GST_VALIDATE_MONITOR_GET_OBJECT (monitor));
+
+ gdouble rate = 1.0;
+ GstFormat format = GST_FORMAT_TIME;
+
+ gst_element_query_position (pipeline, format, &position);
+
+ format = GST_FORMAT_TIME;
+ gst_element_query_duration (pipeline, format, &duration);
+
+ query = gst_query_new_segment (GST_FORMAT_DEFAULT);
+ if (gst_element_query (pipeline, query))
+ gst_query_parse_segment (query, &rate, NULL, NULL, NULL);
+ gst_query_unref (query);
+
+ gst_validate_printf (NULL,
+ "<position: %" GST_TIME_FORMAT " duration: %" GST_TIME_FORMAT
+ " speed: %f />\r", GST_TIME_ARGS (position), GST_TIME_ARGS (duration),
+ rate);
+
+ return TRUE;
+}
+
static void
gst_validate_bin_monitor_create_scenarios (GstValidateBinMonitor * monitor)
{
if (GST_IS_PIPELINE (GST_VALIDATE_MONITOR_GET_OBJECT (monitor))) {
const gchar *scenario_name;
+ monitor->print_pos_srcid =
+ g_timeout_add (500, (GSourceFunc) print_position, monitor);
+
if ((scenario_name = g_getenv ("GST_VALIDATE_SCENARIO"))) {
gchar **scenario_v = g_strsplit (scenario_name, "->", 2);
/*< private >*/
gulong element_added_id;
+ guint print_pos_srcid;
};
/**
_("Query position reported a value outside of the current expected "
"segment"), NULL);
REGISTER_VALIDATE_ISSUE (CRITICAL, SCENARIO_NOT_ENDED,
- _("All the actions were not executed before the program stoped"),
- NULL);
+ _("All the actions were not executed before the program stoped"), NULL);
REGISTER_VALIDATE_ISSUE (CRITICAL, SCENARIO_ACTION_EXECUTION_ERROR,
- _("The execution of an action did not properly happen"),
- NULL);
+ _("The execution of an action did not properly happen"), NULL);
REGISTER_VALIDATE_ISSUE (WARNING, G_LOG_WARNING, _("We got a g_log warning"),
- NULL);
+ NULL);
REGISTER_VALIDATE_ISSUE (WARNING, G_LOG_CRITICAL,
- _("We got a g_log critical issue"), NULL);
+ _("We got a g_log critical issue"), NULL);
REGISTER_VALIDATE_ISSUE (ISSUE, G_LOG_ISSUE, _("We got a g_log issue"), NULL);
}
static gboolean eos_on_shutdown = FALSE;
static gboolean force_reencoding = FALSE;
static GList *all_raw_caps = NULL;
-static guint print_pos_srcid = 0;
static gboolean buffering = FALSE;
static gboolean is_live = FALSE;
return TRUE;
}
-static gboolean
-print_position (void)
-{
- GstQuery *query;
- gint64 position, duration;
-
- gdouble rate = 1.0;
- GstFormat format = GST_FORMAT_TIME;
-
- gst_element_query_position (pipeline, format, &position);
-
- format = GST_FORMAT_TIME;
- gst_element_query_duration (pipeline, format, &duration);
-
- query = gst_query_new_segment (GST_FORMAT_DEFAULT);
- if (gst_element_query (pipeline, query))
- gst_query_parse_segment (query, &rate, NULL, NULL, NULL);
- gst_query_unref (query);
-
- g_print ("<position: %" GST_TIME_FORMAT " duration: %" GST_TIME_FORMAT
- " speed: %f />\r", GST_TIME_ARGS (position), GST_TIME_ARGS (duration),
- rate);
-
- return TRUE;
-}
-
static gboolean
bus_callback (GstBus * bus, GstMessage * message, gpointer data)
{
gst_message_parse_state_changed (message, &old, &new, &pending);
if (new == GST_STATE_PLAYING) {
- if (print_pos_srcid == 0)
- print_pos_srcid =
- g_timeout_add (50, (GSourceFunc) print_position, NULL);
GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (pipeline),
GST_DEBUG_GRAPH_SHOW_ALL, "gst-validate-transcode.playing");
}
/* buffering... */
if (!buffering) {
gst_element_set_state (pipeline, GST_STATE_PAUSED);
- if (print_pos_srcid) {
- if (g_source_remove (print_pos_srcid))
- print_pos_srcid = 0;
- }
buffering = TRUE;
}
}
static gboolean buffering = FALSE;
static gboolean is_live = FALSE;
-static guint print_pos_srcid = 0;
#ifdef G_OS_UNIX
static gboolean
}
#endif /* G_OS_UNIX */
-static gboolean
-print_position (void)
-{
- GstQuery *query;
- gint64 position, duration;
-
- gdouble rate = 1.0;
- GstFormat format = GST_FORMAT_TIME;
-
- gst_element_query_position (pipeline, format, &position);
-
- format = GST_FORMAT_TIME;
- gst_element_query_duration (pipeline, format, &duration);
-
- query = gst_query_new_segment (GST_FORMAT_DEFAULT);
- if (gst_element_query (pipeline, query))
- gst_query_parse_segment (query, &rate, NULL, NULL, NULL);
- gst_query_unref (query);
-
- g_print ("<position: %" GST_TIME_FORMAT " duration: %" GST_TIME_FORMAT
- " speed: %f />\r", GST_TIME_ARGS (position), GST_TIME_ARGS (duration),
- rate);
-
- return TRUE;
-}
-
static gboolean
bus_callback (GstBus * bus, GstMessage * message, gpointer data)
{
g_main_loop_quit (loop);
break;
case GST_MESSAGE_ASYNC_DONE:
- if (print_pos_srcid == 0)
- print_pos_srcid =
- g_timeout_add (50, (GSourceFunc) print_position, NULL);
break;
case GST_MESSAGE_STATE_CHANGED:
if (GST_MESSAGE_SRC (message) == GST_OBJECT (pipeline)) {
/* buffering... */
if (!buffering) {
gst_element_set_state (pipeline, GST_STATE_PAUSED);
- if (print_pos_srcid) {
- if (g_source_remove (print_pos_srcid))
- print_pos_srcid = 0;
- }
buffering = TRUE;
}
}