From d0897a352847fad6763b3f9869cca952da34b052 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 8 Oct 2007 17:12:32 +0000 Subject: [PATCH] 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. --- ChangeLog | 9 +++++++++ gst/playback/gstdecodebin.c | 19 +++++++++++-------- gst/playback/gstdecodebin2.c | 12 +++++++++--- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 54f8cbffa1..65358813cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-10-08 Wim Taymans + + * 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 * gst/playback/gstdecodebin.c: (add_fakesink), (type_found): diff --git a/gst/playback/gstdecodebin.c b/gst/playback/gstdecodebin.c index 338d8681db..68228dba0f 100644 --- a/gst/playback/gstdecodebin.c +++ b/gst/playback/gstdecodebin.c @@ -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 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); @@ -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)) diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index e42309e9f0..c403f4127f 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -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; -- 2.34.1