This apparently fixes #93735

Original commit message from CVS:
This apparently fixes #93735
This commit is contained in:
Ronald S. Bultje 2003-04-08 10:04:27 +00:00
parent d889af82bc
commit 50b46e7146

View file

@ -414,6 +414,7 @@ gst_spider_identity_sink_loop_type_finding (GstSpiderIdentity *ident)
gboolean getmorebuf = TRUE;
GList *type_list;
gboolean restart_spider = FALSE;
GstCaps *caps;
/* this should possibly be a property */
guint bufsizelimit = 4096;
@ -468,6 +469,11 @@ gst_spider_identity_sink_loop_type_finding (GstSpiderIdentity *ident)
goto end;
}
/* maybe there are already valid caps now? */
if ((caps = gst_pad_get_caps (ident->sink)) != NULL) {
goto plug;
}
/* now do the actual typefinding with the supplied buffer */
type_list = (GList *) gst_type_get_list ();
@ -478,26 +484,15 @@ gst_spider_identity_sink_loop_type_finding (GstSpiderIdentity *ident)
while (factories) {
GstTypeFactory *factory = GST_TYPE_FACTORY (factories->data);
GstTypeFindFunc typefindfunc = (GstTypeFindFunc)factory->typefindfunc;
GstCaps *caps;
if (typefindfunc && (caps = typefindfunc (buf, factory))) {
/* pause the autoplugger */
if (gst_element_get_state (GST_ELEMENT (GST_ELEMENT_PARENT(ident))) == GST_STATE_PLAYING) {
gst_element_set_state (GST_ELEMENT (GST_ELEMENT_PARENT(ident)), GST_STATE_PAUSED);
restart_spider = TRUE;
}
if (gst_pad_try_set_caps (ident->sink, caps) <= 0) {
g_warning ("typefind: found type but peer didn't accept it");
}
gst_spider_identity_plug (ident);
/* restart autoplugger */
if (restart_spider){
gst_element_set_state (GST_ELEMENT (GST_ELEMENT_PARENT(ident)), GST_STATE_PLAYING);
}
goto end;
gst_caps_sink (caps);
} else {
goto plug;
}
}
factories = g_slist_next (factories);
}
@ -515,6 +510,24 @@ end:
/* push the buffer */
gst_spider_identity_chain (ident->sink, buf);
return;
plug:
gst_caps_debug (caps, "spider starting caps");
gst_caps_sink (caps);
/* pause the autoplugger */
if (gst_element_get_state (GST_ELEMENT (GST_ELEMENT_PARENT(ident))) == GST_STATE_PLAYING) {
gst_element_set_state (GST_ELEMENT (GST_ELEMENT_PARENT(ident)), GST_STATE_PAUSED);
restart_spider = TRUE;
}
gst_spider_identity_plug (ident);
/* restart autoplugger */
if (restart_spider){
gst_element_set_state (GST_ELEMENT (GST_ELEMENT_PARENT(ident)), GST_STATE_PLAYING);
}
goto end;
}
static gboolean