ReactOS 0.4.15-dev-7670-g69b08be
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 "wine/winternl.h"
#include "winuser.h"
#include "commdlg.h"
#include "vfw.h"
#include "msvideo_private.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h"
Include dependency graph for msvideo_main.c:

Go to the source code of this file.

Classes

struct  reg_driver
 
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
 

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 WINE_HICMSVIDEO_GetHicPtr (HIC hic)
 
DWORD WINAPI VideoForWindowsVersion (void)
 
BOOL VFWAPI ICInfo (DWORD type, DWORD handler, ICINFO *info)
 
BOOL VFWAPI ICInstall (DWORD type, DWORD handler, LPARAM lparam, char *desc, UINT flags)
 
BOOL VFWAPI ICRemove (DWORD type, DWORD handler, UINT flags)
 
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)
 
HIC VFWAPI ICLocate (DWORD type, DWORD handler, BITMAPINFOHEADER *in, BITMAPINFOHEADER *out, WORD mode)
 
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)
 
static BITMAPINFOcopy_bitmapinfo (const BITMAPINFO *src)
 
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 struct list reg_driver_list = LIST_INIT(reg_driver_list)
 
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
#define LOWORD(l)
Definition: pedump.c:82
const WCHAR * str
#define HIWORD(l)
Definition: typedefs.h:247

Definition at line 53 of file msvideo_main.c.

◆ HKLM_DRIVERS32

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

Definition at line 48 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

Function Documentation

◆ clear_compvars()

static void clear_compvars ( PCOMPVARS  pc)
static

Definition at line 1484 of file msvideo_main.c.

1485{
1486 heap_free(pc->lpbiIn);
1487 heap_free(pc->lpBitsPrev);
1488 heap_free(pc->lpBitsOut);
1489 heap_free(pc->lpState);
1490 pc->lpbiIn = pc->lpBitsPrev = pc->lpBitsOut = pc->lpState = NULL;
1491 if (pc->dwFlags & 0x80000000)
1492 {
1493 heap_free(pc->lpbiOut);
1494 pc->lpbiOut = NULL;
1495 pc->dwFlags &= ~0x80000000;
1496 }
1497}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define NULL
Definition: types.h:112
DWORD dwFlags
Definition: vfw.h:819
LPVOID lpState
Definition: vfw.h:832
LPVOID lpBitsPrev
Definition: vfw.h:826
LPBITMAPINFO lpbiOut
Definition: vfw.h:824
LPVOID lpBitsOut
Definition: vfw.h:825
LPBITMAPINFO lpbiIn
Definition: vfw.h:823

Referenced by ICSeqCompressFrameEnd(), and ICSeqCompressFrameStart().

◆ compare_fourcc()

static int compare_fourcc ( DWORD  fcc1,
DWORD  fcc2 
)
static

Definition at line 218 of file msvideo_main.c.

219{
220 char fcc_str1[4];
221 char fcc_str2[4];
222 fourcc_to_string(fcc_str1, fcc1);
223 fourcc_to_string(fcc_str2, fcc2);
224 return _strnicmp(fcc_str1, fcc_str2, 4);
225}
#define _strnicmp(_String1, _String2, _MaxCount)
Definition: compat.h:23
#define fourcc_to_string(str, fcc)
Definition: msvideo_main.c:53

◆ copy_bitmapinfo()

static BITMAPINFO * copy_bitmapinfo ( const BITMAPINFO src)
static

Definition at line 1509 of file msvideo_main.c.

1510{
1511 int num_colors;
1512 unsigned int size;
1513 BITMAPINFO *dst;
1514
1515 if (src->bmiHeader.biClrUsed)
1516 num_colors = min(src->bmiHeader.biClrUsed, 256);
1517 else
1518 num_colors = src->bmiHeader.biBitCount > 8 ? 0 : 1 << src->bmiHeader.biBitCount;
1519
1520 size = FIELD_OFFSET(BITMAPINFO, bmiColors[num_colors]);
1521 if (src->bmiHeader.biCompression == BI_BITFIELDS)
1522 size += 3 * sizeof(DWORD);
1523
1524 if (!(dst = heap_alloc(size)))
1525 return NULL;
1526
1527 memcpy(dst, src, size);
1528 return dst;
1529}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
GLsizeiptr size
Definition: glext.h:5919
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define BI_BITFIELDS
Definition: mmreg.h:507
#define min(a, b)
Definition: monoChain.cc:55
#define DWORD
Definition: nt_native.h:44
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

Referenced by ICSeqCompressFrameStart().

◆ DllMain()

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

Definition at line 118 of file msvideo_main.c.

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

◆ enum_compressors()

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

Definition at line 861 of file msvideo_main.c.

