gst/playback/gstplaybasebin.c: Attempt to fix up buffer probe thingies.

Original commit message from CVS:
2005-09-21  Andy Wingo  <wingo@pobox.com>

* gst/playback/gstplaybasebin.c: Attempt to fix up buffer probe
thingies.

* gst/playback/gstdecodebin.c (gst_decode_bin_dispose): Dispose
can be called multiple times, dogs.
This commit is contained in:
Andy Wingo 2005-09-21 12:58:35 +00:00
parent 9bbe8af0c3
commit 997b3c4b78
3 changed files with 44 additions and 17 deletions

View file

@ -1,3 +1,11 @@
2005-09-21 Andy Wingo <wingo@pobox.com>
* gst/playback/gstplaybasebin.c: Attempt to fix up buffer probe
thingies.
* gst/playback/gstdecodebin.c (gst_decode_bin_dispose): Dispose
can be called multiple times, dogs.
2005-09-21 Wim Taymans <wim@fluendo.com> 2005-09-21 Wim Taymans <wim@fluendo.com>
* gst-libs/gst/rtp/gstbasertppayload.c: * gst-libs/gst/rtp/gstbasertppayload.c:

View file

@ -348,7 +348,9 @@ gst_decode_bin_dispose (GObject * object)
decode_bin = GST_DECODE_BIN (object); decode_bin = GST_DECODE_BIN (object);
if (decode_bin->factories)
gst_plugin_feature_list_free (decode_bin->factories); gst_plugin_feature_list_free (decode_bin->factories);
decode_bin->factories = NULL;
G_OBJECT_CLASS (parent_class)->dispose (object); G_OBJECT_CLASS (parent_class)->dispose (object);
} }
@ -567,7 +569,7 @@ try_to_link_1 (GstDecodeBin * decode_bin, GstPad * pad, GList * factories)
/* make an element from the factory first */ /* make an element from the factory first */
if ((element = gst_element_factory_create (factory, NULL)) == NULL) { if ((element = gst_element_factory_create (factory, NULL)) == NULL) {
/* hmm, strange. Like with all things in live, let's move on.. */ /* hmm, strange. Like with all things in life, let's move on.. */
GST_WARNING_OBJECT (decode_bin, "could not create an element from %s", GST_WARNING_OBJECT (decode_bin, "could not create an element from %s",
gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (factory))); gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (factory)));
continue; continue;

View file

