ReactOS  0.4.14-dev-41-g31d7680
msvideo_main.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winnls.h"
#include "wingdi.h"
#include "winuser.h"
#include "commdlg.h"
#include "vfw.h"
#include "msvideo_private.h"
#include "wine/debug.h"
Include dependency graph for msvideo_main.c:

Go to the source code of this file.

Classes

struct  _reg_driver
 
struct  driver_info_t
 
struct  choose_compressor
 
struct  codec_info
 

Macros

#define HKLM_DRIVERS32   "Software\\Microsoft\\Windows NT\\CurrentVersion\\Drivers32"
 
#define fourcc_to_string(str, fcc)
 
#define XX(x)   case (x): str = #x; break
 
#define XX(x)   case x: TRACE("(%p,"#x",0x%08lx,0x%08lx)\n",whic,lParam1,lParam2); break
 

Typedefs

typedef struct _reg_driver reg_driver
 
typedef BOOL(* enum_handler_t) (const char *name, const char *driver, unsigned int index, void *param)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msvideo)
 
static const charwine_dbgstr_fcc (DWORD fcc)
 
static const charwine_dbgstr_icerr (int ret)
 
BOOL WINAPI DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserved)
 
static LRESULT MSVIDEO_SendMessage (WINE_HIC *whic, UINT msg, DWORD_PTR lParam1, DWORD_PTR lParam2)
 
static int compare_fourcc (DWORD fcc1, DWORD fcc2)
 
static DWORD get_size_image (LONG width, LONG height, WORD depth)
 
static BOOL enum_drivers (DWORD fccType, enum_handler_t handler, void *param)
 
static WINE_HICMSVIDEO_GetHicPtr (HIC hic)
 
DWORD WINAPI VideoForWindowsVersion (void)
 
static BOOL ICInfo_enum_handler (const char *name, const char *driver, unsigned int nr, void *param)
 
BOOL VFWAPI ICInfo (DWORD fccType, DWORD fccHandler, ICINFO *lpicinfo)
 
BOOL VFWAPI ICInstall (DWORD fccType, DWORD fccHandler, LPARAM lParam, LPSTR szDesc, UINT wFlags)
 
BOOL VFWAPI ICRemove (DWORD fccType, DWORD fccHandler, UINT wFlags)
 
HIC VFWAPI ICOpen (DWORD fccType, DWORD fccHandler, UINT wMode)
 
HIC VFWAPI ICOpenFunction (DWORD fccType, DWORD fccHandler, UINT wMode, DRIVERPROC lpfnHandler)
 
LRESULT VFWAPI ICGetInfo (HIC hic, ICINFO *picinfo, DWORD cb)
 
static HIC try_driver (driver_info_t *info)
 
static BOOL ICLocate_enum_handler (const char *name, const char *driver, unsigned int nr, void *param)
 
HIC VFWAPI ICLocate (DWORD fccType, DWORD fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, WORD wMode)
 
HIC VFWAPI ICGetDisplayFormat (HIC hic, BITMAPINFOHEADER *in, BITMAPINFOHEADER *out, int depth, int width, int height)
 
DWORD VFWAPIV ICCompress (HIC hic, DWORD dwFlags, LPBITMAPINFOHEADER lpbiOutput, LPVOID lpData, LPBITMAPINFOHEADER lpbiInput, LPVOID lpBits, LPDWORD lpckid, LPDWORD lpdwFlags, LONG lFrameNum, DWORD dwFrameSize, DWORD dwQuality, LPBITMAPINFOHEADER lpbiPrev, LPVOID lpPrev)
 
DWORD VFWAPIV ICDecompress (HIC hic, DWORD dwFlags, LPBITMAPINFOHEADER lpbiFormat, LPVOID lpData, LPBITMAPINFOHEADER lpbi, LPVOID lpBits)
 
static BOOL enum_compressors (HWND list, COMPVARS *pcv, BOOL enum_all)
 
static INT_PTR CALLBACK icm_choose_compressor_dlgproc (HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 
BOOL VFWAPI ICCompressorChoose (HWND hwnd, UINT uiFlags, LPVOID pvIn, LPVOID lpData, PCOMPVARS pc, LPSTR lpszTitle)
 
void VFWAPI ICCompressorFree (PCOMPVARS pc)
 
LRESULT VFWAPI ICSendMessage (HIC hic, UINT msg, DWORD_PTR lParam1, DWORD_PTR lParam2)
 
DWORD VFWAPIV ICDrawBegin (HIC hic, DWORD dwFlags, HPALETTE hpal, HWND hwnd, HDC hdc, INT xDst, INT yDst, INT dxDst, INT dyDst, LPBITMAPINFOHEADER lpbi, INT xSrc, INT ySrc, INT dxSrc, INT dySrc, DWORD dwRate, DWORD dwScale)
 
DWORD VFWAPIV ICDraw (HIC hic, DWORD dwFlags, LPVOID lpFormat, LPVOID lpData, DWORD cbData, LONG lTime)
 
LRESULT WINAPI ICClose (HIC hic)
 
HANDLE VFWAPI ICImageCompress (HIC hic, UINT uiFlags, LPBITMAPINFO lpbiIn, LPVOID lpBits, LPBITMAPINFO lpbiOut, LONG lQuality, LONG *plSize)
 
HANDLE VFWAPI ICImageDecompress (HIC hic, UINT uiFlags, LPBITMAPINFO lpbiIn, LPVOID lpBits, LPBITMAPINFO lpbiOut)
 
LPVOID VFWAPI ICSeqCompressFrame (PCOMPVARS pc, UINT uiFlags, LPVOID lpBits, BOOL *pfKey, LONG *plSize)
 
static void clear_compvars (PCOMPVARS pc)
 
void VFWAPI ICSeqCompressFrameEnd (PCOMPVARS pc)
 
BOOL VFWAPI ICSeqCompressFrameStart (PCOMPVARS pc, LPBITMAPINFO lpbiIn)
 
static BOOL GetFileNamePreview (LPVOID lpofn, BOOL bSave, BOOL bUnicode)
 
BOOL WINAPI GetOpenFileNamePreviewA (LPOPENFILENAMEA lpofn)
 
BOOL WINAPI GetOpenFileNamePreviewW (LPOPENFILENAMEW lpofn)
 
BOOL WINAPI GetSaveFileNamePreviewA (LPOPENFILENAMEA lpofn)
 
BOOL WINAPI GetSaveFileNamePreviewW (LPOPENFILENAMEW lpofn)
 

Variables

static WINE_HICMSVIDEO_FirstHic
 
static reg_driverreg_driver_list = NULL
 
HMODULE MSVFW32_hModule
 
static DWORD IC_HandleRef = 1
 

Macro Definition Documentation

◆ fourcc_to_string

#define fourcc_to_string (   str,
  fcc 
)
Value:
do { \
(str)[0] = LOBYTE(LOWORD(fcc)); \
(str)[1] = HIBYTE(LOWORD(fcc)); \
(str)[2] = LOBYTE(HIWORD(fcc)); \
(str)[3] = HIBYTE(HIWORD(fcc)); \
} while(0)
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
const WCHAR * str
#define HIWORD(l)
Definition: typedefs.h:246
#define LOWORD(l)
Definition: pedump.c:82

Definition at line 50 of file msvideo_main.c.

◆ HKLM_DRIVERS32

#define HKLM_DRIVERS32   "Software\\Microsoft\\Windows NT\\CurrentVersion\\Drivers32"

Definition at line 45 of file msvideo_main.c.

◆ XX [1/2]

#define XX (   x)    case (x): str = #x; break

◆ XX [2/2]

#define XX (   x)    case x: TRACE("(%p,"#x",0x%08lx,0x%08lx)\n",whic,lParam1,lParam2); break

Typedef Documentation

◆ enum_handler_t

typedef BOOL(* enum_handler_t) (const char *name, const char *driver, unsigned int index, void *param)

Definition at line 235 of file msvideo_main.c.

◆ reg_driver

Definition at line 103 of file msvideo_main.c.

Function Documentation

◆ clear_compvars()

static void clear_compvars ( PCOMPVARS  pc)
static

Definition at line 1510 of file msvideo_main.c.

1511 {
1512  HeapFree(GetProcessHeap(), 0, pc->lpbiIn);
1513  HeapFree(GetProcessHeap(), 0, pc->lpBitsPrev);
1514  HeapFree(GetProcessHeap(), 0, pc->lpBitsOut);
1515  HeapFree(GetProcessHeap(), 0, pc->lpState);
1516  pc->lpbiIn = pc->lpBitsPrev = pc->lpBitsOut = pc->lpState = NULL;
1517  if (pc->dwFlags & 0x80000000)
1518  {
1519  HeapFree(GetProcessHeap(), 0, pc->lpbiOut);
1520  pc->lpbiOut = NULL;
1521  pc->dwFlags &= ~0x80000000;
1522  }
1523 }
LPBITMAPINFO lpbiIn
Definition: vfw.h:823
LPBITMAPINFO lpbiOut
Definition: vfw.h:824
smooth NULL
Definition: ftsmooth.c:416
LPVOID lpBitsPrev
Definition: vfw.h:826
#define GetProcessHeap()
Definition: compat.h:395
LPVOID lpBitsOut
Definition: vfw.h:825
LPVOID lpState
Definition: vfw.h:832
DWORD dwFlags
Definition: vfw.h:819
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by ICSeqCompressFrameEnd(), and ICSeqCompressFrameStart().

◆ compare_fourcc()

static int compare_fourcc ( DWORD  fcc1,
DWORD  fcc2 
)
static

Definition at line 217 of file msvideo_main.c.

218 {
219  char fcc_str1[4];
220  char fcc_str2[4];
221  fourcc_to_string(fcc_str1, fcc1);
222  fourcc_to_string(fcc_str2, fcc2);
223  return strncasecmp(fcc_str1, fcc_str2, 4);
224 }
#define strncasecmp
Definition: fake.h:10
#define fourcc_to_string(str, fcc)
Definition: msvideo_main.c:50

Referenced by ICInfo_enum_handler(), ICInstall(), ICOpen(), and ICRemove().

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hinst,
DWORD  reason,
LPVOID  reserved 
)

Definition at line 117 of file msvideo_main.c.

118 {
119  TRACE("%p,%x,%p\n", hinst, reason, reserved);
120 
121  switch(reason)
122  {
123  case DLL_PROCESS_ATTACH:
126  break;
127  }
128  return TRUE;
129 }
#define TRUE
Definition: types.h:120
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
HMODULE MSVFW32_hModule
Definition: msvideo_main.c:115
r reserved
Definition: btrfs.c:2893
#define TRACE(s)
Definition: solgame.cpp:4
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
static HINSTANCE hinst
Definition: edit.c:551

◆ enum_compressors()

static BOOL enum_compressors ( HWND  list,
COMPVARS pcv,
BOOL  enum_all 
)
static

Definition at line 888 of file msvideo_main.c.

