From 5d540ce92409a96a47f706c5e3e4d7d067c3fc86 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sun, 26 Oct 2003 12:16:43 +0000 Subject: [PATCH] Rename osselement to ossmixer and only open audio device if we have at least one pad. This makes ossmixer *only* open... Original commit message from CVS: Rename osselement to ossmixer and only open audio device if we have at least one pad. This makes ossmixer *only* open the mixer, which means we can open multiple mixer sessions. --- sys/oss/gstosselement.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/oss/gstosselement.c b/sys/oss/gstosselement.c index 6773ea7442..e4ac82a9f1 100644 --- a/sys/oss/gstosselement.c +++ b/sys/oss/gstosselement.c @@ -412,6 +412,8 @@ gst_osselement_open_audio (GstOssElement *oss) if (GST_PAD_IS_SINK (firstpad)) { mode = GST_OSSELEMENT_WRITE; } + } else { + goto do_mixer; } /* first try to open the sound card */ @@ -515,6 +517,7 @@ gst_osselement_open_audio (GstOssElement *oss) oss->caps = caps; +do_mixer: gst_ossmixer_build_list (oss); return TRUE; @@ -523,10 +526,11 @@ gst_osselement_open_audio (GstOssElement *oss) static void gst_osselement_close_audio (GstOssElement *oss) { + gst_ossmixer_free_list (oss); + if (oss->fd < 0) return; - gst_ossmixer_free_list (oss); close(oss->fd); oss->fd = -1; } @@ -678,7 +682,7 @@ gst_osselement_factory_init (GstPlugin *plugin) { GstElementFactory *factory; - factory = gst_element_factory_new ("osselement", + factory = gst_element_factory_new ("ossmixer", GST_TYPE_OSSELEMENT, &gst_osselement_details); g_return_val_if_fail (factory != NULL, FALSE);