index b3b97f4ca458457b041b6f0d790624c7afacb146..c4370a3ae9101431fef23f7d471b338842d83079 100644 (file)
_gst_check_raised_warning = TRUE;
}
+static gint
+sort_plugins (GstPlugin * a, GstPlugin * b)
+{
+ int ret;
+
+ ret = strcmp (gst_plugin_get_source (a), gst_plugin_get_source (b));
+ if (ret == 0)
+ ret = strcmp (gst_plugin_get_name (a), gst_plugin_get_name (b));
+ return ret;
+}
+
+static void
+print_plugins (void)
+{
+ GList *plugins, *l;
+
+ plugins = gst_default_registry_get_plugin_list ();
+ plugins = g_list_sort (plugins, (GCompareFunc) sort_plugins);
+ for (l = plugins; l != NULL; l = l->next) {
+ GstPlugin *plugin = GST_PLUGIN (l->data);
+
+ if (strcmp (gst_plugin_get_source (plugin), "BLACKLIST") != 0) {
+ GST_LOG ("%20s@%s", gst_plugin_get_name (plugin),
+ GST_STR_NULL (gst_plugin_get_filename (plugin)));
+ }
+ }
+ gst_plugin_list_free (plugins);
+}
+
/* initialize GStreamer testing */
void
gst_check_init (int *argc, char **argv[])
g_log_set_handler ("Gst-Phonon", G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
gst_check_log_critical_func, NULL);
+ print_plugins ();
+
check_cond = g_cond_new ();
check_mutex = g_mutex_new ();
}
*/
GstPad *
gst_check_setup_src_pad (GstElement * element,
- GstStaticPadTemplate * template, GstCaps * caps)
+ GstStaticPadTemplate * tmpl, GstCaps * caps)
{
GstPad *srcpad;
- srcpad = gst_check_setup_src_pad_by_name (element, template, "sink");
+ srcpad = gst_check_setup_src_pad_by_name (element, tmpl, "sink");
if (caps)
fail_unless (gst_pad_set_caps (srcpad, caps), "could not set caps on pad");
return srcpad;
GstPad *
gst_check_setup_src_pad_by_name (GstElement * element,
- GstStaticPadTemplate * template, gchar * name)
+ GstStaticPadTemplate * tmpl, const gchar * name)
{
GstPad *srcpad, *sinkpad;
/* sending pad */
- srcpad = gst_pad_new_from_static_template (template, "src");
+ srcpad = gst_pad_new_from_static_template (tmpl, "src");
GST_DEBUG_OBJECT (element, "setting up sending pad %p", srcpad);
fail_if (srcpad == NULL, "Could not create a srcpad");
ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1);
}
void
-gst_check_teardown_pad_by_name (GstElement * element, gchar * name)
+gst_check_teardown_pad_by_name (GstElement * element, const gchar * name)
{
GstPad *pad_peer, *pad_element;
/* clean up floating src pad */
pad_element = gst_element_get_static_pad (element, name);
- ASSERT_OBJECT_REFCOUNT (pad_element, "pad", 2);
+ /* We don't check the refcount here since there *might* be
+ * a pad cache holding an extra reference on pad_element.
+ * To get to a state where no pad cache will exist,
+ * we first unlink that pad. */
pad_peer = gst_pad_get_peer (pad_element);
if (pad_peer) {
/* FIXME: set_caps isn't that useful; might want to check if fixed,
* then use set_use_fixed or somesuch */
GstPad *
-gst_check_setup_sink_pad (GstElement * element, GstStaticPadTemplate * template,
+gst_check_setup_sink_pad (GstElement * element, GstStaticPadTemplate * tmpl,
GstCaps * caps)
{
GstPad *sinkpad;
- sinkpad = gst_check_setup_sink_pad_by_name (element, template, "src");
+ sinkpad = gst_check_setup_sink_pad_by_name (element, tmpl, "src");
if (caps)
fail_unless (gst_pad_set_caps (sinkpad, caps), "Could not set pad caps");
return sinkpad;
@@ -261,12 +295,12 @@ gst_check_setup_sink_pad (GstElement * element, GstStaticPadTemplate * template,
GstPad *
gst_check_setup_sink_pad_by_name (GstElement * element,
- GstStaticPadTemplate * template, gchar * name)
+ GstStaticPadTemplate * tmpl, const gchar * name)
{
GstPad *srcpad, *sinkpad;
/* receiving pad */
- sinkpad = gst_pad_new_from_static_template (template, "sink");
+ sinkpad = gst_pad_new_from_static_template (tmpl, "sink");
GST_DEBUG_OBJECT (element, "setting up receiving pad %p", sinkpad);
fail_if (sinkpad == NULL, "Could not create a sinkpad");
void
gst_check_drop_buffers (void)
{
- GstBuffer *temp_buffer;
-
- while (g_list_length (buffers)) {
- temp_buffer = GST_BUFFER (buffers->data);
- gst_buffer_unref (temp_buffer);
+ while (buffers != NULL) {
+ gst_buffer_unref (GST_BUFFER (buffers->data));
buffers = g_list_delete_link (buffers, buffers);
}
}
"could not set to playing");
/* push all the buffers in the buffer_in list */
fail_unless (g_list_length (buffer_in) > 0, "the buffer_in list is empty");
- while (g_list_length (buffer_in) > 0) {
+ while (buffer_in != NULL) {
GstBuffer *next_buffer = GST_BUFFER (buffer_in->data);
fail_unless (GST_IS_BUFFER (next_buffer),
"data in buffer_in should be a buffer");
/* remove the buffer from the list */
buffer_in = g_list_remove (buffer_in, next_buffer);
- if (g_list_length (buffer_in) == 0) {
+ if (buffer_in == NULL) {
fail_unless (gst_pad_push (src_pad, next_buffer) == last_flow_return,
"we expect something else from the last buffer");
} else {
fail_unless (gst_element_set_state (element,
GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
/* check that there is a buffer out */
- fail_unless (g_list_length (buffers) == g_list_length (buffer_out),
- "We expected %d buffers, but there are %d buffers",
- g_list_length (buffer_out), g_list_length (buffers));
- while (g_list_length (buffers) > 0) {
+ fail_unless_equals_int (g_list_length (buffers), g_list_length (buffer_out));
+ while (buffers != NULL) {
GstBuffer *new = GST_BUFFER (buffers->data);
GstBuffer *orig = GST_BUFFER (buffer_out->data);
+ GST_LOG ("orig buffer: size %u, caps %" GST_PTR_FORMAT,
+ GST_BUFFER_SIZE (orig), GST_BUFFER_CAPS (orig));
+ GST_LOG ("new buffer: size %u, caps %" GST_PTR_FORMAT,
+ GST_BUFFER_SIZE (new), GST_BUFFER_CAPS (new));
+ GST_MEMDUMP ("orig buffer", GST_BUFFER_DATA (orig), GST_BUFFER_SIZE (orig));
+ GST_MEMDUMP ("new buffer", GST_BUFFER_DATA (new), GST_BUFFER_SIZE (new));
+
/* remove the buffers */
buffers = g_list_remove (buffers, new);
buffer_out = g_list_remove (buffer_out, orig);
gint
gst_check_run_suite (Suite * suite, const gchar * name, const gchar * fname)
{
+ SRunner *sr;
+ gchar *xmlfilename = NULL;
gint nf;
- SRunner *sr = srunner_create (suite);
+ sr = srunner_create (suite);
if (g_getenv ("GST_CHECK_XML")) {
/* how lucky we are to have __FILE__ end in .c */
- gchar *xmlfilename = g_strdup_printf ("%sheck.xml", fname);
+ xmlfilename = g_strdup_printf ("%sheck.xml", fname);
srunner_set_xml (sr, xmlfilename);
}
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
+ g_free (xmlfilename);
srunner_free (sr);
return nf;
}
/* only run specified functions */
funcs = g_strsplit (gst_checks, ",", -1);
for (f = funcs; f != NULL && *f != NULL; ++f) {
- if (strcmp (*f, func_name) == 0) {
+ if (g_pattern_match_simple (*f, func_name)) {
res = TRUE;
break;
}