summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>2004-01-22 20:51:08 +0000
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>2004-01-22 20:51:08 +0000
commit6eac1f9c4c9bec13deade8ca77f1b06e066f7649 (patch)
treee2e49064b0504e1a9ca3361c1767fe0ebf40d8e0 /sys
parent396397ee7c0c85bb586c88833b88f29c758e33f7 (diff)
sys/oss/gstosselement.c: Fix the ossmixer case where we shouldn't open /dev/dsp* because it might block operations (w...
Original commit message from CVS: 2004-01-22 Ronald Bultje <rbultje@ronald.bitfreak.net> * sys/oss/gstosselement.c: (gst_osselement_class_probe_devices): Fix the ossmixer case where we shouldn't open /dev/dsp* because it might block operations (which is bad for a mixer).
Diffstat (limited to 'sys')
-rw-r--r--sys/oss/gstosselement.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/sys/oss/gstosselement.c b/sys/oss/gstosselement.c
index 1ed36542..1219cc4f 100644
--- a/sys/oss/gstosselement.c
+++ b/sys/oss/gstosselement.c
@@ -207,8 +207,24 @@ static gboolean
gst_osselement_class_probe_devices (GstOssElementClass *klass,
gboolean check)
{
+ GstElementClass *eklass = GST_ELEMENT_CLASS (klass);
static gboolean init = FALSE;
static GList *device_combinations;
+ GList *padtempllist;
+ gint openmode = O_RDONLY;
+ gboolean mixer = FALSE;
+
+ /* Ok, so how do we open the device? We assume that we have (max.) one
+ * pad, and if this is a sinkpad, we're osssink (w). else, we're osssrc
+ * (r) */
+ padtempllist = gst_element_class_get_pad_template_list (eklass);
+ if (padtempllist != NULL) {
+ GstPadTemplate *firstpadtempl = padtempllist->data;
+ if (GST_PAD_TEMPLATE_DIRECTION (firstpadtempl) == GST_PAD_SINK) {
+ openmode = O_WRONLY;
+ }
+ mixer = TRUE;
+ }
if (!init && !check) {
gchar *dsp_base[] = { "/dev/dsp", "/dev/sound/dsp", NULL };
@@ -249,8 +265,10 @@ gst_osselement_class_probe_devices (GstOssElementClass *klass,
continue;
/* we just check the dsp. we assume the mixer always works.
- * we don't need a mixer anyway (says OSS)... */
- if ((fd = open (devices[n].dsp, O_RDONLY)) > 0 || errno == EBUSY) {
+ * we don't need a mixer anyway (says OSS)... If we are a
+ * mixer element, we use the mixer anyway. */
+ if ((fd = open (mixer ? devices[n].mixer :
+ devices[n].dsp, openmode)) > 0 || errno == EBUSY) {
GstOssDeviceCombination *combi;
if (fd > 0)