Commit 1ce6923a authored by Ronald S. Bultje's avatar Ronald S. Bultje
Browse files

ext/ogg/gstoggdemux.c: Send EOS when deactivating.

Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_deactivate_current_chain):
Send EOS when deactivating.
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(check_queue), (queue_threshold_reached), (queue_out_of_data),
(gen_preroll_element), (probe_triggered), (mute_stream),
(silence_stream), (new_decoded_pad), (setup_substreams),
(set_active_source):
* gst/playback/gstplaybin.c: (gst_play_bin_get_property),
(remove_sinks), (add_sink):
* gst/playback/gststreaminfo.c: (cb_probe), (gst_stream_info_new):
Change for new probe API.
parent 85ce2383
2005-06-29 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_deactivate_current_chain):
Send EOS when deactivating.
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(check_queue), (queue_threshold_reached), (queue_out_of_data),
(gen_preroll_element), (probe_triggered), (mute_stream),
(silence_stream), (new_decoded_pad), (setup_substreams),
(set_active_source):
* gst/playback/gstplaybin.c: (gst_play_bin_get_property),
(remove_sinks), (add_sink):
* gst/playback/gststreaminfo.c: (cb_probe), (gst_stream_info_new):
Change for new probe API.
2005-06-29 Wim Taymans <wim@fluendo.com> 2005-06-29 Wim Taymans <wim@fluendo.com>
   
