Add a semi-functional ICCompressorChoose implementation
Dmitry Timoshkov
dmitry at baikal.ru
Tue Nov 22 06:11:01 CST 2005
Hello,
Changelog:
Dmitry Timoshkov <dmitry at codeweavers.com>
Add a semi-functional ICCompressorChoose implementation.
diff -up cvs/hq/wine/dlls/msvideo/drawdib.c wine/dlls/msvideo/drawdib.c
--- cvs/hq/wine/dlls/msvideo/drawdib.c 2005-06-03 13:43:26.000000000 +0900
+++ wine/dlls/msvideo/drawdib.c 2005-11-22 19:48:42.000000000 +0800
@@ -20,11 +20,15 @@
* Handle palettes
*/
+#include <stdarg.h>
+#include <stdio.h>
#include <string.h>
-#include "msvideo_private.h"
+#include "windef.h"
+#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
+#include "vfw.h"
#include "wine/debug.h"
diff -up cvs/hq/wine/dlls/msvideo/Makefile.in wine/dlls/msvideo/Makefile.in
--- cvs/hq/wine/dlls/msvideo/Makefile.in 2005-05-13 10:37:02.000000000 +0900
+++ wine/dlls/msvideo/Makefile.in 2005-11-22 19:40:25.000000000 +0800
@@ -17,6 +17,8 @@ C_SRCS16 = \
SPEC_SRCS16 = msvideo.spec
+RC_SRCS = rsrc.rc
+
@MAKE_DLL_RULES@
### Dependencies:
diff -up /dev/null wine/dlls/msvideo/msvfw32_En.rc
--- /dev/null 2005-11-23 03:32:14.316883250 +0800
+++ wine/dlls/msvideo/msvfw32_En.rc 2005-11-22 19:39:40.000000000 +0800
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2005 Dmitry Timoshkov
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "msvideo_private.h"
+
+ICM_CHOOSE_COMPRESSOR DIALOG DISCARDABLE 36, 24, 187, 95
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Video Compression"
+FONT 8, "MS Shell Dlg"
+{
+ DEFPUSHBUTTON "OK",IDOK,129,2,49,14
+ PUSHBUTTON "Cancel",IDCANCEL,129,18,49,14
+
+ LTEXT "&Compressor:",-1,9,6,105,8
+ COMBOBOX 880,9,16,111,67,CBS_DROPDOWNLIST|WS_VSCROLL|WS_TABSTOP
+
+ PUSHBUTTON "Con&figure...",882,129,36,49,14
+ PUSHBUTTON "&About...",883,129,52,49,14
+
+ SCROLLBAR 884,9,44,111,9,WS_TABSTOP
+
+ LTEXT "Compression &Quality:",886,9,34,80,8
+
+ CONTROL "&Key Frame Every",887,"Button",BS_AUTOCHECKBOX|WS_TABSTOP,9,60,66,12
+ EDITTEXT 888,78,60,22,12
+ LTEXT "frames",889,103,62,26,10
+
+ CONTROL "&Data Rate",894,"Button",BS_AUTOCHECKBOX|WS_TABSTOP,9,76,66,12
+ EDITTEXT 895,78,76,22,12
+ LTEXT "KB/sec",896,102,78,26,10
+}
+
+STRINGTABLE DISCARDABLE
+{
+ IDS_FULLFRAMES "Full Frames (Uncompressed)"
+}
diff -up cvs/hq/wine/dlls/msvideo/msvideo16.c wine/dlls/msvideo/msvideo16.c
--- cvs/hq/wine/dlls/msvideo/msvideo16.c 2005-09-27 22:39:07.000000000 +0900
+++ wine/dlls/msvideo/msvideo16.c 2005-11-22 19:47:04.000000000 +0800
@@ -20,14 +20,18 @@
*/
#define COM_NO_WINDOWS_H
+#include <stdarg.h>
#include <stdio.h>
#include <string.h>
-#include "msvideo_private.h"
+#include "windef.h"
+#include "winbase.h"
#include "winver.h"
#include "winnls.h"
#include "winreg.h"
+#include "winuser.h"
#include "vfw16.h"
+#include "msvideo_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvideo);
diff -up cvs/hq/wine/dlls/msvideo/msvideo_main.c wine/dlls/msvideo/msvideo_main.c
--- cvs/hq/wine/dlls/msvideo/msvideo_main.c 2005-10-18 10:20:21.000000000 +0900
+++ wine/dlls/msvideo/msvideo_main.c 2005-11-22 20:05:15.000000000 +0800
@@ -2,6 +2,7 @@
* Copyright 1998 Marcus Meissner
* Copyright 2000 Bradley Baetz
* Copyright 2003 Michael Günnewig
+ * Copyright 2005 Dmitry Timoshkov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -25,17 +26,20 @@
* - no thread safety
*/
+#include <stdarg.h>
#include <stdio.h>
#include <string.h>
-#include "msvideo_private.h"
+#define COM_NO_WINDOWS_H
+#include "windef.h"
+#include "winbase.h"
+#include "winreg.h"
#include "winnls.h"
#include "wingdi.h"
#include "winuser.h"
-#include "winreg.h"
-
-#include "windowsx.h"
-
+#include "commdlg.h"
+#include "vfw.h"
+#include "msvideo_private.h"
#include "wine/debug.h"
/* Drivers32 settings */
@@ -705,35 +709,175 @@ DWORD VFWAPIV ICDecompress(HIC hic,DWOR
return ret;
}
+
+struct choose_compressor
+{
+ UINT flags;
+ LPCSTR title;
+ COMPVARS cv;
+};
+
+static BOOL enum_compressors(HWND list)
+{
+ UINT id;
+ ICINFO icinfo;
+
+ id = 0;
+
+ while (ICInfo(ICTYPE_VIDEO, id, &icinfo))
+ {
+ ICINFO *ic;
+ DWORD idx;
+ HIC hic;
+
+ hic = ICOpen(icinfo.fccType, icinfo.fccHandler, ICMODE_COMPRESS);
+
+ if (hic)
+ {
+ /* for unknown reason fccHandler reported by the driver
+ * doesn't always work, use the one returned by ICInfo instead.
+ */
+ DWORD fccHandler = icinfo.fccHandler;
+
+ ICGetInfo(hic, &icinfo, sizeof(icinfo));
+ icinfo.fccHandler = fccHandler;
+ ICClose(hic);
+
+ idx = SendMessageW(list, CB_ADDSTRING, 0, (LPARAM)icinfo.szDescription);
+
+ ic = HeapAlloc(GetProcessHeap(), 0, sizeof(ICINFO));
+ *ic = icinfo;
+ SendMessageW(list, CB_SETITEMDATA, idx, (LPARAM)ic);
+ }
+ id++;
+ }
+
+ return id != 0;
+}
+
+static INT_PTR CALLBACK icm_choose_compressor_dlgproc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
+{
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ {
+ WCHAR buf[128];
+ struct choose_compressor *choose_comp = (struct choose_compressor *)lparam;
+
+ if (choose_comp->title)
+ SetWindowTextA(hdlg, choose_comp->title);
+
+ LoadStringW((HINSTANCE)GetWindowLongPtrW(hdlg, GWLP_HINSTANCE),
+ IDS_FULLFRAMES, buf, 128);
+ SendDlgItemMessageW(hdlg, IDC_COMP_LIST, CB_ADDSTRING, 0, (LPARAM)buf);
+
+ enum_compressors(GetDlgItem(hdlg, IDC_COMP_LIST));
+
+ SendDlgItemMessageW(hdlg, IDC_COMP_LIST, CB_SETCURSEL, 0, 0);
+ SetFocus(GetDlgItem(hdlg, IDC_COMP_LIST));
+
+ SetWindowLongPtrW(hdlg, DWLP_USER, (ULONG_PTR)choose_comp);
+ break;
+ }
+
+ case WM_COMMAND:
+ switch (LOWORD(wparam))
+ {
+ case IDOK:
+ {
+ HWND list = GetDlgItem(hdlg, IDC_COMP_LIST);
+ INT cur_sel;
+ ICINFO *ic;
+
+ cur_sel = SendMessageW(list, CB_GETCURSEL, 0, 0);
+ ic = (ICINFO *)SendMessageW(list, CB_GETITEMDATA, cur_sel, 0);
+ if (ic)
+ {
+ struct choose_compressor *choose_comp = (struct choose_compressor *)GetWindowLongPtrW(hdlg, DWLP_USER);
+
+ choose_comp->cv.hic = ICOpen(ic->fccType, ic->fccHandler, ICMODE_COMPRESS);
+ if (choose_comp->cv.hic)
+ {
+ choose_comp->cv.fccType = ic->fccType;
+ choose_comp->cv.fccHandler = ic->fccHandler;
+ /* FIXME: fill everything else */
+ }
+ }
+ }
+ /* fall through */
+ case IDCANCEL:
+ {
+ HWND list = GetDlgItem(hdlg, IDC_COMP_LIST);
+ INT idx = 0;
+
+ while (1)
+ {
+ LRESULT ret = SendMessageW(list, CB_GETITEMDATA, idx++, 0);
+
+ if (!ret || ret == CB_ERR) break;
+
+ HeapFree(GetProcessHeap(), 0, (void *)ret);
+ }
+
+ EndDialog(hdlg, LOWORD(wparam) == IDOK);
+ break;
+ }
+
+ default:
+ break;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+
/***********************************************************************
* ICCompressorChoose [MSVFW32.@]
*/
BOOL VFWAPI ICCompressorChoose(HWND hwnd, UINT uiFlags, LPVOID pvIn,
LPVOID lpData, PCOMPVARS pc, LPSTR lpszTitle)
{
- FIXME("(%p,0x%X,%p,%p,%p,%s),stub!\n",hwnd,uiFlags,pvIn,lpData,pc,lpszTitle);
+ struct choose_compressor choose_comp;
+ BOOL ret;
- if (pc == NULL || pc->cbSize != sizeof(COMPVARS))
- return FALSE;
+ TRACE("(%p,%08x,%p,%p,%p,%s)\n", hwnd, uiFlags, pvIn, lpData, pc, lpszTitle);
- if ((pc->dwFlags & ICMF_COMPVARS_VALID) == 0) {
- pc->dwFlags = 0;
- pc->fccType = pc->fccHandler = 0;
- pc->hic = NULL;
- pc->lpbiOut = NULL;
- pc->lpBitsOut = pc->lpBitsPrev = pc->lpState = NULL;
- pc->lQ = ICQUALITY_DEFAULT;
- pc->lKey = -1;
- pc->lDataRate = 300; /* kB */
- pc->lpState = NULL;
- pc->cbState = 0;
- }
- if (pc->fccType == 0)
- pc->fccType = ICTYPE_VIDEO;
+ if (!pc || pc->cbSize != sizeof(COMPVARS))
+ return FALSE;
- /* FIXME */
-
- return FALSE;
+ if (!(pc->dwFlags & ICMF_COMPVARS_VALID))
+ {
+ pc->dwFlags = 0;
+ pc->fccType = pc->fccHandler = 0;
+ pc->hic = NULL;
+ pc->lpbiOut = NULL;
+ pc->lpBitsOut = pc->lpBitsPrev = pc->lpState = NULL;
+ pc->lQ = ICQUALITY_DEFAULT;
+ pc->lKey = -1;
+ pc->lDataRate = 300; /* kB */
+ pc->lpState = NULL;
+ pc->cbState = 0;
+ }
+ if (pc->fccType == 0)
+ pc->fccType = ICTYPE_VIDEO;
+
+ choose_comp.flags = uiFlags;
+ choose_comp.title = lpszTitle;
+
+ ret = DialogBoxParamW(MSVFW32_hModule, MAKEINTRESOURCEW(ICM_CHOOSE_COMPRESSOR), hwnd,
+ icm_choose_compressor_dlgproc, (LPARAM)&choose_comp);
+
+ if (ret)
+ {
+ *pc = choose_comp.cv;
+ pc->dwFlags |= ICMF_COMPVARS_VALID;
+ }
+
+ return ret;
}
diff -up cvs/hq/wine/dlls/msvideo/msvideo_private.h wine/dlls/msvideo/msvideo_private.h
--- cvs/hq/wine/dlls/msvideo/msvideo_private.h 2005-08-23 23:02:58.000000000 +0900
+++ wine/dlls/msvideo/msvideo_private.h 2005-11-22 19:42:24.000000000 +0800
@@ -19,14 +19,9 @@
#ifndef __WINE_MSVIDEO_PRIVATE_H
#define __WINE_MSVIDEO_PRIVATE_H
-#define COM_NO_WINDOWS_H
-#include <stdarg.h>
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-#include "commdlg.h"
-#include "vfw.h"
+#define ICM_CHOOSE_COMPRESSOR 1
+#define IDC_COMP_LIST 880
+#define IDS_FULLFRAMES 901
/* HIC struct (same layout as Win95 one) */
typedef struct tagWINE_HIC {
diff -up cvs/hq/wine/dlls/msvideo/rsrc.rc wine/dlls/msvideo/rsrc.rc
--- /dev/null 2005-11-23 03:32:14.316883250 +0800
+++ wine/dlls/msvideo/rsrc.rc 2005-11-22 19:39:50.000000000 +0800
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2005 Dmitry Timoshkov
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "windef.h"
+#include "winuser.h"
+
+#include "msvfw32_En.rc"
More information about the wine-patches
mailing list