From 75c436246d7eaf3d268a30e7401d289e6dd6e399 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Tue, 7 Feb 2006 12:27:54 +0100 Subject: [PATCH] msvideo: Add a codec to the compressors list only if it supports specified input format. Return a compressor handle in COMPVARS structure. --- dlls/msvideo/msvideo_main.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/dlls/msvideo/msvideo_main.c b/dlls/msvideo/msvideo_main.c index cd638c0df24..5f6956ca836 100644 --- a/dlls/msvideo/msvideo_main.c +++ b/dlls/msvideo/msvideo_main.c @@ -705,19 +705,21 @@ struct choose_compressor COMPVARS cv; }; -static BOOL enum_compressors(HWND list) +static BOOL enum_compressors(HWND list, COMPVARS *pcv) { - UINT id; + UINT id, total = 0; ICINFO icinfo; id = 0; - while (ICInfo(ICTYPE_VIDEO, id, &icinfo)) + while (ICInfo(pcv->fccType, id, &icinfo)) { ICINFO *ic; DWORD idx; HIC hic; + id++; + hic = ICOpen(icinfo.fccType, icinfo.fccHandler, ICMODE_COMPRESS); if (hic) @@ -727,6 +729,17 @@ static BOOL enum_compressors(HWND list) */ DWORD fccHandler = icinfo.fccHandler; + if (pcv->lpbiIn) + { + if (ICCompressQuery(hic, pcv->lpbiIn, NULL) != ICERR_OK) + { + TRACE("fccHandler %s doesn't support input DIB format %ld\n", + wine_dbgstr_fcc(icinfo.fccHandler), pcv->lpbiIn->bmiHeader.biCompression); + ICClose(hic); + continue; + } + } + ICGetInfo(hic, &icinfo, sizeof(icinfo)); icinfo.fccHandler = fccHandler; ICClose(hic); @@ -737,10 +750,10 @@ static BOOL enum_compressors(HWND list) *ic = icinfo; SendMessageW(list, CB_SETITEMDATA, idx, (LPARAM)ic); } - id++; + total++; } - return id != 0; + return total != 0; } static INT_PTR CALLBACK icm_choose_compressor_dlgproc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) @@ -764,7 +777,7 @@ static INT_PTR CALLBACK icm_choose_compressor_dlgproc(HWND hdlg, UINT msg, WPARA ic->fccHandler = comptypeDIB; SendDlgItemMessageW(hdlg, IDC_COMP_LIST, CB_SETITEMDATA, 0, (LPARAM)ic); - enum_compressors(GetDlgItem(hdlg, IDC_COMP_LIST)); + enum_compressors(GetDlgItem(hdlg, IDC_COMP_LIST), &choose_comp->cv); SendDlgItemMessageW(hdlg, IDC_COMP_LIST, CB_SETCURSEL, 0, 0); SetFocus(GetDlgItem(hdlg, IDC_COMP_LIST)); @@ -795,6 +808,7 @@ static INT_PTR CALLBACK icm_choose_compressor_dlgproc(HWND hdlg, UINT msg, WPARA { choose_comp->cv.fccType = ic->fccType; choose_comp->cv.fccHandler = ic->fccHandler; + choose_comp->cv.hic = ICOpen(ic->fccType, ic->fccHandler, ICMODE_COMPRESS); /* FIXME: fill everything else */ } } @@ -860,6 +874,7 @@ BOOL VFWAPI ICCompressorChoose(HWND hwnd, UINT uiFlags, LPVOID pvIn, if (pc->fccType == 0) pc->fccType = ICTYPE_VIDEO; + choose_comp.cv = *pc; choose_comp.flags = uiFlags; choose_comp.title = lpszTitle;