summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2014-06-28 12:44:31 +0100
committerTim-Philipp Müller <tim@centricular.com>2014-06-28 14:25:25 +0100
commit7dcc3ffe5a6448852fce9dd2525c979fc78e6ee3 (patch)
tree123c2982c90c4921b11c5ccbd59588ac1aa698b0
parent07a3a983915c69d68753f565e6628d793be5147e (diff)
downloadgstreamer-plugins-good-7dcc3ffe5a6448852fce9dd2525c979fc78e6ee3.tar.gz
autoaudiosrc: use audiotestsrc as fallback element instead of fakesrc
fakesrc doesn't announce audio caps, so most audio pipelines will just error out with not-negotiated if a fallback element is created.
-rw-r--r--gst/autodetect/gstautoaudiosrc.c23
-rw-r--r--gst/autodetect/gstautodetect.c16
-rw-r--r--gst/autodetect/gstautodetect.h3
3 files changed, 40 insertions, 2 deletions
diff --git a/gst/autodetect/gstautoaudiosrc.c b/gst/autodetect/gstautoaudiosrc.c
index e60b24c86..2859386cf 100644
--- a/gst/autodetect/gstautoaudiosrc.c
+++ b/gst/autodetect/gstautoaudiosrc.c
@@ -49,9 +49,30 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY);
+static GstElement *
+gst_auto_audio_src_create_fake_element (GstAutoDetect * autodetect)
+{
+ GstElement *fake;
+
+ fake = gst_element_factory_make ("audiotestsrc", "fake-auto-audio-src");
+ if (fake != NULL) {
+ g_object_set (fake, "is-live", TRUE, NULL);
+ gst_util_set_object_arg (G_OBJECT (fake), "wave", "silence");
+ } else {
+ GST_ELEMENT_ERROR (autodetect, RESOURCE, NOT_FOUND,
+ ("Failed to find usable audio source element."),
+ ("Failed to find a usable audio source and couldn't create an audio"
+ "testsrc as fallback either, check your GStreamer installation."));
+ /* This will error out with not-negotiated.. */
+ fake = gst_element_factory_make ("fakesrc", "fake-auto-audio-src");
+ }
+ return fake;
+}
+
static void
gst_auto_audio_src_class_init (GstAutoAudioSrcClass * klass)
{
+ GstAutoDetectClass *autoclass = GST_AUTO_DETECT_CLASS (klass);
GstElementClass *eklass = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (eklass,
@@ -61,6 +82,8 @@ gst_auto_audio_src_class_init (GstAutoAudioSrcClass * klass)
"Wrapper audio source for automatically detected audio source",
"Jan Schmidt <thaytan@noraisin.net>, "
"Stefan Kost <ensonic@users.sf.net>");
+
+ autoclass->create_fake_element = gst_auto_audio_src_create_fake_element;
}
static void
diff --git a/gst/autodetect/gstautodetect.c b/gst/autodetect/gstautodetect.c
index 6970eaa51..59aab7e1b 100644
--- a/gst/autodetect/gstautodetect.c
+++ b/gst/autodetect/gstautodetect.c
@@ -119,7 +119,7 @@ gst_auto_detect_clear_kid (GstAutoDetect * self)
}
static GstElement *
-gst_auto_detect_create_fake_element (GstAutoDetect * self)
+gst_auto_detect_create_fake_element_default (GstAutoDetect * self)
{
GstElement *fake;
gchar dummy_factory[10], dummy_name[20];
@@ -132,6 +132,20 @@ gst_auto_detect_create_fake_element (GstAutoDetect * self)
return fake;
}
+static GstElement *
+gst_auto_detect_create_fake_element (GstAutoDetect * self)
+{
+ GstAutoDetectClass *klass = GST_AUTO_DETECT_GET_CLASS (self);
+ GstElement *fake;
+
+ if (klass->create_fake_element)
+ fake = klass->create_fake_element (self);
+ else
+ fake = gst_auto_detect_create_fake_element_default (self);
+
+ return fake;
+}
+
static gboolean
gst_auto_detect_attach_ghost_pad (GstAutoDetect * self)
{
diff --git a/gst/autodetect/gstautodetect.h b/gst/autodetect/gstautodetect.h
index 03b06aed7..05ae89fe5 100644
--- a/gst/autodetect/gstautodetect.h
+++ b/gst/autodetect/gstautodetect.h
@@ -60,9 +60,10 @@ typedef struct _GstAutoDetect {
typedef struct _GstAutoDetectClass {
GstBinClass parent_class;
- /*< public >*/
+ /*< private >*/
/* virtual methods for subclasses */
void (*configure)(GstAutoDetect *self, GstElement *kid);
+ GstElement * (*create_fake_element) (GstAutoDetect * autodetect);
} GstAutoDetectClass;
GType gst_auto_detect_get_type (void);