GstValidateBinMonitor * monitor);
static void
+gst_validate_bin_set_media_descriptor (GstValidateMonitor * monitor,
+ GstMediaDescriptor * media_descriptor)
+{
+ GList *tmp;
+
+ GST_VALIDATE_MONITOR_LOCK (monitor);
+ for (tmp = GST_VALIDATE_BIN_MONITOR_CAST (monitor)->element_monitors; tmp;
+ tmp = tmp->next)
+ gst_validate_monitor_set_media_descriptor (tmp->data, media_descriptor);
+ GST_VALIDATE_MONITOR_UNLOCK (monitor);
+
+ GST_VALIDATE_MONITOR_CLASS (parent_class)->set_media_descriptor (monitor,
+ media_descriptor);
+}
+
+static void
gst_validate_bin_monitor_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
FALSE, G_PARAM_READABLE));
validatemonitor_class->setup = gst_validate_bin_monitor_setup;
+ validatemonitor_class->set_media_descriptor =
+ gst_validate_bin_set_media_descriptor;
}
static void
GstValidateElementMonitor * monitor);
static void
+gst_validate_element_set_media_descriptor (GstValidateMonitor * monitor,
+ GstMediaDescriptor * media_descriptor)
+{
+ gboolean done;
+ GstPad *pad;
+ GstValidateMonitor *pmonitor;
+ GstIterator *iterator;
+
+ iterator =
+ gst_element_iterate_pads (GST_ELEMENT (GST_VALIDATE_MONITOR_GET_OBJECT
+ (monitor)));
+ done = FALSE;
+ while (!done) {
+ GValue value = { 0, };
+
+ switch (gst_iterator_next (iterator, &value)) {
+ case GST_ITERATOR_OK:
+
+ pad = g_value_get_object (&value);
+
+ pmonitor = g_object_get_data ((GObject *) pad, "validate-monitor");
+ if (pmonitor)
+ gst_validate_monitor_set_media_descriptor (pmonitor,
+ media_descriptor);
+ g_value_reset (&value);
+ break;
+ case GST_ITERATOR_RESYNC:
+ /* TODO how to handle this? */
+ gst_iterator_resync (iterator);
+ break;
+ case GST_ITERATOR_ERROR:
+ done = TRUE;
+ break;
+ case GST_ITERATOR_DONE:
+ done = TRUE;
+ break;
+ }
+ }
+ gst_iterator_free (iterator);
+}
+
+
+static void
gst_validate_element_monitor_dispose (GObject * object)
{
GstValidateElementMonitor *monitor =
monitor_klass->setup = gst_validate_element_monitor_do_setup;
monitor_klass->get_element = gst_validate_element_monitor_get_element;
+ monitor_klass->set_media_descriptor =
+ gst_validate_element_set_media_descriptor;
}
static void
g_object_weak_unref (G_OBJECT (monitor->target),
(GWeakNotify) _target_freed_cb, monitor);
+ if (monitor->media_descriptor)
+ gst_object_unref (monitor->media_descriptor);
+
G_OBJECT_CLASS (parent_class)->dispose (object);
}
(type,
n_construct_params,
construct_params));
+
+ if (monitor->parent) {
+ gst_validate_monitor_set_media_descriptor (monitor,
+ monitor->parent->media_descriptor);
+ }
+
+
gst_validate_monitor_setup (monitor);
return (GObject *) monitor;
}
break;
}
}
+
+void
+gst_validate_monitor_set_media_descriptor (GstValidateMonitor * monitor,
+ GstMediaDescriptor * media_descriptor)
+{
+ GstValidateMonitorClass *klass = GST_VALIDATE_MONITOR_GET_CLASS (monitor);
+
+ GST_DEBUG_OBJECT (monitor->target, "Set media desc: %" GST_PTR_FORMAT,
+ media_descriptor);
+ if (monitor->media_descriptor)
+ gst_object_unref (monitor->media_descriptor);
+
+ if (media_descriptor)
+ gst_object_ref (media_descriptor);
+
+ monitor->media_descriptor = media_descriptor;
+ if (klass->set_media_descriptor)
+ klass->set_media_descriptor (monitor, media_descriptor);
+}
#include <gst/validate/gst-validate-reporter.h>
#include <gst/validate/gst-validate-runner.h>
#include <gst/validate/gst-validate-override.h>
+#include <gst/validate/media-descriptor-parser.h>
G_BEGIN_DECLS
GMutex overrides_mutex;
GQueue overrides;
+ GstMediaDescriptor *media_descriptor;
GstValidateReportingLevel level;
gboolean (* setup) (GstValidateMonitor * monitor);
GstElement *(* get_element) (GstValidateMonitor * monitor);
+ void (*set_media_descriptor) (GstValidateMonitor * monitor,
+ GstMediaDescriptor * media_descriptor);
};
/* normal GObject stuff */
GstElement * gst_validate_monitor_get_element (GstValidateMonitor * monitor);
const gchar * gst_validate_monitor_get_element_name (GstValidateMonitor * monitor);
-
+void gst_validate_monitor_set_media_descriptor (GstValidateMonitor * monitor,
+ GstMediaDescriptor *media_descriptor);
G_END_DECLS
#endif /* __GST_VALIDATE_MONITOR_H__ */
#include <gst/validate/validate.h>
#include <gst/validate/gst-validate-scenario.h>
#include <gst/validate/gst-validate-utils.h>
+#include <gst/validate/media-descriptor-parser.h>
#ifdef G_OS_UNIX
#include <glib-unix.h>
main (int argc, gchar ** argv)
{
GError *err = NULL;
- const gchar *scenario = NULL, *configs = NULL;
+ const gchar *scenario = NULL, *configs = NULL, *media_info = NULL;
gboolean list_scenarios = FALSE, monitor_handles_state,
inspect_action_type = FALSE;
GstStateChangeReturn sret;
" if no parameter passed, it will list all avalaible action types"
" otherwize will print the full description of the wanted types",
NULL},
+ {"set-media-info", '\0', 0, G_OPTION_ARG_STRING, &media_info,
+ "Set a media_info XML file descriptor to share information about the"
+ " media file that will be reproduced.",
+ NULL},
{"set-configs", '\0', 0, G_OPTION_ARG_STRING, &configs,
"Let you set a config scenario, the scenario needs to be set as 'config"
"' you can specify a list of scenario separated by ':'"
- " it will override the GST_VALIDATE_SCENARIO environment variable,",
+ " it will override the GST_VALIDATE_SCENARIO environment variable.",
NULL},
{NULL}
};
runner, NULL);
gst_validate_reporter_set_handle_g_logs (GST_VALIDATE_REPORTER (monitor));
+ if (media_info) {
+ GError *err = NULL;
+ GstMediaDescriptorParser *parser = gst_media_descriptor_parser_new (runner,
+ media_info, &err);
+
+ if (parser == NULL) {
+ GST_ERROR ("Could not use %s as a media-info file (error: %s)",
+ media_info, err ? err->message : "Unknown error");
+
+ exit (1);
+ }
+
+ gst_validate_monitor_set_media_descriptor (monitor,
+ GST_MEDIA_DESCRIPTOR (parser));
+ gst_object_unref (parser);
+ }
+
mainloop = g_main_loop_new (NULL, FALSE);
bus = gst_element_get_bus (pipeline);
gst_bus_add_signal_watch (bus);