No subject


Wed Feb 11 21:28:26 CST 2009


of the ACMFORMATDETAILS structure is valid. The enumerator will 
enumerate all suggested destination formats for the given pwfx 
format.".
Since the WAVEFORMATEX structure is valid, there is no need 
to cycle through all the standard formats (moreover the WAVEFORMATEX 
format could be not a standard one). 
This feature is requested by 
ever17 (bug 16394), I tested this patch with the demo version.

_________________________
S. Guidoni

------=_Part_73327_4020186.1234812000164
Content-Type: APPLICATION/OCTET-STREAM; name=msacm32_enumsuggest.bin
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=msacm32_enumsuggest.bin; size=4641

--- dlls/msacm32/format.c	2009-02-16 19:07:18.000000000 +0100
+++ dlls/msacm32/format.c	2009-02-14 19:55:33.000000000 +0100
@@ -443,41 +443,89 @@ static BOOL MSACM_FormatEnumHelper(PWINE
     ACMFORMATTAGDETAILSW	aftd;
     unsigned int			i, j;
 
-    for (i = 0; i < padid->cFormatTags; i++) {
+    if (fdwEnum & ACM_FORMATENUMF_SUGGEST) {
+	HDRVR hdrvr;
+	ACMDRVFORMATSUGGEST		adfs;
+	pafd->dwFormatIndex = 0;
 	memset(&aftd, 0, sizeof(aftd));
 	aftd.cbStruct = sizeof(aftd);
-	aftd.dwFormatTagIndex = i;
-	if (acmFormatTagDetailsW(had, &aftd, ACM_FORMATTAGDETAILSF_INDEX) != MMSYSERR_NOERROR)
-	    continue;
-
-	if ((fdwEnum & ACM_FORMATENUMF_WFORMATTAG) && aftd.dwFormatTag != pwfxRef->wFormatTag)
-	    continue;
-
-	for (j = 0; j < aftd.cStandardFormats; j++) {
-	    pafd->dwFormatIndex = j;
-	    pafd->dwFormatTag = aftd.dwFormatTag;
-	    if (acmFormatDetailsW(had, pafd, ACM_FORMATDETAILSF_INDEX) != MMSYSERR_NOERROR)
-		continue;
+	memset(&adfs, 0, sizeof(adfs));
+	adfs.cbStruct = sizeof(adfs);
 
-	    if ((fdwEnum & ACM_FORMATENUMF_NCHANNELS) &&
-		pafd->pwfx->nChannels != pwfxRef->nChannels)
-		continue;
-	    if ((fdwEnum & ACM_FORMATENUMF_NSAMPLESPERSEC) &&
-		pafd->pwfx->nSamplesPerSec != pwfxRef->nSamplesPerSec)
-		continue;
-	    if ((fdwEnum & ACM_FORMATENUMF_WBITSPERSAMPLE) &&
-		pafd->pwfx->wBitsPerSample != pwfxRef->wBitsPerSample)
+	for (i = 0; i < padid->cFormatTags; i++) {
+		
+		aftd.dwFormatTag = i;
+		pafd->dwFormatTag = aftd.dwFormatTag;
+		pafd->pwfx->wFormatTag = pafd->dwFormatTag;
+
+		if (acmFormatTagDetailsW(had, &aftd, ACM_FORMATTAGDETAILSF_INDEX) != MMSYSERR_NOERROR)
+		    continue;
+	
+		adfs.cbwfxSrc = aftd.cbFormatSize;
+		adfs.cbwfxDst = aftd.cbFormatSize;
+		adfs.pwfxSrc = pwfxRef;
+		adfs.pwfxDst = pafd->pwfx;
+		pafd->fdwSupport = padid->fdwSupport;
+	
+		if ((fdwEnum & ACM_FORMATENUMF_WFORMATTAG) && aftd.dwFormatTag != pwfxRef->wFormatTag)
+		    continue;
+
+		if ((fdwEnum & ACM_FORMATENUMF_HARDWARE) &&
+		    !(pafd->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_HARDWARE))
+		    continue;
+
+		if (fdwEnum & (ACM_FORMATENUMF_INPUT | ACM_FORMATENUMF_OUTPUT))
+		    FIXME("Unsupported fdwEnum values %08x\n", fdwEnum);
+	
+		hdrvr = OpenDriver(padid->pszFileName,0,0);
+		SendDriverMessage(hdrvr,ACMDM_FORMAT_SUGGEST,(DWORD)&adfs,(fdwEnum & 0x000000FFL));
+	
+		if (acmFormatDetailsW(had, pafd, ACM_FORMATDETAILSF_FORMAT) != MMSYSERR_NOERROR)
+			continue;
+	
+		pafd->cbwfx = sizeof(*(pafd->pwfx));
+	
+		if (!(fnCallback)((HACMDRIVERID)padid, pafd, dwInstance, padid->fdwSupport))
+			return FALSE;
+		}
+    }
+    else {
+	for (i = 0; i < padid->cFormatTags; i++) {
+		memset(&aftd, 0, sizeof(aftd));
+		aftd.cbStruct = sizeof(aftd);
+		aftd.dwFormatTagIndex = i;
+		if (acmFormatTagDetailsW(had, &aftd, ACM_FORMATTAGDETAILSF_INDEX) != MMSYSERR_NOERROR)
 		continue;
-	    if ((fdwEnum & ACM_FORMATENUMF_HARDWARE) &&
-		!(pafd->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_HARDWARE))
+	
+		if ((fdwEnum & ACM_FORMATENUMF_WFORMATTAG) && aftd.dwFormatTag != pwfxRef->wFormatTag)
 		continue;
-
-	    /* more checks to be done on fdwEnum */
-
-	    if (!(fnCallback)((HACMDRIVERID)padid, pafd, dwInstance, padid->fdwSupport))
-		return FALSE;
+	
+		for (j = 0; j < aftd.cStandardFormats; j++) {
+		pafd->dwFormatIndex = j;
+		pafd->dwFormatTag = aftd.dwFormatTag;
+		if (acmFormatDetailsW(had, pafd, ACM_FORMATDETAILSF_INDEX) != MMSYSERR_NOERROR)
+			continue;
+	
+		if ((fdwEnum & ACM_FORMATENUMF_NCHANNELS) &&
+			pafd->pwfx->nChannels != pwfxRef->nChannels)
+			continue;
+		if ((fdwEnum & ACM_FORMATENUMF_NSAMPLESPERSEC) &&
+			pafd->pwfx->nSamplesPerSec != pwfxRef->nSamplesPerSec)
+			continue;
+		if ((fdwEnum & ACM_FORMATENUMF_WBITSPERSAMPLE) &&
+			pafd->pwfx->wBitsPerSample != pwfxRef->wBitsPerSample)
+			continue;
+		if ((fdwEnum & ACM_FORMATENUMF_HARDWARE) &&
+			!(pafd->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_HARDWARE))
+			continue;
+	
+		/* more checks to be done on fdwEnum */
+	
+		if (!(fnCallback)((HACMDRIVERID)padid, pafd, dwInstance, padid->fdwSupport))
+			return FALSE;
+		}
+		/* the "formats" used by the filters are also reported */
 	}
-	/* the "formats" used by the filters are also reported */
     }
     return TRUE;
 }
@@ -514,8 +562,7 @@ MMRESULT WINAPI acmFormatEnumW(HACMDRIVE
 	(pafd->dwFormatTag != pafd->pwfx->wFormatTag))
 	return MMSYSERR_INVALPARAM;
 
-    if (fdwEnum & (ACM_FORMATENUMF_CONVERT|ACM_FORMATENUMF_SUGGEST|
-		   ACM_FORMATENUMF_INPUT|ACM_FORMATENUMF_OUTPUT))
+    if (fdwEnum & (ACM_FORMATENUMF_CONVERT|ACM_FORMATENUMF_INPUT|ACM_FORMATENUMF_OUTPUT))
 	FIXME("Unsupported fdwEnum values %08x\n", fdwEnum);
 
     if (had) {

------=_Part_73327_4020186.1234812000164--




More information about the wine-patches mailing list