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).
This commit is contained in:
Mark Nauwelaerts 2008-03-11 23:12:04 +00:00 committed by Tim-Philipp Müller
parent aec7206df9
commit fd1c1295dc
3 changed files with 30 additions and 4 deletions

View file

@ -1,3 +1,13 @@
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>
* gst/qtdemux/qtdemux.c: (gst_qtdemux_perform_seek),

View file

@ -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;
}

View file

@ -51,6 +51,8 @@ struct _GstOssSrc {
gchar *device;
gchar *device_name;
GstCaps *probed_caps;
GstOssMixer *mixer;
};