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):
* gst/playback/gstdecodebin2.c: (gst_decode_bin_init),
(type_found):
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 */
GST_STATE_LOCK (decode_bin);
if (decode_bin->shutting_down)
- goto shutting_down;
+ goto exit;
+
+ /* 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;
- /* 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;
+ decode_bin->have_type = TRUE;
GST_DEBUG_OBJECT (decode_bin, "typefind found caps %" GST_PTR_FORMAT, 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. */
GST_DEBUG_OBJECT (decode_bin, "we have more dynamic elements");
}
-shutting_down:
+exit:
GST_STATE_UNLOCK (decode_bin);
return;
}
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))
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 */
};
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");
gst_object_unref (pad);
+exit:
GST_STATE_UNLOCK (decode_bin);
return;
}
goto missing_typefind;
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:{
+ dbin->have_type = FALSE;
if (!add_fakesink (dbin))
goto missing_fakesink;
break;