mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-20 14:18:34 +00:00
remove tests replaced by checks
Original commit message from CVS: remove tests replaced by checks
This commit is contained in:
parent
047dc85f20
commit
13cdc0bf84
12 changed files with 4 additions and 784 deletions
|
@ -1,11 +1,11 @@
|
||||||
include ../Rules
|
include ../Rules
|
||||||
|
|
||||||
# disable gst-compprep-check until it doesn't leave stray files for distcheck
|
# disable gst-compprep-check until it doesn't leave stray files for distcheck
|
||||||
tests_pass = name tee property fake gst-inspect-check struct_size
|
tests_pass = gst-inspect-check struct_size
|
||||||
tests_fail =
|
tests_fail =
|
||||||
tests_ignore =
|
tests_ignore =
|
||||||
|
|
||||||
noinst_HEADERS = property.h struct_i386.h
|
noinst_HEADERS = struct_i386.h
|
||||||
|
|
||||||
gst_inspect_check_SOURCES =
|
gst_inspect_check_SOURCES =
|
||||||
gst-inspect-check$(EXEEXT): $(srcdir)/gst-inspect-check.in
|
gst-inspect-check$(EXEEXT): $(srcdir)/gst-inspect-check.in
|
||||||
|
|
|
@ -1,84 +0,0 @@
|
||||||
/*
|
|
||||||
* test for fakesrc and fakesink element
|
|
||||||
* thomas@apestaart.org
|
|
||||||
* originally written for 0.3.2
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
#include "property.h"
|
|
||||||
|
|
||||||
GstElement *
|
|
||||||
element_create (char *name, char *element)
|
|
||||||
/*
|
|
||||||
* create the element
|
|
||||||
* print an error if it can't be created
|
|
||||||
* return NULL if it couldn't be created
|
|
||||||
* return element if it did work
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
GstElement *el = NULL;
|
|
||||||
|
|
||||||
el = (GstElement *) gst_element_factory_make (element, name);
|
|
||||||
if (el == NULL) {
|
|
||||||
fprintf (stderr, "Could not create element %s (%s) !\n", name, element);
|
|
||||||
return NULL;
|
|
||||||
} else
|
|
||||||
return el;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
GstElement *pipeline = NULL;
|
|
||||||
GstElement *src, *sink;
|
|
||||||
gint retval = 0;
|
|
||||||
|
|
||||||
/* init */
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
/* create */
|
|
||||||
g_print ("Creating pipeline\n");
|
|
||||||
pipeline = gst_pipeline_new ("pipeline");
|
|
||||||
|
|
||||||
g_print ("Connecting signals to pipeline\n");
|
|
||||||
g_signal_connect (pipeline, "deep_notify",
|
|
||||||
G_CALLBACK (property_change_callback), NULL);
|
|
||||||
g_print ("Creating elements\n");
|
|
||||||
if (!(src = element_create ("src", "fakesrc")))
|
|
||||||
return 1;
|
|
||||||
g_object_set (G_OBJECT (src), "sizetype", 2, NULL);
|
|
||||||
if (!(sink = element_create ("sink", "fakesink")))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
/* add */
|
|
||||||
g_print ("Adding elements to bin\n");
|
|
||||||
gst_bin_add (GST_BIN (pipeline), src);
|
|
||||||
gst_bin_add (GST_BIN (pipeline), sink);
|
|
||||||
|
|
||||||
/* link */
|
|
||||||
g_print ("Linking elements\n");
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
/* we expect this to give an error */
|
|
||||||
if (gst_bin_iterate (GST_BIN (pipeline)) != FALSE) {
|
|
||||||
g_warning
|
|
||||||
("Iterating a bin with unlinked elements should return FALSE !\n");
|
|
||||||
retval = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
gst_pad_link (gst_element_get_pad (src, "src"),
|
|
||||||
gst_element_get_pad (sink, "sink"));
|
|
||||||
|
|
||||||
/* set to play */
|
|
||||||
g_print ("Doing 1 iteration\n");
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
/* we expect this to work */
|
|
||||||
if (gst_bin_iterate (GST_BIN (pipeline)) != TRUE) {
|
|
||||||
g_error ("Iterating a bin with linked elements should return TRUE !\n");
|
|
||||||
retval = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_print ("Done !\n");
|
|
||||||
return retval;
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
/*
|
|
||||||
* test with names
|
|
||||||
* create a bunch of elements with NULL as name
|
|
||||||
* make sure they get created with a decent name
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
GstElement *element = NULL;
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
/* init */
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
for (i = 0; i < 50; ++i) {
|
|
||||||
/* create element */
|
|
||||||
element = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (GST_IS_ELEMENT (element));
|
|
||||||
g_assert (gst_element_get_name (element) != NULL);
|
|
||||||
g_print ("Created identity element with name %s\n",
|
|
||||||
gst_element_get_name (element));
|
|
||||||
}
|
|
||||||
g_print ("Done !\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,83 +0,0 @@
|
||||||
/*
|
|
||||||
* test for setting and getting of object properties
|
|
||||||
* creates a fakesrc
|
|
||||||
* sets silent (boolean), name (string), and sizemin (int)
|
|
||||||
* then retrieves the set values and compares
|
|
||||||
* thomas@apestaart.org
|
|
||||||
* originally written for 0.4.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
GstElement *
|
|
||||||
element_create (char *name, char *element)
|
|
||||||
/*
|
|
||||||
* create the element
|
|
||||||
* print an error if it can't be created
|
|
||||||
* return NULL if it couldn't be created
|
|
||||||
* return element if it did work
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
GstElement *el = NULL;
|
|
||||||
|
|
||||||
el = (GstElement *) gst_element_factory_make (element, name);
|
|
||||||
if (el == NULL) {
|
|
||||||
fprintf (stderr, "Could not create element %s (%s) !\n", name, element);
|
|
||||||
return NULL;
|
|
||||||
} else
|
|
||||||
return el;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
GstElement *src;
|
|
||||||
gint retval = 0;
|
|
||||||
gboolean silent_set, silent_get;
|
|
||||||
gint sizemin_set, sizemin_get;
|
|
||||||
gchar *name_set, *name_get;
|
|
||||||
|
|
||||||
/* init */
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
/* create */
|
|
||||||
g_print ("Creating element\n");
|
|
||||||
if (!(src = element_create ("src", "fakesrc")))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
/* set */
|
|
||||||
silent_set = TRUE;
|
|
||||||
sizemin_set = 1;
|
|
||||||
name_set = g_strdup_printf ("test");
|
|
||||||
|
|
||||||
gst_element_set (src,
|
|
||||||
"name", name_set, "sizemin", sizemin_set, "silent", silent_set, NULL);
|
|
||||||
/* get */
|
|
||||||
gst_element_get (src,
|
|
||||||
"name", &name_get, "sizemin", &sizemin_get, "silent", &silent_get, NULL);
|
|
||||||
|
|
||||||
/* compare */
|
|
||||||
if (sizemin_set != sizemin_get) {
|
|
||||||
g_print ("sizemin: set value %d differs from returned value %d\n",
|
|
||||||
sizemin_set, sizemin_get);
|
|
||||||
retval = 1;
|
|
||||||
} else
|
|
||||||
g_print ("name: set right\n");
|
|
||||||
|
|
||||||
if (silent_set != silent_get) {
|
|
||||||
g_print ("silent: set value %s differs from returned value %s\n",
|
|
||||||
silent_set ? "TRUE" : "FALSE", silent_get ? "TRUE" : "FALSE");
|
|
||||||
retval = 1;
|
|
||||||
} else
|
|
||||||
g_print ("silent: set right\n");
|
|
||||||
|
|
||||||
if (strcmp (name_set, name_get) != 0) {
|
|
||||||
g_print ("name: set value %s differs from returned value %s\n",
|
|
||||||
name_set, name_get);
|
|
||||||
retval = 1;
|
|
||||||
} else
|
|
||||||
g_print ("name: set right\n");
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
/* extracted from gst-launch */
|
|
||||||
static void
|
|
||||||
property_change_callback (GObject *object, GstObject *orig, GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
GValue value = { 0, }; /* the important thing is that value.type = 0 */
|
|
||||||
gchar *str = 0;
|
|
||||||
|
|
||||||
if (pspec->flags & G_PARAM_READABLE) {
|
|
||||||
g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
|
|
||||||
g_object_get_property (G_OBJECT (orig), pspec->name, &value);
|
|
||||||
/* fix current bug with g_strdup_value_contents not working with gint64 */
|
|
||||||
if (G_IS_PARAM_SPEC_INT64 (pspec))
|
|
||||||
str = g_strdup_printf ("%" G_GINT64_FORMAT, g_value_get_int64 (&value));
|
|
||||||
else
|
|
||||||
str = g_strdup_value_contents (&value);
|
|
||||||
g_print ("%s: %s = %s\n", GST_OBJECT_NAME (orig), pspec->name, str);
|
|
||||||
g_free (str);
|
|
||||||
g_value_unset(&value);
|
|
||||||
} else {
|
|
||||||
g_warning ("Parameter not readable. What's up with that?");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,172 +0,0 @@
|
||||||
/*
|
|
||||||
* test for tee element
|
|
||||||
* this tests for proxying of caps from tee sink to src's in various situations
|
|
||||||
* it also tests if you get a good, unique pad when requesting a third one
|
|
||||||
* which shows a bug in 0.3.2 :
|
|
||||||
* request pad, get 0
|
|
||||||
* request pad, get 1
|
|
||||||
* remove pad 0,
|
|
||||||
* request pad, get 1 (number of pads), already exists, assert fail
|
|
||||||
*
|
|
||||||
* thomas@apestaart.org
|
|
||||||
* originally written for 0.3.2
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
#include <property.h>
|
|
||||||
|
|
||||||
GstElement *
|
|
||||||
element_create (char *name, char *element)
|
|
||||||
/*
|
|
||||||
* create the element
|
|
||||||
* print an error if it can't be created
|
|
||||||
* return NULL if it couldn't be created
|
|
||||||
* return element if it did work
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
GstElement *el = NULL;
|
|
||||||
|
|
||||||
el = (GstElement *) gst_element_factory_make (element, name);
|
|
||||||
if (el == NULL) {
|
|
||||||
fprintf (stderr, "Could not create element %s (%s) !\n", name, element);
|
|
||||||
return NULL;
|
|
||||||
} else
|
|
||||||
return el;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
GstElement *pipeline = NULL;
|
|
||||||
GstElement *tee, *src, *sink1, *sink2;
|
|
||||||
GstPad *tee_src1, *tee_src2;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
GstCaps *src_caps = NULL;
|
|
||||||
GstCaps *sink_caps = NULL;
|
|
||||||
GstStructure *structure = NULL;
|
|
||||||
GstPad *pad = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* init */
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
/* create */
|
|
||||||
g_print ("Creating pipeline\n");
|
|
||||||
pipeline = gst_pipeline_new ("pipeline");
|
|
||||||
|
|
||||||
g_print ("Connecting signals to pipeline\n");
|
|
||||||
g_signal_connect (pipeline, "deep_notify",
|
|
||||||
G_CALLBACK (property_change_callback), NULL);
|
|
||||||
|
|
||||||
g_print ("Creating elements\n");
|
|
||||||
if (!(tee = element_create ("tee", "tee")))
|
|
||||||
return 1;
|
|
||||||
if (!(src = element_create ("src", "fakesrc")))
|
|
||||||
return 1;
|
|
||||||
g_object_set (G_OBJECT (src), "sizetype", 2, NULL);
|
|
||||||
if (!(sink1 = element_create ("sink1", "fakesink")))
|
|
||||||
return 1;
|
|
||||||
if (!(sink2 = element_create ("sink2", "fakesink")))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
/* add */
|
|
||||||
g_print ("Adding elements to bin\n");
|
|
||||||
gst_bin_add (GST_BIN (pipeline), src);
|
|
||||||
gst_bin_add (GST_BIN (pipeline), tee);
|
|
||||||
|
|
||||||
/* link input part */
|
|
||||||
g_print ("Linking input elements\n");
|
|
||||||
gst_pad_link (gst_element_get_pad (src, "src"),
|
|
||||||
gst_element_get_pad (tee, "sink"));
|
|
||||||
|
|
||||||
/* request one pad from tee */
|
|
||||||
g_print ("Requesting first pad\n");
|
|
||||||
tee_src1 = gst_element_get_request_pad (tee, "src%d");
|
|
||||||
gst_bin_add (GST_BIN (pipeline), sink1);
|
|
||||||
gst_pad_link (tee_src1, gst_element_get_pad (sink1, "sink"));
|
|
||||||
|
|
||||||
/* set to play */
|
|
||||||
g_print ("Doing 1 iteration\n");
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
|
|
||||||
/* pause and request another pad */
|
|
||||||
g_print ("Requesting second pad\n");
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
|
||||||
tee_src2 = gst_element_get_request_pad (tee, "src%d");
|
|
||||||
gst_bin_add (GST_BIN (pipeline), sink2);
|
|
||||||
gst_pad_link (tee_src2, gst_element_get_pad (sink2, "sink"));
|
|
||||||
|
|
||||||
/* now we have two fakesinks linked, iterate */
|
|
||||||
g_print ("Doing 1 iteration\n");
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
|
|
||||||
/* We don't allow apps to call gst_pad_try_set_caps(). */
|
|
||||||
#if 0
|
|
||||||
/* now we try setting caps on the src pad */
|
|
||||||
/* FIXME: should we set to pause here ? */
|
|
||||||
src_caps = gst_caps_from_string ("audio/raw, format=(s)\"int\", "
|
|
||||||
"rate=(i)44100");
|
|
||||||
|
|
||||||
g_assert (src_caps != NULL);
|
|
||||||
g_print ("Setting caps on fakesrc's src pad\n");
|
|
||||||
pad = gst_element_get_pad (src, "src");
|
|
||||||
if ((gst_pad_try_set_caps (pad, src_caps)) <= 0) {
|
|
||||||
g_print ("Could not set caps !\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* now iterate and see if it proxies caps ok */
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
sink_caps = gst_pad_get_caps (gst_element_get_pad (sink1, "sink"));
|
|
||||||
if (sink_caps && gst_caps_is_fixed (sink_caps)) {
|
|
||||||
structure = gst_caps_get_structure (sink_caps, 0);
|
|
||||||
} else {
|
|
||||||
structure = NULL;
|
|
||||||
g_print ("sink_caps is not fixed\n");
|
|
||||||
}
|
|
||||||
if (structure == NULL || !(gst_structure_has_field (structure, "rate"))) {
|
|
||||||
g_print ("Hm, rate has not been propagated to sink1.\n");
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
int rate;
|
|
||||||
|
|
||||||
gst_structure_get_int (structure, "rate", &rate);
|
|
||||||
g_print ("Rate of pad on sink1 : %d\n", rate);
|
|
||||||
}
|
|
||||||
sink_caps = gst_pad_get_caps (gst_element_get_pad (sink2, "sink"));
|
|
||||||
structure = gst_caps_get_structure (sink_caps, 0);
|
|
||||||
if (structure != NULL && !(gst_structure_has_field (structure, "rate"))) {
|
|
||||||
g_print ("Hm, rate has not been propagated to sink2.\n");
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
int rate;
|
|
||||||
|
|
||||||
gst_structure_get_int (structure, "rate", &rate);
|
|
||||||
g_print ("Rate of pad on sink2 : %d\n", rate);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* remove the first one, iterate */
|
|
||||||
g_print ("Removing first sink\n");
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
|
||||||
gst_pad_unlink (tee_src1, gst_element_get_pad (sink1, "sink"));
|
|
||||||
gst_bin_remove (GST_BIN (pipeline), sink1);
|
|
||||||
|
|
||||||
/* only second fakesink linked, iterate */
|
|
||||||
g_print ("Doing 1 iteration\n");
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
|
|
||||||
/* request another pad */
|
|
||||||
g_print ("Requesting third pad\n");
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
|
||||||
/* in 0.3.2 the next statement gives an assert error */
|
|
||||||
tee_src1 = gst_element_get_request_pad (tee, "src%d");
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
||||||
|
|
||||||
g_print ("Done !\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,11 +1,11 @@
|
||||||
include ../Rules
|
include ../Rules
|
||||||
|
|
||||||
# disable gst-compprep-check until it doesn't leave stray files for distcheck
|
# disable gst-compprep-check until it doesn't leave stray files for distcheck
|
||||||
tests_pass = name tee property fake gst-inspect-check struct_size
|
tests_pass = gst-inspect-check struct_size
|
||||||
tests_fail =
|
tests_fail =
|
||||||
tests_ignore =
|
tests_ignore =
|
||||||
|
|
||||||
noinst_HEADERS = property.h struct_i386.h
|
noinst_HEADERS = struct_i386.h
|
||||||
|
|
||||||
gst_inspect_check_SOURCES =
|
gst_inspect_check_SOURCES =
|
||||||
gst-inspect-check$(EXEEXT): $(srcdir)/gst-inspect-check.in
|
gst-inspect-check$(EXEEXT): $(srcdir)/gst-inspect-check.in
|
||||||
|
|
|
@ -1,84 +0,0 @@
|
||||||
/*
|
|
||||||
* test for fakesrc and fakesink element
|
|
||||||
* thomas@apestaart.org
|
|
||||||
* originally written for 0.3.2
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
#include "property.h"
|
|
||||||
|
|
||||||
GstElement *
|
|
||||||
element_create (char *name, char *element)
|
|
||||||
/*
|
|
||||||
* create the element
|
|
||||||
* print an error if it can't be created
|
|
||||||
* return NULL if it couldn't be created
|
|
||||||
* return element if it did work
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
GstElement *el = NULL;
|
|
||||||
|
|
||||||
el = (GstElement *) gst_element_factory_make (element, name);
|
|
||||||
if (el == NULL) {
|
|
||||||
fprintf (stderr, "Could not create element %s (%s) !\n", name, element);
|
|
||||||
return NULL;
|
|
||||||
} else
|
|
||||||
return el;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
GstElement *pipeline = NULL;
|
|
||||||
GstElement *src, *sink;
|
|
||||||
gint retval = 0;
|
|
||||||
|
|
||||||
/* init */
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
/* create */
|
|
||||||
g_print ("Creating pipeline\n");
|
|
||||||
pipeline = gst_pipeline_new ("pipeline");
|
|
||||||
|
|
||||||
g_print ("Connecting signals to pipeline\n");
|
|
||||||
g_signal_connect (pipeline, "deep_notify",
|
|
||||||
G_CALLBACK (property_change_callback), NULL);
|
|
||||||
g_print ("Creating elements\n");
|
|
||||||
if (!(src = element_create ("src", "fakesrc")))
|
|
||||||
return 1;
|
|
||||||
g_object_set (G_OBJECT (src), "sizetype", 2, NULL);
|
|
||||||
if (!(sink = element_create ("sink", "fakesink")))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
/* add */
|
|
||||||
g_print ("Adding elements to bin\n");
|
|
||||||
gst_bin_add (GST_BIN (pipeline), src);
|
|
||||||
gst_bin_add (GST_BIN (pipeline), sink);
|
|
||||||
|
|
||||||
/* link */
|
|
||||||
g_print ("Linking elements\n");
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
/* we expect this to give an error */
|
|
||||||
if (gst_bin_iterate (GST_BIN (pipeline)) != FALSE) {
|
|
||||||
g_warning
|
|
||||||
("Iterating a bin with unlinked elements should return FALSE !\n");
|
|
||||||
retval = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
gst_pad_link (gst_element_get_pad (src, "src"),
|
|
||||||
gst_element_get_pad (sink, "sink"));
|
|
||||||
|
|
||||||
/* set to play */
|
|
||||||
g_print ("Doing 1 iteration\n");
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
/* we expect this to work */
|
|
||||||
if (gst_bin_iterate (GST_BIN (pipeline)) != TRUE) {
|
|
||||||
g_error ("Iterating a bin with linked elements should return TRUE !\n");
|
|
||||||
retval = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_print ("Done !\n");
|
|
||||||
return retval;
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
/*
|
|
||||||
* test with names
|
|
||||||
* create a bunch of elements with NULL as name
|
|
||||||
* make sure they get created with a decent name
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
GstElement *element = NULL;
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
/* init */
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
for (i = 0; i < 50; ++i) {
|
|
||||||
/* create element */
|
|
||||||
element = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (GST_IS_ELEMENT (element));
|
|
||||||
g_assert (gst_element_get_name (element) != NULL);
|
|
||||||
g_print ("Created identity element with name %s\n",
|
|
||||||
gst_element_get_name (element));
|
|
||||||
}
|
|
||||||
g_print ("Done !\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,83 +0,0 @@
|
||||||
/*
|
|
||||||
* test for setting and getting of object properties
|
|
||||||
* creates a fakesrc
|
|
||||||
* sets silent (boolean), name (string), and sizemin (int)
|
|
||||||
* then retrieves the set values and compares
|
|
||||||
* thomas@apestaart.org
|
|
||||||
* originally written for 0.4.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
GstElement *
|
|
||||||
element_create (char *name, char *element)
|
|
||||||
/*
|
|
||||||
* create the element
|
|
||||||
* print an error if it can't be created
|
|
||||||
* return NULL if it couldn't be created
|
|
||||||
* return element if it did work
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
GstElement *el = NULL;
|
|
||||||
|
|
||||||
el = (GstElement *) gst_element_factory_make (element, name);
|
|
||||||
if (el == NULL) {
|
|
||||||
fprintf (stderr, "Could not create element %s (%s) !\n", name, element);
|
|
||||||
return NULL;
|
|
||||||
} else
|
|
||||||
return el;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
GstElement *src;
|
|
||||||
gint retval = 0;
|
|
||||||
gboolean silent_set, silent_get;
|
|
||||||
gint sizemin_set, sizemin_get;
|
|
||||||
gchar *name_set, *name_get;
|
|
||||||
|
|
||||||
/* init */
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
/* create */
|
|
||||||
g_print ("Creating element\n");
|
|
||||||
if (!(src = element_create ("src", "fakesrc")))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
/* set */
|
|
||||||
silent_set = TRUE;
|
|
||||||
sizemin_set = 1;
|
|
||||||
name_set = g_strdup_printf ("test");
|
|
||||||
|
|
||||||
gst_element_set (src,
|
|
||||||
"name", name_set, "sizemin", sizemin_set, "silent", silent_set, NULL);
|
|
||||||
/* get */
|
|
||||||
gst_element_get (src,
|
|
||||||
"name", &name_get, "sizemin", &sizemin_get, "silent", &silent_get, NULL);
|
|
||||||
|
|
||||||
/* compare */
|
|
||||||
if (sizemin_set != sizemin_get) {
|
|
||||||
g_print ("sizemin: set value %d differs from returned value %d\n",
|
|
||||||
sizemin_set, sizemin_get);
|
|
||||||
retval = 1;
|
|
||||||
} else
|
|
||||||
g_print ("name: set right\n");
|
|
||||||
|
|
||||||
if (silent_set != silent_get) {
|
|
||||||
g_print ("silent: set value %s differs from returned value %s\n",
|
|
||||||
silent_set ? "TRUE" : "FALSE", silent_get ? "TRUE" : "FALSE");
|
|
||||||
retval = 1;
|
|
||||||
} else
|
|
||||||
g_print ("silent: set right\n");
|
|
||||||
|
|
||||||
if (strcmp (name_set, name_get) != 0) {
|
|
||||||
g_print ("name: set value %s differs from returned value %s\n",
|
|
||||||
name_set, name_get);
|
|
||||||
retval = 1;
|
|
||||||
} else
|
|
||||||
g_print ("name: set right\n");
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
/* extracted from gst-launch */
|
|
||||||
static void
|
|
||||||
property_change_callback (GObject *object, GstObject *orig, GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
GValue value = { 0, }; /* the important thing is that value.type = 0 */
|
|
||||||
gchar *str = 0;
|
|
||||||
|
|
||||||
if (pspec->flags & G_PARAM_READABLE) {
|
|
||||||
g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
|
|
||||||
g_object_get_property (G_OBJECT (orig), pspec->name, &value);
|
|
||||||
/* fix current bug with g_strdup_value_contents not working with gint64 */
|
|
||||||
if (G_IS_PARAM_SPEC_INT64 (pspec))
|
|
||||||
str = g_strdup_printf ("%" G_GINT64_FORMAT, g_value_get_int64 (&value));
|
|
||||||
else
|
|
||||||
str = g_strdup_value_contents (&value);
|
|
||||||
g_print ("%s: %s = %s\n", GST_OBJECT_NAME (orig), pspec->name, str);
|
|
||||||
g_free (str);
|
|
||||||
g_value_unset(&value);
|
|
||||||
} else {
|
|
||||||
g_warning ("Parameter not readable. What's up with that?");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,172 +0,0 @@
|
||||||
/*
|
|
||||||
* test for tee element
|
|
||||||
* this tests for proxying of caps from tee sink to src's in various situations
|
|
||||||
* it also tests if you get a good, unique pad when requesting a third one
|
|
||||||
* which shows a bug in 0.3.2 :
|
|
||||||
* request pad, get 0
|
|
||||||
* request pad, get 1
|
|
||||||
* remove pad 0,
|
|
||||||
* request pad, get 1 (number of pads), already exists, assert fail
|
|
||||||
*
|
|
||||||
* thomas@apestaart.org
|
|
||||||
* originally written for 0.3.2
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
#include <property.h>
|
|
||||||
|
|
||||||
GstElement *
|
|
||||||
element_create (char *name, char *element)
|
|
||||||
/*
|
|
||||||
* create the element
|
|
||||||
* print an error if it can't be created
|
|
||||||
* return NULL if it couldn't be created
|
|
||||||
* return element if it did work
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
GstElement *el = NULL;
|
|
||||||
|
|
||||||
el = (GstElement *) gst_element_factory_make (element, name);
|
|
||||||
if (el == NULL) {
|
|
||||||
fprintf (stderr, "Could not create element %s (%s) !\n", name, element);
|
|
||||||
return NULL;
|
|
||||||
} else
|
|
||||||
return el;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
GstElement *pipeline = NULL;
|
|
||||||
GstElement *tee, *src, *sink1, *sink2;
|
|
||||||
GstPad *tee_src1, *tee_src2;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
GstCaps *src_caps = NULL;
|
|
||||||
GstCaps *sink_caps = NULL;
|
|
||||||
GstStructure *structure = NULL;
|
|
||||||
GstPad *pad = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* init */
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
/* create */
|
|
||||||
g_print ("Creating pipeline\n");
|
|
||||||
pipeline = gst_pipeline_new ("pipeline");
|
|
||||||
|
|
||||||
g_print ("Connecting signals to pipeline\n");
|
|
||||||
g_signal_connect (pipeline, "deep_notify",
|
|
||||||
G_CALLBACK (property_change_callback), NULL);
|
|
||||||
|
|
||||||
g_print ("Creating elements\n");
|
|
||||||
if (!(tee = element_create ("tee", "tee")))
|
|
||||||
return 1;
|
|
||||||
if (!(src = element_create ("src", "fakesrc")))
|
|
||||||
return 1;
|
|
||||||
g_object_set (G_OBJECT (src), "sizetype", 2, NULL);
|
|
||||||
if (!(sink1 = element_create ("sink1", "fakesink")))
|
|
||||||
return 1;
|
|
||||||
if (!(sink2 = element_create ("sink2", "fakesink")))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
/* add */
|
|
||||||
g_print ("Adding elements to bin\n");
|
|
||||||
gst_bin_add (GST_BIN (pipeline), src);
|
|
||||||
gst_bin_add (GST_BIN (pipeline), tee);
|
|
||||||
|
|
||||||
/* link input part */
|
|
||||||
g_print ("Linking input elements\n");
|
|
||||||
gst_pad_link (gst_element_get_pad (src, "src"),
|
|
||||||
gst_element_get_pad (tee, "sink"));
|
|
||||||
|
|
||||||
/* request one pad from tee */
|
|
||||||
g_print ("Requesting first pad\n");
|
|
||||||
tee_src1 = gst_element_get_request_pad (tee, "src%d");
|
|
||||||
gst_bin_add (GST_BIN (pipeline), sink1);
|
|
||||||
gst_pad_link (tee_src1, gst_element_get_pad (sink1, "sink"));
|
|
||||||
|
|
||||||
/* set to play */
|
|
||||||
g_print ("Doing 1 iteration\n");
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
|
|
||||||
/* pause and request another pad */
|
|
||||||
g_print ("Requesting second pad\n");
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
|
||||||
tee_src2 = gst_element_get_request_pad (tee, "src%d");
|
|
||||||
gst_bin_add (GST_BIN (pipeline), sink2);
|
|
||||||
gst_pad_link (tee_src2, gst_element_get_pad (sink2, "sink"));
|
|
||||||
|
|
||||||
/* now we have two fakesinks linked, iterate */
|
|
||||||
g_print ("Doing 1 iteration\n");
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
|
|
||||||
/* We don't allow apps to call gst_pad_try_set_caps(). */
|
|
||||||
#if 0
|
|
||||||
/* now we try setting caps on the src pad */
|
|
||||||
/* FIXME: should we set to pause here ? */
|
|
||||||
src_caps = gst_caps_from_string ("audio/raw, format=(s)\"int\", "
|
|
||||||
"rate=(i)44100");
|
|
||||||
|
|
||||||
g_assert (src_caps != NULL);
|
|
||||||
g_print ("Setting caps on fakesrc's src pad\n");
|
|
||||||
pad = gst_element_get_pad (src, "src");
|
|
||||||
if ((gst_pad_try_set_caps (pad, src_caps)) <= 0) {
|
|
||||||
g_print ("Could not set caps !\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* now iterate and see if it proxies caps ok */
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
sink_caps = gst_pad_get_caps (gst_element_get_pad (sink1, "sink"));
|
|
||||||
if (sink_caps && gst_caps_is_fixed (sink_caps)) {
|
|
||||||
structure = gst_caps_get_structure (sink_caps, 0);
|
|
||||||
} else {
|
|
||||||
structure = NULL;
|
|
||||||
g_print ("sink_caps is not fixed\n");
|
|
||||||
}
|
|
||||||
if (structure == NULL || !(gst_structure_has_field (structure, "rate"))) {
|
|
||||||
g_print ("Hm, rate has not been propagated to sink1.\n");
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
int rate;
|
|
||||||
|
|
||||||
gst_structure_get_int (structure, "rate", &rate);
|
|
||||||
g_print ("Rate of pad on sink1 : %d\n", rate);
|
|
||||||
}
|
|
||||||
sink_caps = gst_pad_get_caps (gst_element_get_pad (sink2, "sink"));
|
|
||||||
structure = gst_caps_get_structure (sink_caps, 0);
|
|
||||||
if (structure != NULL && !(gst_structure_has_field (structure, "rate"))) {
|
|
||||||
g_print ("Hm, rate has not been propagated to sink2.\n");
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
int rate;
|
|
||||||
|
|
||||||
gst_structure_get_int (structure, "rate", &rate);
|
|
||||||
g_print ("Rate of pad on sink2 : %d\n", rate);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* remove the first one, iterate */
|
|
||||||
g_print ("Removing first sink\n");
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
|
||||||
gst_pad_unlink (tee_src1, gst_element_get_pad (sink1, "sink"));
|
|
||||||
gst_bin_remove (GST_BIN (pipeline), sink1);
|
|
||||||
|
|
||||||
/* only second fakesink linked, iterate */
|
|
||||||
g_print ("Doing 1 iteration\n");
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
|
|
||||||
/* request another pad */
|
|
||||||
g_print ("Requesting third pad\n");
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
|
||||||
/* in 0.3.2 the next statement gives an assert error */
|
|
||||||
tee_src1 = gst_element_get_request_pad (tee, "src%d");
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
||||||
|
|
||||||
g_print ("Done !\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
Loading…
Reference in a new issue