mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-06 23:48:53 +00:00
Fixed autoplugging.
Original commit message from CVS: Fixed autoplugging.
This commit is contained in:
parent
06913f27c3
commit
855b6877e9
6 changed files with 47 additions and 41 deletions
|
@ -81,7 +81,7 @@ noinst_HEADERS = \
|
||||||
gsti386.h \
|
gsti386.h \
|
||||||
gstppc.h
|
gstppc.h
|
||||||
|
|
||||||
#CFLAGS += -O2 -Wall
|
CFLAGS += -O6 -Wall
|
||||||
|
|
||||||
libgst_la_LIBADD = $(GLIB_LIBS) $(GTK_LIBS) $(XML_LIBS)
|
libgst_la_LIBADD = $(GLIB_LIBS) $(GTK_LIBS) $(XML_LIBS)
|
||||||
libgst_la_LDFLAGS = -version-info $(STREAMER_CURRENT):$(STREAMER_REVISION):$(STREAMER_AGE)
|
libgst_la_LDFLAGS = -version-info $(STREAMER_CURRENT):$(STREAMER_REVISION):$(STREAMER_AGE)
|
||||||
|
|
|
@ -120,6 +120,7 @@ gst_asyncdisksrc_init (GstAsyncDiskSrc *asyncdisksrc)
|
||||||
{
|
{
|
||||||
GST_SRC_SET_FLAGS (asyncdisksrc, GST_SRC_ASYNC);
|
GST_SRC_SET_FLAGS (asyncdisksrc, GST_SRC_ASYNC);
|
||||||
|
|
||||||
|
g_print("init\n");
|
||||||
asyncdisksrc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
asyncdisksrc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
||||||
gst_pad_set_pull_function (asyncdisksrc->srcpad,gst_asyncdisksrc_pull);
|
gst_pad_set_pull_function (asyncdisksrc->srcpad,gst_asyncdisksrc_pull);
|
||||||
// FIXME must set pullregion
|
// FIXME must set pullregion
|
||||||
|
|
35
gst/gstbin.c
35
gst/gstbin.c
|
@ -567,7 +567,6 @@ gst_bin_pullsrc_wrapper (int argc,char *argv[])
|
||||||
GstElement *element = GST_ELEMENT (argv);
|
GstElement *element = GST_ELEMENT (argv);
|
||||||
GList *pads;
|
GList *pads;
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
GstBuffer *buf;
|
|
||||||
G_GNUC_UNUSED const gchar *name = gst_element_get_name (element);
|
G_GNUC_UNUSED const gchar *name = gst_element_get_name (element);
|
||||||
|
|
||||||
DEBUG("entering gst_bin_pullsrc_wrapper(%d,\"%s\")\n",argc,name);
|
DEBUG("entering gst_bin_pullsrc_wrapper(%d,\"%s\")\n",argc,name);
|
||||||
|
@ -577,7 +576,7 @@ gst_bin_pullsrc_wrapper (int argc,char *argv[])
|
||||||
while (pads) {
|
while (pads) {
|
||||||
pad = GST_PAD (pads->data);
|
pad = GST_PAD (pads->data);
|
||||||
if (pad->direction == GST_PAD_SRC) {
|
if (pad->direction == GST_PAD_SRC) {
|
||||||
if (pad->pullfunc == NULL) fprintf(stderr,"error, no pullfunc\n");
|
if (pad->pullfunc == NULL) fprintf(stderr,"error, no pullfunc in \"%s\"\n", name);
|
||||||
(pad->pullfunc)(pad);
|
(pad->pullfunc)(pad);
|
||||||
}
|
}
|
||||||
pads = g_list_next(pads);
|
pads = g_list_next(pads);
|
||||||
|
@ -839,7 +838,7 @@ gst_bin_iterate_func (GstBin *bin)
|
||||||
GList *pads;
|
GList *pads;
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
|
|
||||||
DEBUG_ENTER("(%s)",gst_element_get_name(GST_ELEMENT(bin)));
|
DEBUG_ENTER("(%s)", gst_element_get_name (GST_ELEMENT (bin)));
|
||||||
|
|
||||||
g_return_if_fail (bin != NULL);
|
g_return_if_fail (bin != NULL);
|
||||||
g_return_if_fail (GST_IS_BIN (bin));
|
g_return_if_fail (GST_IS_BIN (bin));
|
||||||
|
@ -849,7 +848,7 @@ gst_bin_iterate_func (GstBin *bin)
|
||||||
// all we really have to do is switch to the first child
|
// all we really have to do is switch to the first child
|
||||||
// FIXME this should be lots more intelligent about where to start
|
// FIXME this should be lots more intelligent about where to start
|
||||||
|
|
||||||
GST_FLAG_SET(GST_ELEMENT (bin->children->data),GST_ELEMENT_COTHREAD_STOPPING);
|
GST_FLAG_SET (GST_ELEMENT (bin->children->data), GST_ELEMENT_COTHREAD_STOPPING);
|
||||||
cothread_switch (GST_ELEMENT (bin->children->data)->threadstate);
|
cothread_switch (GST_ELEMENT (bin->children->data)->threadstate);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -862,33 +861,33 @@ gst_bin_iterate_func (GstBin *bin)
|
||||||
entries = bin->entries;
|
entries = bin->entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_assert(entries != NULL);
|
g_assert (entries != NULL);
|
||||||
|
|
||||||
while (entries) {
|
while (entries) {
|
||||||
entry = GST_ELEMENT (entries->data);
|
entry = GST_ELEMENT (entries->data);
|
||||||
if (GST_IS_SRC (entry)) {
|
if (GST_IS_SRC (entry)) {
|
||||||
// if (GST_SRC_PUSH_FUNCTION(entry))
|
pads = entry->pads;
|
||||||
// gst_src_push (GST_SRC (entry));
|
while (pads) {
|
||||||
// else {
|
pad = GST_PAD (pads->data);
|
||||||
pads = entry->pads;
|
if (pad->direction == GST_PAD_SRC) {
|
||||||
while (pads) {
|
if (pad->pullfunc == NULL)
|
||||||
pad = GST_PAD(pads->data);
|
fprintf(stderr, "error, no pullfunc in \"%s\"\n", gst_element_get_name (entry));
|
||||||
if (pad->direction == GST_PAD_SRC) {
|
else
|
||||||
if (pad->pullfunc == NULL) fprintf(stderr,"error, no pullfunc\n");
|
|
||||||
(pad->pullfunc)(pad);
|
(pad->pullfunc)(pad);
|
||||||
}
|
|
||||||
pads = g_list_next(pads);
|
|
||||||
}
|
}
|
||||||
// }
|
pads = g_list_next (pads);
|
||||||
|
}
|
||||||
} else if (GST_IS_CONNECTION (entry))
|
} else if (GST_IS_CONNECTION (entry))
|
||||||
gst_connection_push (GST_CONNECTION (entry));
|
gst_connection_push (GST_CONNECTION (entry));
|
||||||
else if (GST_IS_BIN (entry))
|
else if (GST_IS_BIN (entry))
|
||||||
gst_bin_iterate (GST_BIN (entry));
|
gst_bin_iterate (GST_BIN (entry));
|
||||||
else
|
else {
|
||||||
|
fprintf(stderr, "gstbin: entry \"%s\" cannot be handled\n", gst_element_get_name (entry));
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
}
|
||||||
entries = g_list_next (entries);
|
entries = g_list_next (entries);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_LEAVE("(%s)",gst_element_get_name(GST_ELEMENT(bin)));
|
DEBUG_LEAVE("(%s)", gst_element_get_name (GST_ELEMENT (bin)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -505,8 +505,6 @@ gst_pad_disconnect (GstPad *srcpad,
|
||||||
srcpad->peer = NULL;
|
srcpad->peer = NULL;
|
||||||
sinkpad->peer = NULL;
|
sinkpad->peer = NULL;
|
||||||
|
|
||||||
srcpad->chainfunc = NULL;
|
|
||||||
srcpad->pullfunc = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -688,7 +686,7 @@ gst_pad_add_type_id (GstPad *pad,
|
||||||
g_return_if_fail (GST_IS_PAD (pad));
|
g_return_if_fail (GST_IS_PAD (pad));
|
||||||
g_return_if_fail (gst_type_find_by_id (id) != NULL);
|
g_return_if_fail (gst_type_find_by_id (id) != NULL);
|
||||||
|
|
||||||
g_list_append(pad->types, GINT_TO_POINTER((gint)id));
|
pad->types = g_list_append(pad->types, GINT_TO_POINTER((gint)id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -157,15 +157,15 @@ gst_pipeline_typefind (GstPipeline *pipeline, GstElement *element)
|
||||||
gst_bin_add (GST_BIN (pipeline), typefind);
|
gst_bin_add (GST_BIN (pipeline), typefind);
|
||||||
|
|
||||||
gst_bin_create_plan (GST_BIN (pipeline));
|
gst_bin_create_plan (GST_BIN (pipeline));
|
||||||
gst_element_set_state (GST_ELEMENT (element), GST_STATE_READY);
|
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY);
|
||||||
gst_element_set_state (GST_ELEMENT (element), GST_STATE_PLAYING);
|
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
||||||
|
|
||||||
// keep pushing buffers... the have_type signal handler will set the found flag
|
// keep pushing buffers... the have_type signal handler will set the found flag
|
||||||
// while (!found) {
|
while (!found) {
|
||||||
// gst_src_push(GST_SRC(element));
|
gst_bin_iterate (GST_BIN (pipeline));
|
||||||
// }
|
}
|
||||||
|
|
||||||
gst_element_set_state (GST_ELEMENT (element), GST_STATE_NULL);
|
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
|
||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
type_id = gst_util_get_int_arg (GTK_OBJECT (typefind), "type");
|
type_id = gst_util_get_int_arg (GTK_OBJECT (typefind), "type");
|
||||||
|
@ -187,7 +187,7 @@ gst_pipeline_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink)
|
||||||
gboolean connected = FALSE;
|
gboolean connected = FALSE;
|
||||||
guint16 type;
|
guint16 type;
|
||||||
|
|
||||||
type = ((GstType *)pad->types->data)->id;
|
type = GPOINTER_TO_INT (pad->types->data);
|
||||||
|
|
||||||
g_print("gstpipeline: autoplug pad connect function type %d for \"%s\" to \"%s\"\n", type,
|
g_print("gstpipeline: autoplug pad connect function type %d for \"%s\" to \"%s\"\n", type,
|
||||||
gst_element_get_name(src), gst_element_get_name(sink));
|
gst_element_get_name(src), gst_element_get_name(sink));
|
||||||
|
@ -195,7 +195,7 @@ gst_pipeline_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink)
|
||||||
sinkpads = gst_element_get_pad_list(sink);
|
sinkpads = gst_element_get_pad_list(sink);
|
||||||
while (sinkpads) {
|
while (sinkpads) {
|
||||||
GstPad *sinkpad = (GstPad *)sinkpads->data;
|
GstPad *sinkpad = (GstPad *)sinkpads->data;
|
||||||
guint16 sinktype = ((GstType *)sinkpad->types->data)->id;
|
guint16 sinktype = GPOINTER_TO_INT (sinkpad->types->data);
|
||||||
|
|
||||||
// if we have a match, connect the pads
|
// if we have a match, connect the pads
|
||||||
if (sinktype == type &&
|
if (sinktype == type &&
|
||||||
|
@ -228,9 +228,10 @@ gst_pipeline_pads_autoplug (GstElement *src, GstElement *sink)
|
||||||
|
|
||||||
while (srcpads) {
|
while (srcpads) {
|
||||||
GstPad *srcpad = (GstPad *)srcpads->data;
|
GstPad *srcpad = (GstPad *)srcpads->data;
|
||||||
|
GList *srctypes = gst_pad_get_type_ids(srcpad);
|
||||||
guint16 srctype = 0;
|
guint16 srctype = 0;
|
||||||
if (srcpad)
|
if (srctypes)
|
||||||
srctype = ((GstType *)srcpad->types->data)->id;
|
srctype = GPOINTER_TO_INT (srctypes->data);
|
||||||
|
|
||||||
if (srcpad->direction == GST_PAD_SRC && !GST_PAD_CONNECTED(srcpad)) {
|
if (srcpad->direction == GST_PAD_SRC && !GST_PAD_CONNECTED(srcpad)) {
|
||||||
|
|
||||||
|
@ -238,9 +239,10 @@ gst_pipeline_pads_autoplug (GstElement *src, GstElement *sink)
|
||||||
// FIXME could O(n) if the types were sorted...
|
// FIXME could O(n) if the types were sorted...
|
||||||
while (sinkpads) {
|
while (sinkpads) {
|
||||||
GstPad *sinkpad = (GstPad *)sinkpads->data;
|
GstPad *sinkpad = (GstPad *)sinkpads->data;
|
||||||
|
GList *sinktypes = gst_pad_get_type_ids(sinkpad);
|
||||||
guint16 sinktype = 0;
|
guint16 sinktype = 0;
|
||||||
if (srcpad)
|
if (sinktypes)
|
||||||
sinktype = ((GstType *)sinkpad->types->data)->id;
|
sinktype = GPOINTER_TO_INT (sinktypes->data);
|
||||||
|
|
||||||
// if we have a match, connect the pads
|
// if we have a match, connect the pads
|
||||||
if (sinktype == srctype &&
|
if (sinktype == srctype &&
|
||||||
|
@ -400,12 +402,15 @@ gst_pipeline_autoplug (GstPipeline *pipeline)
|
||||||
|
|
||||||
if (pad->direction == GST_PAD_SINK) {
|
if (pad->direction == GST_PAD_SINK) {
|
||||||
GList *types = gst_pad_get_type_ids(pad);
|
GList *types = gst_pad_get_type_ids(pad);
|
||||||
if (types)
|
if (types) {
|
||||||
sink_type = GPOINTER_TO_INT (types->data);
|
sink_type = GPOINTER_TO_INT (types->data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sink_type = 0;
|
sink_type = 0;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
g_print ("type %d\n", sink_type);
|
||||||
|
|
||||||
pads = g_list_next(pads);
|
pads = g_list_next(pads);
|
||||||
}
|
}
|
||||||
|
@ -497,15 +502,17 @@ differ:
|
||||||
sinkpad = (GstPad *)sinkpads->data;
|
sinkpad = (GstPad *)sinkpads->data;
|
||||||
|
|
||||||
// FIXME connect matching pads, not just the first one...
|
// FIXME connect matching pads, not just the first one...
|
||||||
/*
|
|
||||||
if (sinkpad->direction == GST_PAD_SINK &&
|
if (sinkpad->direction == GST_PAD_SINK &&
|
||||||
!GST_PAD_CONNECTED(sinkpad)) {
|
!GST_PAD_CONNECTED(sinkpad)) {
|
||||||
|
guint16 sinktype = 0;
|
||||||
|
GList *types = gst_pad_get_type_ids(sinkpad);
|
||||||
|
if (types)
|
||||||
|
sinktype = GPOINTER_TO_INT (types->data);
|
||||||
// the queue has the type of the elements it connects
|
// the queue has the type of the elements it connects
|
||||||
srcpad->type = sinkpad->type;
|
gst_pad_set_type_id (srcpad, sinktype);
|
||||||
gst_element_get_pad(queue, "sink")->type = sinkpad->type;
|
gst_pad_set_type_id (gst_element_get_pad(queue, "sink"), sinktype);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
sinkpads = g_list_next(sinkpads);
|
sinkpads = g_list_next(sinkpads);
|
||||||
}
|
}
|
||||||
gst_pipeline_pads_autoplug(thesrcelement, queue);
|
gst_pipeline_pads_autoplug(thesrcelement, queue);
|
||||||
|
|
|
@ -120,6 +120,7 @@ gst_asyncdisksrc_init (GstAsyncDiskSrc *asyncdisksrc)
|
||||||
{
|
{
|
||||||
GST_SRC_SET_FLAGS (asyncdisksrc, GST_SRC_ASYNC);
|
GST_SRC_SET_FLAGS (asyncdisksrc, GST_SRC_ASYNC);
|
||||||
|
|
||||||
|
g_print("init\n");
|
||||||
asyncdisksrc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
asyncdisksrc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
||||||
gst_pad_set_pull_function (asyncdisksrc->srcpad,gst_asyncdisksrc_pull);
|
gst_pad_set_pull_function (asyncdisksrc->srcpad,gst_asyncdisksrc_pull);
|
||||||
// FIXME must set pullregion
|
// FIXME must set pullregion
|
||||||
|
|
Loading…
Reference in a new issue