* gst-libs/gst/audio/gstaudiosink.c: (gst_audioringbuffer_init): * gst-libs/gst/audio/gstaudiosink.c: (gst_audioringbuffer_init):
......
...@@ -1143,6 +1143,7 @@ gst_ogg_demux_deactivate_current_chain (GstOggDemux * ogg) ...@@ -1143,6 +1143,7 @@ gst_ogg_demux_deactivate_current_chain (GstOggDemux * ogg)
for (i = 0; i < chain->streams->len; i++) { for (i = 0; i < chain->streams->len; i++) {
GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i); GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
gst_pad_push_event (GST_PAD (pad), gst_event_new (GST_EVENT_EOS));
gst_element_remove_pad (GST_ELEMENT (ogg), GST_PAD (pad)); gst_element_remove_pad (GST_ELEMENT (ogg), GST_PAD (pad));
} }
/* if we cannot seek, we can destroy the chain completely */ /* if we cannot seek, we can destroy the chain completely */
......
...@@ -69,7 +69,7 @@ const GList *gst_play_base_bin_get_streaminfo (GstPlayBaseBin * play_base_bin); ...@@ -69,7 +69,7 @@ const GList *gst_play_base_bin_get_streaminfo (GstPlayBaseBin * play_base_bin);
static gboolean prepare_output (GstPlayBaseBin * play_base_bin); static gboolean prepare_output (GstPlayBaseBin * play_base_bin);
static void set_active_source (GstPlayBaseBin * play_base_bin, static void set_active_source (GstPlayBaseBin * play_base_bin,
GstStreamType type, gint source_num); GstStreamType type, gint source_num);
static gboolean probe_triggered (GstProbe * probe, GstMiniObject ** data, static gboolean probe_triggered (GstPad * pad, GstEvent * event,
gpointer user_data); gpointer user_data);
static void setup_substreams (GstPlayBaseBin * play_base_bin); static void setup_substreams (GstPlayBaseBin * play_base_bin);
...@@ -187,7 +187,7 @@ gst_play_base_bin_init (GstPlayBaseBin * play_base_bin) ...@@ -187,7 +187,7 @@ gst_play_base_bin_init (GstPlayBaseBin * play_base_bin)
play_base_bin->building_group = NULL; play_base_bin->building_group = NULL;
play_base_bin->queued_groups = NULL; play_base_bin->queued_groups = NULL;
play_base_bin->queue_size = DEFAULT_QUEUE_SIZE; play_base_bin->queue_size = 0; //DEFAULT_QUEUE_SIZE;
play_base_bin->queue_threshold = DEFAULT_QUEUE_THRESHOLD; play_base_bin->queue_threshold = DEFAULT_QUEUE_THRESHOLD;
} }
...@@ -443,7 +443,7 @@ fill_buffer (GstPlayBaseBin * play_base_bin, gint percent) ...@@ -443,7 +443,7 @@ fill_buffer (GstPlayBaseBin * play_base_bin, gint percent)
} }
static gboolean static gboolean
check_queue (GstProbe * probe, GstMiniObject ** data, gpointer user_data) check_queue (GstPad * pad, GstBuffer * data, gpointer user_data)
{ {
GstElement *queue = GST_ELEMENT (user_data); GstElement *queue = GST_ELEMENT (user_data);
GstPlayBaseBin *play_base_bin = g_object_get_data (G_OBJECT (queue), "pbb"); GstPlayBaseBin *play_base_bin = g_object_get_data (G_OBJECT (queue), "pbb");
...@@ -478,26 +478,23 @@ queue_overrun (GstElement * element, GstPlayBaseBin * play_base_bin) ...@@ -478,26 +478,23 @@ 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)
{ {
GstProbe *probe;
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 ((probe = g_object_get_data (G_OBJECT (queue), "probe"))) { if (g_object_get_data (G_OBJECT (queue), "probe")) {
GstPad *sinkpad; GstPad *sinkpad;
sinkpad = gst_element_get_pad (queue, "sink"); sinkpad = gst_element_get_pad (queue, "sink");
GST_DEBUG_OBJECT (play_base_bin, GST_DEBUG_OBJECT (play_base_bin,
"Removing buffer probe %p from pad %s:%s (%p)", "Removing buffer probe from pad %s:%s (%p)",
probe, GST_DEBUG_PAD_NAME (sinkpad), sinkpad); GST_DEBUG_PAD_NAME (sinkpad), sinkpad);
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_probe (sinkpad, probe); gst_pad_remove_buffer_probe (sinkpad, G_CALLBACK (check_queue), queue);
gst_probe_destroy (probe);
g_object_unref (G_OBJECT (sinkpad)); g_object_unref (G_OBJECT (sinkpad));
} }
...@@ -506,8 +503,6 @@ queue_threshold_reached (GstElement * queue, GstPlayBaseBin * play_base_bin) ...@@ -506,8 +503,6 @@ queue_threshold_reached (GstElement * queue, GstPlayBaseBin * play_base_bin)
static void static void
queue_out_of_data (GstElement * queue, GstPlayBaseBin * play_base_bin) queue_out_of_data (GstElement * queue, GstPlayBaseBin * play_base_bin)
{ {
GstProbe *probe;
GST_DEBUG ("Underrun, re-caching"); GST_DEBUG ("Underrun, re-caching");
/* On underrun, we want to temoprarily pause playback, set a "min-size" /* On underrun, we want to temoprarily pause playback, set a "min-size"
...@@ -517,16 +512,15 @@ queue_out_of_data (GstElement * queue, GstPlayBaseBin * play_base_bin) ...@@ -517,16 +512,15 @@ queue_out_of_data (GstElement * queue, GstPlayBaseBin * play_base_bin)
(guint64) play_base_bin->queue_threshold, NULL); (guint64) play_base_bin->queue_threshold, NULL);
/* re-connect probe */ /* re-connect probe */
if (!(probe = g_object_get_data (G_OBJECT (queue), "probe"))) { if (!g_object_get_data (G_OBJECT (queue), "probe")) {
GstPad *sinkpad; GstPad *sinkpad;
probe = gst_probe_new (FALSE, check_queue, queue);
sinkpad = gst_element_get_pad (queue, "sink"); sinkpad = gst_element_get_pad (queue, "sink");
gst_pad_add_probe (sinkpad, probe); gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (check_queue), queue);
g_object_set_data (G_OBJECT (queue), "probe", probe); g_object_set_data (G_OBJECT (queue), "probe", (gpointer) 0x1);
GST_DEBUG_OBJECT (play_base_bin, GST_DEBUG_OBJECT (play_base_bin,
"Re-attaching buffering probe %p to pad %s:%s (%p)", "Re-attaching buffering probe to pad %s:%s",
probe, GST_DEBUG_PAD_NAME (sinkpad), sinkpad); GST_DEBUG_PAD_NAME (sinkpad), sinkpad);
g_object_unref (G_OBJECT (sinkpad)); g_object_unref (G_OBJECT (sinkpad));
fill_buffer (play_base_bin, 0); fill_buffer (play_base_bin, 0);
...@@ -551,7 +545,6 @@ gen_preroll_element (GstPlayBaseBin * play_base_bin, ...@@ -551,7 +545,6 @@ gen_preroll_element (GstPlayBaseBin * play_base_bin,
const gchar *prename; const gchar *prename;
guint sig; guint sig;
GstPad *preroll_pad; GstPad *preroll_pad;
GstProbe *probe;
if (type == GST_STREAM_TYPE_VIDEO) if (type == GST_STREAM_TYPE_VIDEO)
prename = "video"; prename = "video";
...@@ -588,7 +581,6 @@ gen_preroll_element (GstPlayBaseBin * play_base_bin, ...@@ -588,7 +581,6 @@ gen_preroll_element (GstPlayBaseBin * play_base_bin,
group->type[GST_STREAM_TYPE_AUDIO - 1].npads == 0) || group->type[GST_STREAM_TYPE_AUDIO - 1].npads == 0) ||
(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))) {
GstProbe *probe;
GstPad *sinkpad; GstPad *sinkpad;
g_signal_connect (G_OBJECT (preroll), "running", g_signal_connect (G_OBJECT (preroll), "running",
...@@ -597,14 +589,13 @@ gen_preroll_element (GstPlayBaseBin * play_base_bin, ...@@ -597,14 +589,13 @@ gen_preroll_element (GstPlayBaseBin * play_base_bin,
"min-threshold-time", (guint64) play_base_bin->queue_threshold, NULL); "min-threshold-time", (guint64) play_base_bin->queue_threshold, NULL);
/* give updates on queue size */ /* give updates on queue size */
probe = gst_probe_new (FALSE, check_queue, preroll);
sinkpad = gst_element_get_pad (preroll, "sink"); sinkpad = gst_element_get_pad (preroll, "sink");
gst_pad_add_probe (sinkpad, probe); gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (check_queue), preroll);
GST_DEBUG_OBJECT (play_base_bin, "Attaching probe %p to pad %s:%s (%p)", GST_DEBUG_OBJECT (play_base_bin, "Attaching probe to pad %s:%s (%p)",
probe, GST_DEBUG_PAD_NAME (sinkpad), sinkpad); GST_DEBUG_PAD_NAME (sinkpad), sinkpad);
g_object_unref (G_OBJECT (sinkpad)); g_object_unref (G_OBJECT (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", probe); g_object_set_data (G_OBJECT (preroll), "probe", (gpointer) 0x1);
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);
...@@ -615,10 +606,7 @@ gen_preroll_element (GstPlayBaseBin * play_base_bin, ...@@ -615,10 +606,7 @@ gen_preroll_element (GstPlayBaseBin * play_base_bin,
/* listen for EOS */ /* listen for EOS */
preroll_pad = gst_element_get_pad (preroll, "src"); preroll_pad = gst_element_get_pad (preroll, "src");
probe = gst_probe_new (FALSE, probe_triggered, info); gst_pad_add_event_probe (preroll_pad, G_CALLBACK (probe_triggered), info);
/* have to REALIZE the pad as we cannot attach a padprobe to a ghostpad */
gst_pad_add_probe (preroll_pad, probe);
gst_object_unref (preroll_pad);
/* add to group list */ /* add to group list */
/* FIXME refcount elements */ /* FIXME refcount elements */
...@@ -760,7 +748,7 @@ no_more_pads (GstElement * element, GstPlayBaseBin * play_base_bin) ...@@ -760,7 +748,7 @@ no_more_pads (GstElement * element, GstPlayBaseBin * play_base_bin)
} }
static gboolean static gboolean
probe_triggered (GstProbe * probe, GstMiniObject ** data, gpointer user_data) probe_triggered (GstPad * pad, GstEvent * event, gpointer user_data)
{ {
GstPlayBaseGroup *group; GstPlayBaseGroup *group;
GstPlayBaseBin *play_base_bin; GstPlayBaseBin *play_base_bin;
...@@ -769,73 +757,70 @@ probe_triggered (GstProbe * probe, GstMiniObject ** data, gpointer user_data) ...@@ -769,73 +757,70 @@ probe_triggered (GstProbe * probe, GstMiniObject ** data, gpointer user_data)
group = (GstPlayBaseGroup *) g_object_get_data (G_OBJECT (info), "group"); group = (GstPlayBaseGroup *) g_object_get_data (G_OBJECT (info), "group");
play_base_bin = group->bin; play_base_bin = group->bin;
if (GST_IS_EVENT (*data)) { if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
GstEvent *event = GST_EVENT (*data); gint num_groups = 0;
gboolean have_left;
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) { GST_DEBUG ("probe got EOS in group %p", group);
gint num_groups = 0;
gboolean have_left;
GST_DEBUG ("probe got EOS in group %p", group); GROUP_LOCK (play_base_bin);
GROUP_LOCK (play_base_bin); /* mute this stream */
//g_object_set (G_OBJECT (info), "mute", TRUE, NULL);
if (info->type > 0 && info->type <= NUM_TYPES)
group->type[info->type - 1].done = TRUE;
/* mute this stream */ /* see if we have some more groups left to play */
//g_object_set (G_OBJECT (info), "mute", TRUE, NULL); num_groups = g_list_length (play_base_bin->queued_groups);
if (info->type > 0 && info->type <= NUM_TYPES) if (play_base_bin->building_group)
group->type[info->type - 1].done = TRUE; num_groups++;
have_left = (num_groups > 1);
/* see if we have some more groups left to play */ /* see if the complete group is muted */
num_groups = g_list_length (play_base_bin->queued_groups); if (!group_is_muted (group)) {
if (play_base_bin->building_group) /* group is not completely muted, we remove the EOS event
num_groups++; * and continue, eventually the other streams will be EOSed and
have_left = (num_groups > 1); * we can switch out this group. */
GST_DEBUG ("group %p not completely muted", group);
/* see if the complete group is muted */ GROUP_UNLOCK (play_base_bin);
if (!group_is_muted (group)) {
/* group is not completely muted, we remove the EOS event
* and continue, eventually the other streams will be EOSed and
* we can switch out this group. */
GST_DEBUG ("group %p not completely muted", group);
GROUP_UNLOCK (play_base_bin); /* remove the EOS if we have something left */
return !have_left;
}
/* remove the EOS if we have something left */ if (have_left) {
return !have_left; /* ok, get rid of the current group then */
//group_destroy (group);
/* removing the current group brings the next group
* active */
play_base_bin->queued_groups =
g_list_remove (play_base_bin->queued_groups, group);
/* and wait for the next one to be ready */
while (!play_base_bin->queued_groups) {
GROUP_WAIT (play_base_bin);
} }
group = play_base_bin->queued_groups->data;
if (have_left) { /* now activate the next one */
/* ok, get rid of the current group then */ setup_substreams (play_base_bin);
group_destroy (group); GST_DEBUG ("switching to next group %p - emitting signal", group);
/* removing the current group brings the next group /* and signal the new group */
* active */ GST_PLAY_BASE_BIN_GET_CLASS (play_base_bin)->
play_base_bin->queued_groups = setup_output_pads (play_base_bin, group);
g_list_remove (play_base_bin->queued_groups, group);
/* and wait for the next one to be ready */
while (!play_base_bin->queued_groups) {
GROUP_WAIT (play_base_bin);
}
/* now activate the next one */
setup_substreams (play_base_bin);
GST_DEBUG ("switching to next group %p - emitting signal",
play_base_bin->queued_groups->data);
/* and signal the new group */
GST_PLAY_BASE_BIN_GET_CLASS (play_base_bin)->
setup_output_pads (play_base_bin, group);
GROUP_UNLOCK (play_base_bin); GROUP_UNLOCK (play_base_bin);
g_object_notify (G_OBJECT (play_base_bin), "streaminfo"); g_object_notify (G_OBJECT (play_base_bin), "stream-info");
/* get rid of the EOS event */ /* get rid of the EOS event */
return FALSE; return FALSE;
} else { } else {
GROUP_UNLOCK (play_base_bin); GROUP_UNLOCK (play_base_bin);
GST_LOG ("Last group done, EOS"); GST_LOG ("Last group done, EOS");
}
} }
} }
return TRUE; return TRUE;
} }
...@@ -877,15 +862,13 @@ preroll_unlinked (GstPad * pad, GstPad * peerpad, ...@@ -877,15 +862,13 @@ preroll_unlinked (GstPad * pad, GstPad * peerpad,
/* Mute stream on first data - for header-is-in-stream-stuff /* Mute stream on first data - for header-is-in-stream-stuff
* (vorbis, ogmtext). */ * (vorbis, ogmtext). */
static gboolean static gboolean
mute_stream (GstProbe * probe, GstMiniObject ** d, gpointer data) mute_stream (GstPad * pad, GstBuffer * buf, gpointer data)
{ {
GstStreamInfo *info = GST_STREAM_INFO (data); GstStreamInfo *info = GST_STREAM_INFO (data);
if (GST_IS_BUFFER (*d)) { 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),
gst_pad_remove_probe (GST_PAD_CAST (info->object), probe); G_CALLBACK (mute_stream), data);
gst_probe_destroy (probe);
}
/* no data */ /* no data */
return FALSE; return FALSE;
...@@ -893,7 +876,7 @@ mute_stream (GstProbe * probe, GstMiniObject ** d, gpointer data) ...@@ -893,7 +876,7 @@ mute_stream (GstProbe * probe, GstMiniObject ** d, gpointer data)
/* Eat data. */ /* Eat data. */
static gboolean static gboolean
silence_stream (GstProbe * probe, GstMiniObject ** d, gpointer data) silence_stream (GstPad * pad, GstMiniObject * data, gpointer user_data)
{ {
/* no data */ /* no data */
return FALSE; return FALSE;
...@@ -913,7 +896,6 @@ new_decoded_pad (GstElement * element, GstPad * pad, gboolean last, ...@@ -913,7 +896,6 @@ new_decoded_pad (GstElement * element, GstPad * pad, gboolean last,
GstStreamType type; GstStreamType type;
GstPad *sinkpad; GstPad *sinkpad;
GstPlayBaseGroup *group; GstPlayBaseGroup *group;
GstProbe *probe;
guint sig; guint sig;
GstObject *parent; GstObject *parent;
...@@ -973,9 +955,9 @@ new_decoded_pad (GstElement * element, GstPad * pad, gboolean last, ...@@ -973,9 +955,9 @@ 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) {
probe = gst_probe_new (FALSE, silence_stream, info); gst_pad_add_data_probe (GST_PAD_CAST (pad),
gst_pad_add_probe (GST_PAD_CAST (pad), probe); G_CALLBACK (silence_stream), info);
g_object_set_data (G_OBJECT (pad), "eat_probe", probe); g_object_set_data (G_OBJECT (pad), "eat_probe", (gpointer) 0x1);
} }
add_stream (group, info); add_stream (group, info);
...@@ -1065,7 +1047,6 @@ static void ...@@ -1065,7 +1047,6 @@ static void
setup_substreams (GstPlayBaseBin * play_base_bin) setup_substreams (GstPlayBaseBin * play_base_bin)
{ {
GstPlayBaseGroup *group; GstPlayBaseGroup *group;
GstProbe *probe;
gint n; gint n;
const GList *item; const GList *item;
...@@ -1074,18 +1055,16 @@ setup_substreams (GstPlayBaseBin * play_base_bin) ...@@ -1074,18 +1055,16 @@ setup_substreams (GstPlayBaseBin * 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;
probe = g_object_get_data (G_OBJECT (info->object), "eat_probe"); if (g_object_get_data (G_OBJECT (info->object), "eat_probe")) {
if (probe) { gst_pad_remove_data_probe (GST_PAD_CAST (info->object),
gst_pad_remove_probe (GST_PAD_CAST (info->object), probe); G_CALLBACK (silence_stream), info);
gst_probe_destroy (probe); 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) {
GstProbe *probe; gst_pad_add_buffer_probe (GST_PAD_CAST (info->object),
G_CALLBACK (mute_stream), info);
probe = gst_probe_new (FALSE, mute_stream, info);
gst_pad_add_probe (GST_PAD_CAST (info->object), probe);
} }
} }
...@@ -1501,10 +1480,8 @@ set_active_source (GstPlayBaseBin * play_base_bin, ...@@ -1501,10 +1480,8 @@ 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 {
GstProbe *probe; gst_pad_add_buffer_probe (GST_PAD_CAST (info->object),
G_CALLBACK (mute_stream), info);
probe = gst_probe_new (FALSE, mute_stream, info);
gst_pad_add_probe (GST_PAD_CAST (info->object), probe);
} }
num++; num++;
} }
......
...@@ -332,7 +332,7 @@ gst_play_bin_get_property (GObject * object, guint prop_id, GValue * value, ...@@ -332,7 +332,7 @@ gst_play_bin_get_property (GObject * object, guint prop_id, GValue * value,
g_value_set_double (value, play_bin->volume); g_value_set_double (value, play_bin->volume);
break; break;
case ARG_FRAME: case ARG_FRAME:
g_value_set_boxed (value, play_bin->frame); gst_value_set_mini_object (value, GST_MINI_OBJECT (play_bin->frame));
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
...@@ -630,6 +630,7 @@ remove_sinks (GstPlayBin * play_bin) ...@@ -630,6 +630,7 @@ remove_sinks (GstPlayBin * play_bin)
GList *sinks; GList *sinks;
GstObject *parent; GstObject *parent;
GstElement *element; GstElement *element;
GstPad *pad, *peer;
GST_DEBUG ("removesinks"); GST_DEBUG ("removesinks");
element = g_hash_table_lookup (play_bin->cache, "abin"); element = g_hash_table_lookup (play_bin->cache, "abin");
...@@ -643,6 +644,15 @@ remove_sinks (GstPlayBin * play_bin) ...@@ -643,6 +644,15 @@ remove_sinks (GstPlayBin * play_bin)
gst_bin_remove (GST_BIN (parent), element); gst_bin_remove (GST_BIN (parent), element);
gst_object_unref (parent); gst_object_unref (parent);
} }
pad = gst_element_get_pad (element, "sink");
if (pad != NULL) {
peer = gst_pad_get_peer (pad);
if (peer != NULL) {
gst_pad_unlink (peer, pad);
gst_object_unref (peer);
}
gst_object_unref (pad);
}
} }
element = g_hash_table_lookup (play_bin->cache, "vbin"); element = g_hash_table_lookup (play_bin->cache, "vbin");
if (element != NULL) { if (element != NULL) {
...@@ -652,6 +662,15 @@ remove_sinks (GstPlayBin * play_bin) ...@@ -652,6 +662,15 @@ remove_sinks (GstPlayBin * play_bin)
gst_bin_remove (GST_BIN (parent), element); gst_bin_remove (GST_BIN (parent), element);
gst_object_unref (parent); gst_object_unref (parent);
} }
pad = gst_element_get_pad (element, "sink");
if (pad != NULL) {
peer = gst_pad_get_peer (pad);
if (peer != NULL) {
gst_pad_unlink (peer, pad);
gst_object_unref (peer);
}
gst_object_unref (pad);
}
} }
for (sinks = play_bin->sinks; sinks; sinks = g_list_next (sinks)) { for (sinks = play_bin->sinks; sinks; sinks = g_list_next (sinks)) {
...@@ -717,7 +736,7 @@ add_sink (GstPlayBin * play_bin, GstElement * sink, GstPad * srcpad) ...@@ -717,7 +736,7 @@ add_sink (GstPlayBin * play_bin, GstElement * sink, GstPad * srcpad)
/* could not link this stream */ /* could not link this stream */
capsstr = gst_caps_to_string (gst_pad_get_caps (srcpad)); capsstr = gst_caps_to_string (gst_pad_get_caps (srcpad));
g_warning ("could not link %s", capsstr); g_warning ("could not link %s: %d", capsstr, res);
g_free (capsstr); g_free (capsstr);
gst_bin_remove (GST_BIN (play_bin), sink); gst_bin_remove (GST_BIN (play_bin), sink);
......
...@@ -173,34 +173,30 @@ gst_stream_info_init (GstStreamInfo * stream_info) ...@@ -173,34 +173,30 @@ gst_stream_info_init (GstStreamInfo * stream_info)
} }
static gboolean static gboolean
cb_probe (GstProbe * probe, GstMiniObject ** data, gpointer user_data) cb_probe (GstPad * pad, GstEvent * e, gpointer user_data)
{ {
GstStreamInfo *info = user_data; GstStreamInfo *info = user_data;
if (GST_IS_EVENT (*data)) { if (GST_EVENT_TYPE (e) == GST_EVENT_TAG) {
GstEvent *e = GST_EVENT (*data); gchar *codec; //, *lang;
GstTagList *list = gst_event_tag_get_list (e);
if (GST_EVENT_TYPE (e) == GST_EVENT_TAG) {
gchar *codec; //, *lang; if (gst_tag_list_get_string (list, GST_TAG_VIDEO_CODEC, &codec)) {
GstTagList *list = gst_event_tag_get_list (e); g_free (info->codec);