Rename osselement to ossmixer and only open audio device if we have at least one...
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>
Sun, 26 Oct 2003 12:16:43 +0000 (12:16 +0000)
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>
Sun, 26 Oct 2003 12:16:43 +0000 (12:16 +0000)
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

index 6773ea7..e4ac82a 100644 (file)
@@ -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);