@ -483,12 +483,15 @@ queue_overrun (GstElement * element, GstPlayBaseBin * play_base_bin)
static void static void
queue_threshold_reached (GstElement * queue, GstPlayBaseBin * play_base_bin) queue_threshold_reached (GstElement * queue, GstPlayBaseBin * play_base_bin)
{ {
gpointer data;
GST_DEBUG ("Running"); GST_DEBUG ("Running");
/* play */ /* play */
g_object_set (queue, "min-threshold-time", (guint64) 0, NULL); g_object_set (queue, "min-threshold-time", (guint64) 0, NULL);
if (g_object_get_data (G_OBJECT (queue), "probe")) { data = g_object_get_data (G_OBJECT (queue), "probe");
if (data) {
GstPad *sinkpad; GstPad *sinkpad;
sinkpad = gst_element_get_pad (queue, "sink"); sinkpad = gst_element_get_pad (queue, "sink");
@ -499,7 +502,7 @@ queue_threshold_reached (GstElement * queue, GstPlayBaseBin * play_base_bin)
fill_buffer (play_base_bin, 100); fill_buffer (play_base_bin, 100);
g_object_set_data (G_OBJECT (queue), "probe", NULL); g_object_set_data (G_OBJECT (queue), "probe", NULL);
gst_pad_remove_buffer_probe (sinkpad, G_CALLBACK (check_queue), queue); gst_pad_remove_buffer_probe (sinkpad, GPOINTER_TO_INT (data));
gst_object_unref (sinkpad); gst_object_unref (sinkpad);
} }
@ -519,10 +522,11 @@ queue_out_of_data (GstElement * queue, GstPlayBaseBin * play_base_bin)
/* re-connect probe */ /* re-connect probe */
if (!g_object_get_data (G_OBJECT (queue), "probe")) { if (!g_object_get_data (G_OBJECT (queue), "probe")) {
GstPad *sinkpad; GstPad *sinkpad;
guint id;
sinkpad = gst_element_get_pad (queue, "sink"); sinkpad = gst_element_get_pad (queue, "sink");
gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (check_queue), queue); id = gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (check_queue), queue);
g_object_set_data (G_OBJECT (queue), "probe", (gpointer) 0x1); g_object_set_data (G_OBJECT (queue), "probe", GINT_TO_POINTER (id));
GST_DEBUG_OBJECT (play_base_bin, GST_DEBUG_OBJECT (play_base_bin,
"Re-attaching buffering probe to pad %s:%s", "Re-attaching buffering probe to pad %s:%s",
GST_DEBUG_PAD_NAME (sinkpad), sinkpad); GST_DEBUG_PAD_NAME (sinkpad), sinkpad);
@ -587,6 +591,7 @@ gen_preroll_element (GstPlayBaseBin * play_base_bin,
(type == GST_STREAM_TYPE_AUDIO && (type == GST_STREAM_TYPE_AUDIO &&
group->type[GST_STREAM_TYPE_VIDEO - 1].npads == 0))) { group->type[GST_STREAM_TYPE_VIDEO - 1].npads == 0))) {
GstPad *sinkpad; GstPad *sinkpad;
guint id;
g_signal_connect (G_OBJECT (preroll), "running", g_signal_connect (G_OBJECT (preroll), "running",
G_CALLBACK (queue_threshold_reached), play_base_bin); G_CALLBACK (queue_threshold_reached), play_base_bin);
@ -595,12 +600,12 @@ gen_preroll_element (GstPlayBaseBin * play_base_bin,
/* give updates on queue size */ /* give updates on queue size */
sinkpad = gst_element_get_pad (preroll, "sink"); sinkpad = gst_element_get_pad (preroll, "sink");
gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (check_queue), preroll); id = gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (check_queue), preroll);
GST_DEBUG_OBJECT (play_base_bin, "Attaching probe to pad %s:%s (%p)", GST_DEBUG_OBJECT (play_base_bin, "Attaching probe to pad %s:%s (%p)",
GST_DEBUG_PAD_NAME (sinkpad), sinkpad); GST_DEBUG_PAD_NAME (sinkpad), sinkpad);
gst_object_unref (sinkpad); gst_object_unref (sinkpad);
g_object_set_data (G_OBJECT (preroll), "pbb", play_base_bin); g_object_set_data (G_OBJECT (preroll), "pbb", play_base_bin);
g_object_set_data (G_OBJECT (preroll), "probe", (gpointer) 0x1); g_object_set_data (G_OBJECT (preroll), "probe", GINT_TO_POINTER (id));
g_signal_connect (G_OBJECT (preroll), "underrun", g_signal_connect (G_OBJECT (preroll), "underrun",
G_CALLBACK (queue_out_of_data), play_base_bin); G_CALLBACK (queue_out_of_data), play_base_bin);
@ -874,12 +879,14 @@ static gboolean
mute_stream (GstPad * pad, GstBuffer * buf, gpointer data) mute_stream (GstPad * pad, GstBuffer * buf, gpointer data)
{ {
GstStreamInfo *info = GST_STREAM_INFO (data); GstStreamInfo *info = GST_STREAM_INFO (data);
guint id;
GST_DEBUG ("mute stream triggered"); GST_DEBUG ("mute stream triggered");
g_object_set (G_OBJECT (info), "mute", TRUE, NULL); g_object_set (G_OBJECT (info), "mute", TRUE, NULL);
gst_pad_remove_buffer_probe (GST_PAD_CAST (info->object), id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (info), "mute_probe"));
G_CALLBACK (mute_stream), data); g_object_set_data (G_OBJECT (info), "mute_probe", NULL);
gst_pad_remove_buffer_probe (GST_PAD_CAST (info->object), id);
/* no data */ /* no data */
return FALSE; return FALSE;
@ -968,9 +975,11 @@ new_decoded_pad (GstElement * element, GstPad * pad, gboolean last,
/* select 1st for now - we'll select a preferred one after preroll */ /* select 1st for now - we'll select a preferred one after preroll */
if (type == GST_STREAM_TYPE_UNKNOWN || group->type[type - 1].npads > 0) { if (type == GST_STREAM_TYPE_UNKNOWN || group->type[type - 1].npads > 0) {
gst_pad_add_data_probe (GST_PAD_CAST (pad), guint id;
id = gst_pad_add_data_probe (GST_PAD_CAST (pad),
G_CALLBACK (silence_stream), info); G_CALLBACK (silence_stream), info);
g_object_set_data (G_OBJECT (pad), "eat_probe", (gpointer) 0x1); g_object_set_data (G_OBJECT (pad), "eat_probe", GINT_TO_POINTER (id));
} }
add_stream (group, info); add_stream (group, info);
@ -1067,17 +1076,22 @@ setup_substreams (GstPlayBaseBin * play_base_bin)
group = get_active_group (play_base_bin); group = get_active_group (play_base_bin);
for (item = group->streaminfo; item; item = item->next) { for (item = group->streaminfo; item; item = item->next) {
GstStreamInfo *info = item->data; GstStreamInfo *info = item->data;
gpointer data;
if (g_object_get_data (G_OBJECT (info->object), "eat_probe")) { data = g_object_get_data (G_OBJECT (info->object), "eat_probe");
if (data) {
gst_pad_remove_data_probe (GST_PAD_CAST (info->object), gst_pad_remove_data_probe (GST_PAD_CAST (info->object),
G_CALLBACK (silence_stream), info); GPOINTER_TO_INT (data));
g_object_set_data (G_OBJECT (info->object), "eat_probe", NULL); g_object_set_data (G_OBJECT (info->object), "eat_probe", NULL);
} }
/* now remove unknown pads */ /* now remove unknown pads */
if (info->type == GST_STREAM_TYPE_UNKNOWN) { if (info->type == GST_STREAM_TYPE_UNKNOWN) {
gst_pad_add_buffer_probe (GST_PAD_CAST (info->object), guint id;
id = gst_pad_add_buffer_probe (GST_PAD_CAST (info->object),
G_CALLBACK (mute_stream), info); G_CALLBACK (mute_stream), info);
g_object_set_data (G_OBJECT (info), "mute_probe", GINT_TO_POINTER (id));
} }
} }
@ -1497,8 +1511,11 @@ set_active_source (GstPlayBaseBin * play_base_bin,
g_object_set (s->data, "mute", FALSE, NULL); g_object_set (s->data, "mute", FALSE, NULL);
have_active = TRUE; have_active = TRUE;
} else { } else {
gst_pad_add_buffer_probe (GST_PAD_CAST (info->object), guint id;
id = gst_pad_add_buffer_probe (GST_PAD_CAST (info->object),
G_CALLBACK (mute_stream), info); G_CALLBACK (mute_stream), info);
g_object_set_data (G_OBJECT (info), "mute_probe", GINT_TO_POINTER (id));
} }
num++; num++;
} }