862{
863 UINT id, total = 0;
864 ICINFO icinfo;
865
866 id = 0;
867
868 while (ICInfo(pcv->fccType, id, &icinfo))
869 {
870 struct codec_info *ic;
871 DWORD idx;
872 HIC hic;
873
874 id++;
875
877
878 if (hic)
879 {
880 /* for unknown reason fccHandler reported by the driver
881 * doesn't always work, use the one returned by ICInfo instead.
882 */
883 DWORD fccHandler = icinfo.fccHandler;
884
885 if (!enum_all && pcv->lpbiIn)
886 {
887 if (ICCompressQuery(hic, pcv->lpbiIn, NULL) != ICERR_OK)
888 {
889 TRACE("fccHandler %s doesn't support input DIB format %d\n",
891 ICClose(hic);
892 continue;
893 }
894 }
895
896 ICGetInfo(hic, &icinfo, sizeof(icinfo));
897 icinfo.fccHandler = fccHandler;
898
900
901 ic = heap_alloc(sizeof(*ic));
902 ic->icinfo = icinfo;
903 ic->hic = hic;
905 }
906 total++;
907 }
908
909 return total != 0;
910}
Definition: list.h:37
unsigned int idx
Definition: utils.c:41
unsigned long DWORD
Definition: ntddk_ex.h:95
size_t total
GLuint id
Definition: glext.h:5910
static const char * wine_dbgstr_fcc(DWORD fcc)
Definition: msvideo_main.c:60
HIC VFWAPI ICOpen(DWORD fccType, DWORD fccHandler, UINT wMode)
Definition: msvideo_main.c:441
LRESULT VFWAPI ICGetInfo(HIC hic, ICINFO *picinfo, DWORD cb)
Definition: msvideo_main.c:594
BOOL VFWAPI ICInfo(DWORD type, DWORD handler, ICINFO *info)
Definition: msvideo_main.c:270
LRESULT WINAPI ICClose(HIC hic)
unsigned int UINT
Definition: ndis.h:50
DWORD fccType
Definition: vfw.h:821
Definition: vfw.h:280
DWORD fccType
Definition: vfw.h:282
DWORD fccHandler
Definition: vfw.h:283
WCHAR szDescription[128]
Definition: vfw.h:291
ICINFO icinfo
Definition: msvideo_main.c:858
ULONG biCompression
Definition: precomp.h:38
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1476
#define ICERR_OK
Definition: vfw.h:50
#define ICMODE_COMPRESS
Definition: vfw.h:268
#define ICCompressQuery(hic, lpbiInput, lpbiOutput)
Definition: vfw.h:224
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_SETITEMDATA
Definition: winuser.h:1965
#define CB_ADDSTRING
Definition: winuser.h:1935
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by icm_choose_compressor_dlgproc().

◆ get_size_image()

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

Definition at line 227 of file msvideo_main.c.

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

Referenced by ICGetDisplayFormat(), and ICImageDecompress().

◆ GetFileNamePreview()

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

Definition at line 1639 of file msvideo_main.c.

1640{
1641 CHAR szFunctionName[20];
1642 BOOL (*fnGetFileName)(LPVOID);
1643 HMODULE hComdlg32;
1644 BOOL ret;
1645
1646 FIXME("(%p,%d,%d), semi-stub!\n",lpofn,bSave,bUnicode);
1647
1648 lstrcpyA(szFunctionName, (bSave ? "GetSaveFileName" : "GetOpenFileName"));
1649 lstrcatA(szFunctionName, (bUnicode ? "W" : "A"));
1650
1651 hComdlg32 = LoadLibraryA("COMDLG32.DLL");
1652 if (hComdlg32 == NULL)
1653 return FALSE;
1654
1655 fnGetFileName = (LPVOID)GetProcAddress(hComdlg32, szFunctionName);
1656 if (fnGetFileName == NULL)
1657 {
1658 FreeLibrary(hComdlg32);
1659 return FALSE;
1660 }
1661
1662 /* FIXME: need to add OFN_ENABLEHOOK and our own handler */
1663 ret = fnGetFileName(lpofn);
1664
1665 FreeLibrary(hComdlg32);
1666 return ret;
1667}
#define FIXME(fmt,...)
Definition: debug.h:111
#define FALSE
Definition: types.h:117
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
unsigned int BOOL
Definition: ntddk_ex.h:94
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define BOOL
Definition: nt_native.h:43
#define LPVOID
Definition: nt_native.h:45
char CHAR
Definition: xmlstorage.h:175

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

◆ GetOpenFileNamePreviewA()

BOOL WINAPI GetOpenFileNamePreviewA ( LPOPENFILENAMEA  lpofn)

Definition at line 1672 of file msvideo_main.c.

1673{
1674 FIXME("(%p), semi-stub!\n", lpofn);
1675
1676 return GetFileNamePreview(lpofn, FALSE, FALSE);
1677}
static BOOL GetFileNamePreview(LPVOID lpofn, BOOL bSave, BOOL bUnicode)

◆ GetOpenFileNamePreviewW()

BOOL WINAPI GetOpenFileNamePreviewW ( LPOPENFILENAMEW  lpofn)

Definition at line 1682 of file msvideo_main.c.

1683{
1684 FIXME("(%p), semi-stub!\n", lpofn);
1685
1686 return GetFileNamePreview(lpofn, FALSE, TRUE);
1687}

◆ GetSaveFileNamePreviewA()

BOOL WINAPI GetSaveFileNamePreviewA ( LPOPENFILENAMEA  lpofn)

Definition at line 1692 of file msvideo_main.c.

1693{
1694 FIXME("(%p), semi-stub!\n", lpofn);
1695
1696 return GetFileNamePreview(lpofn, TRUE, FALSE);
1697}

◆ GetSaveFileNamePreviewW()

BOOL WINAPI GetSaveFileNamePreviewW ( LPOPENFILENAMEW  lpofn)

Definition at line 1702 of file msvideo_main.c.

1703{
1704 FIXME("(%p), semi-stub!\n", lpofn);
1705
1706 return GetFileNamePreview(lpofn, TRUE, TRUE);
1707}

◆ ICClose()

LRESULT WINAPI ICClose ( HIC  hic)

Definition at line 1245 of file msvideo_main.c.

1246{
1247 WINE_HIC* whic = MSVIDEO_GetHicPtr(hic);
1248 WINE_HIC** p;
1249
1250 TRACE("(%p)\n",hic);
1251
1252 if (!whic) return ICERR_BADHANDLE;
1253
1254 if (whic->driverproc)
1255 {
1256 MSVIDEO_SendMessage(whic, DRV_CLOSE, 0, 0);
1257 MSVIDEO_SendMessage(whic, DRV_DISABLE, 0, 0);
1258 MSVIDEO_SendMessage(whic, DRV_FREE, 0, 0);
1259 }
1260 else
1261 {
1262 CloseDriver(whic->hdrv, 0, 0);
1263 }
1264
1265 /* remove whic from list */
1266 for (p = &MSVIDEO_FirstHic; *p != NULL; p = &((*p)->next))
1267 {
1268 if ((*p) == whic)
1269 {
1270 *p = whic->next;
1271 break;
1272 }
1273 }
1274
1275 heap_free(whic);
1276 return 0;
1277}
LRESULT WINAPI CloseDriver(HDRVR hDrvr, LPARAM lParam1, LPARAM lParam2)
Definition: driver.c:462
GLfloat GLfloat p
Definition: glext.h:8902
#define DRV_CLOSE
Definition: mmsystem.h:122
#define DRV_FREE
Definition: mmsystem.h:124
#define DRV_DISABLE
Definition: mmsystem.h:123
static WINE_HIC * MSVIDEO_GetHicPtr(HIC hic)
Definition: msvideo_main.c:241
static LRESULT MSVIDEO_SendMessage(WINE_HIC *whic, UINT msg, DWORD_PTR lParam1, DWORD_PTR lParam2)
Definition: msvideo_main.c:137
static WINE_HIC * MSVIDEO_FirstHic
Definition: msvideo_main.c:104
struct tagWINE_HIC * next
DRIVERPROC driverproc
#define ICERR_BADHANDLE
Definition: vfw.h:63

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

◆ 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 797 of file msvideo_main.c.

802{
803 ICCOMPRESS iccmp;
804
805 TRACE("(%p,%d,%p,%p,%p,%p,...)\n",hic,dwFlags,lpbiOutput,lpData,lpbiInput,lpBits);
806
807 iccmp.dwFlags = dwFlags;
808
809 iccmp.lpbiOutput = lpbiOutput;
810 iccmp.lpOutput = lpData;
811 iccmp.lpbiInput = lpbiInput;
812 iccmp.lpInput = lpBits;
813
814 iccmp.lpckid = lpckid;
815 iccmp.lpdwFlags = lpdwFlags;
816 iccmp.lFrameNum = lFrameNum;
817 iccmp.dwFrameSize = dwFrameSize;
818 iccmp.dwQuality = dwQuality;
819 iccmp.lpbiPrev = lpbiPrev;
820 iccmp.lpPrev = lpPrev;
821 return ICSendMessage(hic,ICM_COMPRESS,(DWORD_PTR)&iccmp,sizeof(iccmp));
822}
LRESULT VFWAPI ICSendMessage(HIC hic, UINT msg, DWORD_PTR lParam1, DWORD_PTR lParam2)
LPBITMAPINFOHEADER lpbiInput
Definition: vfw.h:176
LONG lFrameNum
Definition: vfw.h:180
DWORD dwFrameSize
Definition: vfw.h:181
DWORD dwQuality
Definition: vfw.h:182
LPBITMAPINFOHEADER lpbiPrev
Definition: vfw.h:183
DWORD dwFlags
Definition: vfw.h:173
LPBITMAPINFOHEADER lpbiOutput
Definition: vfw.h:174
LPDWORD lpdwFlags
Definition: vfw.h:179
LPDWORD lpckid
Definition: vfw.h:178
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define ICM_COMPRESS
Definition: vfw.h:103
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

Referenced by AVICompressorIn_Receive(), AVIFILE_EncodeFrame(), and test_encode().

◆ ICCompressorChoose()

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

Definition at line 1097 of file msvideo_main.c.

1099{
1100 struct choose_compressor choose_comp;
1101 BOOL ret;
1102
1103 TRACE("(%p,%08x,%p,%p,%p,%s)\n", hwnd, uiFlags, pvIn, lpData, pc, lpszTitle);
1104
1105 if (!pc || pc->cbSize != sizeof(COMPVARS))
1106 return FALSE;
1107
1108 if (!(pc->dwFlags & ICMF_COMPVARS_VALID))
1109 {
1110 pc->dwFlags = 0;
1111 pc->fccType = pc->fccHandler = 0;
1112 pc->hic = NULL;
1113 pc->lpbiIn = NULL;
1114 pc->lpbiOut = NULL;
1115 pc->lpBitsOut = pc->lpBitsPrev = pc->lpState = NULL;
1116 pc->lQ = ICQUALITY_DEFAULT;
1117 pc->lKey = -1;
1118 pc->lDataRate = 300; /* kB */
1119 pc->lpState = NULL;
1120 pc->cbState = 0;
1121 }
1122 if (pc->fccType == 0)
1123 pc->fccType = ICTYPE_VIDEO;
1124
1125 choose_comp.cv = *pc;
1126 choose_comp.flags = uiFlags;
1127 choose_comp.title = lpszTitle;
1128
1130 icm_choose_compressor_dlgproc, (LPARAM)&choose_comp);
1131
1132 if (ret)
1133 {
1134 *pc = choose_comp.cv;
1136 }
1137
1138 return ret;
1139}
#define ICTYPE_VIDEO
Definition: mmreg.h:531
static INT_PTR CALLBACK icm_choose_compressor_dlgproc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: msvideo_main.c:912
#define ICM_CHOOSE_COMPRESSOR
Definition: vfw.h:817
LONG lKey
Definition: vfw.h:828
DWORD fccHandler
Definition: vfw.h:822
LONG cbSize
Definition: vfw.h:818
LONG lQ
Definition: vfw.h:830
HIC hic
Definition: vfw.h:820
LONG cbState
Definition: vfw.h:833
LONG lDataRate
Definition: vfw.h:829
#define ICQUALITY_DEFAULT
Definition: vfw.h:278
#define ICMF_COMPVARS_VALID
Definition: vfw.h:836
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by AVISaveOptionsFmtChoose().

◆ ICCompressorFree()

void VFWAPI ICCompressorFree ( PCOMPVARS  pc)

Definition at line 1145 of file msvideo_main.c.

1146{
1147 TRACE("(%p)\n", pc);
1148
1149 if (pc && pc->cbSize == sizeof(COMPVARS))
1150 {
1151 if (pc->hic)
1152 {
1153 ICClose(pc->hic);
1154 pc->hic = NULL;
1155 }
1156 heap_free(pc->lpbiIn);
1157 pc->lpbiIn = NULL;
1158 heap_free(pc->lpBitsOut);
1159 pc->lpBitsOut = NULL;
1160 heap_free(pc->lpBitsPrev);
1161 pc->lpBitsPrev = NULL;
1162 heap_free(pc->lpState);
1163 pc->lpState = NULL;
1164 pc->dwFlags = 0;
1165 }
1166}

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 827 of file msvideo_main.c.

