Re: [GnomeMeeting-devel-list] Name update in the plugins



On Fri, 2004-02-06 at 15:52, PUYDT Julien wrote:
> Any taker?

Well, the following patch compiles and doesn't crash here. It may even
solve the problem.

Snark
diff -ur pwlib-cvs-20040204.CVS/plugins/vidinput_v4l/vidinput_v4l.cxx pwlib-cvs-20040204.CVS.patched/plugins/vidinput_v4l/vidinput_v4l.cxx
--- pwlib-cvs-20040204.CVS/plugins/vidinput_v4l/vidinput_v4l.cxx	2004-01-18 15:22:12.000000000 +0100
+++ pwlib-cvs-20040204.CVS.patched/plugins/vidinput_v4l/vidinput_v4l.cxx	2004-02-06 16:49:26.000000000 +0100
@@ -303,16 +303,18 @@
 { 
    PCLASSINFO(V4LNames, PObject);
 public:
-  V4LNames();
+  V4LNames() {/* nothing */};
+
+  void Update ();
   
   PString GetUserFriendly(PString devName);
 
-  PString GetDeviceName(PString    userName);
+  PString GetDeviceName(PString userName);
 
   PStringList GetInputDeviceNames();
 
 protected:
-  void  AddUserDeviceName(PString userName, PString devName);
+  void AddUserDeviceName(PString userName, PString devName);
 
   PString BuildUserFriendly(PString devname);
 
@@ -326,7 +328,8 @@
   PStringList     inputDeviceNames;
 };
 
-V4LNames::V4LNames()
+void
+V4LNames::Update()
 {
   PDirectory   procvideo("/proc/video/dev");
   PString      entry;
@@ -458,8 +461,15 @@
 
 void V4LNames::AddUserDeviceName(PString userName, PString devName)
 {
-  userKey.SetAt(userName, devName);
-  deviceKey.SetAt(devName, userName);
+  if (userName != devName) { // must be a real userName!
+    userKey.SetAt(userName, devName);
+    deviceKey.SetAt(devName, userName);
+  } else { // we didn't find a good userName
+    if (!deviceKey.Contains (devName)) { // never met before: fallback
+      userKey.SetAt(userName, devName);
+      deviceKey.SetAt(devName, userName);
+    } // no else: we already know the pair
+  }
 }
 
 PString V4LNames::BuildUserFriendly(PString devname)
@@ -497,6 +507,7 @@
 V4LNames & GetNames()
 {
   static V4LNames names;
+  names.Update();
   return names;
 } 
 


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