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,
"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
}
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];
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)
{
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);