829{
830 ICDECOMPRESS icd;
831 DWORD ret;
832
833 TRACE("(%p,%d,%p,%p,%p,%p)\n",hic,dwFlags,lpbiFormat,lpData,lpbi,lpBits);
834
835 icd.dwFlags = dwFlags;
836 icd.lpbiInput = lpbiFormat;
837 icd.lpInput = lpData;
838
839 icd.lpbiOutput = lpbi;
840 icd.lpOutput = lpBits;
841 icd.ckid = 0;
843
844 return ret;
845}
DWORD dwFlags
Definition: vfw.h:334
LPBITMAPINFOHEADER lpbiInput
Definition: vfw.h:335
DWORD ckid
Definition: vfw.h:339
LPBITMAPINFOHEADER lpbiOutput
Definition: vfw.h:337
#define ICM_DECOMPRESS
Definition: vfw.h:109

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 1228 of file msvideo_main.c.

1228 {
1229 ICDRAW icd;
1230
1231 TRACE("(%p,%d,%p,%p,%d,%d)\n",hic,dwFlags,lpFormat,lpData,cbData,lTime);
1232
1233 icd.dwFlags = dwFlags;
1234 icd.lpFormat = lpFormat;
1235 icd.lpData = lpData;
1236 icd.cbData = cbData;
1237 icd.lTime = lTime;
1238
1239 return ICSendMessage(hic,ICM_DRAW,(DWORD_PTR)&icd,sizeof(icd));
1240}
Definition: vfw.h:718
LONG lTime
Definition: vfw.h:723
DWORD cbData
Definition: vfw.h:722
LPVOID lpData
Definition: vfw.h:721
LPVOID lpFormat
Definition: vfw.h:720
DWORD dwFlags
Definition: vfw.h:719
LPCWSTR lpFormat
Definition: trayclock.cpp:32
#define ICM_DRAW
Definition: vfw.h:121

◆ 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 1182 of file msvideo_main.c.

1199{
1200
1201 ICDRAWBEGIN icdb;
1202
1203 TRACE("(%p,%d,%p,%p,%p,%u,%u,%u,%u,%p,%u,%u,%u,%u,%d,%d)\n",
1204 hic, dwFlags, hpal, hwnd, hdc, xDst, yDst, dxDst, dyDst,
1205 lpbi, xSrc, ySrc, dxSrc, dySrc, dwRate, dwScale);
1206
1207 icdb.dwFlags = dwFlags;
1208 icdb.hpal = hpal;
1209 icdb.hwnd = hwnd;
1210 icdb.hdc = hdc;
1211 icdb.xDst = xDst;
1212 icdb.yDst = yDst;
1213 icdb.dxDst = dxDst;
1214 icdb.dyDst = dyDst;
1215 icdb.lpbi = lpbi;
1216 icdb.xSrc = xSrc;
1217 icdb.ySrc = ySrc;
1218 icdb.dxSrc = dxSrc;
1219 icdb.dySrc = dySrc;
1220 icdb.dwRate = dwRate;
1221 icdb.dwScale = dwScale;
1222 return ICSendMessage(hic,ICM_DRAW_BEGIN,(DWORD_PTR)&icdb,sizeof(icdb));
1223}
HDC hdc
Definition: main.c:9
INT dyDst
Definition: vfw.h:702
INT yDst
Definition: vfw.h:700
DWORD dwRate
Definition: vfw.h:708
INT xSrc
Definition: vfw.h:704
HDC hdc
Definition: vfw.h:698
LPBITMAPINFOHEADER lpbi
Definition: vfw.h:703
INT dxDst
Definition: vfw.h:701
HPALETTE hpal
Definition: vfw.h:696
DWORD dwScale
Definition: vfw.h:709
DWORD dwFlags
Definition: vfw.h:695
HWND hwnd
Definition: vfw.h:697
INT ySrc
Definition: vfw.h:705
INT dxSrc
Definition: vfw.h:706
INT xDst
Definition: vfw.h:699
INT dySrc
Definition: vfw.h:707
#define ICM_DRAW_BEGIN
Definition: vfw.h:115

◆ ICGetDisplayFormat()

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

Definition at line 699 of file msvideo_main.c.

701{
702 HIC tmphic = hic;
703
704 TRACE("(%p, %p, %p, %d, %d, %d)\n", hic, in, out, depth, width, height);
705
706 if (!tmphic)
707 {
709 if (!tmphic)
710 return NULL;
711 }
712
713 if (ICDecompressQuery(tmphic, in, NULL))
714 goto err;
715
716 if (width <= 0 || height <= 0)
717 {
718 width = in->biWidth;
719 height = in->biHeight;
720 }
721
722 if (!depth)
723 depth = 32;
724
725 *out = *in;
726 out->biSize = sizeof(*out);
727 out->biWidth = width;
728 out->biHeight = height;
729 out->biCompression = BI_RGB;
730 out->biSizeImage = get_size_image(width, height, depth);
731
732 /* first try the given depth */
733 out->biBitCount = depth;
734 out->biSizeImage = get_size_image(width, height, out->biBitCount);
735 if (!ICDecompressQuery(tmphic, in, out))
736 {
737 if (depth == 8)
738 ICDecompressGetPalette(tmphic, in, out);
739 return tmphic;
740 }
741
742 /* then try 16, both with BI_RGB and BI_BITFIELDS */
743 if (depth <= 16)
744 {
745 out->biBitCount = 16;
746 out->biSizeImage = get_size_image(width, height, out->biBitCount);
747 if (!ICDecompressQuery(tmphic, in, out))
748 return tmphic;
749
750 out->biCompression = BI_BITFIELDS;
751 if (!ICDecompressQuery(tmphic, in, out))
752 return tmphic;
753 out->biCompression = BI_RGB;
754 }
755
756 /* then try 24 */
757 if (depth <= 24)
758 {
759 out->biBitCount = 24;
760 out->biSizeImage = get_size_image(width, height, out->biBitCount);
761 if (!ICDecompressQuery(tmphic, in, out))
762 return tmphic;
763 }
764
765 /* then try 32 */
766 if (depth <= 32)
767 {
768 out->biBitCount = 32;
769 out->biSizeImage = get_size_image(width, height, out->biBitCount);
770 if (!ICDecompressQuery(tmphic, in, out))
771 return tmphic;
772 }
773
774 /* as a last resort, try 32 bpp with the original width and height */
775 out->biWidth = in->biWidth;
776 out->biHeight = in->biHeight;
777 out->biBitCount = 32;
778 out->biSizeImage = get_size_image(out->biWidth, out->biHeight, out->biBitCount);
779 if (!ICDecompressQuery(tmphic, in, out))
780 return tmphic;
781
782 /* finally, ask the compressor for its default output format */
784 return tmphic;
785
786err:
787 if (hic != tmphic)
788 ICClose(tmphic);
789
790 return NULL;
791}
#define BI_RGB
Definition: precomp.h:47
GLuint in
Definition: glext.h:9616
HIC VFWAPI ICLocate(DWORD type, DWORD handler, BITMAPINFOHEADER *in, BITMAPINFOHEADER *out, WORD mode)
Definition: msvideo_main.c:633
static DWORD get_size_image(LONG width, LONG height, WORD depth)
Definition: msvideo_main.c:227
#define err(...)
static FILE * out
Definition: regtests2xml.c:44
#define ICMODE_DECOMPRESS
Definition: vfw.h:269
#define ICDecompressQuery(hic, lpbiInput, lpbiOutput)
Definition: vfw.h:377
#define ICDecompressGetPalette(hic, lpbiInput, lpbiOutput)
Definition: vfw.h:392
#define ICM_DECOMPRESS_GET_FORMAT
Definition: vfw.h:106

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

◆ ICGetInfo()

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

Definition at line 594 of file msvideo_main.c.

595{
596 LRESULT ret;
597 WINE_HIC* whic = MSVIDEO_GetHicPtr(hic);
598
599 TRACE("(%p,%p,%d)\n", hic, picinfo, cb);
600
601 if (!whic) return ICERR_BADHANDLE;
602 if (!picinfo) return MMSYSERR_INVALPARAM;
603
604 /* (WS) The field szDriver should be initialized because the driver
605 * is not obliged and often will not do it. Some applications, like
606 * VirtualDub, rely on this field and will occasionally crash if it
607 * goes uninitialized.
608 */
609 if (cb >= sizeof(ICINFO)) picinfo->szDriver[0] = '\0';
610
611 ret = ICSendMessage(hic, ICM_GETINFO, (DWORD_PTR)picinfo, cb);
612
613 /* (WS) When szDriver was not supplied by the driver itself, apparently
614 * Windows will set its value equal to the driver file name. This can
615 * be obtained from the registry as we do here.
616 */
617 if (cb >= sizeof(ICINFO) && picinfo->szDriver[0] == 0)
618 {
619 ICINFO ii;
620
621 memset(&ii, 0, sizeof(ii));
622 ii.dwSize = sizeof(ii);
623 ICInfo(picinfo->fccType, picinfo->fccHandler, &ii);
624 lstrcpyW(picinfo->szDriver, ii.szDriver);
625 }
626
627 return ret;
628}
#define lstrcpyW
Definition: compat.h:749
#define MMSYSERR_INVALPARAM
Definition: mmsystem.h:107
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
#define memset(x, y, z)
Definition: compat.h:39
WCHAR szDriver[128]
Definition: vfw.h:292
DWORD dwSize
Definition: vfw.h:281
#define ICM_GETINFO
Definition: vfw.h:82
LONG_PTR LRESULT
Definition: windef.h:209

Referenced by AVISaveOptionsUpdate(), enum_compressors(), fill_format_info(), 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 1284 of file msvideo_main.c.

