mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
51cbf22624
Original commit message from CVS: This is a megapatch with the following changes: - moved the gchar *name to GstObject, removed the ones in GstElement and GstPad. - moved the parent handling completely into GstObject. This cause *all* of the plugins to fail (except those that used gst_pad_get_parent) - rearanged the XML save handling. - GstObject now has a class function save/restore_thyself. - GstObject has a generic method gst_object_save_thyself, this makes it possible to fire a signal wehever a new object is loaded. This is needed so we can add XML save hooks. - GstXML API has changed slightly. You now have to create a GstXML object first before you can actually load something. This makes it possible to attach a signal to GstXML whenever an object is loaded. I'm not sure we will keep this interface. - GstObject can now print the path_string without knowing about the GstPad and GstElement types. - Added gst_bin_get_by_name_recurse_up to lookup an element in the current element hierarchy. - added XML namespaces to the saved pipelines the namespace is: http://gstreamer.net/gst-core/1.0/ namespaces are needed to distinguish user generated XML from the core XML. Note that the plugins still contain a macro GST_OBJECT_PARENT that will be replaced with gst_pad_get_parent shortly.
98 lines
2.1 KiB
C
98 lines
2.1 KiB
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <gst/gst.h>
|
|
|
|
static guint outcount, incount;
|
|
|
|
static void
|
|
buffer_handoff_sink (GstElement *src, GstElement *bin)
|
|
{
|
|
g_print ("\n\n *** buffer arrived in sink ***\n\n");
|
|
gst_element_set_state(bin, GST_STATE_NULL);
|
|
|
|
outcount++;
|
|
}
|
|
|
|
static void
|
|
buffer_handoff_src (GstElement *src, GstElement *bin)
|
|
{
|
|
g_print ("\n\n *** buffer started in src ***\n\n");
|
|
incount++;
|
|
}
|
|
|
|
/* eos will be called when the src element has an end of stream */
|
|
void eos(GstElement *element, gpointer data)
|
|
{
|
|
g_print("have eos, quitting\n");
|
|
}
|
|
|
|
int main(int argc,char *argv[])
|
|
{
|
|
GstXML *xml;
|
|
GList *toplevelelements;
|
|
gint i = 1;
|
|
|
|
gst_init(&argc,&argv);
|
|
|
|
if (argc < 2) {
|
|
g_print ("usage: %s <xml file>\n", argv[0]);
|
|
exit (-1);
|
|
}
|
|
|
|
g_print ("\n *** using testfile %s\n", argv[1]);
|
|
|
|
xml = gst_xml_new();
|
|
xml = gst_xml_parse_file (xml, argv[1], NULL);
|
|
|
|
toplevelelements = gst_xml_get_topelements (xml);
|
|
|
|
while (toplevelelements) {
|
|
GstElement *bin = (GstElement *)toplevelelements->data;
|
|
GstElement *src, *sink;
|
|
|
|
g_print ("\n ***** testcase %d\n", i++);
|
|
|
|
src = gst_bin_get_by_name (GST_BIN (bin), "fakesrc");
|
|
if (src) {
|
|
gtk_signal_connect (GTK_OBJECT(src), "handoff",
|
|
GTK_SIGNAL_FUNC(buffer_handoff_src), bin);
|
|
}
|
|
else {
|
|
g_print ("could not find src element\n");
|
|
exit(-1);
|
|
}
|
|
|
|
sink = gst_bin_get_by_name (GST_BIN (bin), "fakesink");
|
|
if (sink) {
|
|
gtk_signal_connect (GTK_OBJECT(sink), "handoff",
|
|
GTK_SIGNAL_FUNC(buffer_handoff_sink), bin);
|
|
}
|
|
else {
|
|
g_print ("could not find sink element\n");
|
|
exit(-1);
|
|
}
|
|
|
|
incount = 0;
|
|
outcount = 0;
|
|
|
|
// gst_element_set_state(bin, GST_STATE_READY);
|
|
gst_element_set_state(bin, GST_STATE_PLAYING);
|
|
|
|
if (GST_IS_THREAD (bin)) {
|
|
sleep (1);
|
|
}
|
|
else {
|
|
gst_bin_iterate(GST_BIN(bin));
|
|
}
|
|
|
|
if (outcount != 1 && incount != 1) {
|
|
g_print ("test failed\n");
|
|
exit (-1);
|
|
}
|
|
|
|
toplevelelements = g_list_next (toplevelelements);
|
|
}
|
|
|
|
exit(0);
|
|
}
|
|
|