ekiga r7159 - in trunk: . lib/engine/components/gstreamer



Author: jpuydt
Date: Mon Oct  6 18:02:05 2008
New Revision: 7159
URL: http://svn.gnome.org/viewvc/ekiga?rev=7159&view=rev

Log:
Fixed bug #554170.

Modified:
   trunk/ChangeLog
   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
   trunk/lib/engine/components/gstreamer/gst-videoinput.cpp
   trunk/lib/engine/components/gstreamer/gst-videoinput.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	Mon Oct  6 18:02:05 2008
@@ -58,15 +58,15 @@
 {
   detect_devices ();
 
-  for (std::map<std::string, std::string>::const_iterator iter
+  for (std::map<std::pair<std::string, std::string>, std::string>::const_iterator iter
 	 = devices_by_name.begin ();
        iter != devices_by_name.end ();
        ++iter) {
 
     Ekiga::AudioInputDevice device;
     device.type = "GStreamer";
-    device.source = "GStreamer";
-    device.name = iter->first;
+    device.source = iter->first.first;
+    device.name = iter->first.second;
     devices.push_back (device);
   }
 }
@@ -77,8 +77,7 @@
   bool result = false;
 
   if (device.type == "GStreamer"
-      && device.source == "GStreamer"
-      && devices_by_name.find (device.name) != devices_by_name.end ()) {
+      && devices_by_name.find (std::pair<std::string, std::string>(device.source, device.name)) != devices_by_name.end ()) {
 
     current_state.opened = false;
     current_state.device = device;
@@ -103,7 +102,7 @@
 			     ",channels=%d"
 			     ",width=%d"
 			     " name=ekiga_sink",
-			     devices_by_name[current_state.device.name].c_str (),
+			     devices_by_name[std::pair<std::string,std::string>(current_state.device.source, current_state.device.name)].c_str (),
 			     samplerate, channels, bits_per_sample);
   g_print ("Pipeline: %s\n", command);
   pipeline = gst_parse_launch (command, &error);
@@ -233,11 +232,11 @@
 }
 
 bool
-GST::AudioInputManager::has_device (const std::string& /*source*/,
+GST::AudioInputManager::has_device (const std::string& source,
 				    const std::string& device_name,
 				    Ekiga::AudioInputDevice& /*device*/)
 {
-  return (devices_by_name.find (device_name) != devices_by_name.end ());
+  return (devices_by_name.find (std::pair<std::string,std::string>(source, device_name)) != devices_by_name.end ());
 }
 
 void
@@ -257,7 +256,7 @@
 
   if (elt != NULL) {
 
-    devices_by_name[_("Audio test")] = "audiotestsrc name=ekiga_volume";
+    devices_by_name[std::pair<std::string,std::string>(_("Audio test"),_("Audio test"))] = "audiotestsrc name=ekiga_volume";
     gst_object_unref (GST_OBJECT (elt));
   }
 }
@@ -294,7 +293,7 @@
 	descr = g_strdup_printf ("alsasrc device=%s ! volume name=ekiga_volume",
 				 g_value_get_string (device));
 
-	devices_by_name[name] = descr;
+	devices_by_name[std::pair<std::string,std::string>("ALSA", name)] = descr;
 	g_free (name);
 	g_free (descr);
       }

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	Mon Oct  6 18:02:05 2008
@@ -84,7 +84,7 @@
 
     /* we take a user-readable name, and get the string describing
      * the actual device */
-    std::map<std::string, std::string> devices_by_name;
+    std::map<std::pair<std::string, std::string>, std::string> devices_by_name;
 
     GstElement* pipeline;
   };

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	Mon Oct  6 18:02:05 2008
@@ -59,15 +59,15 @@
 {
   detect_devices ();
 
-  for (std::map<std::string, std::string>::const_iterator iter
+  for (std::map<std::pair<std::string, std::string>, std::string>::const_iterator iter
 	 = devices_by_name.begin ();
        iter != devices_by_name.end ();
        ++iter) {
 
     Ekiga::AudioOutputDevice device;
     device.type = "GStreamer";
-    device.source = "GStreamer";
-    device.name = iter->first;
+    device.source = iter->first.first;
+    device.name = iter->first.second;
     devices.push_back (device);
   }
 }
@@ -79,8 +79,7 @@
   bool result = false;
 
   if (device.type == "GStreamer"
-      && device.source == "GStreamer"
-      && devices_by_name.find (device.name) != devices_by_name.end ()) {
+      && devices_by_name.find (std::pair<std::string,std::string>(device.source, device.name)) != devices_by_name.end ()) {
 
     unsigned ii = (ps == Ekiga::primary)?0:1;
     current_state[ii].opened = false;
@@ -110,7 +109,7 @@
 			     " name=ekiga_src"
 			     " ! %s",
 			     samplerate, channels, bits_per_sample,
-			     devices_by_name[current_state[ii].device.name].c_str ());
+			     devices_by_name[std::pair<std::string,std::string>(current_state[ii].device.source, current_state[ii].device.name)].c_str ());
   g_print ("Pipeline: %s\n", command);
   pipeline[ii] = gst_parse_launch (command, &error);
 
@@ -245,11 +244,11 @@
 }
 
 bool
