adding createdevenum

Maarten Lankhorst m.b.lankhorst at gmail.com
Mon Apr 25 12:07:14 CDT 2005


This patch adds the videoinputdevice catagory in the way devenum does 
it, using avicap32

note that this patch does not add a working capGetDriverDescriptionW 
neither does it implement CLSID_VfwCapture.
However this is not a problem, the patch does what it's supposed to do 
anyhow...
-------------- next part --------------
? devenumera.patch
Index: Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/devenum/Makefile.in,v
retrieving revision 1.9
diff -u -p -r1.9 Makefile.in
--- Makefile.in	19 Aug 2004 19:31:20 -0000	1.9
+++ Makefile.in	25 Apr 2005 17:00:40 -0000
@@ -3,7 +3,7 @@ TOPOBJDIR = ../..
 SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 MODULE    = devenum.dll
-IMPORTS   = ole32 oleaut32 winmm user32 advapi32 kernel32
+IMPORTS   = ole32 oleaut32 winmm user32 advapi32 kernel32 avicap32
 EXTRALIBS = -lstrmiids -luuid
 
 C_SRCS = \
Index: createdevenum.c
===================================================================
RCS file: /home/wine/wine/dlls/devenum/createdevenum.c,v
retrieving revision 1.9
diff -u -p -r1.9 createdevenum.c
--- createdevenum.c	25 Jan 2005 10:56:39 -0000	1.9
+++ createdevenum.c	25 Apr 2005 17:00:41 -0000
@@ -117,6 +117,7 @@ HRESULT WINAPI DEVENUM_ICreateDevEnum_Cr
 
     if (IsEqualGUID(clsidDeviceClass, &CLSID_AudioRendererCategory) ||
         IsEqualGUID(clsidDeviceClass, &CLSID_AudioInputDeviceCategory) ||
+        IsEqualGUID(clsidDeviceClass, &CLSID_VideoInputDeviceCategory) ||
         IsEqualGUID(clsidDeviceClass, &CLSID_MidiRendererCategory))
     {
         hbasekey = HKEY_CURRENT_USER;
@@ -142,6 +143,7 @@ HRESULT WINAPI DEVENUM_ICreateDevEnum_Cr
     {
         if (IsEqualGUID(clsidDeviceClass, &CLSID_AudioRendererCategory) ||
             IsEqualGUID(clsidDeviceClass, &CLSID_AudioInputDeviceCategory) ||
+            IsEqualGUID(clsidDeviceClass, &CLSID_VideoInputDeviceCategory) ||
             IsEqualGUID(clsidDeviceClass, &CLSID_MidiRendererCategory))
         {
              HRESULT hr = DEVENUM_CreateSpecialCategories();
@@ -413,6 +415,44 @@ static HRESULT DEVENUM_CreateSpecialCate
                 CoTaskMemFree(pTypes);
 	    }
 	}
+        res = DEVENUM_CreateAMCategoryKey(&CLSID_VideoInputDeviceCategory);
+        if (SUCCEEDED(res))
+           for (i = 0; i < 10; i++) {
+              WCHAR szDeviceName[80], szDeviceVersion[80];
+
+              if (capGetDriverDescriptionW ((WORD) i,
+                     szDeviceName, sizeof (szDeviceName),
+                     szDeviceVersion, sizeof (szDeviceVersion))) {
+                 IMoniker * pMoniker = NULL;
+                 TRACE("\nSuccess !\n");
+
+                 rfp2.nMediaTypes = 1;
+                 pTypes = CoTaskMemAlloc(rfp2.nMediaTypes * sizeof(REGPINTYPES));
+                 if (!pTypes) {
+                    IFilterMapper2_Release(pMapper);
+                    return E_OUTOFMEMORY;
+                 }
+
+                 pTypes[0].clsMajorType = &MEDIATYPE_Video;
+                 pTypes[0].clsMinorType = &MEDIASUBTYPE_RGB24;
+
+                 rfp2.lpMediaType = pTypes;
+
+                 res = IFilterMapper2_RegisterFilter(pMapper,
+                                      &CLSID_VfwCapture,
+                                      szDeviceName,
+                                      &pMoniker,
+                                      &CLSID_VideoInputDeviceCategory,
+                                      szDeviceName,
+                                      &rf2);
+
+                 /* FIXME: do additional stuff with IMoniker here, depending on what RegisterFilter does */
+                 if (pMoniker) IMoniker_Release(pMoniker);
+
+                 if (i == iDefaultDevice) FIXME("Default device\n");
+                 CoTaskMemFree(pTypes);
+                 }
+           }
     }
 
     if (pMapper)
Index: devenum_private.h
===================================================================
RCS file: /home/wine/wine/dlls/devenum/devenum_private.h,v
retrieving revision 1.8
diff -u -p -r1.8 devenum_private.h
--- devenum_private.h	13 Dec 2004 21:19:02 -0000	1.8
+++ devenum_private.h	25 Apr 2005 17:00:41 -0000
@@ -26,6 +26,7 @@
 
 #include "windef.h"
 #include "winbase.h"
+#include "wingdi.h"
 #include "winuser.h"
 #include "winreg.h"
 #include "winerror.h"
@@ -38,6 +39,7 @@
 #include "olectl.h"
 #include "wine/unicode.h"
 #include "uuids.h"
+#include "vfw.h"
 
 /**********************************************************************
  * Dll lifetime tracking declaration for devenum.dll


More information about the wine-patches mailing list