889 {
890  UINT id, total = 0;
891  ICINFO icinfo;
892 
893  id = 0;
894 
895  while (ICInfo(pcv->fccType, id, &icinfo))
896  {
897  struct codec_info *ic;
898  DWORD idx;
899  HIC hic;
900 
901  id++;
902 
904 
905  if (hic)
906  {
907  /* for unknown reason fccHandler reported by the driver
908  * doesn't always work, use the one returned by ICInfo instead.
909  */
910  DWORD fccHandler = icinfo.fccHandler;
911 
912  if (!enum_all && pcv->lpbiIn)
913  {
914  if (ICCompressQuery(hic, pcv->lpbiIn, NULL) != ICERR_OK)
915  {
916  TRACE("fccHandler %s doesn't support input DIB format %d\n",
918  ICClose(hic);
919  continue;
920  }
921  }
922 
923  ICGetInfo(hic, &icinfo, sizeof(icinfo));
924  icinfo.fccHandler = fccHandler;
925 
927 
928  ic = HeapAlloc(GetProcessHeap(), 0, sizeof(struct codec_info));
929  ic->icinfo = icinfo;
930  ic->hic = hic;
932  }
933  total++;
934  }
935 
936  return total != 0;
937 }
#define CB_SETITEMDATA
Definition: winuser.h:1948
HIC VFWAPI ICOpen(DWORD fccType, DWORD fccHandler, UINT wMode)
Definition: msvideo_main.c:437
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1471
#define ICERR_OK
Definition: vfw.h:50
BOOL VFWAPI ICInfo(DWORD fccType, DWORD fccHandler, ICINFO *lpicinfo)
Definition: msvideo_main.c:337
DWORD fccHandler
Definition: vfw.h:283
LPBITMAPINFO lpbiIn
Definition: vfw.h:823
LRESULT WINAPI ICClose(HIC hic)
#define ICCompressQuery(hic, lpbiInput, lpbiOutput)
Definition: vfw.h:224
DWORD biCompression
Definition: amvideo.idl:35
unsigned int idx
Definition: utils.c:41
#define CB_ADDSTRING
Definition: winuser.h:1918
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
DWORD fccType
Definition: vfw.h:821
WCHAR szDescription[128]
Definition: vfw.h:291
LRESULT VFWAPI ICGetInfo(HIC hic, ICINFO *picinfo, DWORD cb)
Definition: msvideo_main.c:601
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD fccType
Definition: vfw.h:282
Definition: _list.h:228
static const char * wine_dbgstr_fcc(DWORD fcc)
Definition: msvideo_main.c:57
Definition: vfw.h:280
#define ICMODE_COMPRESS
Definition: vfw.h:268
ICINFO icinfo
Definition: msvideo_main.c:885
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned int UINT
Definition: ndis.h:50
GLenum GLuint id
Definition: glext.h:5579

Referenced by icm_choose_compressor_dlgproc().

◆ enum_drivers()

static BOOL enum_drivers ( DWORD  fccType,
enum_handler_t  handler,
void param 
)
static

Definition at line 237 of file msvideo_main.c.

238 {
239  char fccTypeStr[4];
240  char name_buf[10];
241  char buf[2048];
242 
243  DWORD i, cnt = 0, lRet;
244  BOOL result = FALSE;
245  HKEY hKey;
246 
247  fourcc_to_string(fccTypeStr, fccType);
248 
249  /* first, go through the registry entries */
251  if (lRet == ERROR_SUCCESS)
252  {
253  i = 0;
254  for (;;)
255  {
256  DWORD name_len = 10, driver_len = 128;
257  lRet = RegEnumValueA(hKey, i++, name_buf, &name_len, 0, 0, (BYTE *)buf, &driver_len);
258  if (lRet == ERROR_NO_MORE_ITEMS) break;
259  if (name_len != 9 || name_buf[4] != '.') continue;
260  if (fccType && strncasecmp(name_buf, fccTypeStr, 4)) continue;
261  if ((result = handler(name_buf, buf, cnt++, param))) break;
262  }
263  RegCloseKey( hKey );
264  }
265  if (result) return result;
266 
267  /* if that didn't work, go through the values in system.ini */
268  if (GetPrivateProfileSectionA("drivers32", buf, sizeof(buf), "system.ini"))
269  {
270  char *s;
271  for (s = buf; *s; s += strlen(s) + 1)
272  {
273  if (s[4] != '.' || s[9] != '=') continue;
274  if (fccType && strncasecmp(s, fccTypeStr, 4)) continue;
275  if ((result = handler(s, s + 10, cnt++, param))) break;
276  }
277  }
278 
279  return result;
280 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3331
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned int BOOL
Definition: ntddk_ex.h:94
#define HKLM_DRIVERS32
Definition: msvideo_main.c:45
#define strncasecmp
Definition: fake.h:10
LONG WINAPI RegEnumValueA(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpdwReserved, _Out_opt_ LPDWORD lpdwType, _Out_opt_ LPBYTE lpData, _Inout_opt_ LPDWORD lpcbData)
Definition: reg.c:2691
GLfloat param
Definition: glext.h:5796
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned char BYTE
Definition: mem.h:68
GLdouble s
Definition: gl.h:2039
#define fourcc_to_string(str, fcc)
Definition: msvideo_main.c:50
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7786
GLuint64EXT * result
Definition: glext.h:11304
INT WINAPI GetPrivateProfileSectionA(LPCSTR section, LPSTR buffer, DWORD len, LPCSTR filename)
Definition: profile.c:1381
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by ICInfo(), and ICLocate().

◆ get_size_image()

static DWORD get_size_image ( LONG  width,
LONG  height,
WORD  depth 
)
static

Definition at line 226 of file msvideo_main.c.

227 {
228  DWORD ret = width * depth;
229  ret = (ret + 7) / 8; /* divide by byte size, rounding up */
230  ret = (ret + 3) & ~3; /* align to 4 bytes */
231  ret *= abs(height);
232  return ret;
233 }
#define abs(i)
Definition: fconv.c:206
GLint GLint GLsizei width
Definition: gl.h:1546
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
int ret
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546

Referenced by ICGetDisplayFormat(), and ICImageDecompress().

◆ GetFileNamePreview()

static BOOL GetFileNamePreview ( LPVOID  lpofn,
BOOL  bSave,
BOOL  bUnicode 
)
static

Definition at line 1650 of file msvideo_main.c.

1651 {
1652  CHAR szFunctionName[20];
1653  BOOL (*fnGetFileName)(LPVOID);
1654  HMODULE hComdlg32;
1655  BOOL ret;
1656 
1657  FIXME("(%p,%d,%d), semi-stub!\n",lpofn,bSave,bUnicode);
1658 
1659  lstrcpyA(szFunctionName, (bSave ? "GetSaveFileName" : "GetOpenFileName"));
1660  lstrcatA(szFunctionName, (bUnicode ? "W" : "A"));
1661 
1662  hComdlg32 = LoadLibraryA("COMDLG32.DLL");
1663  if (hComdlg32 == NULL)
1664  return FALSE;
1665 
1666  fnGetFileName = (LPVOID)GetProcAddress(hComdlg32, szFunctionName);
1667  if (fnGetFileName == NULL)
1668  {
1669  FreeLibrary(hComdlg32);
1670  return FALSE;
1671  }
1672 
1673  /* FIXME: need to add OFN_ENABLEHOOK and our own handler */
1674  ret = fnGetFileName(lpofn);
1675 
1676  FreeLibrary(hComdlg32);
1677  return ret;
1678 }
char CHAR
Definition: xmlstorage.h:175
#define BOOL
Definition: nt_native.h:43
unsigned int BOOL
Definition: ntddk_ex.h:94
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define FreeLibrary(x)
Definition: compat.h:405
#define LPVOID
Definition: nt_native.h:45
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
int ret
#define GetProcAddress(x, y)
Definition: compat.h:410

Referenced by GetOpenFileNamePreviewA(), GetOpenFileNamePreviewW(), GetSaveFileNamePreviewA(), and GetSaveFileNamePreviewW().

◆ GetOpenFileNamePreviewA()

BOOL WINAPI GetOpenFileNamePreviewA ( LPOPENFILENAMEA  lpofn)

Definition at line 1683 of file msvideo_main.c.

1684 {
1685  FIXME("(%p), semi-stub!\n", lpofn);
1686 
1687  return GetFileNamePreview(lpofn, FALSE, FALSE);
1688 }
#define FIXME(fmt,...)
Definition: debug.h:110
static BOOL GetFileNamePreview(LPVOID lpofn, BOOL bSave, BOOL bUnicode)

◆ GetOpenFileNamePreviewW()

BOOL WINAPI GetOpenFileNamePreviewW ( LPOPENFILENAMEW  lpofn)

Definition at line 1693 of file msvideo_main.c.

1694 {
1695  FIXME("(%p), semi-stub!\n", lpofn);
1696 
1697  return GetFileNamePreview(lpofn, FALSE, TRUE);
1698 }
#define TRUE
Definition: types.h:120
#define FIXME(fmt,...)
Definition: debug.h:110
static BOOL GetFileNamePreview(LPVOID lpofn, BOOL bSave, BOOL bUnicode)

◆ GetSaveFileNamePreviewA()

BOOL WINAPI GetSaveFileNamePreviewA ( LPOPENFILENAMEA  lpofn)

Definition at line 1703 of file msvideo_main.c.

1704 {
1705  FIXME("(%p), semi-stub!\n", lpofn);
1706 
1707  return GetFileNamePreview(lpofn, TRUE, FALSE);
1708 }
#define TRUE
Definition: types.h:120
#define FIXME(fmt,...)
Definition: debug.h:110
static BOOL GetFileNamePreview(LPVOID lpofn, BOOL bSave, BOOL bUnicode)

◆ GetSaveFileNamePreviewW()

BOOL WINAPI GetSaveFileNamePreviewW ( LPOPENFILENAMEW  lpofn)

Definition at line 1713 of file msvideo_main.c.

1714 {
1715  FIXME("(%p), semi-stub!\n", lpofn);
1716 
1717  return GetFileNamePreview(lpofn, TRUE, TRUE);
1718 }
#define TRUE
Definition: types.h:120
#define FIXME(fmt,...)
Definition: debug.h:110
static BOOL GetFileNamePreview(LPVOID lpofn, BOOL bSave, BOOL bUnicode)

◆ ICClose()

LRESULT WINAPI ICClose ( HIC  hic)

Definition at line 1270 of file msvideo_main.c.

1271 {
1272  WINE_HIC* whic = MSVIDEO_GetHicPtr(hic);
1273  WINE_HIC** p;
1274 
1275  TRACE("(%p)\n",hic);
1276 
1277  if (!whic) return ICERR_BADHANDLE;
1278 
1279  if (whic->driverproc)
1280  {
1281  MSVIDEO_SendMessage(whic, DRV_CLOSE, 0, 0);
1282  MSVIDEO_SendMessage(whic, DRV_DISABLE, 0, 0);
1283  MSVIDEO_SendMessage(whic, DRV_FREE, 0, 0);
1284  }
1285  else
1286  {
1287  CloseDriver(whic->hdrv, 0, 0);
1288  }
1289 
1290  /* remove whic from list */
1291  for (p = &MSVIDEO_FirstHic; *p != NULL; p = &((*p)->next))
1292  {
1293  if ((*p) == whic)
1294  {
1295  *p = whic->next;
1296  break;
1297  }
1298  }
1299 
1300  HeapFree(GetProcessHeap(), 0, whic);
1301  return 0;
1302 }
#define DRV_DISABLE
Definition: mmsystem.h:123
static LRESULT MSVIDEO_SendMessage(WINE_HIC *whic, UINT msg, DWORD_PTR lParam1, DWORD_PTR lParam2)
Definition: msvideo_main.c:136
struct tagWINE_HIC * next
LRESULT WINAPI CloseDriver(HDRVR hDrvr, LPARAM lParam1, LPARAM lParam2)
Definition: driver.c:462
#define DRV_CLOSE
Definition: mmsystem.h:122
DRIVERPROC driverproc
static WINE_HIC * MSVIDEO_FirstHic
Definition: msvideo_main.c:101
smooth NULL
Definition: ftsmooth.c:416
#define ICERR_BADHANDLE
Definition: vfw.h:63
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
#define DRV_FREE
Definition: mmsystem.h:124
GLfloat GLfloat p
Definition: glext.h:8902
static WINE_HIC * MSVIDEO_GetHicPtr(HIC hic)
Definition: msvideo_main.c:287
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by AVIDec_BreakConnect(), AVIFILE_CloseCompressor(), AVISaveOptionsUpdate(), DrawDibBegin(), DrawDibEnd(), enum_compressors(), ICCompressorFree(), ICGetDisplayFormat(), ICImageDecompress(), icm_choose_compressor_dlgproc(), MCIAVI_CleanUp(), register_vfw_codecs(), test_encode(), test_ICGetDisplayFormat(), test_ICSeqCompress(), test_Locate(), test_OpenCase(), test_raw_decompress(), test_vfw(), and try_driver().

◆ ICCompress()

DWORD VFWAPIV ICCompress ( HIC  hic,
DWORD  dwFlags,
LPBITMAPINFOHEADER  lpbiOutput,
LPVOID  lpData,
LPBITMAPINFOHEADER  lpbiInput,
LPVOID  lpBits,
LPDWORD  lpckid,
LPDWORD  lpdwFlags,
LONG  lFrameNum,
DWORD  dwFrameSize,
DWORD  dwQuality,
LPBITMAPINFOHEADER  lpbiPrev,
LPVOID  lpPrev 
)

Definition at line 824 of file msvideo_main.c.

829 {
830  ICCOMPRESS iccmp;
831 
832  TRACE("(%p,%d,%p,%p,%p,%p,...)\n",hic,dwFlags,lpbiOutput,lpData,lpbiInput,lpBits);
833 
834  iccmp.dwFlags = dwFlags;
835 
836  iccmp.lpbiOutput = lpbiOutput;
837  iccmp.lpOutput = lpData;
838  iccmp.lpbiInput = lpbiInput;
839  iccmp.lpInput = lpBits;
840 
841  iccmp.lpckid = lpckid;
842  iccmp.lpdwFlags = lpdwFlags;
843  iccmp.lFrameNum = lFrameNum;
844  iccmp.dwFrameSize = dwFrameSize;
845  iccmp.dwQuality = dwQuality;
846  iccmp.lpbiPrev = lpbiPrev;
847  iccmp.lpPrev = lpPrev;
848  return ICSendMessage(hic,ICM_COMPRESS,(DWORD_PTR)&iccmp,sizeof(iccmp));
849 }
LPBITMAPINFOHEADER lpbiInput
Definition: vfw.h:176
LRESULT VFWAPI ICSendMessage(HIC hic, UINT msg, DWORD_PTR lParam1, DWORD_PTR lParam2)
LPDWORD lpdwFlags
Definition: vfw.h:179
DWORD dwFrameSize
Definition: vfw.h:181
LPBITMAPINFOHEADER lpbiOutput
Definition: vfw.h:174
LPBITMAPINFOHEADER lpbiPrev
Definition: vfw.h:183
#define TRACE(s)
Definition: solgame.cpp:4
#define ICM_COMPRESS
Definition: vfw.h:103
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
uint32_t DWORD_PTR
Definition: typedefs.h:63
LONG lFrameNum
Definition: vfw.h:180
DWORD dwFlags
Definition: vfw.h:173
LPDWORD lpckid
Definition: vfw.h:178
DWORD dwQuality
Definition: vfw.h:182

Referenced by AVIFILE_EncodeFrame(), and test_encode().

◆ ICCompressorChoose()

BOOL VFWAPI ICCompressorChoose ( HWND  hwnd,
UINT  uiFlags,
LPVOID  pvIn,
LPVOID  lpData,
PCOMPVARS  pc,
LPSTR  lpszTitle 
)

Definition at line 1124 of file msvideo_main.c.

1126 {
1127  struct choose_compressor choose_comp;
1128  BOOL ret;
1129 
1130  TRACE("(%p,%08x,%p,%p,%p,%s)\n", hwnd, uiFlags, pvIn, lpData, pc, lpszTitle);
1131 
1132  if (!pc || pc->cbSize != sizeof(COMPVARS))
1133  return FALSE;
1134 
1135  if (!(pc->dwFlags & ICMF_COMPVARS_VALID))
1136  {
1137  pc->dwFlags = 0;
1138  pc->fccType = pc->fccHandler = 0;
1139  pc->hic = NULL;
1140  pc->lpbiIn = NULL;
1141  pc->lpbiOut = NULL;
1142  pc->lpBitsOut = pc->lpBitsPrev = pc->lpState = NULL;
1143  pc->lQ = ICQUALITY_DEFAULT;
1144  pc->lKey = -1;
1145  pc->lDataRate = 300; /* kB */
1146  pc->lpState = NULL;
1147  pc->cbState = 0;
1148  }
1149  if (pc->fccType == 0)
1150  pc->fccType = ICTYPE_VIDEO;
1151 
1152  choose_comp.cv = *pc;
1153  choose_comp.flags = uiFlags;
1154  choose_comp.title = lpszTitle;
1155 
1157  icm_choose_compressor_dlgproc, (LPARAM)&choose_comp);
1158 
1159  if (ret)
1160  {
1161  *pc = choose_comp.cv;
1163  }
1164 
1165  return ret;
1166 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define ICMF_COMPVARS_VALID
Definition: vfw.h:836
HMODULE MSVFW32_hModule
Definition: msvideo_main.c:115
LONG lDataRate
Definition: vfw.h:829
LPBITMAPINFO lpbiIn
Definition: vfw.h:823
LPBITMAPINFO lpbiOut
Definition: vfw.h:824
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ICQUALITY_DEFAULT
Definition: vfw.h:278
smooth NULL
Definition: ftsmooth.c:416
LPVOID lpBitsPrev
Definition: vfw.h:826
LONG_PTR LPARAM
Definition: windef.h:208
DWORD fccType
Definition: vfw.h:821
#define TRACE(s)
Definition: solgame.cpp:4
HIC hic
Definition: vfw.h:820
static INT_PTR CALLBACK icm_choose_compressor_dlgproc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: msvideo_main.c:939
#define ICTYPE_VIDEO
Definition: mmreg.h:531
LONG lQ
Definition: vfw.h:830
LPVOID lpBitsOut
Definition: vfw.h:825
int ret
LONG lKey
Definition: vfw.h:828
DWORD fccHandler
Definition: vfw.h:822
LPVOID lpState
Definition: vfw.h:832
LONG cbSize
Definition: vfw.h:818
LONG cbState
Definition: vfw.h:833
DWORD dwFlags
Definition: vfw.h:819
Definition: vfw.h:817
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define ICM_CHOOSE_COMPRESSOR

Referenced by AVISaveOptionsFmtChoose().

◆ ICCompressorFree()

void VFWAPI ICCompressorFree ( PCOMPVARS  pc)

Definition at line 1172 of file msvideo_main.c.

1173 {
1174  TRACE("(%p)\n",pc);
1175 
1176  if (pc != NULL && pc->cbSize == sizeof(COMPVARS)) {
1177  if (pc->hic != NULL) {
1178  ICClose(pc->hic);
1179  pc->hic = NULL;
1180  }
1181  HeapFree(GetProcessHeap(), 0, pc->lpbiIn);
1182  pc->lpbiIn = NULL;
1183  HeapFree(GetProcessHeap(), 0, pc->lpBitsOut);
1184  pc->lpBitsOut = NULL;
1185  HeapFree(GetProcessHeap(), 0, pc->lpBitsPrev);
1186  pc->lpBitsPrev = NULL;
1187  HeapFree(GetProcessHeap(), 0, pc->lpState);
1188  pc->lpState = NULL;
1189  pc->dwFlags = 0;
1190  }
1191 }
LPBITMAPINFO lpbiIn
Definition: vfw.h:823
LRESULT WINAPI ICClose(HIC hic)
smooth NULL
Definition: ftsmooth.c:416
LPVOID lpBitsPrev
Definition: vfw.h:826
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
HIC hic
Definition: vfw.h:820
LPVOID lpBitsOut
Definition: vfw.h:825
LPVOID lpState
Definition: vfw.h:832
LONG cbSize
Definition: vfw.h:818
DWORD dwFlags
Definition: vfw.h:819
Definition: vfw.h:817
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by AVISaveOptionsFmtChoose(), and test_ICSeqCompress().

◆ ICDecompress()

DWORD VFWAPIV ICDecompress ( HIC  hic,
DWORD  dwFlags,
LPBITMAPINFOHEADER  lpbiFormat,
LPVOID  lpData,
LPBITMAPINFOHEADER  lpbi,
LPVOID  lpBits 
)

Definition at line 854 of file msvideo_main.c.

856 {
857  ICDECOMPRESS icd;
858  DWORD ret;
859 
860  TRACE("(%p,%d,%p,%p,%p,%p)\n",hic,dwFlags,lpbiFormat,lpData,lpbi,lpBits);
861 
862  icd.dwFlags = dwFlags;
863  icd.lpbiInput = lpbiFormat;
864  icd.lpInput = lpData;
865 
866  icd.lpbiOutput = lpbi;
867  icd.lpOutput = lpBits;
868  icd.ckid = 0;
870 
871  return ret;
872 }
LRESULT VFWAPI ICSendMessage(HIC hic, UINT msg, DWORD_PTR lParam1, DWORD_PTR lParam2)
LPBITMAPINFOHEADER lpbiInput
Definition: vfw.h:335
DWORD ckid
Definition: vfw.h:339
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD dwFlags
Definition: vfw.h:334
int ret
#define ICM_DECOMPRESS
Definition: vfw.h:109
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
uint32_t DWORD_PTR
Definition: typedefs.h:63
LPBITMAPINFOHEADER lpbiOutput
Definition: vfw.h:337

Referenced by AVIDec_Receive(), AVIFILE_EncodeFrame(), DrawDibDraw(), ICImageDecompress(), IGetFrame_fnGetFrame(), MCIAVI_PaintFrame(), and test_raw_decompress().

◆ ICDraw()

DWORD VFWAPIV ICDraw ( HIC  hic,
DWORD  dwFlags,
LPVOID  lpFormat,
LPVOID  lpData,
DWORD  cbData,
LONG  lTime 
)

Definition at line 1253 of file msvideo_main.c.

1253  {
1254  ICDRAW icd;
1255 
1256  TRACE("(%p,%d,%p,%p,%d,%d)\n",hic,dwFlags,lpFormat,lpData,cbData,lTime);
1257 
1258  icd.dwFlags = dwFlags;
1259  icd.lpFormat = lpFormat;
1260  icd.lpData = lpData;
1261  icd.cbData = cbData;
1262  icd.lTime = lTime;
1263 
1264  return ICSendMessage(hic,ICM_DRAW,(DWORD_PTR)&icd,sizeof(icd));
1265 }
DWORD cbData
Definition: vfw.h:722
LPVOID lpFormat
Definition: vfw.h:720
LRESULT VFWAPI ICSendMessage(HIC hic, UINT msg, DWORD_PTR lParam1, DWORD_PTR lParam2)
LONG lTime
Definition: vfw.h:723
Definition: vfw.h:718
#define TRACE(s)
Definition: solgame.cpp:4
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
LPCWSTR lpFormat
Definition: trayclock.cpp:32
uint32_t DWORD_PTR
Definition: typedefs.h:63
DWORD dwFlags
Definition: vfw.h:719
#define ICM_DRAW
Definition: vfw.h:121
LPVOID lpData
Definition: vfw.h:721

◆ ICDrawBegin()

DWORD VFWAPIV ICDrawBegin ( HIC  hic,
DWORD  dwFlags,
HPALETTE  hpal,
HWND  hwnd,
HDC  hdc,
INT  xDst,
INT  yDst,
INT  dxDst,
INT  dyDst,
LPBITMAPINFOHEADER  lpbi,
INT  xSrc,
INT  ySrc,
INT  dxSrc,
INT  dySrc,
DWORD  dwRate,
DWORD  dwScale 
)

Definition at line 1207 of file msvideo_main.c.

1224 {
1225 
1226  ICDRAWBEGIN icdb;
1227 
1228  TRACE("(%p,%d,%p,%p,%p,%u,%u,%u,%u,%p,%u,%u,%u,%u,%d,%d)\n",
1229  hic, dwFlags, hpal, hwnd, hdc, xDst, yDst, dxDst, dyDst,
1230  lpbi, xSrc, ySrc, dxSrc, dySrc, dwRate, dwScale);
1231 
1232  icdb.dwFlags = dwFlags;
1233  icdb.hpal = hpal;
1234  icdb.hwnd = hwnd;
1235  icdb.hdc = hdc;
1236  icdb.xDst = xDst;
1237  icdb.yDst = yDst;
1238  icdb.dxDst = dxDst;
1239  icdb.dyDst = dyDst;
1240  icdb.lpbi = lpbi;
1241  icdb.xSrc = xSrc;
1242  icdb.ySrc = ySrc;
1243  icdb.dxSrc = dxSrc;
1244  icdb.dySrc = dySrc;
1245  icdb.dwRate = dwRate;
1246  icdb.dwScale = dwScale;
1247  return ICSendMessage(hic,ICM_DRAW_BEGIN,(DWORD_PTR)&icdb,sizeof(icdb));
1248 }
INT yDst
Definition: vfw.h:700
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LPBITMAPINFOHEADER lpbi
Definition: vfw.h:703
LRESULT VFWAPI ICSendMessage(HIC hic, UINT msg, DWORD_PTR lParam1, DWORD_PTR lParam2)
HWND hwnd
Definition: vfw.h:697
DWORD dwRate
Definition: vfw.h:708
INT dxDst
Definition: vfw.h:701
HDC hdc
Definition: vfw.h:698
INT xSrc
Definition: vfw.h:704
INT dyDst
Definition: vfw.h:702
#define ICM_DRAW_BEGIN
Definition: vfw.h:115
INT dxSrc
Definition: vfw.h:706
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwFlags
Definition: vfw.h:695
INT ySrc
Definition: vfw.h:705
HDC hdc
Definition: main.c:9
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
DWORD dwScale
Definition: vfw.h:709
uint32_t DWORD_PTR
Definition: typedefs.h:63
HPALETTE hpal
Definition: vfw.h:696
INT dySrc
Definition: vfw.h:707
INT xDst
Definition: vfw.h:699

◆ ICGetDisplayFormat()

HIC VFWAPI ICGetDisplayFormat ( HIC  hic,
BITMAPINFOHEADER in,
BITMAPINFOHEADER out,
int  depth,
int  width,
int  height 
)

Definition at line 726 of file msvideo_main.c.

728 {
729  HIC tmphic = hic;
730 
731  TRACE("(%p, %p, %p, %d, %d, %d)\n", hic, in, out, depth, width, height);
732 
733  if (!tmphic)
734  {
736  if (!tmphic)
737  return NULL;
738  }
739 
740  if (ICDecompressQuery(tmphic, in, NULL))
741  goto err;
742 
743  if (width <= 0 || height <= 0)
744  {
745  width = in->biWidth;
746  height = in->biHeight;
747  }
748 
749  if (!depth)
750  depth = 32;
751 
752  *out = *in;
753  out->biSize = sizeof(*out);
754  out->biWidth = width;
755  out->biHeight = height;
756  out->biCompression = BI_RGB;
757  out->biSizeImage = get_size_image(width, height, depth);
758 
759  /* first try the given depth */
760  out->biBitCount = depth;
761  out->biSizeImage = get_size_image(width, height, out->biBitCount);
762  if (!ICDecompressQuery(tmphic, in, out))
763  {
764  if (depth == 8)
765  ICDecompressGetPalette(tmphic, in, out);
766  return tmphic;
767  }
768 
769  /* then try 16, both with BI_RGB and BI_BITFIELDS */
770  if (depth <= 16)
771  {
772  out->biBitCount = 16;
773  out->biSizeImage = get_size_image(width, height, out->biBitCount);
774  if (!ICDecompressQuery(tmphic, in, out))
775  return tmphic;
776 
777  out->biCompression = BI_BITFIELDS;
778  if (!ICDecompressQuery(tmphic, in, out))
779  return tmphic;
780  out->biCompression = BI_RGB;
781  }
782 
783  /* then try 24 */
784  if (depth <= 24)
785  {
786  out->biBitCount = 24;
787  out->biSizeImage = get_size_image(width, height, out->biBitCount);
788  if (!ICDecompressQuery(tmphic, in, out))
789  return tmphic;
790  }
791 
792  /* then try 32 */
793  if (depth <= 32)
794  {
795  out->biBitCount = 32;
796  out->biSizeImage = get_size_image(width, height, out->biBitCount);
797  if (!ICDecompressQuery(tmphic, in, out))
798  return tmphic;
799  }
800 
801  /* as a last resort, try 32 bpp with the original width and height */
802  out->biWidth = in->biWidth;
803  out->biHeight = in->biHeight;
804  out->biBitCount = 32;
805  out->biSizeImage = get_size_image(out->biWidth, out->biHeight, out->biBitCount);
806  if (!ICDecompressQuery(tmphic, in, out))
807  return tmphic;
808 
809  /* finally, ask the compressor for its default output format */
811  return tmphic;
812 
813 err:
814  if (hic != tmphic)
815  ICClose(tmphic);
816 
817  return NULL;
818 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define ICDecompressQuery(hic, lpbiInput, lpbiOutput)
Definition: vfw.h:377
LRESULT VFWAPI ICSendMessage(HIC hic, UINT msg, DWORD_PTR lParam1, DWORD_PTR lParam2)
#define BI_BITFIELDS
Definition: mmreg.h:507
LRESULT WINAPI ICClose(HIC hic)
smooth NULL
Definition: ftsmooth.c:416
HIC VFWAPI ICLocate(DWORD fccType, DWORD fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, WORD wMode)
Definition: msvideo_main.c:671
#define TRACE(s)
Definition: solgame.cpp:4
#define ICMODE_DECOMPRESS
Definition: vfw.h:269
#define ICDecompressGetPalette(hic, lpbiInput, lpbiOutput)
Definition: vfw.h:392
#define ICM_DECOMPRESS_GET_FORMAT
Definition: vfw.h:106
#define ICTYPE_VIDEO
Definition: mmreg.h:531
static FILE * out
Definition: regtests2xml.c:44
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
#define err(...)
uint32_t DWORD_PTR
Definition: typedefs.h:63
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLuint in
Definition: glext.h:9616
#define BI_RGB
Definition: precomp.h:34
static DWORD get_size_image(LONG width, LONG height, WORD depth)
Definition: msvideo_main.c:226

Referenced by IGetFrame_fnSetFormat(), MCIAVI_OpenVideo(), and test_ICGetDisplayFormat().

◆ ICGetInfo()

LRESULT VFWAPI ICGetInfo ( HIC  hic,
ICINFO picinfo,
DWORD  cb 
)

Definition at line 601 of file msvideo_main.c.

602 {
603  LRESULT ret;
604  WINE_HIC* whic = MSVIDEO_GetHicPtr(hic);
605 
606  TRACE("(%p,%p,%d)\n", hic, picinfo, cb);
607 
608  if (!whic) return ICERR_BADHANDLE;
609  if (!picinfo) return MMSYSERR_INVALPARAM;
610 
611  /* (WS) The field szDriver should be initialized because the driver
612  * is not obliged and often will not do it. Some applications, like
613  * VirtualDub, rely on this field and will occasionally crash if it
614  * goes uninitialized.
615  */
616  if (cb >= sizeof(ICINFO)) picinfo->szDriver[0] = '\0';
617 
618  ret = ICSendMessage(hic, ICM_GETINFO, (DWORD_PTR)picinfo, cb);
619 
620  /* (WS) When szDriver was not supplied by the driver itself, apparently
621  * Windows will set its value equal to the driver file name. This can
622  * be obtained from the registry as we do here.
623  */
624  if (cb >= sizeof(ICINFO) && picinfo->szDriver[0] == 0)
625  {
626  ICINFO ii;
627 
628  memset(&ii, 0, sizeof(ii));
629  ii.dwSize = sizeof(ii);
630  ICInfo(picinfo->fccType, picinfo->fccHandler, &ii);
631  lstrcpyW(picinfo->szDriver, ii.szDriver);
632  }
633 
634  return ret;
635 }
DWORD dwSize
Definition: vfw.h:281
LRESULT VFWAPI ICSendMessage(HIC hic, UINT msg, DWORD_PTR lParam1, DWORD_PTR lParam2)
BOOL VFWAPI ICInfo(DWORD fccType, DWORD fccHandler, ICINFO *lpicinfo)
Definition: msvideo_main.c:337
#define ICM_GETINFO
Definition: vfw.h:82
WCHAR szDriver[128]
Definition: vfw.h:292
DWORD fccHandler
Definition: vfw.h:283
#define ICERR_BADHANDLE
Definition: vfw.h:63
#define TRACE(s)
Definition: solgame.cpp:4
DWORD fccType
Definition: vfw.h:282
static DWORD cb
Definition: integrity.c:41
int ret
uint32_t DWORD_PTR
Definition: typedefs.h:63
Definition: vfw.h:280
#define lstrcpyW
Definition: compat.h:406
#define MMSYSERR_INVALPARAM
Definition: mmsystem.h:107
LONG_PTR LRESULT
Definition: windef.h:209
#define memset(x, y, z)
Definition: compat.h:39
static WINE_HIC * MSVIDEO_GetHicPtr(HIC hic)
Definition: msvideo_main.c:287

Referenced by AVISaveOptionsUpdate(), enum_compressors(), ICMStream_fnCreate(), register_vfw_codecs(), test_encode(), test_OpenCase(), test_raw_decompress(), and test_vfw().

◆ ICImageCompress()

HANDLE VFWAPI ICImageCompress ( HIC  hic,
UINT  uiFlags,
LPBITMAPINFO  lpbiIn,
LPVOID  lpBits,
LPBITMAPINFO  lpbiOut,
LONG  lQuality,
LONG plSize 
)

Definition at line 1309 of file msvideo_main.c.

1314 {
1315  FIXME("(%p,%08x,%p,%p,%p,%d,%p)\n",
1316  hic, uiFlags, lpbiIn, lpBits, lpbiOut, lQuality, plSize);
1317 
1318  return NULL;
1319 }
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416

◆ ICImageDecompress()

HANDLE VFWAPI ICImageDecompress ( HIC  hic,
UINT  uiFlags,
LPBITMAPINFO  lpbiIn,
LPVOID  lpBits,
LPBITMAPINFO  lpbiOut 
)

Definition at line 1325 of file msvideo_main.c.

1328 {
1329  HGLOBAL hMem = NULL;
1330  BYTE* pMem = NULL;
1331  BOOL bReleaseIC = FALSE;
1332  BYTE* pHdr = NULL;
1333  ULONG cbHdr = 0;
1334  BOOL bSucceeded = FALSE;
1335  BOOL bInDecompress = FALSE;
1336  DWORD biSizeImage;
1337 
1338  TRACE("(%p,%08x,%p,%p,%p)\n",
1339  hic, uiFlags, lpbiIn, lpBits, lpbiOut);
1340 
1341  if ( hic == NULL )
1342  {
1343  hic = ICDecompressOpen( ICTYPE_VIDEO, 0, &lpbiIn->bmiHeader, (lpbiOut != NULL) ? &lpbiOut->bmiHeader : NULL );
1344  if ( hic == NULL )
1345  {
1346  WARN("no handler\n" );
1347  goto err;
1348  }
1349  bReleaseIC = TRUE;
1350  }
1351  if ( uiFlags != 0 )
1352  {
1353  FIXME( "unknown flag %08x\n", uiFlags );
1354  goto err;
1355  }
1356  if ( lpbiIn == NULL || lpBits == NULL )
1357  {
1358  WARN("invalid argument\n");
1359  goto err;
1360  }
1361 
1362  if ( lpbiOut != NULL )
1363  {
1364  if ( lpbiOut->bmiHeader.biSize != sizeof(BITMAPINFOHEADER) )
1365  goto err;
1366  cbHdr = sizeof(BITMAPINFOHEADER);
1367  if ( lpbiOut->bmiHeader.biCompression == 3 )
1368  cbHdr += sizeof(DWORD)*3;
1369  else
1370  if ( lpbiOut->bmiHeader.biBitCount <= 8 )
1371  {
1372  if ( lpbiOut->bmiHeader.biClrUsed == 0 )
1373  cbHdr += sizeof(RGBQUAD) * (1<<lpbiOut->bmiHeader.biBitCount);
1374  else
1375  cbHdr += sizeof(RGBQUAD) * lpbiOut->bmiHeader.biClrUsed;
1376  }
1377  }
1378  else
1379  {
1380  TRACE( "get format\n" );
1381 
1382  cbHdr = ICDecompressGetFormatSize(hic,lpbiIn);
1383  if ( cbHdr < sizeof(BITMAPINFOHEADER) )
1384  goto err;
1385  pHdr = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,cbHdr+sizeof(RGBQUAD)*256);
1386  if ( pHdr == NULL )
1387  goto err;
1388  if ( ICDecompressGetFormat( hic, lpbiIn, pHdr ) != ICERR_OK )
1389  goto err;
1390  lpbiOut = (BITMAPINFO*)pHdr;
1391  if ( lpbiOut->bmiHeader.biBitCount <= 8 &&
1392  ICDecompressGetPalette( hic, lpbiIn, lpbiOut ) != ICERR_OK &&
1393  lpbiIn->bmiHeader.biBitCount == lpbiOut->bmiHeader.biBitCount )
1394  {
1395  if ( lpbiIn->bmiHeader.biClrUsed == 0 )
1396  memcpy( lpbiOut->bmiColors, lpbiIn->bmiColors, sizeof(RGBQUAD)*(1<<lpbiOut->bmiHeader.biBitCount) );
1397  else
1398  memcpy( lpbiOut->bmiColors, lpbiIn->bmiColors, sizeof(RGBQUAD)*lpbiIn->bmiHeader.biClrUsed );
1399  }
1400  if ( lpbiOut->bmiHeader.biBitCount <= 8 &&
1401  lpbiOut->bmiHeader.biClrUsed == 0 )
1402  lpbiOut->bmiHeader.biClrUsed = 1<<lpbiOut->bmiHeader.biBitCount;
1403 
1404  lpbiOut->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
1405  cbHdr = sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*lpbiOut->bmiHeader.biClrUsed;
1406  }
1407 
1408  biSizeImage = lpbiOut->bmiHeader.biSizeImage;
1409  if ( biSizeImage == 0 )
1410  biSizeImage = get_size_image(lpbiOut->bmiHeader.biWidth, lpbiOut->bmiHeader.biHeight, lpbiOut->bmiHeader.biBitCount);
1411 
1412  TRACE( "call ICDecompressBegin\n" );
1413 
1414  if ( ICDecompressBegin( hic, lpbiIn, lpbiOut ) != ICERR_OK )
1415  goto err;
1416  bInDecompress = TRUE;
1417 
1418  TRACE( "cbHdr %d, biSizeImage %d\n", cbHdr, biSizeImage );
1419 
1420  hMem = GlobalAlloc( GMEM_MOVEABLE|GMEM_ZEROINIT, cbHdr + biSizeImage );
1421  if ( hMem == NULL )
1422  {
1423  WARN( "out of memory\n" );
1424  goto err;
1425  }
1426  pMem = GlobalLock( hMem );
1427  if ( pMem == NULL )
1428  goto err;
1429  memcpy( pMem, lpbiOut, cbHdr );
1430 
1431  TRACE( "call ICDecompress\n" );
1432  if ( ICDecompress( hic, 0, &lpbiIn->bmiHeader, lpBits, &lpbiOut->bmiHeader, pMem+cbHdr ) != ICERR_OK )
1433  goto err;
1434 
1435  bSucceeded = TRUE;
1436 err:
1437  if ( bInDecompress )
1438  ICDecompressEnd( hic );
1439  if ( bReleaseIC )
1440  ICClose(hic);
1441  HeapFree(GetProcessHeap(),0,pHdr);
1442  if ( pMem != NULL )
1443  GlobalUnlock( hMem );
1444  if ( !bSucceeded && hMem != NULL )
1445  {
1446  GlobalFree(hMem); hMem = NULL;
1447  }
1448 
1449  return hMem;
1450 }
#define ICDecompressEnd(hic)
Definition: vfw.h:404
#define TRUE
Definition: types.h:120
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1471
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
#define WARN(fmt,...)
Definition: debug.h:111
#define ICERR_OK
Definition: vfw.h:50
#define ICDecompressGetFormat(hic, lpbiInput, lpbiOutput)
Definition: vfw.h:383
#define DWORD
Definition: nt_native.h:44
DWORD VFWAPIV ICDecompress(HIC hic, DWORD dwFlags, LPBITMAPINFOHEADER lpbiFormat, LPVOID lpData, LPBITMAPINFOHEADER lpbi, LPVOID lpBits)
Definition: msvideo_main.c:854
unsigned int BOOL
Definition: ntddk_ex.h:94
LRESULT WINAPI ICClose(HIC hic)
#define FIXME(fmt,...)
Definition: debug.h:110
DWORD biCompression
Definition: amvideo.idl:35
smooth NULL
Definition: ftsmooth.c:416
struct tagRGBQUAD RGBQUAD
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define ICDecompressOpen(fccType, fccHandler, lpbiIn, lpbiOut)
Definition: vfw.h:535
RGBQUAD bmiColors[1]
Definition: wingdi.h:1472
#define ICDecompressGetPalette(hic, lpbiInput, lpbiOutput)
Definition: vfw.h:392
#define ICTYPE_VIDEO
Definition: mmreg.h:531
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD biSizeImage
Definition: amvideo.idl:36
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define ICDecompressGetFormatSize(hic, lpbi)
Definition: vfw.h:389
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
#define err(...)
#define ICDecompressBegin(hic, lpbiInput, lpbiOutput)
Definition: vfw.h:371
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:394
#define GMEM_MOVEABLE
Definition: winbase.h:291
#define GMEM_ZEROINIT
Definition: winbase.h:303
static DWORD get_size_image(LONG width, LONG height, WORD depth)
Definition: msvideo_main.c:226

◆ ICInfo()

BOOL VFWAPI ICInfo ( DWORD  fccType,
DWORD  fccHandler,
ICINFO lpicinfo 
)

Definition at line 337 of file msvideo_main.c.

338 {
339  TRACE("(%s,%s,%p)\n",
340  wine_dbgstr_fcc(fccType), wine_dbgstr_fcc(fccHandler), lpicinfo);
341 
342  lpicinfo->fccType = fccType;
343  lpicinfo->fccHandler = fccHandler;
344  return enum_drivers(fccType, ICInfo_enum_handler, lpicinfo);
345 }
static BOOL ICInfo_enum_handler(const char *name, const char *driver, unsigned int nr, void *param)
Definition: msvideo_main.c:306
DWORD fccHandler
Definition: vfw.h:283
#define TRACE(s)
Definition: solgame.cpp:4
static BOOL enum_drivers(DWORD fccType, enum_handler_t handler, void *param)
Definition: msvideo_main.c:237
DWORD fccType
Definition: vfw.h:282
static const char * wine_dbgstr_fcc(DWORD fcc)
Definition: msvideo_main.c:57

Referenced by enum_compressors(), ICGetInfo(), ICOpen(), register_vfw_codecs(), test_ICInfo(), and test_vfw().

◆ ICInfo_enum_handler()

static BOOL ICInfo_enum_handler ( const char name,
const char driver,
unsigned int  nr,
void param 
)
static

Definition at line 306 of file msvideo_main.c.

307 {
308  ICINFO *lpicinfo = param;
309  DWORD fccType = mmioStringToFOURCCA(name, 0);
310  DWORD fccHandler = mmioStringToFOURCCA(name + 5, 0);
311 
312  if (lpicinfo->fccHandler != nr && compare_fourcc(lpicinfo->fccHandler, fccHandler))
313  return FALSE;
314 
315  lpicinfo->fccType = fccType;
316  lpicinfo->fccHandler = fccHandler;
317  lpicinfo->dwFlags = 0;
318  lpicinfo->dwVersion = 0;
319  lpicinfo->dwVersionICM = ICVERSION;
320  lpicinfo->szName[0] = 0;
321  lpicinfo->szDescription[0] = 0;
322  MultiByteToWideChar(CP_ACP, 0, driver, -1, lpicinfo->szDriver, ARRAY_SIZE(lpicinfo->szDriver));
323 
324  return TRUE;
325 }
DWORD dwVersion
Definition: vfw.h:285
#define TRUE
Definition: types.h:120
#define ICVERSION
Definition: vfw.h:45
DWORD dwFlags
Definition: vfw.h:284
ULONG nr
Definition: thread.c:7
#define CP_ACP
Definition: compat.h:99
WCHAR szDriver[128]
Definition: vfw.h:292
DWORD fccHandler
Definition: vfw.h:283
struct @1605::@1606 driver
WCHAR szDescription[128]
Definition: vfw.h:291
FOURCC WINAPI mmioStringToFOURCCA(LPCSTR sz, UINT uFlags)
Definition: mmio.c:1024
GLfloat param
Definition: glext.h:5796
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD fccType
Definition: vfw.h:282
WCHAR szName[16]
Definition: vfw.h:290
Definition: vfw.h:280
#define ARRAY_SIZE(a)
Definition: main.h:24
#define MultiByteToWideChar
Definition: compat.h:100
Definition: name.c:36
static int compare_fourcc(DWORD fcc1, DWORD fcc2)
Definition: msvideo_main.c:217
DWORD dwVersionICM
Definition: vfw.h:286

Referenced by ICInfo().

◆ ICInstall()

BOOL VFWAPI ICInstall ( DWORD  fccType,
DWORD  fccHandler,
LPARAM  lParam,
LPSTR  szDesc,
UINT  wFlags 
)

Definition at line 352 of file msvideo_main.c.

353 {
355  unsigned len;
356 
357  TRACE("(%s,%s,%p,%p,0x%08x)\n", wine_dbgstr_fcc(fccType), wine_dbgstr_fcc(fccHandler), (void*)lParam, szDesc, wFlags);
358 
359  /* Check if a driver is already registered */
360  for (driver = reg_driver_list; driver; driver = driver->next)
361  {
362  if (!compare_fourcc(fccType, driver->fccType) &&
363  !compare_fourcc(fccHandler, driver->fccHandler))
364  break;
365  }
366  if (driver) return FALSE;
367 
368  /* Register the driver */
370  if (!driver) goto oom;
371  driver->fccType = fccType;
372  driver->fccHandler = fccHandler;
373 
374  switch(wFlags)
375  {
376  case ICINSTALL_FUNCTION:
377  driver->proc = (DRIVERPROC)lParam;
378  driver->name = NULL;
379  break;
380  case ICINSTALL_DRIVER:
381  driver->proc = NULL;
382  len = MultiByteToWideChar(CP_ACP, 0, (char*)lParam, -1, NULL, 0);
383  driver->name = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
384  if (!driver->name) goto oom;
385  MultiByteToWideChar(CP_ACP, 0, (char*)lParam, -1, driver->name, len);
386  break;
387  default:
388  ERR("Invalid flags!\n");
390  return FALSE;
391  }
392 
393  /* Insert our driver in the list*/
394  driver->next = reg_driver_list;
396 
397  return TRUE;
398 oom:
400  return FALSE;
401 }
LRESULT(CALLBACK * DRIVERPROC)(DWORD_PTR, HDRVR, UINT, LPARAM, LPARAM)
Definition: mmsystem.h:1001
#define TRUE
Definition: types.h:120
#define CP_ACP
Definition: compat.h:99
static reg_driver * reg_driver_list
Definition: msvideo_main.c:113
struct @1605::@1606 driver
smooth NULL
Definition: ftsmooth.c:416
#define ICINSTALL_FUNCTION
Definition: vfw.h:625
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ICINSTALL_DRIVER
Definition: vfw.h:626
GLenum GLsizei len
Definition: glext.h:6722
static const char * wine_dbgstr_fcc(DWORD fcc)
Definition: msvideo_main.c:57
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:519
#define ERR(fmt,...)
Definition: debug.h:109
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define MultiByteToWideChar
Definition: compat.h:100
static int compare_fourcc(DWORD fcc1, DWORD fcc2)
Definition: msvideo_main.c:217
LPARAM lParam
Definition: combotst.c:139
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by test_ICGetDisplayFormat().

◆ ICLocate()

HIC VFWAPI ICLocate ( DWORD  fccType,
DWORD  fccHandler,
LPBITMAPINFOHEADER  lpbiIn,
LPBITMAPINFOHEADER  lpbiOut,
WORD  wMode 
)

Definition at line 671 of file msvideo_main.c.

673 {
675 
676  TRACE("(%s,%s,%p,%p,0x%04x)\n",
677  wine_dbgstr_fcc(fccType), wine_dbgstr_fcc(fccHandler), lpbiIn, lpbiOut, wMode);
678 
679  info.fccType = fccType;
680  info.fccHandler = fccHandler;
681  info.lpbiIn = lpbiIn;
682  info.lpbiOut = lpbiOut;
683  info.wMode = wMode;
684 
685  switch (wMode)
686  {
687  case ICMODE_FASTCOMPRESS:
688  case ICMODE_COMPRESS:
689  info.querymsg = ICM_COMPRESS_QUERY;
690  break;
692  case ICMODE_DECOMPRESS:
693  info.querymsg = ICM_DECOMPRESS_QUERY;
694  break;
695  case ICMODE_DRAW:
696  info.querymsg = ICM_DRAW_QUERY;
697  break;
698  default:
699  WARN("Unknown mode (%d)\n", wMode);
700  return 0;
701  }
702 
703  /* Easy case: handler/type match, we just fire a query and return */
704  info.hic = try_driver(&info);
705  /* If it didn't work, try each driver in turn. 32 bit codecs only. */
706  /* FIXME: Move this to an init routine? */
707  if (!info.hic) enum_drivers(fccType, ICLocate_enum_handler, &info);
708 
709  if (info.hic)
710  {
711  TRACE("=> %p\n", info.hic);
712  return info.hic;
713  }
714 
715  if (fccType == streamtypeVIDEO)
716  return ICLocate(ICTYPE_VIDEO, fccHandler, lpbiIn, lpbiOut, wMode);
717 
718  ERR("Required media codec '%s %s' not found!\n",
719  wine_dbgstr_fcc(fccType), wine_dbgstr_fcc(fccHandler));
720  return 0;
721 }
#define WARN(fmt,...)
Definition: debug.h:111
#define ICM_COMPRESS_QUERY
Definition: vfw.h:101
#define ICMODE_FASTDECOMPRESS
Definition: vfw.h:270
struct _test_info info[]
Definition: SetCursorPos.c:19
#define ICM_DECOMPRESS_QUERY
Definition: vfw.h:107
#define ICM_DRAW_QUERY
Definition: vfw.h:114
HIC VFWAPI ICLocate(DWORD fccType, DWORD fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, WORD wMode)
Definition: msvideo_main.c:671
#define TRACE(s)
Definition: solgame.cpp:4
#define ICMODE_DRAW
Definition: vfw.h:273
#define ICMODE_DECOMPRESS
Definition: vfw.h:269
#define ICTYPE_VIDEO
Definition: mmreg.h:531
static BOOL enum_drivers(DWORD fccType, enum_handler_t handler, void *param)
Definition: msvideo_main.c:237
#define ICMODE_FASTCOMPRESS
Definition: vfw.h:272
static HIC try_driver(driver_info_t *info)
Definition: msvideo_main.c:647
static BOOL ICLocate_enum_handler(const char *name, const char *driver, unsigned int nr, void *param)
Definition: msvideo_main.c:660
static const char * wine_dbgstr_fcc(DWORD fcc)
Definition: msvideo_main.c:57
#define streamtypeVIDEO
Definition: aviriff.h:92
#define ERR(fmt,...)
Definition: debug.h:109
#define ICMODE_COMPRESS
Definition: vfw.h:268

Referenced by AVIDec_SetMediaType(), AVISaveOptionsUpdate(), ICGetDisplayFormat(), IGetFrame_fnSetFormat(), MCIAVI_OpenVideo(), test_Locate(), and test_raw_decompress().

◆ ICLocate_enum_handler()

static BOOL ICLocate_enum_handler ( const char name,
const char driver,
unsigned int  nr,
void param 
)
static

Definition at line 660 of file msvideo_main.c.

661 {
663  info->fccHandler = mmioStringToFOURCCA(name + 5, 0);
664  info->hic = try_driver(info);
665  return info->hic != 0;
666 }
FOURCC WINAPI mmioStringToFOURCCA(LPCSTR sz, UINT uFlags)
Definition: mmio.c:1024
GLfloat param
Definition: glext.h:5796
static HIC try_driver(driver_info_t *info)
Definition: msvideo_main.c:647
Definition: name.c:36

Referenced by ICLocate().

◆ icm_choose_compressor_dlgproc()

static INT_PTR CALLBACK icm_choose_compressor_dlgproc ( HWND  hdlg,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 939 of file msvideo_main.c.

940 {
941  switch (msg)
942  {
943  case WM_INITDIALOG:
944  {
945  struct codec_info *ic;
946  WCHAR buf[128];
947  struct choose_compressor *choose_comp = (struct choose_compressor *)lparam;
948 
950 
951  /* FIXME */
952  choose_comp->flags &= ~(ICMF_CHOOSE_DATARATE | ICMF_CHOOSE_KEYFRAME);
953 
954  if (choose_comp->title)
955  SetWindowTextA(hdlg, choose_comp->title);
956 
957  if (!(choose_comp->flags & ICMF_CHOOSE_DATARATE))
958  {
962  }
963 
964  if (!(choose_comp->flags & ICMF_CHOOSE_KEYFRAME))
965  {
969  }
970 
971  /* FIXME */
974 
975  /*if (!(choose_comp->flags & ICMF_CHOOSE_PREVIEW))
976  ShowWindow(GetDlgItem(hdlg, IDC_PREVIEW), SW_HIDE);*/
977 
980 
981  ic = HeapAlloc(GetProcessHeap(), 0, sizeof(struct codec_info));
984  ic->hic = 0;
986 
987  enum_compressors(GetDlgItem(hdlg, IDC_COMP_LIST), &choose_comp->cv, choose_comp->flags & ICMF_CHOOSE_ALLCOMPRESSORS);
988 
991 
992  SetWindowLongPtrW(hdlg, DWLP_USER, (ULONG_PTR)choose_comp);
993  break;
994  }
995 
996  case WM_COMMAND:
997  switch (LOWORD(wparam))
998  {
999  case IDC_COMP_LIST:
1000  {
1001  INT cur_sel;
1002  struct codec_info *ic;
1003  BOOL can_configure = FALSE, can_about = FALSE;
1004  struct choose_compressor *choose_comp;
1005 
1007  break;
1008 
1009  choose_comp = (struct choose_compressor *)GetWindowLongPtrW(hdlg, DWLP_USER);
1010 
1011  cur_sel = SendMessageW((HWND)lparam, CB_GETCURSEL, 0, 0);
1012 
1013  ic = (struct codec_info *)SendMessageW((HWND)lparam, CB_GETITEMDATA, cur_sel, 0);
1014  if (ic && ic->hic)
1015  {
1016  if (ICQueryConfigure(ic->hic) == DRVCNF_OK)
1017  can_configure = TRUE;
1018  if (ICQueryAbout(ic->hic) == DRVCNF_OK)
1019  can_about = TRUE;
1020  }
1021  EnableWindow(GetDlgItem(hdlg, IDC_CONFIGURE), can_configure);
1022  EnableWindow(GetDlgItem(hdlg, IDC_ABOUT), can_about);
1023 
1024  if (choose_comp->flags & ICMF_CHOOSE_DATARATE)
1025  {
1026  /* FIXME */
1027  }
1028  if (choose_comp->flags & ICMF_CHOOSE_KEYFRAME)
1029  {
1030  /* FIXME */
1031  }
1032 
1033  break;
1034  }
1035 
1036  case IDC_CONFIGURE:
1037  case IDC_ABOUT:
1038  {
1039  HWND list = GetDlgItem(hdlg, IDC_COMP_LIST);
1040  INT cur_sel;
1041  struct codec_info *ic;
1042 
1043  if (HIWORD(wparam) != BN_CLICKED)
1044  break;
1045 
1046  cur_sel = SendMessageW(list, CB_GETCURSEL, 0, 0);
1047 
1048  ic = (struct codec_info *)SendMessageW(list, CB_GETITEMDATA, cur_sel, 0);
1049  if (ic && ic->hic)
1050  {
1051  if (LOWORD(wparam) == IDC_CONFIGURE)
1052  ICConfigure(ic->hic, hdlg);
1053  else
1054  ICAbout(ic->hic, hdlg);
1055  }
1056 
1057  break;
1058  }
1059 
1060  case IDOK:
1061  {
1062  HWND list = GetDlgItem(hdlg, IDC_COMP_LIST);
1063  INT cur_sel;
1064  struct codec_info *ic;
1065 
1066  if (HIWORD(wparam) != BN_CLICKED)
1067  break;
1068 
1069  cur_sel = SendMessageW(list, CB_GETCURSEL, 0, 0);
1070  ic = (struct codec_info *)SendMessageW(list, CB_GETITEMDATA, cur_sel, 0);
1071  if (ic)
1072  {
1073  struct choose_compressor *choose_comp = (struct choose_compressor *)GetWindowLongPtrW(hdlg, DWLP_USER);
1074 
1075  choose_comp->cv.hic = ic->hic;
1076  choose_comp->cv.fccType = ic->icinfo.fccType;
1077  choose_comp->cv.fccHandler = ic->icinfo.fccHandler;
1078  /* FIXME: fill everything else */
1079 
1080  /* prevent closing the codec handle below */
1081  ic->hic = 0;
1082  }
1083  }
1084  /* fall through */
1085  case IDCANCEL:
1086  {
1087  HWND list = GetDlgItem(hdlg, IDC_COMP_LIST);
1088  INT idx = 0;
1089 
1090  if (HIWORD(wparam) != BN_CLICKED)
1091  break;
1092 
1093  while (1)
1094  {
1095  struct codec_info *ic;
1096 
1097  ic = (struct codec_info *)SendMessageW(list, CB_GETITEMDATA, idx++, 0);
1098 
1099  if (!ic || (LONG_PTR)ic == CB_ERR) break;
1100 
1101  if (ic->hic) ICClose(ic->hic);
1102  HeapFree(GetProcessHeap(), 0, ic);
1103  }
1104 
1105  EndDialog(hdlg, LOWORD(wparam) == IDOK);
1106  break;
1107  }
1108 
1109  default:
1110  break;
1111  }
1112  break;
1113 
1114  default:
1115  break;
1116  }
1117 
1118  return FALSE;
1119 }
#define CBN_SETFOCUS
Definition: winuser.h:1964
#define ICMF_CHOOSE_ALLCOMPRESSORS
Definition: vfw.h:851
#define CB_SETITEMDATA
Definition: winuser.h:1948
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define SW_HIDE
Definition: winuser.h:762
#define CB_GETITEMDATA
Definition: winuser.h:1932
#define IDC_KEYFRAME
HWND WINAPI SetFocus(_In_opt_ HWND)
#define GetWindowLongPtrW
Definition: winuser.h:4730
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define DRVCNF_OK
Definition: mmsystem.h:134
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:56
#define CB_GETCURSEL
Definition: winuser.h:1925
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define IDC_QUALITY_SCROLL
HMODULE MSVFW32_hModule
Definition: msvideo_main.c:115
DWORD fccHandler
Definition: vfw.h:283
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define comptypeDIB
Definition: vfw.h:147
static BOOL enum_compressors(HWND list, COMPVARS *pcv, BOOL enum_all)
Definition: msvideo_main.c:888
unsigned int BOOL
Definition: ntddk_ex.h:94
LRESULT WINAPI ICClose(HIC hic)
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define ICMF_CHOOSE_DATARATE
Definition: vfw.h:849
unsigned int idx
Definition: utils.c:41
#define CB_ADDSTRING
Definition: winuser.h:1918
LONG_PTR LPARAM
Definition: windef.h:208
DWORD fccType
Definition: vfw.h:821
#define IDC_DATARATE
#define IDC_DATARATE_KB
#define CB_ERR
Definition: winuser.h:2410
#define IDC_COMP_LIST
Definition: resource.h:7
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
HIC hic
Definition: vfw.h:820
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
#define BN_CLICKED
Definition: winuser.h:1907
DWORD fccType
Definition: vfw.h:282
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ICQueryConfigure(hic)
Definition: vfw.h:320
#define IDS_FULLFRAMES
#define ICQueryAbout(hic)
Definition: vfw.h:313
#define ICAbout(hic, hwnd)
Definition: vfw.h:316
#define DWLP_USER
Definition: winuser.h:866
Definition: _list.h:228
#define CB_SETCURSEL
Definition: winuser.h:1943
#define WM_COMMAND
Definition: winuser.h:1722
DWORD fccHandler
Definition: vfw.h:822
#define ICConfigure(hic, hwnd)
Definition: vfw.h:323
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define streamtypeVIDEO
Definition: aviriff.h:92
#define ICMF_CHOOSE_KEYFRAME
Definition: vfw.h:848
#define IDC_KEYFRAME_FRAMES
ICINFO icinfo
Definition: msvideo_main.c:885
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define IDC_DATARATE_CHECKBOX
#define CBN_SELCHANGE
Definition: winuser.h:1961
#define msg(x)
Definition: auth_time.c:54
#define IDC_ABOUT
#define HIWORD(l)
Definition: typedefs.h:246
#define SetWindowLongPtrW
Definition: winuser.h:5247
#define IDCANCEL
Definition: winuser.h:825
#define IDC_KEYFRAME_CHECKBOX
#define IDC_QUALITY_TXT
#define WM_INITDIALOG
Definition: winuser.h:1721
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:394
#define IDC_CONFIGURE
Definition: resource.h:28
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by ICCompressorChoose().

◆ ICOpen()

HIC VFWAPI ICOpen ( DWORD  fccType,
DWORD  fccHandler,
UINT  wMode 
)

Definition at line 437 of file msvideo_main.c.

438 {
439  WCHAR codecname[10];
440  ICOPEN icopen;
441  HDRVR hdrv;
442  WINE_HIC* whic;
443  static const WCHAR drv32W[] = {'d','r','i','v','e','r','s','3','2','\0'};
445 
446  TRACE("(%s,%s,0x%08x)\n", wine_dbgstr_fcc(fccType), wine_dbgstr_fcc(fccHandler), wMode);
447 
448  if (!fccHandler) /* No specific handler, return the first valid for wMode */
449  {
450  HIC local;
451  ICINFO info;
452  DWORD loop = 0;
453  info.dwSize = sizeof(info);
454  while(ICInfo(fccType, loop++, &info))
455  {
456  /* Ensure fccHandler is not 0x0 because we will recurse on ICOpen */
457  if(!info.fccHandler)
458  continue;
459  local = ICOpen(fccType, info.fccHandler, wMode);
460  if (local != 0)
461  {
462  TRACE("Returning %s as default handler for %s\n",
463  wine_dbgstr_fcc(info.fccHandler), wine_dbgstr_fcc(fccType));
464  return local;
465  }
466  }
467  }
468 
469  /* Check if there is a registered driver that matches */
471  while(driver)
472  if (!compare_fourcc(fccType, driver->fccType) &&
473  !compare_fourcc(fccHandler, driver->fccHandler)) {
474  fccType = driver->fccType;
475  fccHandler = driver->fccHandler;
476  break;
477  } else
478  driver = driver->next;
479 
480  if (driver && driver->proc)
481  /* The driver has been registered at runtime with its driverproc */
482  return ICOpenFunction(fccType, fccHandler, wMode, driver->proc);
483 
484  /* Well, lParam2 is in fact a LPVIDEO_OPEN_PARMS, but it has the
485  * same layout as ICOPEN
486  */
487  icopen.dwSize = sizeof(ICOPEN);
488  icopen.fccType = fccType;
489  icopen.fccHandler = fccHandler;
490  icopen.dwVersion = 0x00001000; /* FIXME */
491  icopen.dwFlags = wMode;
492  icopen.dwError = 0;
493  icopen.pV1Reserved = NULL;
494  icopen.pV2Reserved = NULL;
495  icopen.dnDevNode = 0; /* FIXME */
496 
497  if (!driver) {
498  /* normalize to lower case as in 'vidc' */
499  ((char*)&fccType)[0] = tolower(((char*)&fccType)[0]);
500  ((char*)&fccType)[1] = tolower(((char*)&fccType)[1]);
501  ((char*)&fccType)[2] = tolower(((char*)&fccType)[2]);
502  ((char*)&fccType)[3] = tolower(((char*)&fccType)[3]);
503  icopen.fccType = fccType;
504  /* Seek the driver in the registry */
505  fourcc_to_string(codecname, fccType);
506  codecname[4] = '.';
507  fourcc_to_string(codecname + 5, fccHandler);
508  codecname[9] = '\0';
509 
510  hdrv = OpenDriver(codecname, drv32W, (LPARAM)&icopen);
511  if (!hdrv)
512  return 0;
513  } else {
514  /* The driver has been registered at runtime with its name */
515  hdrv = OpenDriver(driver->name, NULL, (LPARAM)&icopen);
516  if (!hdrv)
517  return 0;
518  }
519 
520  whic = HeapAlloc(GetProcessHeap(), 0, sizeof(WINE_HIC));
521  if (!whic)
522  {
523  CloseDriver(hdrv, 0, 0);
524  return FALSE;
525  }
526  whic->hdrv = hdrv;
527  whic->driverproc = NULL;
528  whic->type = fccType;
529  whic->handler = fccHandler;
531  whic->hic = (HIC)(ULONG_PTR)IC_HandleRef++;
532  whic->next = MSVIDEO_FirstHic;
533  MSVIDEO_FirstHic = whic;
534 
535  TRACE("=> %p\n", whic->hic);
536  return whic->hic;
537 }
HIC VFWAPI ICOpen(DWORD fccType, DWORD fccHandler, UINT wMode)
Definition: msvideo_main.c:437
DWORD dnDevNode
Definition: vfw.h:166
LRESULT dwError
Definition: vfw.h:163
struct tagWINE_HIC * next
LRESULT WINAPI CloseDriver(HDRVR hDrvr, LPARAM lParam1, LPARAM lParam2)
Definition: driver.c:462
static reg_driver * reg_driver_list
Definition: msvideo_main.c:113
DRIVERPROC driverproc
static WINE_HIC * MSVIDEO_FirstHic
Definition: msvideo_main.c:101
DWORD fccType
Definition: vfw.h:159
HDRVR WINAPI OpenDriver(LPCWSTR lpDriverName, LPCWSTR lpSectionName, LPARAM lParam)
Definition: driver.c:400
DWORD dwSize
Definition: vfw.h:158
BOOL VFWAPI ICInfo(DWORD fccType, DWORD fccHandler, ICINFO *lpicinfo)
Definition: msvideo_main.c:337
HIC VFWAPI ICOpenFunction(DWORD fccType, DWORD fccHandler, UINT wMode, DRIVERPROC lpfnHandler)
Definition: msvideo_main.c:542
struct _test_info info[]
Definition: SetCursorPos.c:19
uint32_t ULONG_PTR
Definition: typedefs.h:63
struct @1605::@1606 driver
DWORD fccHandler
Definition: vfw.h:160
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
Definition: vfw.h:157
unsigned long DWORD
Definition: ntddk_ex.h:95
static DWORD IC_HandleRef
Definition: msvideo_main.c:347
static const char * wine_dbgstr_fcc(DWORD fcc)
Definition: msvideo_main.c:57
DWORD dwFlags
Definition: vfw.h:162
#define local
Definition: zutil.h:30
Definition: vfw.h:280
#define fourcc_to_string(str, fcc)
Definition: msvideo_main.c:50
LPVOID pV1Reserved
Definition: vfw.h:164
LPVOID pV2Reserved
Definition: vfw.h:165
static int compare_fourcc(DWORD fcc1, DWORD fcc2)
Definition: msvideo_main.c:217
static WINE_HIC * MSVIDEO_GetHicPtr(HIC hic)
Definition: msvideo_main.c:287
int tolower(int c)
Definition: utclib.c:902
DWORD dwVersion
Definition: vfw.h:161

Referenced by DrawDibBegin(), enum_compressors(), ICMStream_fnCreate(), register_vfw_codecs(), test_encode(), test_ICGetDisplayFormat(), test_ICSeqCompress(), test_Locate(), test_OpenCase(), test_vfw(), and try_driver().

◆ ICOpenFunction()

HIC VFWAPI ICOpenFunction ( DWORD  fccType,
DWORD  fccHandler,
UINT  wMode,
DRIVERPROC  lpfnHandler 
)

Definition at line 542 of file msvideo_main.c.

543 {
544  ICOPEN icopen;
545  WINE_HIC* whic;
546 
547  TRACE("(%s,%s,%d,%p)\n",
548  wine_dbgstr_fcc(fccType), wine_dbgstr_fcc(fccHandler), wMode, lpfnHandler);
549 
550  icopen.dwSize = sizeof(ICOPEN);
551  icopen.fccType = fccType;
552  icopen.fccHandler = fccHandler;
553  icopen.dwVersion = ICVERSION;
554  icopen.dwFlags = wMode;
555  icopen.dwError = 0;
556  icopen.pV1Reserved = NULL;
557  icopen.pV2Reserved = NULL;
558  icopen.dnDevNode = 0; /* FIXME */
559 
560  whic = HeapAlloc(GetProcessHeap(), 0, sizeof(WINE_HIC));
561  if (!whic) return 0;
562 
563  whic->driverproc = lpfnHandler;
565  whic->hic = (HIC)(ULONG_PTR)IC_HandleRef++;
566  whic->next = MSVIDEO_FirstHic;
567  MSVIDEO_FirstHic = whic;
568 
569  /* Now try opening/loading the driver. Taken from DRIVER_AddToList */
570  /* What if the function is used more than once? */
571 
572  if (MSVIDEO_SendMessage(whic, DRV_LOAD, 0L, 0L) != DRV_SUCCESS)
573  {
574  WARN("DRV_LOAD failed for hic %p\n", whic->hic);
575  MSVIDEO_FirstHic = whic->next;
576  HeapFree(GetProcessHeap(), 0, whic);
577  return 0;
578  }
579  /* return value is not checked */
580  MSVIDEO_SendMessage(whic, DRV_ENABLE, 0L, 0L);
581 
582  whic->driverId = (DWORD)MSVIDEO_SendMessage(whic, DRV_OPEN, 0, (DWORD_PTR)&icopen);
583  /* FIXME: What should we put here? */
584  whic->hdrv = NULL;
585 
586  if (whic->driverId == 0)
587  {
588  WARN("DRV_OPEN failed for hic %p\n", whic->hic);
589  MSVIDEO_FirstHic = whic->next;
590  HeapFree(GetProcessHeap(), 0, whic);
591  return 0;
592  }
593 
594  TRACE("=> %p\n", whic->hic);
595  return whic->hic;
596 }
static LRESULT MSVIDEO_SendMessage(WINE_HIC *whic, UINT msg, DWORD_PTR lParam1, DWORD_PTR lParam2)
Definition: msvideo_main.c:136
#define ICVERSION
Definition: vfw.h:45
DWORD dnDevNode
Definition: vfw.h:166
LRESULT dwError
Definition: vfw.h:163
#define WARN(fmt,...)
Definition: debug.h:111
struct tagWINE_HIC * next
DRIVERPROC driverproc
static WINE_HIC * MSVIDEO_FirstHic
Definition: msvideo_main.c:101
DWORD fccType
Definition: vfw.h:159
DWORD dwSize
Definition: vfw.h:158
#define DWORD
Definition: nt_native.h:44
#define DRV_OPEN
Definition: mmsystem.h:121
uint32_t ULONG_PTR
Definition: typedefs.h:63
DWORD fccHandler
Definition: vfw.h:160
smooth NULL
Definition: ftsmooth.c:416
#define DRV_LOAD(x)
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
Definition: vfw.h:157
static const WCHAR L[]
Definition: oid.c:1250
static DWORD IC_HandleRef
Definition: msvideo_main.c:347
static const char * wine_dbgstr_fcc(DWORD fcc)
Definition: msvideo_main.c:57
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define DRV_ENABLE
Definition: mmsystem.h:120
DWORD dwFlags
Definition: vfw.h:162
#define DRV_SUCCESS
Definition: mmsystem.h:18
LPVOID pV1Reserved
Definition: vfw.h:164
LPVOID pV2Reserved
Definition: vfw.h:165
static WINE_HIC * MSVIDEO_GetHicPtr(HIC hic)
Definition: msvideo_main.c:287
#define HeapFree(x, y, z)
Definition: compat.h:394
DWORD dwVersion
Definition: vfw.h:161

Referenced by ICOpen().

◆ ICRemove()

BOOL VFWAPI ICRemove ( DWORD  fccType,
DWORD  fccHandler,
UINT  wFlags 
)

Definition at line 406 of file msvideo_main.c.

407 {
408  reg_driver** pdriver;
409  reg_driver* drv;
410 
411  TRACE("(%s,%s,0x%08x)\n", wine_dbgstr_fcc(fccType), wine_dbgstr_fcc(fccHandler), wFlags);
412 
413  /* Check if a driver is already registered */
414  for (pdriver = &reg_driver_list; *pdriver; pdriver = &(*pdriver)->next)
415  {
416  if (!compare_fourcc(fccType, (*pdriver)->fccType) &&
417  !compare_fourcc(fccHandler, (*pdriver)->fccHandler))
418  break;
419  }
420  if (!*pdriver)
421  return FALSE;
422 
423  /* Remove the driver from the list */
424  drv = *pdriver;
425  *pdriver = (*pdriver)->next;
426  HeapFree(GetProcessHeap(), 0, drv->name);
427  HeapFree(GetProcessHeap(), 0, drv);
428 
429  return TRUE;
430 }
#define TRUE
Definition: types.h:120
static reg_driver * reg_driver_list
Definition: msvideo_main.c:113
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
static const char * wine_dbgstr_fcc(DWORD fcc)
Definition: msvideo_main.c:57
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:519
reg_driver * next
Definition: msvideo_main.c:110
static int compare_fourcc(DWORD fcc1, DWORD fcc2)
Definition: msvideo_main.c:217
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by test_ICGetDisplayFormat().

◆ ICSendMessage()

LRESULT VFWAPI ICSendMessage ( HIC  hic,
UINT  msg,
DWORD_PTR  lParam1,
DWORD_PTR  lParam2 
)

Definition at line 1196 of file msvideo_main.c.

1197 {
1198  WINE_HIC* whic = MSVIDEO_GetHicPtr(hic);
1199 
1200  if (!whic) return ICERR_BADHANDLE;
1201  return MSVIDEO_SendMessage(whic, msg, lParam1, lParam2);
1202 }
static LRESULT MSVIDEO_SendMessage(WINE_HIC *whic, UINT msg, DWORD_PTR lParam1, DWORD_PTR lParam2)
Definition: msvideo_main.c:136
#define ICERR_BADHANDLE
Definition: vfw.h:63
#define msg(x)
Definition: auth_time.c:54
static WINE_HIC * MSVIDEO_GetHicPtr(HIC hic)
Definition: msvideo_main.c:287

Referenced by ICCompress(), ICDecompress(), ICDraw(), ICDrawBegin(), ICGetDisplayFormat(), ICGetInfo(), ICMStream_fnCreate(), ICSeqCompressFrame(), ICSeqCompressFrameEnd(), ICSeqCompressFrameStart(), MCIAVI_OpenVideo(), test_encode(), and try_driver().

◆ ICSeqCompressFrame()

LPVOID VFWAPI ICSeqCompressFrame ( PCOMPVARS  pc,
UINT  uiFlags,
LPVOID  lpBits,
BOOL pfKey,
LONG plSize 
)

Definition at line 1455 of file msvideo_main.c.

1456 {
1457  ICCOMPRESS* icComp = pc->lpState;
1458  DWORD ret;
1459  TRACE("(%p, 0x%08x, %p, %p, %p)\n", pc, uiFlags, lpBits, pfKey, plSize);
1460 
1461  if (pc->cbState != sizeof(ICCOMPRESS))
1462  {
1463  ERR("Invalid cbState %i\n", pc->cbState);
1464  return NULL;
1465  }
1466 
1467  if (!pc->lKeyCount++)
1468  icComp->dwFlags = ICCOMPRESS_KEYFRAME;
1469  else
1470  {
1471  if (pc->lKey && pc->lKeyCount == (pc->lKey - 1))
1472  /* No key frames if pc->lKey == 0 */
1473  pc->lKeyCount = 0;
1474  icComp->dwFlags = 0;
1475  }
1476 
1477  icComp->lpInput = lpBits;
1478  icComp->lFrameNum = pc->lFrame++;
1479  icComp->lpOutput = pc->lpBitsOut;
1480  icComp->lpPrev = pc->lpBitsPrev;
1481  ret = ICSendMessage(pc->hic, ICM_COMPRESS, (DWORD_PTR)icComp, sizeof(*icComp));
1482 
1483  if (ret == ICERR_OK)
1484  {
1485  LPVOID oldprev, oldout;
1486 
1487  if (icComp->dwFlags & AVIIF_KEYFRAME)
1488  {
1489  pc->lKeyCount = 1;
1490  *pfKey = TRUE;
1491  TRACE("Key frame\n");
1492  }
1493  else
1494  *pfKey = FALSE;
1495 
1496  *plSize = icComp->lpbiOutput->biSizeImage;
1497 
1498  /* We shift Prev and Out, so we don't have to allocate and release memory */
1499  oldprev = pc->lpBitsPrev;
1500  oldout = pc->lpBitsOut;
1501  pc->lpBitsPrev = oldout;
1502  pc->lpBitsOut = oldprev;
1503 
1504  TRACE("returning: %p, compressed frame size %u\n", icComp->lpOutput, *plSize);
1505  return icComp->lpOutput;
1506  }
1507  return NULL;
1508 }
#define TRUE
Definition: types.h:120
LONG lKeyCount
Definition: vfw.h:831
#define ICCOMPRESS_KEYFRAME
Definition: vfw.h:170
LRESULT VFWAPI ICSendMessage(HIC hic, UINT msg, DWORD_PTR lParam1, DWORD_PTR lParam2)
#define AVIIF_KEYFRAME
Definition: aviriff.h:131
#define ICERR_OK
Definition: vfw.h:50
LPBITMAPINFOHEADER lpbiOutput
Definition: vfw.h:174
smooth NULL
Definition: ftsmooth.c:416
LPVOID lpBitsPrev
Definition: vfw.h:826
#define TRACE(s)
Definition: solgame.cpp:4
HIC hic
Definition: vfw.h:820
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD biSizeImage
Definition: amvideo.idl:36
LPVOID lpBitsOut
Definition: vfw.h:825
#define ICM_COMPRESS
Definition: vfw.h:103
int ret
LONG lKey
Definition: vfw.h:828
uint32_t DWORD_PTR
Definition: typedefs.h:63
LPVOID lpState
Definition: vfw.h:832
#define ERR(fmt,...)
Definition: debug.h:109
LONG lFrameNum
Definition: vfw.h:180
LONG cbState
Definition: vfw.h:833
DWORD dwFlags
Definition: vfw.h:173
LONG lFrame
Definition: vfw.h:827

Referenced by test_ICSeqCompress().

◆ ICSeqCompressFrameEnd()

void VFWAPI ICSeqCompressFrameEnd ( PCOMPVARS  pc)

Definition at line 1528 of file msvideo_main.c.

1529 {
1530  TRACE("(%p)\n", pc);
1531  ICSendMessage(pc->hic, ICM_COMPRESS_END, 0, 0);
1532  clear_compvars(pc);
1533 }
LRESULT VFWAPI ICSendMessage(HIC hic, UINT msg, DWORD_PTR lParam1, DWORD_PTR lParam2)
static void clear_compvars(PCOMPVARS pc)
#define TRACE(s)
Definition: solgame.cpp:4
HIC hic
Definition: vfw.h:820
#define ICM_COMPRESS_END
Definition: vfw.h:104

Referenced by test_ICSeqCompress().

◆ ICSeqCompressFrameStart()

BOOL VFWAPI ICSeqCompressFrameStart ( PCOMPVARS  pc,
LPBITMAPINFO  lpbiIn 
)

Definition at line 1538 of file msvideo_main.c.

1539 {
1540  /* I'm ignoring bmiColors as I don't know what to do with it,
1541  * it doesn't appear to be used though
1542  */
1543  DWORD ret;
1544  ICCOMPRESS* icComp;
1545  pc->lpbiIn = HeapAlloc(GetProcessHeap(), 0, sizeof(BITMAPINFO));
1546  if (!pc->lpbiIn)
1547  return FALSE;
1548 
1549  *pc->lpbiIn = *lpbiIn;
1550 
1551  pc->lpState = HeapAlloc(GetProcessHeap(), 0, sizeof(ICCOMPRESS)
1552  + sizeof(*icComp->lpckid) + sizeof(*icComp->lpdwFlags));
1553  if (!pc->lpState)
1554  goto error;
1555 
1556  pc->cbState = sizeof(ICCOMPRESS);
1557 
1558  if (!pc->lpbiOut)
1559  {
1560  /* Ask compressor for needed header size */
1562  (DWORD_PTR)pc->lpbiIn, 0);
1563  if (size <= 0)
1564  goto error;
1565 
1567  if (!pc->lpbiOut)
1568  goto error;
1569  /* Flag to show that we allocated lpbiOut for proper cleanup */
1570  pc->dwFlags |= 0x80000000;
1571 
1573  (DWORD_PTR)pc->lpbiIn, (DWORD_PTR)pc->lpbiOut);
1574  if (ret != ICERR_OK)
1575  {
1576  ERR("Could not get output format from compressor\n");
1577  goto error;
1578  }
1579  if (!pc->lpbiOut->bmiHeader.biSizeImage)
1580  {
1581  /* If we can't know the output frame size for sure at least allocate
1582  * the same size of the input frame and also at least 8Kb to be sure
1583  * that poor compressors will have enough memory to work if the input
1584  * frame is too small.
1585  */
1587  ERR("Bad codec! Invalid output frame size, guessing from input\n");
1588  }
1589  }
1590 
1591  TRACE("Input: %ux%u, fcc %s, bpp %u, size %u\n",
1596  TRACE("Output: %ux%u, fcc %s, bpp %u, size %u\n",
1601 
1602  /* Buffer for compressed frame data */
1604  if (!pc->lpBitsOut)
1605  goto error;
1606 
1607  /* Buffer for previous compressed frame data */
1609  if (!pc->lpBitsPrev)
1610  goto error;
1611 
1612  TRACE("Compvars:\n"
1613  "\tsize: %i\n"
1614  "\tflags: 0x%x\n"
1615  "\thic: %p\n"
1616  "\ttype: %s\n"
1617  "\thandler: %s\n"
1618  "\tin/out: %p/%p\n"
1619  "\tkey/data/quality: %i/%i/%i\n",
1620  pc->cbSize, pc->dwFlags, pc->hic, wine_dbgstr_fcc(pc->fccType),
1621  wine_dbgstr_fcc(pc->fccHandler), pc->lpbiIn, pc->lpbiOut, pc->lKey,
1622  pc->lDataRate, pc->lQ);
1623 
1625  if (ret == ICERR_OK)
1626  {
1627  icComp = pc->lpState;
1628  /* Initialise some variables */
1629  pc->lFrame = 0; pc->lKeyCount = 0;
1630 
1631  icComp->lpbiOutput = &pc->lpbiOut->bmiHeader;
1632  icComp->lpbiInput = &pc->lpbiIn->bmiHeader;
1633  icComp->lpckid = (DWORD *)(icComp + 1);
1634  *icComp->lpckid = 0;
1635  icComp->lpdwFlags = (DWORD *)((char *)(icComp + 1) + sizeof(*icComp->lpckid));
1636  *icComp->lpdwFlags = 0;
1637  icComp->dwFrameSize = 0;
1638  icComp->dwQuality = pc->lQ;
1639  icComp->lpbiPrev = &pc->lpbiIn->bmiHeader;
1640  return TRUE;
1641  }
1642 error:
1643  clear_compvars(pc);
1644  return FALSE;
1645 }
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
LPBITMAPINFOHEADER lpbiInput
Definition: vfw.h:176
#define ICM_COMPRESS_BEGIN
Definition: vfw.h:102
LONG lKeyCount
Definition: vfw.h:831
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1471
#define error(str)
Definition: mkdosfs.c:1605
LRESULT VFWAPI ICSendMessage(HIC hic, UINT msg, DWORD_PTR lParam1, DWORD_PTR lParam2)
#define ICERR_OK
Definition: vfw.h:50
LPDWORD lpdwFlags
Definition: vfw.h:179
DWORD dwFrameSize
Definition: vfw.h:181
LONG lDataRate
Definition: vfw.h:829
LPBITMAPINFO lpbiIn
Definition: vfw.h:823
LPBITMAPINFOHEADER lpbiOutput
Definition: vfw.h:174
LPBITMAPINFO lpbiOut
Definition: vfw.h:824
DWORD biCompression
Definition: amvideo.idl:35
LPBITMAPINFOHEADER lpbiPrev
Definition: vfw.h:183
LPVOID lpBitsPrev
Definition: vfw.h:826
DWORD fccType
Definition: vfw.h:821
static void clear_compvars(PCOMPVARS pc)
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HIC hic
Definition: vfw.h:820
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD biSizeImage
Definition: amvideo.idl:36
LONG lQ
Definition: vfw.h:830
LPVOID lpBitsOut
Definition: vfw.h:825
int ret
LONG lKey
Definition: vfw.h:828
static const char * wine_dbgstr_fcc(DWORD fcc)
Definition: msvideo_main.c:57
uint32_t DWORD_PTR
Definition: typedefs.h:63
DWORD fccHandler
Definition: vfw.h:822
LPVOID lpState
Definition: vfw.h:832
#define ICM_COMPRESS_GET_FORMAT
Definition: vfw.h:99
#define ERR(fmt,...)
Definition: debug.h:109
LONG cbSize
Definition: vfw.h:818
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
LONG cbState
Definition: vfw.h:833
DWORD dwFlags
Definition: vfw.h:819
LPDWORD lpckid
Definition: vfw.h:178
DWORD dwQuality
Definition: vfw.h:182
LONG lFrame
Definition: vfw.h:827

Referenced by test_ICSeqCompress().

◆ MSVIDEO_GetHicPtr()

static WINE_HIC* MSVIDEO_GetHicPtr ( HIC  hic)
static

Definition at line 287 of file msvideo_main.c.

288 {
289  WINE_HIC* whic;
290 
291  for (whic = MSVIDEO_FirstHic; whic && whic->hic != hic; whic = whic->next);
292  return whic;
293 }
struct tagWINE_HIC * next
static WINE_HIC * MSVIDEO_FirstHic
Definition: msvideo_main.c:101

Referenced by ICClose(), ICGetInfo(), ICOpen(), ICOpenFunction(), and ICSendMessage().

◆ MSVIDEO_SendMessage()

static LRESULT MSVIDEO_SendMessage ( WINE_HIC whic,
UINT  msg,
DWORD_PTR  lParam1,
DWORD_PTR  lParam2 
)
static

Definition at line 136 of file msvideo_main.c.

137 {
138  LRESULT ret;
139 
140 #define XX(x) case x: TRACE("(%p,"#x",0x%08lx,0x%08lx)\n",whic,lParam1,lParam2); break
141 
142  switch (msg) {
143  /* DRV_* */
144  XX(DRV_LOAD);
145  XX(DRV_ENABLE);
146  XX(DRV_OPEN);
147  XX(DRV_CLOSE);
148  XX(DRV_DISABLE);
149  XX(DRV_FREE);
150  /* ICM_RESERVED+X */
151  XX(ICM_ABOUT);
152  XX(ICM_CONFIGURE);
153  XX(ICM_GET);
154  XX(ICM_GETINFO);
157  XX(ICM_GETSTATE);
159  XX(ICM_SET);
160  XX(ICM_SETSTATE);
161  /* ICM_USER+X */
167  XX(ICM_COMPRESS);
180  XX(ICM_DRAW_STOP);
181  XX(ICM_DRAW_END);
183  XX(ICM_DRAW);
200  default:
201  FIXME("(%p,0x%08x,0x%08lx,0x%08lx) unknown message\n",whic,msg,lParam1,lParam2);
202  }
203 
204 #undef XX
205 
206  if (whic->driverproc) {
207  /* dwDriverId parameter is the value returned by the DRV_OPEN */
208  ret = whic->driverproc(whic->driverId, whic->hdrv, msg, lParam1, lParam2);
209  } else {
210  ret = SendDriverMessage(whic->hdrv, msg, lParam1, lParam2);
211  }
212 
213  TRACE(" -> %s\n", wine_dbgstr_icerr(ret));
214  return ret;
215 }
#define ICM_DECOMPRESSEX_QUERY
Definition: vfw.h:139
#define DRV_DISABLE
Definition: mmsystem.h:123
#define ICM_DECOMPRESSEX_BEGIN
Definition: vfw.h:138
LRESULT WINAPI SendDriverMessage(HDRVR hDriver, UINT msg, LPARAM lParam1, LPARAM lParam2)
Definition: driver.c:131
#define ICM_GETQUALITY
Definition: vfw.h:89
#define ICM_DRAW_START
Definition: vfw.h:117
#define ICM_COMPRESS_BEGIN
Definition: vfw.h:102
#define ICM_ABOUT
Definition: vfw.h:85
#define ICM_GET
Definition: vfw.h:93
#define ICM_DECOMPRESS_SET_PALETTE
Definition: vfw.h:111
#define ICM_GETDEFAULTQUALITY
Definition: vfw.h:88
static const char * wine_dbgstr_icerr(int ret)
Definition: msvideo_main.c:69
#define ICM_DECOMPRESSEX_END
Definition: vfw.h:141
#define DRV_CLOSE
Definition: mmsystem.h:122
DRIVERPROC driverproc
#define ICM_COMPRESS_QUERY
Definition: vfw.h:101
#define ICM_GETINFO
Definition: vfw.h:82
#define DRV_OPEN
Definition: mmsystem.h:121
#define ICM_DECOMPRESS_QUERY
Definition: vfw.h:107
#define ICM_DRAW_WINDOW
Definition: vfw.h:122
#define ICM_COMPRESS_FRAMES_INFO
Definition: vfw.h:143
#define FIXME(fmt,...)
Definition: debug.h:110
#define ICM_SETSTATE
Definition: vfw.h:81
#define ICM_DRAW_QUERY
Definition: vfw.h:114
#define ICM_GETSTATE
Definition: vfw.h:80
#define DRV_LOAD(x)
#define ICM_DRAW_STOP_PLAY
Definition: vfw.h:129
#define ICM_DRAW_BEGIN
Definition: vfw.h:115
#define ICM_DRAW_START_PLAY
Definition: vfw.h:128
#define ICM_DRAW_SUGGESTFORMAT
Definition: vfw.h:131
#define TRACE(s)
Definition: solgame.cpp:4
#define ICM_DRAW_SETTIME
Definition: vfw.h:123
#define ICM_DRAW_FLUSH
Definition: vfw.h:125
#define ICM_DECOMPRESS_GET_PALETTE
Definition: vfw.h:112
#define ICM_DECOMPRESS_GET_FORMAT
Definition: vfw.h:106
#define ICM_DECOMPRESS_END
Definition: vfw.h:110
#define DRV_FREE
Definition: mmsystem.h:124
#define ICM_DRAW_REALIZE
Definition: vfw.h:124
#define ICM_COMPRESS
Definition: vfw.h:103
int ret
#define ICM_GETBUFFERSWANTED
Definition: vfw.h:134
#define ICM_SETQUALITY
Definition: vfw.h:90
#define ICM_DECOMPRESS
Definition: vfw.h:109
#define ICM_DECOMPRESS_BEGIN
Definition: vfw.h:108
#define ICM_SET_STATUS_PROC
Definition: vfw.h:144
#define DRV_ENABLE
Definition: mmsystem.h:120
#define ICM_COMPRESS_GET_FORMAT
Definition: vfw.h:99
#define ICM_COMPRESS_END
Definition: vfw.h:104
#define ICM_DRAW_STOP
Definition: vfw.h:118
#define msg(x)
Definition: auth_time.c:54
#define ICM_DRAW_RENDERBUFFER
Definition: vfw.h:126
#define ICM_DECOMPRESSEX
Definition: vfw.h:140
#define ICM_DRAW
Definition: vfw.h:121
LONG_PTR LRESULT
Definition: windef.h:209
#define ICM_GETDEFAULTKEYFRAMERATE
Definition: vfw.h:136
#define ICM_DRAW_END
Definition: vfw.h:119
#define ICM_CONFIGURE
Definition: vfw.h:84
#define XX(x)
#define ICM_DRAW_GETTIME
Definition: vfw.h:120
#define ICM_DRAW_GET_PALETTE
Definition: vfw.h:116
#define ICM_SET
Definition: vfw.h:92
#define ICM_COMPRESS_GET_SIZE
Definition: vfw.h:100
#define ICM_DRAW_CHANGEPALETTE
Definition: vfw.h:132

Referenced by ICClose(), ICOpenFunction(), and ICSendMessage().

◆ try_driver()

static HIC try_driver ( driver_info_t info)
static

Definition at line 647 of file msvideo_main.c.

648 {
649  HIC hic;
650 
651  if ((hic = ICOpen(info->fccType, info->fccHandler, info->wMode)))
652  {
653  if (!ICSendMessage(hic, info->querymsg, (DWORD_PTR)info->lpbiIn, (DWORD_PTR)info->lpbiOut))
654  return hic;
655  ICClose(hic);
656  }
657  return 0;
658 }
HIC VFWAPI ICOpen(DWORD fccType, DWORD fccHandler, UINT wMode)
Definition: msvideo_main.c:437
LRESULT VFWAPI ICSendMessage(HIC hic, UINT msg, DWORD_PTR lParam1, DWORD_PTR lParam2)
LRESULT WINAPI ICClose(HIC hic)
uint32_t DWORD_PTR
Definition: typedefs.h:63

Referenced by ICLocate(), and ICLocate_enum_handler().

◆ VideoForWindowsVersion()

DWORD WINAPI VideoForWindowsVersion ( void  )

Definition at line 301 of file msvideo_main.c.

302 {
303  return 0x040003B6; /* 4.950 */
304 }

◆ wine_dbgstr_fcc()

static const char* wine_dbgstr_fcc ( DWORD  fcc)
inlinestatic

Definition at line 57 of file msvideo_main.c.

58 {
59  char fcc_str[5];
60  fourcc_to_string(fcc_str, fcc);
61  fcc_str[4] = '\0';
62  /* Last byte may be ' ' in some cases like "DIB " */
63  if (isalnum(fcc_str[0]) && isalnum(fcc_str[1]) && isalnum(fcc_str[2])
64  && (isalnum(fcc_str[3]) || isspace(fcc_str[3])))
65  return wine_dbg_sprintf("%s", fcc_str);
66  return wine_dbg_sprintf("0x%08x", fcc);
67 }
#define isspace(c)
Definition: acclib.h:69
_Check_return_ _CRTIMP int __cdecl isalnum(_In_ int _C)
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:271
#define fourcc_to_string(str, fcc)
Definition: msvideo_main.c:50

Referenced by enum_compressors(), ICInfo(), ICInstall(), ICLocate(), ICOpen(), ICOpenFunction(), ICRemove(), and ICSeqCompressFrameStart().

◆ wine_dbgstr_icerr()

static const char* wine_dbgstr_icerr ( int  ret)
static

Definition at line 69 of file msvideo_main.c.

70 {
71  const char *str;
72  if (ret <= ICERR_CUSTOM)
73  return wine_dbg_sprintf("ICERR_CUSTOM (%d)", ret);
74 #define XX(x) case (x): str = #x; break
75  switch (ret)
76  {
77  XX(ICERR_OK);
91  XX(ICERR_ABORT);
92  XX(ICERR_ERROR);
95  default: str = wine_dbg_sprintf("UNKNOWN (%d)", ret);
96  }
97 #undef XX
98  return str;
99 }
#define ICERR_OK
Definition: vfw.h:50
#define ICERR_MEMORY
Definition: vfw.h:58
#define ICERR_DONTDRAW
Definition: vfw.h:51
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:271
#define ICERR_ABORT
Definition: vfw.h:65
#define ICERR_CANTUPDATE
Definition: vfw.h:64
const WCHAR * str
#define ICERR_INTERNAL
Definition: vfw.h:59
#define ICERR_BADIMAGESIZE
Definition: vfw.h:68
#define ICERR_BADFORMAT
Definition: vfw.h:57
#define ICERR_BADHANDLE
Definition: vfw.h:63
#define ICERR_BADPARAM
Definition: vfw.h:61
#define ICERR_BADBITDEPTH
Definition: vfw.h:67
int ret
#define ICERR_STOPDRAWING
Definition: vfw.h:54
#define ICERR_UNSUPPORTED
Definition: vfw.h:56
#define ICERR_BADFLAGS
Definition: vfw.h:60
#define ICERR_NEWPALETTE
Definition: vfw.h:52
#define ICERR_CUSTOM
Definition: vfw.h:70
#define ICERR_ERROR
Definition: vfw.h:66
#define ICERR_BADSIZE
Definition: vfw.h:62
#define ICERR_GOTOKEYFRAME
Definition: vfw.h:53
#define XX(x)

Referenced by MSVIDEO_SendMessage().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msvideo  )

Variable Documentation

◆ IC_HandleRef

DWORD IC_HandleRef = 1
static

Definition at line 347 of file msvideo_main.c.

Referenced by ICOpen(), and ICOpenFunction().

◆ MSVFW32_hModule

HMODULE MSVFW32_hModule

◆ MSVIDEO_FirstHic

WINE_HIC* MSVIDEO_FirstHic
static

Definition at line 101 of file msvideo_main.c.

Referenced by ICClose(), ICOpen(), ICOpenFunction(), and MSVIDEO_GetHicPtr().

◆ reg_driver_list

reg_driver* reg_driver_list = NULL
static

Definition at line 113 of file msvideo_main.c.

Referenced by ICInstall(), ICOpen(), and ICRemove().