summaryrefslogtreecommitdiff
path: root/sys/oss
diff options
context:
space:
mode:
Diffstat (limited to 'sys/oss')
-rw-r--r--sys/oss/gstosssrc.c22
-rw-r--r--sys/oss/gstosssrc.h2
2 files changed, 20 insertions, 4 deletions
diff --git a/sys/oss/gstosssrc.c b/sys/oss/gstosssrc.c
index 36aa92dd6..417bdcf07 100644
--- a/sys/oss/gstosssrc.c
+++ b/sys/oss/gstosssrc.c
@@ -243,6 +243,7 @@ gst_oss_src_init (GstOssSrc * osssrc, GstOssSrcClass * g_class)
osssrc->fd = -1;
osssrc->device = g_strdup (device);
osssrc->device_name = g_strdup (DEFAULT_DEVICE_NAME);
+ osssrc->probed_caps = NULL;
}
static void
@@ -263,12 +264,23 @@ gst_oss_src_getcaps (GstBaseSrc * bsrc)
osssrc = GST_OSS_SRC (bsrc);
if (osssrc->fd == -1) {
- caps = gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SRC_PAD
- (bsrc)));
- } else {
- caps = gst_oss_helper_probe_caps (osssrc->fd);
+ GST_DEBUG_OBJECT (osssrc, "device not open, using template caps");
+ return NULL; /* base class will get template caps for us */
}
+ if (osssrc->probed_caps) {
+ GST_LOG_OBJECT (osssrc, "Returning cached caps");
+ return gst_caps_ref (osssrc->probed_caps);
+ }
+
+ caps = gst_oss_helper_probe_caps (osssrc->fd);
+
+ if (caps) {
+ osssrc->probed_caps = gst_caps_ref (caps);
+ }
+
+ GST_INFO_OBJECT (osssrc, "returning caps %" GST_PTR_FORMAT, caps);
+
return caps;
}
@@ -395,6 +407,8 @@ gst_oss_src_close (GstAudioSrc * asrc)
oss->mixer = NULL;
}
+ gst_caps_replace (&oss->probed_caps, NULL);
+
return TRUE;
}
diff --git a/sys/oss/gstosssrc.h b/sys/oss/gstosssrc.h
index 17662985b..0d1461333 100644
--- a/sys/oss/gstosssrc.h
+++ b/sys/oss/gstosssrc.h
@@ -51,6 +51,8 @@ struct _GstOssSrc {
gchar *device;
gchar *device_name;
+ GstCaps *probed_caps;
+
GstOssMixer *mixer;
};