Commit fd1c1295 authored by Mark Nauwelaerts's avatar Mark Nauwelaerts Committed by Tim-Philipp Müller
Browse files

sys/oss/gstosssrc.*: Cache probed caps, so _get_caps() during recording...

sys/oss/gstosssrc.*: Cache probed caps, so _get_caps() during recording doesn't cause ioctl calls which may disrupt t...

Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw skynet be>
* sys/oss/gstosssrc.c: (gst_oss_src_init), (gst_oss_src_getcaps),
(gst_oss_src_close):
* sys/oss/gstosssrc.h:
Cache probed caps, so _get_caps() during recording doesn't cause
ioctl calls which may disrupt the recording (fixes #521875).
parent aec7206d
2008-03-11 Tim-Philipp Müller <tim at centricular dot net>
Patch by: Mark Nauwelaerts <manauw skynet be>
* sys/oss/gstosssrc.c: (gst_oss_src_init), (gst_oss_src_getcaps),
(gst_oss_src_close):
* sys/oss/gstosssrc.h:
Cache probed caps, so _get_caps() during recording doesn't cause
ioctl calls which may disrupt the recording (fixes #521875).
2008-03-11 Wim Taymans <wim.taymans@collabora.co.uk> 2008-03-11 Wim Taymans <wim.taymans@collabora.co.uk>
   
* gst/qtdemux/qtdemux.c: (gst_qtdemux_perform_seek), * gst/qtdemux/qtdemux.c: (gst_qtdemux_perform_seek),
......
...@@ -243,6 +243,7 @@ gst_oss_src_init (GstOssSrc * osssrc, GstOssSrcClass * g_class) ...@@ -243,6 +243,7 @@ gst_oss_src_init (GstOssSrc * osssrc, GstOssSrcClass * g_class)
osssrc->fd = -1; osssrc->fd = -1;
osssrc->device = g_strdup (device); osssrc->device = g_strdup (device);
osssrc->device_name = g_strdup (DEFAULT_DEVICE_NAME); osssrc->device_name = g_strdup (DEFAULT_DEVICE_NAME);
osssrc->probed_caps = NULL;
} }
static void static void
...@@ -263,12 +264,23 @@ gst_oss_src_getcaps (GstBaseSrc * bsrc) ...@@ -263,12 +264,23 @@ gst_oss_src_getcaps (GstBaseSrc * bsrc)
osssrc = GST_OSS_SRC (bsrc); osssrc = GST_OSS_SRC (bsrc);
if (osssrc->fd == -1) { if (osssrc->fd == -1) {
caps = gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SRC_PAD GST_DEBUG_OBJECT (osssrc, "device not open, using template caps");
(bsrc))); return NULL; /* base class will get template caps for us */
} else { }
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); 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; return caps;
} }
...@@ -395,6 +407,8 @@ gst_oss_src_close (GstAudioSrc * asrc) ...@@ -395,6 +407,8 @@ gst_oss_src_close (GstAudioSrc * asrc)
oss->mixer = NULL; oss->mixer = NULL;
} }
gst_caps_replace (&oss->probed_caps, NULL);
return TRUE; return TRUE;
} }
......
...@@ -51,6 +51,8 @@ struct _GstOssSrc { ...@@ -51,6 +51,8 @@ struct _GstOssSrc {
gchar *device; gchar *device;
gchar *device_name; gchar *device_name;
GstCaps *probed_caps;
GstOssMixer *mixer; GstOssMixer *mixer;
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment