gst/playback/: Reenable stream selection. These mechanisms need a complete overhaul in the face of 0.8->0.10 changes ...

Original commit message from CVS:
* gst/playback/gstplaybasebin.c: (group_destroy),
(probe_triggered), (new_decoded_pad), (mute_group_type),
(set_active_source):
* gst/playback/gststreaminfo.c: (gst_stream_info_set_mute):
* gst/playback/gststreamselector.c:
(gst_stream_selector_base_init),
(gst_stream_selector_set_property),
(gst_stream_selector_request_new_pad):
Reenable stream selection. These mechanisms need a complete overhaul
in the face of 0.8->0.10 changes though.
This commit is contained in:
Jan Schmidt 2006-01-11 18:30:25 +00:00
parent 08d73c14eb
commit e0f836f461
4 changed files with 75 additions and 27 deletions

View file

@ -1,3 +1,16 @@
2006-01-11 Jan Schmidt <thaytan@mad.scientist.com>
* gst/playback/gstplaybasebin.c: (group_destroy),
(probe_triggered), (new_decoded_pad), (mute_group_type),
(set_active_source):
* gst/playback/gststreaminfo.c: (gst_stream_info_set_mute):
* gst/playback/gststreamselector.c:
(gst_stream_selector_base_init),
(gst_stream_selector_set_property),
(gst_stream_selector_request_new_pad):
Reenable stream selection. These mechanisms need a complete overhaul
in the face of 0.8->0.10 changes though.
2006-01-11 Jan Schmidt <thaytan@mad.scientist.com>
* ext/ogg/gstoggdemux.c:

View file

@ -299,14 +299,16 @@ group_destroy (GstPlayBaseGroup * group)
for (n = 0; n < NUM_TYPES; n++) {
GstElement *element = group->type[n].preroll;
GstElement *fakesrc;
GstElement *sel;
const GList *item;
if (!element)
continue;
sel = group->type[n].selector;
/* remove any fakesrc elements for this preroll element */
for (item = GST_ELEMENT (group->type[n].selector)->pads;
item != NULL; item = item->next) {
for (item = sel->pads; item != NULL; item = item->next) {
GstPad *pad = GST_PAD (item->data);
guint sig_id;
@ -813,7 +815,7 @@ probe_triggered (GstPad * pad, GstEvent * event, gpointer user_data)
GROUP_LOCK (play_base_bin);
/* mute this stream */
//g_object_set (G_OBJECT (info), "mute", TRUE, NULL);
g_object_set (G_OBJECT (info), "mute", TRUE, NULL);
if (info->type > 0 && info->type <= NUM_TYPES)
group->type[info->type - 1].done = TRUE;
@ -999,6 +1001,9 @@ new_decoded_pad (GstElement * element, GstPad * pad, gboolean last,
G_CALLBACK (preroll_unlinked), play_base_bin);
/* keep a ref to the signal id so that we can disconnect the signal callback */
g_object_set_data (G_OBJECT (sinkpad), "unlinked_id", GINT_TO_POINTER (sig));
/* Store a pointer to the stream selector pad for this stream */
g_object_set_data (G_OBJECT (pad), "pb_sel_pad", sinkpad);
gst_pad_link (pad, sinkpad);
gst_object_unref (sinkpad);
@ -1471,8 +1476,10 @@ get_active_source (GstPlayBaseBin * play_base_bin, GstStreamType type)
/* Kill pad reactivation on state change. */
#if 0
static void muted_group_change_state (GstElement * element,
gint old_state, gint new_state, gpointer data);
#endif
static void
mute_group_type (GstPlayBaseGroup * group, GstStreamType type, gboolean mute)
@ -1490,6 +1497,7 @@ mute_group_type (GstPlayBaseGroup * group, GstStreamType type, gboolean mute)
gst_pad_set_active (pad, active);
gst_object_unref (pad);
#if 0
if (mute) {
g_signal_connect (group->type[type - 1].preroll, "state-changed",
G_CALLBACK (muted_group_change_state), group);
@ -1497,8 +1505,10 @@ mute_group_type (GstPlayBaseGroup * group, GstStreamType type, gboolean mute)
g_signal_handlers_disconnect_by_func (group->type[type - 1].preroll,
G_CALLBACK (muted_group_change_state), group);
}
#endif
}
#if 0
static void
muted_group_change_state (GstElement * element,
gint old_state, gint new_state, gpointer data)
@ -1519,6 +1529,7 @@ muted_group_change_state (GstElement * element,
GROUP_UNLOCK (group->bin);
}
#endif
/*
* Caller has group-lock held.
@ -1532,6 +1543,7 @@ set_active_source (GstPlayBaseBin * play_base_bin,
GList *s;
gint num = 0;
gboolean have_active = FALSE;
GstElement *sel;
GST_LOG ("Changing active source of type %d to %d", type, source_num);
play_base_bin->current[type - 1] = source_num;
@ -1542,14 +1554,28 @@ set_active_source (GstPlayBaseBin * play_base_bin,
return;
}
sel = group->type[type - 1].selector;
for (s = group->streaminfo; s; s = s->next) {
GstStreamInfo *info = s->data;
if (info->type == type) {
if (num == source_num) {
GstPad *sel_pad;
GST_LOG ("Unmuting (if already muted) source %d of type %d", source_num,
type);
g_object_set (s->data, "mute", FALSE, NULL);
g_object_set (info, "mute", FALSE, NULL);
/* Tell the stream selector which pad to accept */
sel_pad = GST_PAD_CAST (g_object_get_data (G_OBJECT (info->object),
"pb_sel_pad"));
if (sel && sel_pad != NULL) {
g_object_set (G_OBJECT (sel), "active-pad", GST_PAD_NAME (sel_pad),
NULL);
}
have_active = TRUE;
} else {
guint id;
@ -1564,7 +1590,12 @@ set_active_source (GstPlayBaseBin * play_base_bin,
}
}
GST_LOG ("Muting group type: %d -> %d", type, !have_active);
if (!have_active) {
GST_LOG ("Muting group type: %d", type);
g_object_set (sel, "active-pad", "", NULL);
} else {
GST_LOG ("Unuting group type: %d", type);
}
mute_group_type (group, type, !have_active);
}

