diff --git a/ChangeLog b/ChangeLog index 59548bb836..4d0e253d7e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-08-04 Benjamin Otte + + * tests/mass_elements.c: (main): + allow specifying src and sink element explicitly, so I can test + videotestsrc instead of fakesrc + 2004-08-04 Benjamin Otte * gst/gststructure.c: (gst_structure_id_empty_new_with_size), diff --git a/tests/benchmarks/mass-elements.c b/tests/benchmarks/mass-elements.c index 9b5d55ec6c..d9d707096e 100644 --- a/tests/benchmarks/mass-elements.c +++ b/tests/benchmarks/mass-elements.c @@ -20,6 +20,8 @@ #define IDENTITY_COUNT (1000) #define BUFFER_COUNT (1000) +#define SRC_ELEMENT "fakesrc" +#define SINK_ELEMENT "fakesink" static GstClockTime @@ -37,6 +39,7 @@ main (gint argc, gchar * argv[]) GstElement *pipeline, *src, *sink, *current, *last; guint i, buffers = BUFFER_COUNT, identities = IDENTITY_COUNT; GstClockTime start, end; + gchar *src_name = SRC_ELEMENT, *sink_name = SINK_ELEMENT; gst_init (&argc, &argv); @@ -44,23 +47,35 @@ main (gint argc, gchar * argv[]) identities = atoi (argv[1]); if (argc > 2) buffers = atoi (argv[2]); + if (argc > 3) + src_name = argv[3]; + if (argc > 4) + sink_name = argv[4]; g_print - ("*** benchmarking this pipeline: fakesrc num-buffers=%u ! %u * identity ! fakesink\n", - buffers, identities); + ("*** benchmarking this pipeline: %s num-buffers=%u ! %u * identity ! %s\n", + src_name, buffers, identities, sink_name); start = gst_get_current_time (); pipeline = gst_element_factory_make ("pipeline", NULL); g_assert (pipeline); - src = gst_element_factory_make ("fakesrc", NULL); - g_assert (src); + src = gst_element_factory_make (src_name, NULL); + if (!src) { + g_print ("no element named \"%s\" found, aborting...\n", src_name); + return 1; + } g_object_set (src, "num-buffers", buffers, NULL); - sink = gst_element_factory_make ("fakesink", NULL); - g_assert (sink); + sink = gst_element_factory_make (sink_name, NULL); + if (!sink) { + g_print ("no element named \"%s\" found, aborting...\n", sink_name); + return 1; + } last = src; gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL); for (i = 0; i < identities; i++) { current = gst_element_factory_make ("identity", NULL); g_assert (current); + /* shut this element up (no g_strdup_printf please) */ + g_object_set (current, "silent", TRUE, NULL); gst_bin_add (GST_BIN (pipeline), current); if (!gst_element_link (last, current)) g_assert_not_reached (); diff --git a/tests/mass_elements.c b/tests/mass_elements.c index 9b5d55ec6c..d9d707096e 100644 --- a/tests/mass_elements.c +++ b/tests/mass_elements.c @@ -20,6 +20,8 @@ #define IDENTITY_COUNT (1000) #define BUFFER_COUNT (1000) +#define SRC_ELEMENT "fakesrc" +#define SINK_ELEMENT "fakesink" static GstClockTime @@ -37,6 +39,7 @@ main (gint argc, gchar * argv[]) GstElement *pipeline, *src, *sink, *current, *last; guint i, buffers = BUFFER_COUNT, identities = IDENTITY_COUNT; GstClockTime start, end; + gchar *src_name = SRC_ELEMENT, *sink_name = SINK_ELEMENT; gst_init (&argc, &argv); @@ -44,23 +47,35 @@ main (gint argc, gchar * argv[]) identities = atoi (argv[1]); if (argc > 2) buffers = atoi (argv[2]); + if (argc > 3) + src_name = argv[3]; + if (argc > 4) + sink_name = argv[4]; g_print - ("*** benchmarking this pipeline: fakesrc num-buffers=%u ! %u * identity ! fakesink\n", - buffers, identities); + ("*** benchmarking this pipeline: %s num-buffers=%u ! %u * identity ! %s\n", + src_name, buffers, identities, sink_name); start = gst_get_current_time (); pipeline = gst_element_factory_make ("pipeline", NULL); g_assert (pipeline); - src = gst_element_factory_make ("fakesrc", NULL); - g_assert (src); + src = gst_element_factory_make (src_name, NULL); + if (!src) { + g_print ("no element named \"%s\" found, aborting...\n", src_name); + return 1; + } g_object_set (src, "num-buffers", buffers, NULL); - sink = gst_element_factory_make ("fakesink", NULL); - g_assert (sink); + sink = gst_element_factory_make (sink_name, NULL); + if (!sink) { + g_print ("no element named \"%s\" found, aborting...\n", sink_name); + return 1; + } last = src; gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL); for (i = 0; i < identities; i++) { current = gst_element_factory_make ("identity", NULL); g_assert (current); + /* shut this element up (no g_strdup_printf please) */ + g_object_set (current, "silent", TRUE, NULL); gst_bin_add (GST_BIN (pipeline), current); if (!gst_element_link (last, current)) g_assert_not_reached ();