msvfw32: Better tracing of ICERR codes and general trace improvements.

Signed-off-by: Bruno Jesus <00cpxxx@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Bruno Jesus 2015-10-22 14:10:29 +08:00 committed by Alexandre Julliard
parent 506e981d08
commit 060db73ab6
1 changed files with 77 additions and 46 deletions

View File

@ -46,16 +46,58 @@
WINE_DEFAULT_DEBUG_CHANNEL(msvideo); WINE_DEFAULT_DEBUG_CHANNEL(msvideo);
/* This one is a macro in order to work for both ASCII and Unicode */
#define fourcc_to_string(str, fcc) do { \
(str)[0] = LOBYTE(LOWORD(fcc)); \
(str)[1] = HIBYTE(LOWORD(fcc)); \
(str)[2] = LOBYTE(HIWORD(fcc)); \
(str)[3] = HIBYTE(HIWORD(fcc)); \
} while(0)
static inline const char *wine_dbgstr_fcc( DWORD fcc ) static inline const char *wine_dbgstr_fcc( DWORD fcc )
{ {
char fcc_str[5] = {LOBYTE(LOWORD(fcc)), HIBYTE(LOWORD(fcc)), char fcc_str[5];
LOBYTE(HIWORD(fcc)), HIBYTE(HIWORD(fcc)), '\0'}; fourcc_to_string(fcc_str, fcc);
if (isalnum(fcc_str[0]) && isalnum(fcc_str[1]) fcc_str[4] = '\0';
&& isalnum(fcc_str[2]) && isalnum(fcc_str[3])) /* Last byte may be ' ' in some cases like "DIB " */
if (isalnum(fcc_str[0]) && isalnum(fcc_str[1]) && isalnum(fcc_str[2])
&& (isalnum(fcc_str[3]) || isspace(fcc_str[3])))
return wine_dbg_sprintf("%s", fcc_str); return wine_dbg_sprintf("%s", fcc_str);
return wine_dbg_sprintf("0x%08x", fcc); return wine_dbg_sprintf("0x%08x", fcc);
} }
static const char *wine_dbgstr_icerr( int ret )
{
const char *str;
if (ret <= ICERR_CUSTOM)
return wine_dbg_sprintf("ICERR_CUSTOM (%d)", ret);
#define XX(x) case (x): str = #x; break
switch (ret)
{
XX(ICERR_OK);
XX(ICERR_DONTDRAW);
XX(ICERR_NEWPALETTE);
XX(ICERR_GOTOKEYFRAME);
XX(ICERR_STOPDRAWING);
XX(ICERR_UNSUPPORTED);
XX(ICERR_BADFORMAT);
XX(ICERR_MEMORY);
XX(ICERR_INTERNAL);
XX(ICERR_BADFLAGS);
XX(ICERR_BADPARAM);
XX(ICERR_BADSIZE);
XX(ICERR_BADHANDLE);
XX(ICERR_CANTUPDATE);
XX(ICERR_ABORT);
XX(ICERR_ERROR);
XX(ICERR_BADBITDEPTH);
XX(ICERR_BADIMAGESIZE);
default: str = wine_dbg_sprintf("UNKNOWN (%d)", ret);
}
#undef XX
return str;
}
static WINE_HIC* MSVIDEO_FirstHic /* = NULL */; static WINE_HIC* MSVIDEO_FirstHic /* = NULL */;
typedef struct _reg_driver reg_driver; typedef struct _reg_driver reg_driver;
@ -70,14 +112,6 @@ struct _reg_driver
static reg_driver* reg_driver_list = NULL; static reg_driver* reg_driver_list = NULL;
/* This one is a macro in order to work for both ASCII and Unicode */
#define fourcc_to_string(str, fcc) do { \
(str)[0] = LOBYTE(LOWORD(fcc)); \
(str)[1] = HIBYTE(LOWORD(fcc)); \
(str)[2] = LOBYTE(HIWORD(fcc)); \
(str)[3] = HIBYTE(HIWORD(fcc)); \
} while(0)
HMODULE MSVFW32_hModule; HMODULE MSVFW32_hModule;
BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
@ -176,7 +210,7 @@ static LRESULT MSVIDEO_SendMessage(WINE_HIC* whic, UINT msg, DWORD_PTR lParam1,
ret = SendDriverMessage(whic->hdrv, msg, lParam1, lParam2); ret = SendDriverMessage(whic->hdrv, msg, lParam1, lParam2);
} }
TRACE(" -> 0x%08lx\n", ret); TRACE(" -> %s\n", wine_dbgstr_icerr(ret));
return ret; return ret;
} }
@ -293,8 +327,8 @@ static BOOL ICInfo_enum_handler(const char *drv, unsigned int nr, void *param)
*/ */
BOOL VFWAPI ICInfo( DWORD fccType, DWORD fccHandler, ICINFO *lpicinfo) BOOL VFWAPI ICInfo( DWORD fccType, DWORD fccHandler, ICINFO *lpicinfo)
{ {
TRACE("(%s,%s/%08x,%p)\n", TRACE("(%s,%s,%p)\n",
wine_dbgstr_fcc(fccType), wine_dbgstr_fcc(fccHandler), fccHandler, lpicinfo); wine_dbgstr_fcc(fccType), wine_dbgstr_fcc(fccHandler), lpicinfo);
lpicinfo->fccType = fccType; lpicinfo->fccType = fccType;
lpicinfo->fccHandler = fccHandler; lpicinfo->fccHandler = fccHandler;
@ -567,7 +601,7 @@ LRESULT VFWAPI ICGetInfo(HIC hic, ICINFO *picinfo, DWORD cb)
lstrcpyW(picinfo->szDriver, ii.szDriver); lstrcpyW(picinfo->szDriver, ii.szDriver);
} }
TRACE(" -> 0x%08lx\n", ret); TRACE(" -> %s\n", wine_dbgstr_icerr(ret));
return ret; return ret;
} }
@ -764,7 +798,7 @@ DWORD VFWAPIV ICDecompress(HIC hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiFormat,
icd.ckid = 0; icd.ckid = 0;
ret = ICSendMessage(hic,ICM_DECOMPRESS,(DWORD_PTR)&icd,sizeof(ICDECOMPRESS)); ret = ICSendMessage(hic,ICM_DECOMPRESS,(DWORD_PTR)&icd,sizeof(ICDECOMPRESS));
TRACE("-> %d\n",ret); TRACE("-> %s\n",wine_dbgstr_icerr(ret));
return ret; return ret;
} }
@ -1378,7 +1412,6 @@ LPVOID VFWAPI ICSeqCompressFrame(PCOMPVARS pc, UINT uiFlags, LPVOID lpBits, BOOL
icComp->lpPrev = pc->lpBitsPrev; icComp->lpPrev = pc->lpBitsPrev;
ret = ICSendMessage(pc->hic, ICM_COMPRESS, (DWORD_PTR)icComp, sizeof(*icComp)); ret = ICSendMessage(pc->hic, ICM_COMPRESS, (DWORD_PTR)icComp, sizeof(*icComp));
TRACE(" -- 0x%08x\n", ret);
if (ret == ICERR_OK) if (ret == ICERR_OK)
{ {
LPVOID oldprev, oldout; LPVOID oldprev, oldout;
@ -1426,10 +1459,8 @@ static void clear_compvars(PCOMPVARS pc)
*/ */
void VFWAPI ICSeqCompressFrameEnd(PCOMPVARS pc) void VFWAPI ICSeqCompressFrameEnd(PCOMPVARS pc)
{ {
DWORD ret;
TRACE("(%p)\n", pc); TRACE("(%p)\n", pc);
ret = ICSendMessage(pc->hic, ICM_COMPRESS_END, 0, 0); ICSendMessage(pc->hic, ICM_COMPRESS_END, 0, 0);
TRACE(" -- %x\n", ret);
clear_compvars(pc); clear_compvars(pc);
} }
@ -1514,15 +1545,15 @@ BOOL VFWAPI ICSeqCompressFrameStart(PCOMPVARS pc, LPBITMAPINFO lpbiIn)
"\tsize: %i\n" "\tsize: %i\n"
"\tflags: 0x%x\n" "\tflags: 0x%x\n"
"\thic: %p\n" "\thic: %p\n"
"\ttype: 0x%x\n" "\ttype: %s\n"
"\thandler: %s\n" "\thandler: %s\n"
"\tin/out: %p/%p\n" "\tin/out: %p/%p\n"
"\tkey/data/quality: %i/%i/%i\n", "\tkey/data/quality: %i/%i/%i\n",
pc->cbSize, pc->dwFlags, pc->hic, pc->fccType, wine_dbgstr_fcc(pc->fccHandler), pc->cbSize, pc->dwFlags, pc->hic, wine_dbgstr_fcc(pc->fccType),
pc->lpbiIn, pc->lpbiOut, pc->lKey, pc->lDataRate, pc->lQ); wine_dbgstr_fcc(pc->fccHandler), pc->lpbiIn, pc->lpbiOut, pc->lKey,
pc->lDataRate, pc->lQ);
ret = ICSendMessage(pc->hic, ICM_COMPRESS_BEGIN, (DWORD_PTR)pc->lpbiIn, (DWORD_PTR)pc->lpbiOut); ret = ICSendMessage(pc->hic, ICM_COMPRESS_BEGIN, (DWORD_PTR)pc->lpbiIn, (DWORD_PTR)pc->lpbiOut);
TRACE(" -- %x\n", ret);
if (ret == ICERR_OK) if (ret == ICERR_OK)
{ {
icComp = pc->lpState; icComp = pc->lpState;