View file

@ -296,9 +296,7 @@ gst_stream_info_set_mute (GstStreamInfo * stream_info, gboolean mute)
GstElement *element;
stream_info->mute = mute;
//gst_pad_set_active_recursive ((GstPad *)
//GST_PAD_CAST (stream_info->object), !mute);
g_warning ("FIXME");
// gst_pad_set_active ((GstPad *) GST_PAD_CAST (stream_info->object), !mute);
element = gst_pad_get_parent_element ((GstPad *)
GST_PAD_CAST (stream_info->object));

View file

@ -1,6 +1,7 @@
/* GStreamer
* Copyright (C) 2003 Julien Moutte <julien@moutte.net>
* Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* Copyright (C) 2005 Jan Schmidt <thaytan@mad.scientist.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -21,12 +22,6 @@
/*
* !!!!!!!!!!!!!!!!! Big phat warning. !!!!!!!!!!!!!!!!!!!!!!
*
* The pads on the sinkside can be filled and the application is
* supposed to enable/disable them. The plugin will receive input
* data over the currently active pad and take care of data
* forwarding and negotiation. This plugin does nothing fancy. It
* exists to be light-weight and simple.
*
* This is not a generic switch element. This is not to be used for
* any such purpose. Patches to make it do that will be rejected.
*/
@ -35,6 +30,8 @@
#include "config.h"
#endif
#include <string.h>
#include "gststreamselector.h"
GST_DEBUG_CATEGORY_STATIC (stream_selector_debug);
@ -112,7 +109,8 @@ gst_stream_selector_base_init (GstStreamSelectorClass * klass)
"Generic",
"N-to-1 input stream_selectoring",
"Julien Moutte <julien@moutte.net>\n"
"Ronald S. Bultje <rbultje@ronald.bitfreak.net>");
"Ronald S. Bultje <rbultje@ronald.bitfreak.net>\n"
"Jan Schmidt <thaytan@mad.scientist.com>");
gst_element_class_set_details (element_class, &gst_stream_selector_details);
@ -180,27 +178,41 @@ gst_stream_selector_set_property (GObject * object, guint prop_id,
switch (prop_id) {
case PROP_ACTIVE_PAD:{
const gchar *pad_name = g_value_get_string (value);
GstPad *pad;
GstPad *pad = NULL;
if (strcmp (pad_name, "") != 0) {
pad = gst_element_get_pad (GST_ELEMENT (object), pad_name);
}
GST_OBJECT_LOCK (object);
pad = gst_element_get_pad (GST_ELEMENT (object), pad_name);
if (pad == sel->active_sinkpad) {
GST_OBJECT_UNLOCK (object);
gst_object_unref (pad);
if (pad)
gst_object_unref (pad);
break;
}
#if 0
if (sel->active_sinkpad && (GST_STATE (sel) >= GST_STATE_PAUSED)) {
gst_pad_set_active (sel->active_sinkpad, FALSE);
GST_DEBUG_OBJECT (sel, "Deactivating pad %" GST_PTR_FORMAT,
sel->active_sinkpad);
}
#endif
gst_object_replace ((GstObject **) (&sel->active_sinkpad),
GST_OBJECT (pad));
gst_object_unref (pad);
GST_OBJECT_CAST (pad));
if (pad)
gst_object_unref (pad);
#if 0
if (sel->active_sinkpad && (GST_STATE (sel) >= GST_STATE_PAUSED)) {
gst_pad_set_active (sel->active_sinkpad, TRUE);
GST_DEBUG_OBJECT (sel, "Activating pad %" GST_PTR_FORMAT,
sel->active_sinkpad);
}
#endif
GST_DEBUG_OBJECT (sel, "New active pad is %" GST_PTR_FORMAT,
sel->active_sinkpad);
GST_OBJECT_UNLOCK (object);
break;
}
@ -312,12 +324,6 @@ gst_stream_selector_request_new_pad (GstElement * element,
GST_DEBUG_FUNCPTR (gst_stream_selector_get_linked_pads));
gst_element_add_pad (GST_ELEMENT (sel), sinkpad);
GST_OBJECT_LOCK (sel);
if (GST_STATE (sel) >= GST_STATE_PAUSED) {
gst_pad_set_active (sinkpad, TRUE);
}
GST_OBJECT_UNLOCK (sel);
return sinkpad;
}