New patches to fix some problems with audio codecs

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

 



Hi,

I made these patches to sane some difficulties with certain multimedia applications, like VirtualDub. In some cases, the the application would either not find the audio codecs at all or it would list them multiple times (with small but bad variations). These patches are commented and should be well straight forward.

Enjoy,
Waldeck
Index: wine/dlls/msacm/format.c
===================================================================
RCS file: /home/wine/wine/dlls/msacm/format.c,v
retrieving revision 1.20
diff -r1.20 format.c
761c761,788
<     if (had) FIXME("had != NULL, not supported\n");
---
>     /* if (had) FIXME("had != NULL, not supported\n"); */
> 
>     /* If had != 0, get tags for specific driver */
>     if (had) {
> 
>        if (acmDriverID((HACMOBJ)had, (HACMDRIVERID *)&padid, 0) != MMSYSERR_NOERROR)
>           return MMSYSERR_INVALHANDLE;
> 
>        for (i = 0; i < padid->cFormatTags; i++) {
> 	  paftd->dwFormatTagIndex = i;
> 	  if (MSACM_Message(had, ACMDM_FORMATTAG_DETAILS,
> 	  (LPARAM)paftd, ACM_FORMATTAGDETAILSF_INDEX) == MMSYSERR_NOERROR) {
> 	     if (paftd->dwFormatTag == WAVE_FORMAT_PCM) {
> 	        if (paftd->szFormatTag[0] == 0)
> 		   MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
> 			 sizeof(paftd->szFormatTag)/sizeof(WCHAR) );
> 		/* FIXME (WS): I actually have no idea why one would
> 		 * have to do this. I just copied it from the block
> 		 * right below, where the EPP is not sure about it either.
> 		 * Oh, well... 
> 	  	 */
> 		if (bPcmDone) continue;
> 		   bPcmDone = TRUE;
> 	     }
> 	     if (!(fnCallback)((HACMDRIVERID)padid, paftd, dwInstance, padid->fdwSupport)) 
>                 return MMSYSERR_NOERROR;
> 	  }
>        }
763,790c790,822
<     for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
< 	/* should check for codec only */
< 	if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
< 	    acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == MMSYSERR_NOERROR) {
< 	    for (i = 0; i < padid->cFormatTags; i++) {
< 		paftd->dwFormatTagIndex = i;
< 		if (MSACM_Message(had, ACMDM_FORMATTAG_DETAILS,
< 				  (LPARAM)paftd, ACM_FORMATTAGDETAILSF_INDEX) == MMSYSERR_NOERROR) {
< 		    if (paftd->dwFormatTag == WAVE_FORMAT_PCM) {
< 			if (paftd->szFormatTag[0] == 0)
< 			    MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
< 						 sizeof(paftd->szFormatTag)/sizeof(WCHAR) );
< 			/* FIXME (EPP): I'm not sure this is the correct
< 			 * algorithm (should make more sense to apply the same
< 			 * for all already loaded formats, but this will do
< 			 * for now
< 			 */
< 			if (bPcmDone) continue;
< 			bPcmDone = TRUE;
< 		    }
< 		    if (!(fnCallback)((HACMDRIVERID)padid, paftd, dwInstance, padid->fdwSupport)) {
<                         acmDriverClose(had, 0);
<                         return MMSYSERR_NOERROR;
< 		    }
< 		}
< 	    }
< 	}
< 	acmDriverClose(had, 0);
---
>     }
> 
>     /* if had==0 then search for the first suitable driver */
>     else {
>        for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
>           /* should check for codec only */
>           if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
> 	     acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == MMSYSERR_NOERROR) {
> 	     for (i = 0; i < padid->cFormatTags; i++) {
> 	        paftd->dwFormatTagIndex = i;
> 	        if (MSACM_Message(had, ACMDM_FORMATTAG_DETAILS,
> 	           (LPARAM)paftd, ACM_FORMATTAGDETAILSF_INDEX) == MMSYSERR_NOERROR) {
> 	           if (paftd->dwFormatTag == WAVE_FORMAT_PCM) {
> 		      if (paftd->szFormatTag[0] == 0)
> 		         MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
> 				 sizeof(paftd->szFormatTag)/sizeof(WCHAR) );
> 		      /* FIXME (EPP): I'm not sure this is the correct
> 		       * algorithm (should make more sense to apply the same
> 		       * for all already loaded formats, but this will do
> 	  	       * for now
> 	       	       */
> 		      if (bPcmDone) continue;
> 		         bPcmDone = TRUE;
> 		   }
> 		   if (!(fnCallback)((HACMDRIVERID)padid, paftd, dwInstance, padid->fdwSupport)) {
>                       acmDriverClose(had, 0);
>                       return MMSYSERR_NOERROR;
> 		   }
> 	        }
> 	     }
>           }
>           acmDriverClose(had, 0);
>        }
793a826
> 
Index: wine/dlls/msacm/stream.c
===================================================================
RCS file: /home/wine/wine/dlls/msacm/stream.c,v
retrieving revision 1.12
diff -r1.12 stream.c
149a150,154
>     /*
>      * The docs say if ACM_STREAMOPENF_QUERY, phas should be NULL. It does
>      * not say it MUST BE NULL. This is breaking down some applications
>      * that happen to pass a non-null (probably garbage) phas.
> 
150a156,157
>     */
> 
233,236c240,242
< 	if (phas)
< 	    *phas = (HACMSTREAM)was;
< 	TRACE("=> (%d)\n", ret);
< 	return ret;
---
>        /* if this is not query, then return the pointer to heap */
>        if (phas)
> 	  *phas = (HACMSTREAM)was;
237a244,249
>     else
>        /* otherwise, we release memory to avoid leaks, hehe! */ 
>        HeapFree(MSACM_hHeap, 0, was);
>     TRACE("=> (%d)\n", ret);
>     return ret;
> 
239c251,256
<     if (phas)
---
>     if (!(fdwOpen & ACM_STREAMOPENF_QUERY)) {
>        /* If it is not dirty, don't clean it up! 
> 	* The doc says that if ACM_STREAMOPENF_QUERY is set
> 	* phas will not be set, even if there is an error.
> 	*/
>        if (phas)
240a258
>     }

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux