ekiga r7567 - trunk/lib/engine/components/gstreamer



Author: jpuydt
Date: Sat Jan 17 20:27:55 2009
New Revision: 7567
URL: http://svn.gnome.org/viewvc/ekiga?rev=7567&view=rev

Log:
Added support for pulseaudio to the gstreamer code (untested)

Modified:
   trunk/lib/engine/components/gstreamer/gst-audioinput.cpp
   trunk/lib/engine/components/gstreamer/gst-audioinput.h
   trunk/lib/engine/components/gstreamer/gst-audiooutput.cpp
   trunk/lib/engine/components/gstreamer/gst-audiooutput.h

Modified: trunk/lib/engine/components/gstreamer/gst-audioinput.cpp
==============================================================================
--- trunk/lib/engine/components/gstreamer/gst-audioinput.cpp	(original)
+++ trunk/lib/engine/components/gstreamer/gst-audioinput.cpp	Sat Jan 17 20:27:55 2009
@@ -317,3 +317,47 @@
     gst_object_unref (GST_OBJECT (elt));
   }
 }
+
+void
+GST::AudioInputManager::detect_pulsesrc_devices ()
+{
+  GstElement* elt = NULL;
+
+  elt = gst_element_factory_make ("pulsesrc", "pulsesrcpresencetest");
+
+  if (elt != NULL) {
+
+    GstPropertyProbe* probe = NULL;
+    const GParamSpec* pspec = NULL;
+    GValueArray* array = NULL;
+
+    gst_element_set_state (elt, GST_STATE_PAUSED);
+    probe = GST_PROPERTY_PROBE (elt);
+    pspec = gst_property_probe_get_property (probe, "device");
+
+    array = gst_property_probe_probe_and_get_values (probe, pspec);
+    if (array != NULL) {
+
+      for (guint index = 0; index < array->n_values; index++) {
+
+	GValue* device = NULL;
+	gchar* name = NULL;
+	gchar* descr = NULL;
+
+	device = g_value_array_get_nth (array, index);
+	g_object_set_property (G_OBJECT (elt), "device", device);
+	g_object_get (G_OBJECT (elt), "device-name", &name, NULL);
+	descr = g_strdup_printf ("pulsesrc device=%s ! volume name=ekiga_volume",
+				 g_value_get_string (device));
+
+	devices_by_name[std::pair<std::string,std::string>("PULSEAUDIO", name)] = descr;
+	g_free (name);
+	g_free (descr);
+      }
+      g_value_array_free (array);
+    }
+
+    gst_element_set_state (elt, GST_STATE_NULL);
+    gst_object_unref (GST_OBJECT (elt));
+  }
+}

Modified: trunk/lib/engine/components/gstreamer/gst-audioinput.h
==============================================================================
--- trunk/lib/engine/components/gstreamer/gst-audioinput.h	(original)
+++ trunk/lib/engine/components/gstreamer/gst-audioinput.h	Sat Jan 17 20:27:55 2009
@@ -81,6 +81,7 @@
     void detect_devices ();
     void detect_audiotestsrc_devices ();
     void detect_alsasrc_devices ();
+    void detect_pulsesrc_devices ();
 
     /* we take a user-readable name, and get the string describing
      * the actual device */

Modified: trunk/lib/engine/components/gstreamer/gst-audiooutput.cpp
==============================================================================
--- trunk/lib/engine/components/gstreamer/gst-audiooutput.cpp	(original)
+++ trunk/lib/engine/components/gstreamer/gst-audiooutput.cpp	Sat Jan 17 20:27:55 2009
@@ -268,6 +268,7 @@
   devices_by_name.clear ();
   detect_fakesink_devices ();
   detect_alsasink_devices ();
+  detect_pulsesink_devices ();
 }
 
 void
@@ -329,3 +330,47 @@
     gst_object_unref (GST_OBJECT (elt));
   }
 }
+
+void
+GST::AudioOutputManager::detect_pulsesink_devices ()
+{
+  GstElement* elt = NULL;
+
+  elt = gst_element_factory_make ("pulsesink", "pulsesinkpresencetest");
+
+  if (elt != NULL) {
+
+    GstPropertyProbe* probe = NULL;
+    const GParamSpec* pspec = NULL;
+    GValueArray* array = NULL;
+
+    gst_element_set_state (elt, GST_STATE_PAUSED);
+    probe = GST_PROPERTY_PROBE (elt);
+    pspec = gst_property_probe_get_property (probe, "device");
+
+    array = gst_property_probe_probe_and_get_values (probe, pspec);
+    if (array != NULL) {
+
+      for (guint index = 0; index < array->n_values; index++) {
+
+	GValue* device = NULL;
+	gchar* name = NULL;
+	gchar* descr = NULL;
+
+	device = g_value_array_get_nth (array, index);
+	g_object_set_property (G_OBJECT (elt), "device", device);
+	g_object_get (G_OBJECT (elt), "device-name", &name, NULL);
+	descr = g_strdup_printf (" volume name=ekiga_volume ! pulsesink device=%s",
+				 g_value_get_string (device));
+
+	devices_by_name[std::pair<std::string,std::string>("PULSEAUDIO", name)] = descr;
+	g_free (name);
+	g_free (descr);
+      }
+      g_value_array_free (array);
+    }
+
+    gst_element_set_state (elt, GST_STATE_NULL);
+    gst_object_unref (GST_OBJECT (elt));
+  }
+}

Modified: trunk/lib/engine/components/gstreamer/gst-audiooutput.h
==============================================================================
--- trunk/lib/engine/components/gstreamer/gst-audiooutput.h	(original)
+++ trunk/lib/engine/components/gstreamer/gst-audiooutput.h	Sat Jan 17 20:27:55 2009
@@ -85,6 +85,7 @@
     void detect_devices ();
     void detect_fakesink_devices ();
     void detect_alsasink_devices ();
+    void detect_pulsesink_devices ();
 
     /* we take a user-readable name, and get the string describing
      * the actual device */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]