-GST::AudioOutputManager::has_device (const std::string& /*source*/,
+GST::AudioOutputManager::has_device (const std::string& source,
 				     const std::string& device_name,
 				     Ekiga::AudioOutputDevice& /*device*/)
 {
-  return (devices_by_name.find (device_name) != devices_by_name.end ());
+  return (devices_by_name.find (std::pair<std::string,std::string>(source, device_name)) != devices_by_name.end ());
 }
 
 void
@@ -269,7 +268,7 @@
 
   if (elt != NULL) {
 
-    devices_by_name[_("Silent")] = "fakesink";
+    devices_by_name[std::pair<std::string,std::string>(_("Silent"), _("Silent"))] = "fakesink";
     gst_object_unref (GST_OBJECT (elt));
   }
 }
@@ -306,7 +305,7 @@
 	descr = g_strdup_printf (" volume name=ekiga_volume ! alsasink device=%s",
 				 g_value_get_string (device));
 
-	devices_by_name[name] = descr;
+	devices_by_name[std::pair<std::string,std::string>("ALSA", name)] = descr;
 	g_free (name);
 	g_free (descr);
       }

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	Mon Oct  6 18:02:05 2008
@@ -88,7 +88,7 @@
 
     /* we take a user-readable name, and get the string describing
      * the actual device */
-    std::map<std::string, std::string> devices_by_name;
+    std::map<std::pair<std::string, std::string>, std::string> devices_by_name;
 
     GstElement* pipeline[2];
   };

Modified: trunk/lib/engine/components/gstreamer/gst-videoinput.cpp
==============================================================================
--- trunk/lib/engine/components/gstreamer/gst-videoinput.cpp	(original)
+++ trunk/lib/engine/components/gstreamer/gst-videoinput.cpp	Mon Oct  6 18:02:05 2008
@@ -61,15 +61,15 @@
 {
   detect_devices ();
 
-  for (std::map<std::string, std::string>::const_iterator iter
+  for (std::map<std::pair<std::string, std::string>, std::string>::const_iterator iter
 	 = devices_by_name.begin ();
        iter != devices_by_name.end ();
        ++iter) {
 
     Ekiga::VideoInputDevice device;
     device.type = "GStreamer";
-    device.source = "GStreamer";
-    device.name = iter->first;
+    device.source = iter->first.first;
+    device.name = iter->first.second;
     devices.push_back (device);
   }
 }
@@ -82,8 +82,7 @@
   bool result = false;
 
   if (device.type == "GStreamer"
-      && device.source == "GStreamer"
-      && devices_by_name.find (device.name) != devices_by_name.end ()) {
+      && devices_by_name.find (std::pair<std::string, std::string>(device.source, device.name)) != devices_by_name.end ()) {
 
     current_state.opened = false;
     current_state.width = 320;
@@ -115,7 +114,7 @@
 			     ",width=%d,height=%d"
 			     ",framerate=(fraction)%d/1"
 			     " name=ekiga_sink",
-			     devices_by_name[current_state.device.name].c_str (),
+			     devices_by_name[std::pair<std::string,std::string>(current_state.device.source, current_state.device.name)].c_str (),
 			     width, height, fps);
   g_print ("Pipeline: %s\n", command);
   pipeline = gst_parse_launch (command, &error);
@@ -197,12 +196,12 @@
 }
 
 bool
-GST::VideoInputManager::has_device (G_GNUC_UNUSED const std::string& source,
+GST::VideoInputManager::has_device (const std::string& source,
 				    const std::string& device_name,
 				    G_GNUC_UNUSED unsigned capabilities,
 				    G_GNUC_UNUSED Ekiga::VideoInputDevice& device)
 {
-  return (devices_by_name.find (device_name) != devices_by_name.end ());
+  return (devices_by_name.find (std::pair<std::string,std::string> (source, device_name)) != devices_by_name.end ());
 }
 
 void
@@ -223,7 +222,7 @@
 
   if (elt != NULL) {
 
-    devices_by_name[_("Video test")] = "videotestsrc";
+    devices_by_name[std::pair<std::string,std::string>(_("Video test"),_("Video test"))] = "videotestsrc";
     gst_object_unref (GST_OBJECT (elt));
   }
 }
@@ -274,7 +273,7 @@
 	descr = g_strdup_printf ("v4l2src device=%s"
 				 " ! videoscale ! ffmpegcolorspace",
 				 g_value_get_string (device));
-	devices_by_name[name] = descr;
+	devices_by_name[std::pair<std::string,std::string>("V4L",name)] = descr;
 	g_free (descr);
       }
 
@@ -339,7 +338,7 @@
 				 " ! videoscale"
 				 " ! ffmpegcolorspace",
 				 g_value_get_uint64 (guid));
-	devices_by_name[name] = descr;
+	devices_by_name[std::pair<std::string,std::string>("DV",name)] = descr;
 	g_free (descr);
       }
 

Modified: trunk/lib/engine/components/gstreamer/gst-videoinput.h
==============================================================================
--- trunk/lib/engine/components/gstreamer/gst-videoinput.h	(original)
+++ trunk/lib/engine/components/gstreamer/gst-videoinput.h	Mon Oct  6 18:02:05 2008
@@ -79,7 +79,7 @@
 
     /* we take a user-readable name, and get the string describing
      * the actual device */
-    std::map<std::string, std::string> devices_by_name;
+    std::map<std::pair<std::string, std::string>, std::string> devices_by_name;
 
     GstElement* pipeline;
   };



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