summaryrefslogtreecommitdiffstats
path: root/gst/autodetect
diff options
context:
space:
mode:
Diffstat (limited to 'gst/autodetect')
-rw-r--r--gst/autodetect/gstautoaudiosink.c40
-rw-r--r--gst/autodetect/gstautovideosink.c41
2 files changed, 61 insertions, 20 deletions
diff --git a/gst/autodetect/gstautoaudiosink.c b/gst/autodetect/gstautoaudiosink.c
index ccaa413a..379113af 100644
--- a/gst/autodetect/gstautoaudiosink.c
+++ b/gst/autodetect/gstautoaudiosink.c
@@ -1,5 +1,6 @@
/* GStreamer
* (c) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
+ * (c) 2006 Jan Schmidt <thaytan@noraisin.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -49,6 +50,8 @@
static GstStateChangeReturn
gst_auto_audio_sink_change_state (GstElement * element,
GstStateChange transition);
+static void gst_auto_audio_sink_dispose (GstAutoAudioSink * sink);
+static void gst_auto_audio_sink_clear_kid (GstAutoAudioSink * sink);
GST_BOILERPLATE (GstAutoAudioSink, gst_auto_audio_sink, GstBin, GST_TYPE_BIN);
@@ -56,7 +59,8 @@ static const GstElementDetails gst_auto_audio_sink_details =
GST_ELEMENT_DETAILS ("Auto audio sink",
"Sink/Audio",
"Wrapper audio sink for automatically detected audio sink",
- "Ronald Bultje <rbultje@ronald.bitfreak.net>");
+ "Ronald Bultje <rbultje@ronald.bitfreak.net>\n"
+ "Jan Schmidt <thaytan@noraisin.net");
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
@@ -77,13 +81,35 @@ gst_auto_audio_sink_base_init (gpointer klass)
static void
gst_auto_audio_sink_class_init (GstAutoAudioSinkClass * klass)
{
+ GObjectClass *gobject_class;
GstElementClass *eklass;
+ gobject_class = G_OBJECT_CLASS (klass);
eklass = GST_ELEMENT_CLASS (klass);
+ gobject_class->dispose =
+ (GObjectFinalizeFunc) GST_DEBUG_FUNCPTR (gst_auto_audio_sink_dispose);
eklass->change_state = GST_DEBUG_FUNCPTR (gst_auto_audio_sink_change_state);
}
+static void
+gst_auto_audio_sink_dispose (GstAutoAudioSink * sink)
+{
+ gst_auto_audio_sink_clear_kid (sink);
+
+ G_OBJECT_CLASS (parent_class)->dispose ((GObject *) sink);
+}
+
+static void
+gst_auto_audio_sink_clear_kid (GstAutoAudioSink * sink)
+{
+ if (sink->kid) {
+ gst_element_set_state (sink->kid, GST_STATE_NULL);
+ gst_bin_remove (GST_BIN (sink), sink->kid);
+ sink->kid = NULL;
+ }
+}
+
/*
* Hack to make initial linking work; ideally, this'd work even when
* no target has been assigned to the ghostpad yet.
@@ -94,11 +120,9 @@ gst_auto_audio_sink_reset (GstAutoAudioSink * sink)
{
GstPad *targetpad;
+ gst_auto_audio_sink_clear_kid (sink);
+
/* fakesink placeholder */
- if (sink->kid) {
- gst_element_set_state (sink->kid, GST_STATE_NULL);
- gst_bin_remove (GST_BIN (sink), sink->kid);
- }
sink->kid = gst_element_factory_make ("fakesink", "tempsink");
gst_bin_add (GST_BIN (sink), sink->kid);
@@ -258,11 +282,7 @@ gst_auto_audio_sink_detect (GstAutoAudioSink * sink)
GstElement *esink;
GstPad *targetpad;
- if (sink->kid) {
- gst_element_set_state (sink->kid, GST_STATE_NULL);
- gst_bin_remove (GST_BIN (sink), sink->kid);
- sink->kid = NULL;
- }
+ gst_auto_audio_sink_clear_kid (sink);
/* find element */
GST_DEBUG_OBJECT (sink, "Creating new kid");
diff --git a/gst/autodetect/gstautovideosink.c b/gst/autodetect/gstautovideosink.c
index 085dea1b..0e0bc7ec 100644
--- a/gst/autodetect/gstautovideosink.c
+++ b/gst/autodetect/gstautovideosink.c
@@ -1,5 +1,6 @@
/* GStreamer
* (c) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
+ * (c) 2006 Jan Schmidt <thaytan@noraisin.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -49,6 +50,8 @@
static GstStateChangeReturn
gst_auto_video_sink_change_state (GstElement * element,
GstStateChange transition);
+static void gst_auto_video_sink_dispose (GstAutoVideoSink * sink);
+static void gst_auto_video_sink_clear_kid (GstAutoVideoSink * sink);
GST_BOILERPLATE (GstAutoVideoSink, gst_auto_video_sink, GstBin, GST_TYPE_BIN);
@@ -56,7 +59,8 @@ static const GstElementDetails gst_auto_video_sink_details =
GST_ELEMENT_DETAILS ("Auto video sink",
"Sink/Video",
"Wrapper video sink for automatically detected video sink",
- "Ronald Bultje <rbultje@ronald.bitfreak.net>");
+ "Ronald Bultje <rbultje@ronald.bitfreak.net>\n"
+ "Jan Schmidt <thaytan@noraisin.net");
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
@@ -76,11 +80,33 @@ gst_auto_video_sink_base_init (gpointer klass)
static void
gst_auto_video_sink_class_init (GstAutoVideoSinkClass * klass)
{
+ GObjectClass *gobject_class;
GstElementClass *eklass = GST_ELEMENT_CLASS (klass);
+ gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->dispose =
+ (GObjectFinalizeFunc) GST_DEBUG_FUNCPTR (gst_auto_video_sink_dispose);
eklass->change_state = GST_DEBUG_FUNCPTR (gst_auto_video_sink_change_state);
}
+static void
+gst_auto_video_sink_dispose (GstAutoVideoSink * sink)
+{
+ gst_auto_video_sink_clear_kid (sink);
+
+ G_OBJECT_CLASS (parent_class)->dispose ((GObject *) sink);
+}
+
+static void
+gst_auto_video_sink_clear_kid (GstAutoVideoSink * sink)
+{
+ if (sink->kid) {
+ gst_element_set_state (sink->kid, GST_STATE_NULL);
+ gst_bin_remove (GST_BIN (sink), sink->kid);
+ sink->kid = NULL;
+ }
+}
+
/*
* Hack to make initial linking work; ideally, this'd work even when
* no target has been assigned to the ghostpad yet.
@@ -91,11 +117,10 @@ gst_auto_video_sink_reset (GstAutoVideoSink * sink)
{
GstPad *targetpad;
+ /* Remove any existing element */
+ gst_auto_video_sink_clear_kid (sink);
+
/* fakesink placeholder */
- if (sink->kid) {
- gst_element_set_state (sink->kid, GST_STATE_NULL);
- gst_bin_remove (GST_BIN (sink), sink->kid);
- }
sink->kid = gst_element_factory_make ("fakesink", "tempsink");
gst_bin_add (GST_BIN (sink), sink->kid);
@@ -204,11 +229,7 @@ gst_auto_video_sink_detect (GstAutoVideoSink * sink)
GstElement *esink;
GstPad *targetpad;
- if (sink->kid) {
- gst_element_set_state (sink->kid, GST_STATE_NULL);
- gst_bin_remove (GST_BIN (sink), sink->kid);
- sink->kid = NULL;
- }
+ gst_auto_video_sink_clear_kid (sink);
/* find element */
GST_DEBUG_OBJECT (sink, "Creating new kid");