From 9cadd004a874b3181f4994df6bf87268f3aa9ca3 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 25 Sep 2006 13:55:44 +0000 Subject: gst/autodetect/: Small cleanups. don't try to set "sync" property when it is not available. Original commit message from CVS: * gst/autodetect/gstautoaudiosink.c: (gst_auto_audio_sink_base_init), (gst_auto_audio_sink_class_init), (gst_auto_audio_sink_find_best): * gst/autodetect/gstautovideosink.c: (gst_auto_video_sink_detect): Small cleanups. don't try to set "sync" property when it is not available. --- gst/autodetect/gstautoaudiosink.c | 9 +++++++-- gst/autodetect/gstautovideosink.c | 15 ++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) (limited to 'gst/autodetect') diff --git a/gst/autodetect/gstautoaudiosink.c b/gst/autodetect/gstautoaudiosink.c index 8e8f14fa..ccaa413a 100644 --- a/gst/autodetect/gstautoaudiosink.c +++ b/gst/autodetect/gstautoaudiosink.c @@ -57,6 +57,7 @@ GST_ELEMENT_DETAILS ("Auto audio sink", "Sink/Audio", "Wrapper audio sink for automatically detected audio sink", "Ronald Bultje "); + static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, @@ -69,13 +70,16 @@ gst_auto_audio_sink_base_init (gpointer klass) gst_element_class_add_pad_template (eklass, gst_static_pad_template_get (&sink_template)); + gst_element_class_set_details (eklass, &gst_auto_audio_sink_details); } static void gst_auto_audio_sink_class_init (GstAutoAudioSinkClass * klass) { - GstElementClass *eklass = GST_ELEMENT_CLASS (klass); + GstElementClass *eklass; + + eklass = GST_ELEMENT_CLASS (klass); eklass->change_state = GST_DEBUG_FUNCPTR (gst_auto_audio_sink_change_state); } @@ -235,7 +239,8 @@ gst_auto_audio_sink_find_best (GstAutoAudioSink * sink) GST_ELEMENT_WARNING (sink, RESOURCE, NOT_FOUND, (NULL), ("Failed to find a usable audio sink")); choice = gst_element_factory_make ("fakesink", "fake-audio-sink"); - g_object_set (choice, "sync", TRUE, NULL); + if (g_object_class_find_property (G_OBJECT_GET_CLASS (choice), "sync")) + g_object_set (choice, "sync", TRUE, NULL); gst_element_set_state (choice, GST_STATE_READY); } } diff --git a/gst/autodetect/gstautovideosink.c b/gst/autodetect/gstautovideosink.c index 6d5a9312..085dea1b 100644 --- a/gst/autodetect/gstautovideosink.c +++ b/gst/autodetect/gstautovideosink.c @@ -212,11 +212,8 @@ gst_auto_video_sink_detect (GstAutoVideoSink * sink) /* find element */ GST_DEBUG_OBJECT (sink, "Creating new kid"); - if (!(esink = gst_auto_video_sink_find_best (sink))) { - GST_ELEMENT_ERROR (sink, LIBRARY, INIT, (NULL), - ("Failed to find a supported video sink")); - return FALSE; - } + if (!(esink = gst_auto_video_sink_find_best (sink))) + goto no_sink; sink->kid = esink; gst_bin_add (GST_BIN (sink), esink); @@ -229,6 +226,14 @@ gst_auto_video_sink_detect (GstAutoVideoSink * sink) GST_DEBUG_OBJECT (sink, "done changing auto video sink"); return TRUE; + + /* ERRORS */ +no_sink: + { + GST_ELEMENT_ERROR (sink, LIBRARY, INIT, (NULL), + ("Failed to find a supported video sink")); + return FALSE; + } } static GstStateChangeReturn -- cgit