1289{
1290 FIXME("(%p,%08x,%p,%p,%p,%d,%p)\n",
1291 hic, uiFlags, lpbiIn, lpBits, lpbiOut, lQuality, plSize);
1292
1293 return NULL;
1294}

◆ ICImageDecompress()

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

Definition at line 1300 of file msvideo_main.c.

1303{
1304 HGLOBAL hMem = NULL;
1305 BYTE* pMem = NULL;
1306 BOOL bReleaseIC = FALSE;
1307 BYTE* pHdr = NULL;
1308 ULONG cbHdr = 0;
1309 BOOL bSucceeded = FALSE;
1310 BOOL bInDecompress = FALSE;
1311 DWORD biSizeImage;
1312
1313 TRACE("(%p,%08x,%p,%p,%p)\n",
1314 hic, uiFlags, lpbiIn, lpBits, lpbiOut);
1315
1316 if ( hic == NULL )
1317 {
1318 hic = ICDecompressOpen( ICTYPE_VIDEO, 0, &lpbiIn->bmiHeader, (lpbiOut != NULL) ? &lpbiOut->bmiHeader : NULL );
1319 if ( hic == NULL )
1320 {
1321 WARN("no handler\n" );
1322 goto err;
1323 }
1324 bReleaseIC = TRUE;
1325 }
1326 if ( uiFlags != 0 )
1327 {
1328 FIXME( "unknown flag %08x\n", uiFlags );
1329 goto err;
1330 }
1331 if ( lpbiIn == NULL || lpBits == NULL )
1332 {
1333 WARN("invalid argument\n");
1334 goto err;
1335 }
1336
1337 if ( lpbiOut != NULL )
1338 {
1339 if ( lpbiOut->bmiHeader.biSize != sizeof(BITMAPINFOHEADER) )
1340 goto err;
1341 cbHdr = sizeof(BITMAPINFOHEADER);
1342 if ( lpbiOut->bmiHeader.biCompression == 3 )
1343 cbHdr += sizeof(DWORD)*3;
1344 else
1345 if ( lpbiOut->bmiHeader.biBitCount <= 8 )
1346 {
1347 if ( lpbiOut->bmiHeader.biClrUsed == 0 )
1348 cbHdr += sizeof(RGBQUAD) * (1<<lpbiOut->bmiHeader.biBitCount);
1349 else
1350 cbHdr += sizeof(RGBQUAD) * lpbiOut->bmiHeader.biClrUsed;
1351 }
1352 }
1353 else
1354 {
1355 TRACE( "get format\n" );
1356
1357 cbHdr = ICDecompressGetFormatSize(hic,lpbiIn);
1358 if ( cbHdr < sizeof(BITMAPINFOHEADER) )
1359 goto err;
1360 if (!(pHdr = heap_alloc_zero(cbHdr + sizeof(RGBQUAD) * 256)))
1361 goto err;
1362 if ( ICDecompressGetFormat( hic, lpbiIn, pHdr ) != ICERR_OK )
1363 goto err;
1364 lpbiOut = (BITMAPINFO*)pHdr;
1365 if ( lpbiOut->bmiHeader.biBitCount <= 8 &&
1366 ICDecompressGetPalette( hic, lpbiIn, lpbiOut ) != ICERR_OK &&
1367 lpbiIn->bmiHeader.biBitCount == lpbiOut->bmiHeader.biBitCount )
1368 {
1369 if ( lpbiIn->bmiHeader.biClrUsed == 0 )
1370 memcpy( lpbiOut->bmiColors, lpbiIn->bmiColors, sizeof(RGBQUAD)*(1<<lpbiOut->bmiHeader.biBitCount) );
1371 else
1372 memcpy( lpbiOut->bmiColors, lpbiIn->bmiColors, sizeof(RGBQUAD)*lpbiIn->bmiHeader.biClrUsed );
1373 }
1374 if ( lpbiOut->bmiHeader.biBitCount <= 8 &&
1375 lpbiOut->bmiHeader.biClrUsed == 0 )
1376 lpbiOut->bmiHeader.biClrUsed = 1<<lpbiOut->bmiHeader.biBitCount;
1377
1378 lpbiOut->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
1379 cbHdr = sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*lpbiOut->bmiHeader.biClrUsed;
1380 }
1381
1382 biSizeImage = lpbiOut->bmiHeader.biSizeImage;
1383 if ( biSizeImage == 0 )
1384 biSizeImage = get_size_image(lpbiOut->bmiHeader.biWidth, lpbiOut->bmiHeader.biHeight, lpbiOut->bmiHeader.biBitCount);
1385
1386 TRACE( "call ICDecompressBegin\n" );
1387
1388 if ( ICDecompressBegin( hic, lpbiIn, lpbiOut ) != ICERR_OK )
1389 goto err;
1390 bInDecompress = TRUE;
1391
1392 TRACE( "cbHdr %d, biSizeImage %d\n", cbHdr, biSizeImage );
1393
1394 hMem = GlobalAlloc( GMEM_MOVEABLE|GMEM_ZEROINIT, cbHdr + biSizeImage );
1395 if ( hMem == NULL )
1396 {
1397 WARN( "out of memory\n" );
1398 goto err;
1399 }
1400 pMem = GlobalLock( hMem );
1401 if ( pMem == NULL )
1402 goto err;
1403 memcpy( pMem, lpbiOut, cbHdr );
1404
1405 TRACE( "call ICDecompress\n" );
1406 if ( ICDecompress( hic, 0, &lpbiIn->bmiHeader, lpBits, &lpbiOut->bmiHeader, pMem+cbHdr ) != ICERR_OK )
1407 goto err;
1408
1409 bSucceeded = TRUE;
1410err:
1411 if ( bInDecompress )
1412 ICDecompressEnd( hic );
1413 if ( bReleaseIC )
1414 ICClose(hic);
1415 heap_free(pHdr);
1416 if ( pMem != NULL )
1417 GlobalUnlock( hMem );
1418 if ( !bSucceeded && hMem != NULL )
1419 {
1420 GlobalFree(hMem); hMem = NULL;
1421 }
1422
1423 return hMem;
1424}
#define WARN(fmt,...)
Definition: debug.h:112
ULONG RGBQUAD
Definition: precomp.h:50
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
DWORD VFWAPIV ICDecompress(HIC hic, DWORD dwFlags, LPBITMAPINFOHEADER lpbiFormat, LPVOID lpData, LPBITMAPINFOHEADER lpbi, LPVOID lpBits)
Definition: msvideo_main.c:827
USHORT biBitCount
Definition: precomp.h:37
RGBQUAD bmiColors[1]
Definition: wingdi.h:1477
uint32_t ULONG
Definition: typedefs.h:59
#define ICDecompressOpen(fccType, fccHandler, lpbiIn, lpbiOut)
Definition: vfw.h:535
#define ICDecompressBegin(hic, lpbiInput, lpbiOutput)
Definition: vfw.h:371
#define ICDecompressGetFormatSize(hic, lpbi)
Definition: vfw.h:389
#define ICDecompressGetFormat(hic, lpbiInput, lpbiOutput)
Definition: vfw.h:383
#define ICDecompressEnd(hic)
Definition: vfw.h:404
#define GMEM_ZEROINIT
Definition: winbase.h:306
#define GMEM_MOVEABLE
Definition: winbase.h:294
unsigned char BYTE
Definition: xxhash.c:193

◆ ICInfo()

BOOL VFWAPI ICInfo ( DWORD  type,
DWORD  handler,
ICINFO info 
)

Definition at line 270 of file msvideo_main.c.

