gst/playback/: Unlink the signal handler when we found the type, we're not going to do anything sensible with more ty...

Original commit message from CVS:
* gst/playback/gstdecodebin.c: (add_fakesink), (type_found):
* gst/playback/gstdecodebin2.c: (gst_decode_bin_init),
(type_found):
Unlink the signal handler when we found the type, we're not going to do
anything sensible with more type_found signals anyway.
This commit is contained in:
Wim Taymans 2007-10-08 10:47:26 +00:00
parent aa2e910ca1
commit ecb6c19729
3 changed files with 23 additions and 1 deletions

View file

@ -1,3 +1,11 @@
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):
Unlink the signal handler when we found the type, we're not going to do
anything sensible with more type_found signals anyway.
2007-10-06 Tim-Philipp Müller <tim at centricular dot net> 2007-10-06 Tim-Philipp Müller <tim at centricular dot net>
* gst-libs/gst/tag/gsttagdemux.c: * gst-libs/gst/tag/gsttagdemux.c:

View file

@ -583,6 +583,7 @@ add_fakesink (GstDecodeBin * decode_bin)
/* hacky, remove sink flag, we don't want our decodebin to become a sink /* hacky, remove sink flag, we don't want our decodebin to become a sink
* just because we add a fakesink element to make us ASYNC */ * just because we add a fakesink element to make us ASYNC */
GST_OBJECT_FLAG_UNSET (decode_bin->fakesink, GST_ELEMENT_IS_SINK); GST_OBJECT_FLAG_UNSET (decode_bin->fakesink, GST_ELEMENT_IS_SINK);
/* takes ownership */ /* takes ownership */
if (!gst_bin_add (GST_BIN (decode_bin), decode_bin->fakesink)) { if (!gst_bin_add (GST_BIN (decode_bin), decode_bin->fakesink)) {
g_warning ("Could not add fakesink element, decodebin will not work"); g_warning ("Could not add fakesink element, decodebin will not work");
@ -1539,6 +1540,12 @@ type_found (GstElement * typefind, guint probability, GstCaps * caps,
if (decode_bin->shutting_down) if (decode_bin->shutting_down)
goto shutting_down; goto shutting_down;
/* 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;
GST_DEBUG_OBJECT (decode_bin, "typefind found caps %" GST_PTR_FORMAT, caps); GST_DEBUG_OBJECT (decode_bin, "typefind found caps %" GST_PTR_FORMAT, caps);
/* special-case text/plain: we only want to accept it as a raw type if it /* special-case text/plain: we only want to accept it as a raw type if it

View file

@ -95,6 +95,8 @@ struct _GstDecodeBin
GstCaps *caps; /* caps on which to stop decoding */ GstCaps *caps; /* caps on which to stop decoding */
GList *factories; /* factories we can use for selecting elements */ GList *factories; /* factories we can use for selecting elements */
guint have_type_id; /* signal id for have-type from typefind */
}; };
struct _GstDecodeBinClass struct _GstDecodeBinClass
@ -541,7 +543,8 @@ gst_decode_bin_init (GstDecodeBin * decode_bin)
/* connect a signal to find out when the typefind element found /* connect a signal to find out when the typefind element found
* a type */ * a type */
g_signal_connect (G_OBJECT (decode_bin->typefind), "have_type", decode_bin->have_type_id =
g_signal_connect (G_OBJECT (decode_bin->typefind), "have-type",
G_CALLBACK (type_found), decode_bin); G_CALLBACK (type_found), decode_bin);
} }
@ -1143,6 +1146,10 @@ type_found (GstElement * typefind, guint probability,
GST_DEBUG_OBJECT (decode_bin, "typefind found caps %" GST_PTR_FORMAT, caps); 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;
pad = gst_element_get_static_pad (typefind, "src"); pad = gst_element_get_static_pad (typefind, "src");
analyze_new_pad (decode_bin, typefind, pad, caps, NULL); analyze_new_pad (decode_bin, typefind, pad, caps, NULL);