gst/playback/: Don't disconnect the have_type signal because we never reconnect it later on. Instead keep a variable ...

Original commit message from CVS:
* gst/playback/gstdecodebin.c: (type_found),
(gst_decode_bin_change_state):
* gst/playback/gstdecodebin2.c: (type_found),
(gst_decode_bin_change_state):
Don't disconnect the have_type signal because we never reconnect it
later on. Instead keep a variable to see if we already detected a type.
This commit is contained in:
Wim Taymans 2007-10-08 17:12:32 +00:00
parent ecb6c19729
commit d0897a3528
3 changed files with 29 additions and 11 deletions

View file

@ -1,3 +1,12 @@
2007-10-08 Wim Taymans <wim.taymans@gmail.com>
* gst/playback/gstdecodebin.c: (type_found),
(gst_decode_bin_change_state):
* gst/playback/gstdecodebin2.c: (type_found),
(gst_decode_bin_change_state):
Don't disconnect the have_type signal because we never reconnect it
later on. Instead keep a variable to see if we already detected a type.
2007-10-08 Wim Taymans <wim.taymans@gmail.com>
* gst/playback/gstdecodebin.c: (add_fakesink), (type_found):

View file

@ -71,6 +71,7 @@ struct _GstDecodeBin
gint numpads;
gint numwaiting;
gboolean have_type;
guint have_type_id; /* signal id for the typefind element */
gboolean shutting_down; /* stop pluggin if we're shutting down */
@ -1538,13 +1539,14 @@ type_found (GstElement * typefind, guint probability, GstCaps * caps,
GST_STATE_LOCK (decode_bin);
if (decode_bin->shutting_down)
goto shutting_down;
goto exit;
/* don't need the typefind anymore, we're not going to dynamically change
* elements anyway */
if (decode_bin->have_type_id)
g_signal_handler_disconnect (G_OBJECT (typefind), decode_bin->have_type_id);
decode_bin->have_type_id = 0;
/* don't need the typefind anymore if we already found a type, we're not going
* to be able to do anything with it anyway except for generating errors */
if (decode_bin->have_type)
goto exit;
decode_bin->have_type = TRUE;
GST_DEBUG_OBJECT (decode_bin, "typefind found caps %" GST_PTR_FORMAT, caps);
@ -1558,7 +1560,7 @@ type_found (GstElement * typefind, guint probability, GstCaps * caps,
GST_ELEMENT_ERROR (decode_bin, STREAM, WRONG_TYPE,
(_("This appears to be a text file")),
("decodebin cannot decode plain text files"));
goto shutting_down;
goto exit;
}
/* autoplug the new pad with the caps that the signal gave us. */
@ -1577,7 +1579,7 @@ type_found (GstElement * typefind, guint probability, GstCaps * caps,
GST_DEBUG_OBJECT (decode_bin, "we have more dynamic elements");
}
shutting_down:
exit:
GST_STATE_UNLOCK (decode_bin);
return;
}
@ -1710,6 +1712,7 @@ gst_decode_bin_change_state (GstElement * element, GstStateChange transition)
case GST_STATE_CHANGE_READY_TO_PAUSED:
GST_OBJECT_LOCK (decode_bin);
decode_bin->shutting_down = FALSE;
decode_bin->have_type = FALSE;
GST_OBJECT_UNLOCK (decode_bin);
if (!add_fakesink (decode_bin))

View file

@ -96,6 +96,7 @@ struct _GstDecodeBin
GList *factories; /* factories we can use for selecting elements */
gboolean have_type; /* if we received the have_type signal */
guint have_type_id; /* signal id for have-type from typefind */
};
@ -1146,9 +1147,12 @@ type_found (GstElement * typefind, guint probability,
GST_DEBUG_OBJECT (decode_bin, "typefind found caps %" GST_PTR_FORMAT, caps);
if (decode_bin->have_type_id)
g_signal_handler_disconnect (typefind, decode_bin->have_type_id);
decode_bin->have_type_id = 0;
/* we can only deal with one type, we don't yet support dynamically changing
* caps from the typefind element */
if (decode_bin->have_type)
goto exit;
decode_bin->have_type = TRUE;
pad = gst_element_get_static_pad (typefind, "src");
@ -1156,6 +1160,7 @@ type_found (GstElement * typefind, guint probability,
gst_object_unref (pad);
exit:
GST_STATE_UNLOCK (decode_bin);
return;
}
@ -2190,6 +2195,7 @@ gst_decode_bin_change_state (GstElement * element, GstStateChange transition)
goto missing_typefind;
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:{
dbin->have_type = FALSE;
if (!add_fakesink (dbin))
goto missing_fakesink;
break;