271{
272 char name_buf[10], buf[2048];
273 DWORD ret_type, ret_handler;
274 struct reg_driver *driver;
275 DWORD i, count = 0;
276 LONG res;
277 HKEY key;
278
279 TRACE("type %s, handler %s, info %p.\n",
281
282 memset(info, 0, sizeof(*info));
283 info->dwSize = sizeof(*info);
284 info->dwVersionICM = ICVERSION;
285
287 {
288 i = 0;
289 for (;;)
290 {
291 DWORD name_len = ARRAY_SIZE(name_buf), driver_len = ARRAY_SIZE(info->szDriver);
292
293 res = RegEnumValueA(key, i++, name_buf, &name_len, 0, 0, (BYTE *)buf, &driver_len);
294 if (res == ERROR_NO_MORE_ITEMS) break;
295
296 if (name_len != 9 || name_buf[4] != '.') continue;
297 ret_type = mmioStringToFOURCCA(name_buf, 0);
298 ret_handler = mmioStringToFOURCCA(name_buf + 5, 0);
299 if (type && compare_fourcc(type, ret_type)) continue;
300 if (compare_fourcc(handler, ret_handler) && handler != count++) continue;
301
302 info->fccType = ret_type;
303 info->fccHandler = ret_handler;
304 MultiByteToWideChar(CP_ACP, 0, buf, -1, info->szDriver, ARRAY_SIZE(info->szDriver));
305 TRACE("Returning codec %s, driver %s.\n", debugstr_a(name_buf), debugstr_a(buf));
306 return TRUE;
307 }
309 }
310
311 if (GetPrivateProfileSectionA("drivers32", buf, sizeof(buf), "system.ini"))
312 {
313 char *s;
314 for (s = buf; *s; s += strlen(s) + 1)
315 {
316 if (s[4] != '.' || s[9] != '=') continue;
317 ret_type = mmioStringToFOURCCA(s, 0);
318 ret_handler = mmioStringToFOURCCA(s + 5, 0);
319 if (type && compare_fourcc(type, ret_type)) continue;
320 if (compare_fourcc(handler, ret_handler) && handler != count++) continue;
321
322 info->fccType = ret_type;
323 info->fccHandler = ret_handler;
324 MultiByteToWideChar(CP_ACP, 0, s + 10, -1, info->szDriver, ARRAY_SIZE(info->szDriver));
325 TRACE("Returning codec %s, driver %s.\n", debugstr_an(s, 8), debugstr_a(s + 10));
326 return TRUE;
327 }
328 }
329
331 {
332 if (type && compare_fourcc(type, driver->fccType)) continue;
333 if (compare_fourcc(handler, driver->fccHandler) && handler != count++) continue;
334 if (driver->proc(0, NULL, ICM_GETINFO, (DWORD_PTR)info, sizeof(*info)) == sizeof(*info))
335 return TRUE;
336 }
337
338 info->fccType = type;
339 info->fccHandler = handler;
340 WARN("No driver found for codec %s.%s.\n", wine_dbgstr_fcc(type), wine_dbgstr_fcc(handler));
341 return FALSE;
342}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define ARRAY_SIZE(A)
Definition: main.h:33
#define RegCloseKey(hKey)
Definition: registry.h:49
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3327
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:2697
#define CP_ACP
Definition: compat.h:109
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:55
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
#define MultiByteToWideChar
Definition: compat.h:110
INT WINAPI GetPrivateProfileSectionA(LPCSTR section, LPSTR buffer, DWORD len, LPCSTR filename)
Definition: profile.c:1381
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7482
FOURCC WINAPI mmioStringToFOURCCA(LPCSTR sz, UINT uFlags)
Definition: mmio.c:1025
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble s
Definition: gl.h:2039
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint res
Definition: glext.h:9613
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
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
#define compare_fourcc(fcc1, fcc2)
Definition: iccvid.c:61
uint32_t entry
Definition: isohybrid.c:63
#define debugstr_a
Definition: kernel32.h:31
struct @1665::@1666 driver
static struct list reg_driver_list
Definition: msvideo_main.c:114
#define HKLM_DRIVERS32
Definition: msvideo_main.c:48
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
long LONG
Definition: pedump.c:60
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
Definition: copy.c:22
#define ICVERSION
Definition: vfw.h:45
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

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

◆ ICInstall()

BOOL VFWAPI ICInstall ( DWORD  type,
DWORD  handler,
LPARAM  lparam,
char desc,
UINT  flags 
)

Definition at line 349 of file msvideo_main.c.

350{
351 struct reg_driver *driver;
352
353 TRACE("type %s, handler %s, lparam %#lx, desc %s, flags %#x.\n",
355
357 {
358 if (!compare_fourcc(type, driver->fccType)
359 && !compare_fourcc(handler, driver->fccHandler))
360 {
361 return FALSE;
362 }
363 }
364
365 switch (flags)
366 {
368 if (!(driver = heap_alloc_zero(sizeof(*driver))))
369 return FALSE;
370 driver->fccType = type;
371 driver->fccHandler = handler;
372 driver->proc = (DRIVERPROC)lparam;
374 return TRUE;
375 case ICINSTALL_DRIVER:
376 {
377 const char *driver = (const char *)lparam;
378 char value[10];
379 HKEY key;
380 LONG res;
381
383 return FALSE;
385 value[4] = '.';
387 value[9] = 0;
388 res = RegSetValueExA(key, value, 0, REG_SZ, (const BYTE *)driver, strlen(driver) + 1);
390 return !res;
391 }
392 default:
393 FIXME("Unhandled flags %#x.\n", flags);
394 return FALSE;
395 }
396}
@ lparam
Definition: SystemMenu.c:31
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4828
GLbitfield flags
Definition: glext.h:7161
#define REG_SZ
Definition: layer.c:22
LRESULT(CALLBACK * DRIVERPROC)(DWORD_PTR, HDRVR, UINT, LPARAM, LPARAM)
Definition: mmsystem.h:1001
static const WCHAR desc[]
Definition: protectdata.c:36
#define KEY_SET_VALUE
Definition: nt_native.h:1017
Definition: pdh_main.c:94
#define ICINSTALL_DRIVER
Definition: vfw.h:626
#define ICINSTALL_FUNCTION
Definition: vfw.h:625

Referenced by test_ICGetDisplayFormat(), and test_ICInfo().

◆ ICLocate()

HIC VFWAPI ICLocate ( DWORD  type,
DWORD  handler,
BITMAPINFOHEADER in,
BITMAPINFOHEADER out,
WORD  mode 
)

Definition at line 633 of file msvideo_main.c.

635{
636 ICINFO info = {sizeof(info)};
637 UINT msg;
638 HIC hic;
639 DWORD i;
640
641 TRACE("type %s, handler %s, in %p, out %p, mode %u.\n",
643
644 switch (mode)
645 {
647 case ICMODE_COMPRESS:
649 break;
653 break;
654 case ICMODE_DRAW:
656 break;
657 default:
658 FIXME("Unhandled mode %#x.\n", mode);
659 return 0;
660 }
661
662 if ((hic = ICOpen(type, handler, mode)))
663 {
664 if (!ICSendMessage(hic, msg, (DWORD_PTR)in, (DWORD_PTR)out))
665 {
666 TRACE("Found codec %s.%s.\n", wine_dbgstr_fcc(type),
668 return hic;
669 }
670 ICClose(hic);
671 }
672
673 for (i = 0; ICInfo(type, i, &info); ++i)
674 {
675 if ((hic = ICOpen(info.fccType, info.fccHandler, mode)))
676 {
677 if (!ICSendMessage(hic, msg, (DWORD_PTR)in, (DWORD_PTR)out))
678 {
679 TRACE("Found codec %s.%s.\n", wine_dbgstr_fcc(info.fccType),
680 wine_dbgstr_fcc(info.fccHandler));
681 return hic;
682 }
683 ICClose(hic);
684 }
685 }
686
687 if (type == streamtypeVIDEO)
689
690 WARN("Could not find a driver for codec %s.%s.\n",
692
693 return 0;
694}
#define msg(x)
Definition: auth_time.c:54
#define streamtypeVIDEO
Definition: aviriff.h:92
GLenum mode
Definition: glext.h:6217
#define ICM_DRAW_QUERY
Definition: vfw.h:114
#define ICMODE_FASTCOMPRESS
Definition: vfw.h:272
#define ICM_COMPRESS_QUERY
Definition: vfw.h:101
#define ICM_DECOMPRESS_QUERY
Definition: vfw.h:107
#define ICMODE_FASTDECOMPRESS
Definition: vfw.h:270
#define ICMODE_DRAW
Definition: vfw.h:273

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

◆ icm_choose_compressor_dlgproc()

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

Definition at line 912 of file msvideo_main.c.

913{
914 switch (msg)
915 {
916 case WM_INITDIALOG:
917 {
918 struct codec_info *ic;
919 WCHAR buf[128];
920 struct choose_compressor *choose_comp = (struct choose_compressor *)lparam;
921
923
924 /* FIXME */
926
927 if (choose_comp->title)
928 SetWindowTextA(hdlg, choose_comp->title);
929
930 if (!(choose_comp->flags & ICMF_CHOOSE_DATARATE))
931 {
935 }
936
937 if (!(choose_comp->flags & ICMF_CHOOSE_KEYFRAME))
938 {
942 }
943
944 /* FIXME */
947
948 /*if (!(choose_comp->flags & ICMF_CHOOSE_PREVIEW))
949 ShowWindow(GetDlgItem(hdlg, IDC_PREVIEW), SW_HIDE);*/
950
953
954 ic = heap_alloc(sizeof(*ic));
957 ic->hic = 0;
959
960 enum_compressors(GetDlgItem(hdlg, IDC_COMP_LIST), &choose_comp->cv, choose_comp->flags & ICMF_CHOOSE_ALLCOMPRESSORS);
961
964
965 SetWindowLongPtrW(hdlg, DWLP_USER, (ULONG_PTR)choose_comp);
966 break;
967 }
968
969 case WM_COMMAND:
970 switch (LOWORD(wparam))
971 {
972 case IDC_COMP_LIST:
973 {
974 INT cur_sel;
975 struct codec_info *ic;
976 BOOL can_configure = FALSE, can_about = FALSE;
977 struct choose_compressor *choose_comp;
978
980 break;
981
982 choose_comp = (struct choose_compressor *)GetWindowLongPtrW(hdlg, DWLP_USER);
983
984 cur_sel = SendMessageW((HWND)lparam, CB_GETCURSEL, 0, 0);
985
986 ic = (struct codec_info *)SendMessageW((HWND)lparam, CB_GETITEMDATA, cur_sel, 0);
987 if (ic && ic->hic)
988 {
989 if (ICQueryConfigure(ic->hic) == DRVCNF_OK)
990 can_configure = TRUE;
991 if (ICQueryAbout(ic->hic) == DRVCNF_OK)
992 can_about = TRUE;
993 }
994 EnableWindow(GetDlgItem(hdlg, IDC_CONFIGURE), can_configure);
995 EnableWindow(GetDlgItem(hdlg, IDC_ABOUT), can_about);
996
997 if (choose_comp->flags & ICMF_CHOOSE_DATARATE)
998 {
999 /* FIXME */
1000 }
1001 if (choose_comp->flags & ICMF_CHOOSE_KEYFRAME)
1002 {
1003 /* FIXME */
1004 }
1005
1006 break;
1007 }
1008
1009 case IDC_CONFIGURE:
1010 case IDC_ABOUT:
1011 {
1013 INT cur_sel;
1014 struct codec_info *ic;
1015
1016 if (HIWORD(wparam) != BN_CLICKED)
1017 break;
1018
1019 cur_sel = SendMessageW(list, CB_GETCURSEL, 0, 0);
1020
1021 ic = (struct codec_info *)SendMessageW(list, CB_GETITEMDATA, cur_sel, 0);
1022 if (ic && ic->hic)
1023 {
1024 if (LOWORD(wparam) == IDC_CONFIGURE)
1025 ICConfigure(ic->hic, hdlg);
1026 else
1027 ICAbout(ic->hic, hdlg);
1028 }
1029
1030 break;
1031 }
1032
1033 case IDOK:
1034 {
1036 INT cur_sel;
1037 struct codec_info *ic;
1038
1039 if (HIWORD(wparam) != BN_CLICKED)
1040 break;
1041
1042 cur_sel = SendMessageW(list, CB_GETCURSEL, 0, 0);
1043 ic = (struct codec_info *)SendMessageW(list, CB_GETITEMDATA, cur_sel, 0);
1044 if (ic)
1045 {
1046 struct choose_compressor *choose_comp = (struct choose_compressor *)GetWindowLongPtrW(hdlg, DWLP_USER);
1047
1048 choose_comp->cv.hic = ic->hic;
1049 choose_comp->cv.fccType = ic->icinfo.fccType;
1050 choose_comp->cv.fccHandler = ic->icinfo.fccHandler;
1051 /* FIXME: fill everything else */
1052
1053 /* prevent closing the codec handle below */
1054 ic->hic = 0;
1055 }
1056 }
1057 /* fall through */
1058 case IDCANCEL:
1059 {
1061 INT idx = 0;
1062
1063 if (HIWORD(wparam) != BN_CLICKED)
1064 break;
1065
1066 while (1)
1067 {
1068 struct codec_info *ic;
1069
1070 ic = (struct codec_info *)SendMessageW(list, CB_GETITEMDATA, idx++, 0);
1071
1072 if (!ic || (LONG_PTR)ic == CB_ERR) break;
1073
1074 if (ic->hic) ICClose(ic->hic);
1075 heap_free(ic);
1076 }
1077
1078 EndDialog(hdlg, LOWORD(wparam) == IDOK);
1079 break;
1080 }
1081
1082 default:
1083 break;
1084 }
1085 break;
1086
1087 default:
1088 break;
1089 }
1090
1091 return FALSE;
1092}
@ wparam
Definition: SystemMenu.c:30
#define IDC_COMP_LIST
Definition: resource.h:7
#define IDC_CONFIGURE
Definition: resource.h:28
#define DRVCNF_OK
Definition: mmsystem.h:134
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
static BOOL enum_compressors(HWND list, COMPVARS *pcv, BOOL enum_all)
Definition: msvideo_main.c:861
#define IDC_QUALITY_SCROLL
#define IDC_KEYFRAME_FRAMES
#define IDC_DATARATE_CHECKBOX
#define IDC_QUALITY_TXT
#define IDS_FULLFRAMES
#define IDC_DATARATE
#define IDC_KEYFRAME
#define IDC_ABOUT
#define IDC_DATARATE_KB
#define IDC_KEYFRAME_CHECKBOX
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define comptypeDIB
Definition: vfw.h:147
#define ICAbout(hic, hwnd)
Definition: vfw.h:316
#define ICQueryAbout(hic)
Definition: vfw.h:313
#define ICMF_CHOOSE_KEYFRAME
Definition: vfw.h:848
#define ICQueryConfigure(hic)
Definition: vfw.h:320
#define ICConfigure(hic, hwnd)
Definition: vfw.h:323
#define ICMF_CHOOSE_DATARATE
Definition: vfw.h:849
#define ICMF_CHOOSE_ALLCOMPRESSORS
Definition: vfw.h:851
#define SW_HIDE
Definition: winuser.h:767
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
#define DWLP_USER
Definition: winuser.h:871
#define GetWindowLongPtrW
Definition: winuser.h:4828
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDCANCEL
Definition: winuser.h:830
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define CBN_SETFOCUS
Definition: winuser.h:1981
#define WM_COMMAND
Definition: winuser.h:1739
#define CB_ERR
Definition: winuser.h:2434
#define CB_SETCURSEL
Definition: winuser.h:1960
#define WM_INITDIALOG
Definition: winuser.h:1738
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:829
#define CBN_SELCHANGE
Definition: winuser.h:1978
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define CB_GETITEMDATA
Definition: winuser.h:1949
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define BN_CLICKED
Definition: winuser.h:1924
#define CB_GETCURSEL
Definition: winuser.h:1942
#define SetWindowLongPtrW
Definition: winuser.h:5345
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by ICCompressorChoose().

◆ ICOpen()

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

Definition at line 441 of file msvideo_main.c.

442{
443 WCHAR codecname[10];
444 ICOPEN icopen;
445 WINE_HIC* whic;
446 static const WCHAR drv32W[] = {'d','r','i','v','e','r','s','3','2','\0'};
447 struct reg_driver *driver;
448 HDRVR hdrv = NULL;
449
450 TRACE("(%s,%s,0x%08x)\n", wine_dbgstr_fcc(fccType), wine_dbgstr_fcc(fccHandler), wMode);
451
452 if (!fccHandler) /* No specific handler, return the first valid for wMode */
453 {
454 HIC local;
455 ICINFO info;
456 DWORD loop = 0;
457 info.dwSize = sizeof(info);
458 while(ICInfo(fccType, loop++, &info))
459 {
460 /* Ensure fccHandler is not 0x0 because we will recurse on ICOpen */
461 if(!info.fccHandler)
462 continue;
463 local = ICOpen(fccType, info.fccHandler, wMode);
464 if (local != 0)
465 {
466 TRACE("Returning %s as default handler for %s\n",
468 return local;
469 }
470 }
471 }
472
474 {
475 if (!compare_fourcc(fccType, driver->fccType)
476 && !compare_fourcc(fccHandler, driver->fccHandler))
477 {
478 return ICOpenFunction(driver->fccType, driver->fccHandler, wMode, driver->proc);
479 }
480 }
481
482 /* Well, lParam2 is in fact a LPVIDEO_OPEN_PARMS, but it has the
483 * same layout as ICOPEN
484 */
485 icopen.dwSize = sizeof(ICOPEN);
486 icopen.fccType = fccType;
487 icopen.fccHandler = fccHandler;
488 icopen.dwVersion = 0x00001000; /* FIXME */
489 icopen.dwFlags = wMode;
490 icopen.dwError = 0;
491 icopen.pV1Reserved = NULL;
492 icopen.pV2Reserved = NULL;
493 icopen.dnDevNode = 0; /* FIXME */
494
495 if (!hdrv)
496 {
497 /* normalize to lower case as in 'vidc' */
498 ((char*)&fccType)[0] = tolower(((char*)&fccType)[0]);
499 ((char*)&fccType)[1] = tolower(((char*)&fccType)[1]);
500 ((char*)&fccType)[2] = tolower(((char*)&fccType)[2]);
501 ((char*)&fccType)[3] = tolower(((char*)&fccType)[3]);
502 icopen.fccType = fccType;
503 /* Seek the driver in the registry */
504 fourcc_to_string(codecname, fccType);
505 codecname[4] = '.';
506 fourcc_to_string(codecname + 5, fccHandler);
507 codecname[9] = '\0';
508
509 hdrv = OpenDriver(codecname, drv32W, (LPARAM)&icopen);
510 if (!hdrv)
511 return 0;
512 }
513
514 if (!(whic = heap_alloc(sizeof(*whic))))
515 {
516 CloseDriver(hdrv, 0, 0);
517 return FALSE;
518 }
519 whic->hdrv = hdrv;
520 whic->driverproc = NULL;
521 whic->type = fccType;
522 whic->handler = fccHandler;
524 whic->hic = (HIC)(ULONG_PTR)IC_HandleRef++;
525 whic->next = MSVIDEO_FirstHic;
526 MSVIDEO_FirstHic = whic;
527
528 TRACE("=> %p\n", whic->hic);
529 return whic->hic;
530}
int tolower(int c)
Definition: utclib.c:902
HDRVR WINAPI OpenDriver(LPCWSTR lpDriverName, LPCWSTR lpSectionName, LPARAM lParam)
Definition: driver.c:400
#define local
Definition: zutil.h:30
HIC VFWAPI ICOpenFunction(DWORD fccType, DWORD fccHandler, UINT wMode, DRIVERPROC lpfnHandler)
Definition: msvideo_main.c:535
static DWORD IC_HandleRef
Definition: msvideo_main.c:344
Definition: vfw.h:157
LRESULT dwError
Definition: vfw.h:163
LPVOID pV1Reserved
Definition: vfw.h:164
DWORD dnDevNode
Definition: vfw.h:166
LPVOID pV2Reserved
Definition: vfw.h:165
DWORD dwSize
Definition: vfw.h:158
DWORD dwVersion
Definition: vfw.h:161
DWORD fccHandler
Definition: vfw.h:160
DWORD dwFlags
Definition: vfw.h:162
DWORD fccType
Definition: vfw.h:159
DWORD fccHandler
Definition: msvideo_main.c:109
DWORD fccType
Definition: msvideo_main.c:108

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

◆ ICOpenFunction()

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

Definition at line 535 of file msvideo_main.c.

536{
537 ICOPEN icopen;
538 WINE_HIC* whic;
539
540 TRACE("(%s,%s,%d,%p)\n",
541 wine_dbgstr_fcc(fccType), wine_dbgstr_fcc(fccHandler), wMode, lpfnHandler);
542
543 icopen.dwSize = sizeof(ICOPEN);
544 icopen.fccType = fccType;
545 icopen.fccHandler = fccHandler;
546 icopen.dwVersion = ICVERSION;
547 icopen.dwFlags = wMode;
548 icopen.dwError = 0;
549 icopen.pV1Reserved = NULL;
550 icopen.pV2Reserved = NULL;
551 icopen.dnDevNode = 0; /* FIXME */
552
553 if (!(whic = heap_alloc(sizeof(*whic))))
554 return NULL;
555
556 whic->driverproc = lpfnHandler;
558 whic->hic = (HIC)(ULONG_PTR)IC_HandleRef++;
559 whic->next = MSVIDEO_FirstHic;
560 MSVIDEO_FirstHic = whic;
561
562 /* Now try opening/loading the driver. Taken from DRIVER_AddToList */
563 /* What if the function is used more than once? */
564
565 if (MSVIDEO_SendMessage(whic, DRV_LOAD, 0L, 0L) != DRV_SUCCESS)
566 {
567 WARN("DRV_LOAD failed for hic %p\n", whic->hic);
568 MSVIDEO_FirstHic = whic->next;
569 heap_free(whic);
570 return 0;
571 }
572 /* return value is not checked */
574
575 whic->driverId = (DWORD)MSVIDEO_SendMessage(whic, DRV_OPEN, 0, (DWORD_PTR)&icopen);
576 /* FIXME: What should we put here? */
577 whic->hdrv = NULL;
578
579 if (whic->driverId == 0)
580 {
581 WARN("DRV_OPEN failed for hic %p\n", whic->hic);
582 MSVIDEO_FirstHic = whic->next;
583 heap_free(whic);
584 return 0;
585 }
586
587 TRACE("=> %p\n", whic->hic);
588 return whic->hic;
589}
#define DRV_LOAD(x)
#define DRV_SUCCESS
Definition: mmsystem.h:18
#define DRV_ENABLE
Definition: mmsystem.h:120
#define DRV_OPEN
Definition: mmsystem.h:121
#define L(x)
Definition: ntvdm.h:50

Referenced by ICOpen().

◆ ICRemove()

BOOL VFWAPI ICRemove ( DWORD  type,
DWORD  handler,
UINT  flags 
)

Definition at line 401 of file msvideo_main.c.

402{
403 struct reg_driver *driver;
404 char value[10];
405 HKEY key;
406 LONG res;
407
408 TRACE("type %s, handler %s, flags %#x.\n",
410
412 {
413 if (!compare_fourcc(type, driver->fccType)
414 && !compare_fourcc(handler, driver->fccHandler))
415 {
416 list_remove(&driver->entry);
418 return TRUE;
419 }
420 }
421
423 {
425 value[4] = '.';
427 value[9] = 0;
430 return !res;
431 }
432
433 return FALSE;
434}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
LONG WINAPI RegDeleteValueA(HKEY hKey, LPCSTR lpValueName)
Definition: reg.c:2325

Referenced by test_ICGetDisplayFormat(), and test_ICInfo().

◆ ICSendMessage()

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

◆ ICSeqCompressFrame()

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

Definition at line 1429 of file msvideo_main.c.

1430{
1431 ICCOMPRESS* icComp = pc->lpState;
1432 DWORD ret;
1433 TRACE("(%p, 0x%08x, %p, %p, %p)\n", pc, uiFlags, lpBits, pfKey, plSize);
1434
1435 if (pc->cbState != sizeof(ICCOMPRESS))
1436 {
1437 ERR("Invalid cbState %i\n", pc->cbState);
1438 return NULL;
1439 }
1440
1441 if (!pc->lKeyCount++)
1442 icComp->dwFlags = ICCOMPRESS_KEYFRAME;
1443 else
1444 {
1445 if (pc->lKey && pc->lKeyCount == (pc->lKey - 1))
1446 /* No key frames if pc->lKey == 0 */
1447 pc->lKeyCount = 0;
1448 icComp->dwFlags = 0;
1449 }
1450
1451 icComp->lpInput = lpBits;
1452 icComp->lFrameNum = pc->lFrame++;
1453 icComp->lpOutput = pc->lpBitsOut;
1454 icComp->lpPrev = pc->lpBitsPrev;
1455 ret = ICSendMessage(pc->hic, ICM_COMPRESS, (DWORD_PTR)icComp, sizeof(*icComp));
1456
1457 if (ret == ICERR_OK)
1458 {
1459 LPVOID oldprev, oldout;
1460
1461 if (icComp->dwFlags & AVIIF_KEYFRAME)
1462 {
1463 pc->lKeyCount = 1;
1464 *pfKey = TRUE;
1465 TRACE("Key frame\n");
1466 }
1467 else
1468 *pfKey = FALSE;
1469
1470 *plSize = icComp->lpbiOutput->biSizeImage;
1471
1472 /* We shift Prev and Out, so we don't have to allocate and release memory */
1473 oldprev = pc->lpBitsPrev;
1474 oldout = pc->lpBitsOut;
1475 pc->lpBitsPrev = oldout;
1476 pc->lpBitsOut = oldprev;
1477
1478 TRACE("returning: %p, compressed frame size %u\n", icComp->lpOutput, *plSize);
1479 return icComp->lpOutput;
1480 }
1481 return NULL;
1482}
#define AVIIF_KEYFRAME
Definition: aviriff.h:131
#define ERR(fmt,...)
Definition: debug.h:110
DWORD biSizeImage
Definition: amvideo.idl:36
LONG lKeyCount
Definition: vfw.h:831
LONG lFrame
Definition: vfw.h:827
#define ICCOMPRESS_KEYFRAME
Definition: vfw.h:170

Referenced by test_ICSeqCompress().

◆ ICSeqCompressFrameEnd()

void VFWAPI ICSeqCompressFrameEnd ( PCOMPVARS  pc)

Definition at line 1502 of file msvideo_main.c.

1503{
1504 TRACE("(%p)\n", pc);
1506 clear_compvars(pc);
1507}
static void clear_compvars(PCOMPVARS pc)
#define ICM_COMPRESS_END
Definition: vfw.h:104

Referenced by test_ICSeqCompress().

◆ ICSeqCompressFrameStart()

BOOL VFWAPI ICSeqCompressFrameStart ( PCOMPVARS  pc,
LPBITMAPINFO  lpbiIn 
)

Definition at line 1534 of file msvideo_main.c.

1535{
1536 /* I'm ignoring bmiColors as I don't know what to do with it,
1537 * it doesn't appear to be used though
1538 */
1539 DWORD ret;
1540 ICCOMPRESS* icComp;
1541
1542 if (!(pc->lpbiIn = copy_bitmapinfo(lpbiIn)))
1543 return FALSE;
1544
1545 if (!(pc->lpState = heap_alloc(sizeof(ICCOMPRESS) + sizeof(*icComp->lpckid) + sizeof(*icComp->lpdwFlags))))
1546 goto error;
1547
1548 pc->cbState = sizeof(ICCOMPRESS);
1549
1550 if (!pc->lpbiOut)
1551 {
1552 /* Ask compressor for needed header size */
1554 (DWORD_PTR)pc->lpbiIn, 0);
1555 if (size <= 0)
1556 goto error;
1557
1558 if (!(pc->lpbiOut = heap_alloc_zero(size)))
1559 goto error;
1560 /* Flag to show that we allocated lpbiOut for proper cleanup */
1561 pc->dwFlags |= 0x80000000;
1562
1564 (DWORD_PTR)pc->lpbiIn, (DWORD_PTR)pc->lpbiOut);
1565 if (ret != ICERR_OK)
1566 {
1567 ERR("Could not get output format from compressor\n");
1568 goto error;
1569 }
1570 if (!pc->lpbiOut->bmiHeader.biSizeImage)
1571 {
1572 /* If we can't know the output frame size for sure at least allocate
1573 * the same size of the input frame and also at least 8Kb to be sure
1574 * that poor compressors will have enough memory to work if the input
1575 * frame is too small.
1576 */
1578 ERR("Bad codec! Invalid output frame size, guessing from input\n");
1579 }
1580 }
1581
1582 TRACE("Input: %ux%u, fcc %s, bpp %u, size %u\n",
1587 TRACE("Output: %ux%u, fcc %s, bpp %u, size %u\n",
1592
1593 /* Buffer for compressed frame data */
1595 goto error;
1596
1597 /* Buffer for previous compressed frame data */
1599 goto error;
1600
1601 TRACE("Compvars:\n"
1602 "\tsize: %i\n"
1603 "\tflags: 0x%x\n"
1604 "\thic: %p\n"
1605 "\ttype: %s\n"
1606 "\thandler: %s\n"
1607 "\tin/out: %p/%p\n"
1608 "\tkey/data/quality: %i/%i/%i\n",
1609 pc->cbSize, pc->dwFlags, pc->hic, wine_dbgstr_fcc(pc->fccType),
1610 wine_dbgstr_fcc(pc->fccHandler), pc->lpbiIn, pc->lpbiOut, pc->lKey,
1611 pc->lDataRate, pc->lQ);
1612
1614 if (ret == ICERR_OK)
1615 {
1616 icComp = pc->lpState;
1617 /* Initialise some variables */
1618 pc->lFrame = 0; pc->lKeyCount = 0;
1619
1620 icComp->lpbiOutput = &pc->lpbiOut->bmiHeader;
1621 icComp->lpbiInput = &pc->lpbiIn->bmiHeader;
1622 icComp->lpckid = (DWORD *)(icComp + 1);
1623 *icComp->lpckid = 0;
1624 icComp->lpdwFlags = (DWORD *)((char *)(icComp + 1) + sizeof(*icComp->lpckid));
1625 *icComp->lpdwFlags = 0;
1626 icComp->dwFrameSize = 0;
1627 icComp->dwQuality = pc->lQ;
1628 icComp->lpbiPrev = &pc->lpbiIn->bmiHeader;
1629 return TRUE;
1630 }
1631error:
1632 clear_compvars(pc);
1633 return FALSE;
1634}
#define error(str)
Definition: mkdosfs.c:1605
static BITMAPINFO * copy_bitmapinfo(const BITMAPINFO *src)
#define max(a, b)
Definition: svc.c:63
#define ICM_COMPRESS_BEGIN
Definition: vfw.h:102
#define ICM_COMPRESS_GET_FORMAT
Definition: vfw.h:99

Referenced by test_ICSeqCompress().

◆ MSVIDEO_GetHicPtr()

static WINE_HIC * MSVIDEO_GetHicPtr ( HIC  hic)
static

Definition at line 241 of file msvideo_main.c.

242{
243 WINE_HIC* whic;
244
245 for (whic = MSVIDEO_FirstHic; whic && whic->hic != hic; whic = whic->next);
246 return whic;
247}

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 137 of file msvideo_main.c.

138{
139 LRESULT ret;
140
141#define XX(x) case x: TRACE("(%p,"#x",0x%08lx,0x%08lx)\n",whic,lParam1,lParam2); break
142
143 switch (msg) {
144 /* DRV_* */
145 XX(DRV_LOAD);
146 XX(DRV_ENABLE);
147 XX(DRV_OPEN);
148 XX(DRV_CLOSE);
150 XX(DRV_FREE);
151 /* ICM_RESERVED+X */
152 XX(ICM_ABOUT);
154 XX(ICM_GET);
160 XX(ICM_SET);
162 /* ICM_USER+X */
184 XX(ICM_DRAW);
201 default:
202 FIXME("(%p,0x%08x,0x%08lx,0x%08lx) unknown message\n",whic,msg,lParam1,lParam2);
203 }
204
205#undef XX
206
207 if (whic->driverproc) {
208 /* dwDriverId parameter is the value returned by the DRV_OPEN */
209 ret = whic->driverproc(whic->driverId, whic->hdrv, msg, lParam1, lParam2);
210 } else {
211 ret = SendDriverMessage(whic->hdrv, msg, lParam1, lParam2);
212 }
213
214 TRACE(" -> %s\n", wine_dbgstr_icerr(ret));
215 return ret;
216}
LRESULT WINAPI SendDriverMessage(HDRVR hDriver, UINT msg, LPARAM lParam1, LPARAM lParam2)
Definition: driver.c:131
static const char * wine_dbgstr_icerr(int ret)
Definition: msvideo_main.c:72
#define XX(x)
#define ICM_DECOMPRESSEX_END
Definition: vfw.h:141
#define ICM_DRAW_CHANGEPALETTE
Definition: vfw.h:132
#define ICM_DRAW_FLUSH
Definition: vfw.h:125
#define ICM_DRAW_SETTIME
Definition: vfw.h:123
#define ICM_COMPRESS_GET_SIZE
Definition: vfw.h:100
#define ICM_GETDEFAULTKEYFRAMERATE
Definition: vfw.h:136
#define ICM_GETQUALITY
Definition: vfw.h:89
#define ICM_DECOMPRESSEX_BEGIN
Definition: vfw.h:138
#define ICM_SET_STATUS_PROC
Definition: vfw.h:144
#define ICM_DECOMPRESS_GET_PALETTE
Definition: vfw.h:112
#define ICM_DRAW_START_PLAY
Definition: vfw.h:128
#define ICM_DECOMPRESSEX
Definition: vfw.h:140
#define ICM_DRAW_GETTIME
Definition: vfw.h:120
#define ICM_DRAW_WINDOW
Definition: vfw.h:122
#define ICM_DRAW_STOP_PLAY
Definition: vfw.h:129
#define ICM_GETSTATE
Definition: vfw.h:80
#define ICM_DRAW_RENDERBUFFER
Definition: vfw.h:126
#define ICM_CONFIGURE
Definition: vfw.h:84
#define ICM_DECOMPRESS_END
Definition: vfw.h:110
#define ICM_DECOMPRESSEX_QUERY
Definition: vfw.h:139
#define ICM_DECOMPRESS_BEGIN
Definition: vfw.h:108
#define ICM_DRAW_SUGGESTFORMAT
Definition: vfw.h:131
#define ICM_DRAW_REALIZE
Definition: vfw.h:124
#define ICM_SETQUALITY
Definition: vfw.h:90
#define ICM_GETDEFAULTQUALITY
Definition: vfw.h:88
#define ICM_DRAW_START
Definition: vfw.h:117
#define ICM_DRAW_END
Definition: vfw.h:119
#define ICM_GET
Definition: vfw.h:93
#define ICM_SETSTATE
Definition: vfw.h:81
#define ICM_DRAW_GET_PALETTE
Definition: vfw.h:116
#define ICM_COMPRESS_FRAMES_INFO
Definition: vfw.h:143
#define ICM_ABOUT
Definition: vfw.h:85
#define ICM_GETBUFFERSWANTED
Definition: vfw.h:134
#define ICM_DECOMPRESS_SET_PALETTE
Definition: vfw.h:111
#define ICM_SET
Definition: vfw.h:92
#define ICM_DRAW_STOP
Definition: vfw.h:118

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

◆ VideoForWindowsVersion()

DWORD WINAPI VideoForWindowsVersion ( void  )

Definition at line 255 of file msvideo_main.c.

256{
257 return 0x040003B6; /* 4.950 */
258}

◆ wine_dbgstr_fcc()

static const char * wine_dbgstr_fcc ( DWORD  fcc)
inlinestatic

Definition at line 60 of file msvideo_main.c.

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

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 72 of file msvideo_main.c.

73{
74 const char *str;
75 if (ret <= ICERR_CUSTOM)
76 return wine_dbg_sprintf("ICERR_CUSTOM (%d)", ret);
77#define XX(x) case (x): str = #x; break
78 switch (ret)
79 {
80 XX(ICERR_OK);
98 default: str = wine_dbg_sprintf("UNKNOWN (%d)", ret);
99 }
100#undef XX
101 return str;
102}
#define ICERR_NEWPALETTE
Definition: vfw.h:52
#define ICERR_BADPARAM
Definition: vfw.h:61
#define ICERR_CANTUPDATE
Definition: vfw.h:64
#define ICERR_CUSTOM
Definition: vfw.h:70
#define ICERR_INTERNAL
Definition: vfw.h:59
#define ICERR_BADIMAGESIZE
Definition: vfw.h:68
#define ICERR_UNSUPPORTED
Definition: vfw.h:56
#define ICERR_BADFORMAT
Definition: vfw.h:57
#define ICERR_ERROR
Definition: vfw.h:66
#define ICERR_BADFLAGS
Definition: vfw.h:60
#define ICERR_BADSIZE
Definition: vfw.h:62
#define ICERR_ABORT
Definition: vfw.h:65
#define ICERR_GOTOKEYFRAME
Definition: vfw.h:53
#define ICERR_MEMORY
Definition: vfw.h:58
#define ICERR_STOPDRAWING
Definition: vfw.h:54
#define ICERR_BADBITDEPTH
Definition: vfw.h:67
#define ICERR_DONTDRAW
Definition: vfw.h:51

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 344 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 104 of file msvideo_main.c.

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

◆ reg_driver_list

struct list reg_driver_list = LIST_INIT(reg_driver_list)
static

Definition at line 114 of file msvideo_main.c.

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