remove obsolete tests

Original commit message from CVS:
remove obsolete tests
parent 4c645e9a
SUBDIRS = instantiate muxing sched threadstate seeking
SUBDIRS = instantiate sched threadstate seeking
if GST_DISABLE_TRACE
LAT =
else
LAT = lat
endif
noinst_PROGRAMS = $(LAT) mass_elements complexity
noinst_PROGRAMS = mass_elements complexity
AM_CFLAGS = $(GST_OBJ_CFLAGS)
LIBS = $(GST_OBJ_LIBS) \
$(top_builddir)/gst/base/libgstbase-@GST_MAJORMINOR@.la
EXTRA_DIST = README
DIST_SUBDIRS= instantiate muxing sched threadstate seeking
DIST_SUBDIRS= instantiate sched threadstate seeking
#include <gst/gst.h>
#include <stdlib.h>
#include <string.h>
/* FIXME: WTF does this do? */
static guint64 max = 0, min = -1, total = 0;
static guint count = 0;
static guint print_del = 1;
static guint iterations = 0;
static guint mhz = 0;
void
handoff_src (GstElement * src, GstBuffer * buf, gpointer user_data)
{
gst_trace_read_tsc ((gint64 *) & GST_BUFFER_TIMESTAMP (buf));
}
void
handoff_sink (GstElement * sink, GstBuffer * buf, gpointer user_data)
{
guint64 end, d, avg;
guint avg_ns;
gst_trace_read_tsc ((gint64 *) & end);
d = end - GST_BUFFER_TIMESTAMP (buf);
if (d > max)
max = d;
if (d < min)
min = d;
total += d;
count++;
avg = total / count;
avg_ns = (guint) (1000.0 * (double) avg / (double) mhz);
if ((count % print_del) == 0) {
g_print ("%07d:%08" G_GUINT64_FORMAT " min:%08" G_GUINT64_FORMAT " max:%08"
G_GUINT64_FORMAT " avg:%08" G_GUINT64_FORMAT " avg-s:0.%09d\r", count,
d, min, max, avg, avg_ns);
}
}
GstElement *
identity_add (GstPipeline * pipeline, GstElement * first, int count)
{
GstElement *last, *ident;
int i;
char buf[20];
last = first;
for (i = 0; i < count; i++) {
snprintf (buf, 20, "identity_%03d", i);
ident = gst_element_factory_make ("identity", buf);
g_return_val_if_fail (ident != NULL, NULL);
g_object_set (G_OBJECT (ident), "silent", TRUE, NULL);
gst_bin_add (GST_BIN (pipeline), GST_ELEMENT (ident));
gst_pad_link (gst_element_get_pad (last, "src"),
gst_element_get_pad (ident, "sink"));
last = ident;
}
return last;
}
GstElement *
fakesrc (void)
{
GstElement *src;
src = gst_element_factory_make ("fakesrc", "src");
g_return_val_if_fail (src != NULL, NULL);
g_object_set (G_OBJECT (src), "silent", TRUE, NULL);
g_object_set (G_OBJECT (src), "num_buffers", iterations, NULL);
g_object_set (G_OBJECT (src), "signal-handoffs", TRUE, NULL);
g_signal_connect (G_OBJECT (src), "handoff", G_CALLBACK (handoff_src), NULL);
return src;
}
GstElement *
fakesink (void)
{
GstElement *sink;
sink = gst_element_factory_make ("fakesink", "fakesink");
g_return_val_if_fail (sink != NULL, NULL);
g_object_set (G_OBJECT (sink), "silent", TRUE, NULL);
g_object_set (G_OBJECT (sink), "signal-handoffs", TRUE, NULL);
g_signal_connect (G_OBJECT (sink),
"handoff", G_CALLBACK (handoff_sink), NULL);
return sink;
}
GstPipeline *
simple (int argc, int argi, char *argv[])
{
GstPipeline *pipeline;
GstElement *last, *src, *sink;
int idents;
if ((argc - argi) < 1) {
fprintf (stderr, "bad params");
return NULL;
}
idents = atoi (argv[argi]);
pipeline = GST_PIPELINE (gst_pipeline_new ("pipeline"));
g_return_val_if_fail (pipeline != NULL, NULL);
src = fakesrc ();
gst_bin_add (GST_BIN (pipeline), GST_ELEMENT (src));
last = identity_add (pipeline, src, idents);
sink = fakesink ();
gst_bin_add (GST_BIN (pipeline), GST_ELEMENT (sink));
gst_pad_link (gst_element_get_pad (last, "src"),
gst_element_get_pad (sink, "sink"));
return pipeline;
}
GstPipeline *
queue (int argc, int argi, char *argv[])
{
GstPipeline *pipeline;
GstElement *last, *src, *sink, *src_q, *sink_q;
int idents;
if ((argc - argi) < 1) {
fprintf (stderr, "bad params");
return NULL;
}
idents = atoi (argv[argi]);
pipeline = GST_PIPELINE (gst_pipeline_new ("pipeline"));
g_return_val_if_fail (pipeline != NULL, NULL);
src = fakesrc ();
g_return_val_if_fail (src != NULL, NULL);
gst_bin_add (GST_BIN (pipeline), GST_ELEMENT (src));
src_q = gst_element_factory_make ("queue", "src_q");
g_return_val_if_fail (src_q != NULL, NULL);
gst_bin_add (GST_BIN (pipeline), GST_ELEMENT (src_q));
gst_pad_link (gst_element_get_pad (src, "src"),
gst_element_get_pad (src_q, "sink"));
last = identity_add (pipeline, src_q, idents);
sink_q = gst_element_factory_make ("queue", "sink_q");
g_return_val_if_fail (sink_q != NULL, NULL);
gst_bin_add (GST_BIN (pipeline), GST_ELEMENT (sink_q));
gst_pad_link (gst_element_get_pad (last, "src"),
gst_element_get_pad (sink_q, "sink"));
sink = fakesink ();
g_return_val_if_fail (sink != NULL, NULL);
gst_bin_add (GST_BIN (pipeline), GST_ELEMENT (sink));
gst_pad_link (gst_element_get_pad (sink_q, "src"),
gst_element_get_pad (sink, "sink"));
return pipeline;
}
struct test
{
char *name;
char *params;
GstPipeline *(*func) (int argc, int argi, char *argv[]);
};
static struct test tests[] = {
{"simple", "ident_count", simple},
{"queue", "ident_count", queue},
{NULL, NULL, NULL}
};
int
main (int argc, char *argv[])
{
GstPipeline *pipeline;
int i;
char *name;
gst_init (&argc, &argv);
if (argc < 3) {
fprintf (stderr,
"usage: %s iterations print_del mhz test_name [test_params...]\n",
argv[0]);
for (i = 0; tests[i].name; i++) {
fprintf (stderr, " %s %s\n", tests[i].name, tests[i].params);
}
exit (1);
} else {
iterations = atoi (argv[1]);
print_del = atoi (argv[2]);
mhz = atoi (argv[3]);
name = argv[4];
}
pipeline = NULL;
for (i = 0; tests[i].name && !pipeline; i++) {
if (!strcmp (name, tests[i].name)) {
pipeline = tests[i].func (argc, 5, argv);
}
}
g_return_val_if_fail (pipeline != NULL, -1);
/*xmlSaveFile("lat.gst", gst_xml_write(GST_ELEMENT(pipeline))); */
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
while (count < iterations) {
g_usleep (G_USEC_PER_SEC);
}
g_print ("\n");
return 0;
}
Makefile
Makefile.in
*.o
*.lo
*.la
.deps
.libs
*.xml
*.gst
case1
*.bb
*.bbg
*.da
noinst_PROGRAMS = case1
LDADD = $(GST_OBJ_LIBS)
AM_CFLAGS = $(GST_OBJ_CFLAGS)
#include <stdlib.h>
#include <gst/gst.h>
gboolean playing = TRUE;
static void
handoff_signal (GstElement * element, GstBuffer * buf)
{
g_print ("handoff \"%s\" %" G_GINT64_FORMAT "\n",
gst_element_get_name (element), GST_BUFFER_TIMESTAMP (buf));
}
static void
eos_signal (GstElement * element)
{
g_print ("eos received from \"%s\"\n", gst_element_get_name (element));
playing = FALSE;
}
int
main (int argc, char *argv[])
{
GstBin *pipeline;
GstElement *src, *tee, *identity1, *identity2, *aggregator, *sink;
gst_init (&argc, &argv);
pipeline = GST_BIN (gst_pipeline_new ("pipeline"));
g_return_val_if_fail (pipeline != NULL, 1);
src = gst_element_factory_make ("fakesrc", "src");
g_object_set (G_OBJECT (src), "num_buffers", 40, NULL);
g_return_val_if_fail (src != NULL, 2);
tee = gst_element_factory_make ("tee", "tee");
g_return_val_if_fail (tee != NULL, 3);
identity1 = gst_element_factory_make ("identity", "identity0");
g_return_val_if_fail (identity1 != NULL, 3);
identity2 = gst_element_factory_make ("identity", "identity1");
g_object_set (G_OBJECT (identity2), "duplicate", 2, NULL);
g_object_set (G_OBJECT (identity2), "loop_based", TRUE, NULL);
g_return_val_if_fail (identity2 != NULL, 3);
aggregator = gst_element_factory_make ("aggregator", "aggregator");
g_object_set (G_OBJECT (aggregator), "sched", 4, NULL);
g_return_val_if_fail (aggregator != NULL, 3);
sink = gst_element_factory_make ("fakesink", "sink");
g_return_val_if_fail (sink != NULL, 4);
gst_bin_add_many (pipeline, src, tee, identity1, identity2, aggregator, sink,
NULL);
gst_element_link_pads (src, "src", tee, "sink");
gst_pad_link (gst_element_get_request_pad (tee, "src%d"),
gst_element_get_pad (identity1, "sink"));
gst_pad_link (gst_element_get_request_pad (tee, "src%d"),
gst_element_get_pad (identity2, "sink"));
gst_pad_link (gst_element_get_pad (identity1, "src"),
gst_element_get_request_pad (aggregator, "sink%d"));
gst_pad_link (gst_element_get_pad (identity2, "src"),
gst_element_get_request_pad (aggregator, "sink%d"));
gst_element_link_pads (aggregator, "src", sink, "sink");
g_signal_connect (G_OBJECT (src), "eos", G_CALLBACK (eos_signal), NULL);
g_signal_connect (G_OBJECT (sink), "handoff",
G_CALLBACK (handoff_signal), NULL);
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
g_usleep (2 * G_USEC_PER_SEC);
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
exit (0);
}
noinst_PROGRAMS = probetest
LDADD = $(GST_OBJ_LIBS)
AM_CFLAGS = $(GST_OBJ_CFLAGS)
#include <gst/gst.h>
static GstElement *src1, *src2, *sink, *pipeline, *bin;
static gint state = 0;
static gboolean
notify (GstProbe * probe, GstData ** data, gpointer user_data)
{
switch (state) {
case 0:
if (GST_BUFFER_TIMESTAMP (*data) == 10) {
gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PAUSED);
gst_element_unlink_pads (GST_ELEMENT (src1), "src", sink, "sink");
gst_bin_add (GST_BIN (bin), src2);
gst_bin_remove (GST_BIN (bin), src1);
gst_element_link_pads (GST_ELEMENT (src2), "src", sink, "sink");
gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING);
state++;
gst_data_unref (*data);
return FALSE;
}
break;
case 1:
GST_BUFFER_TIMESTAMP (*data) = GST_BUFFER_TIMESTAMP (*data) + 10;
if (GST_BUFFER_TIMESTAMP (*data) == 20) {
gst_data_unref (*data);
*data = GST_DATA (gst_event_new (GST_EVENT_EOS));
gst_element_set_state (src2, GST_STATE_PAUSED);
return TRUE;
}
break;
default:
break;
}
return TRUE;
}
int
main (int argc, gchar * argv[])
{
gst_init (&argc, &argv);
pipeline = gst_pipeline_new ("main_pipeline");
bin = gst_bin_new ("control");
src1 = gst_element_factory_make ("fakesrc", "src1");
src2 = gst_element_factory_make ("fakesrc", "src2");
gst_bin_add (GST_BIN (bin), src1);
sink = gst_element_factory_make ("fakesink", "sink");
gst_bin_add (GST_BIN (pipeline), sink);
gst_bin_add (GST_BIN (pipeline), bin);
gst_element_link_pads (GST_ELEMENT (src1), "src", sink, "sink");
g_signal_connect (pipeline, "deep_notify",
G_CALLBACK (gst_element_default_deep_notify), NULL);
g_signal_connect (pipeline, "error", G_CALLBACK (gst_element_default_error),
NULL);
gst_pad_add_probe (gst_element_get_pad (src1, "src"),
gst_probe_new (FALSE, notify, NULL));
gst_pad_add_probe (gst_element_get_pad (src2, "src"),
gst_probe_new (FALSE, notify, NULL));
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
while (gst_bin_iterate (GST_BIN (pipeline)));
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
gst_object_unref (pipeline);
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment