Dmitry Timoshkov : msvideo: Add a codec to the compressors list only if it supports

Alexandre Julliard julliard at wine.codeweavers.com
Tue Feb 7 06:05:38 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 75c436246d7eaf3d268a30e7401d289e6dd6e399
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=75c436246d7eaf3d268a30e7401d289e6dd6e399

Author: Dmitry Timoshkov <dmitry at codeweavers.com>
Date:   Tue Feb  7 12:27:54 2006 +0100

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 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/dlls/msvideo/msvideo_main.c b/dlls/msvideo/msvideo_main.c
index cd638c0..5f6956c 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_compr
         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_compr
                 {
                     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
     if (pc->fccType == 0)
         pc->fccType = ICTYPE_VIDEO;
 
+    choose_comp.cv = *pc;
     choose_comp.flags = uiFlags;
     choose_comp.title = lpszTitle;
 




More information about the wine-cvs mailing list