Commit fd2004e5 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

Add a semi-functional ICCompressorChoose implementation.

parent 6154b46b
Makefile
libmsvfw32.def
rsrc.res
......@@ -17,6 +17,8 @@ C_SRCS16 = \
SPEC_SRCS16 = msvideo.spec
RC_SRCS = rsrc.rc
@MAKE_DLL_RULES@
### Dependencies:
......@@ -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"
......
/*
* 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)"
}
......@@ -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);
......
......@@ -2,6 +2,7 @@
* Copyright 1998 Marcus Meissner
* Copyright 2000 Bradley Baetz
* Copyright 2003 Michael Gnnewig
* 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,18 +709,148 @@ DWORD VFWAPIV ICDecompress(HIC hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiFormat,
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;
TRACE("(%p,%08x,%p,%p,%p,%s)\n", hwnd, uiFlags, pvIn, lpData, pc, lpszTitle);
if (pc == NULL || pc->cbSize != sizeof(COMPVARS))
if (!pc || pc->cbSize != sizeof(COMPVARS))
return FALSE;
if ((pc->dwFlags & ICMF_COMPVARS_VALID) == 0) {
if (!(pc->dwFlags & ICMF_COMPVARS_VALID))
{
pc->dwFlags = 0;
pc->fccType = pc->fccHandler = 0;
pc->hic = NULL;
......@@ -731,9 +865,19 @@ BOOL VFWAPI ICCompressorChoose(HWND hwnd, UINT uiFlags, LPVOID pvIn,
if (pc->fccType == 0)
pc->fccType = ICTYPE_VIDEO;
/* FIXME */
choose_comp.flags = uiFlags;
choose_comp.title = lpszTitle;
return FALSE;
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;
}
......
......@@ -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 {
......
/*
* 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"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment