ReactOS 0.4.17-dev-966-gf06eace
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 "winternl.h"
#include "winuser.h"
#include "commdlg.h"
#include "vfw.h"
#include "msvideo_private.h"
#include "wine/debug.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%08Ix,0x%08Ix)\n",whic,lParam1,lParam2); break
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msvideo)
 
static const char * wine_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_HIC * MSVIDEO_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 BITMAPINFO * copy_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_HIC * MSVIDEO_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 52 of file msvideo_main.c.

◆ HKLM_DRIVERS32

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

Definition at line 47 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%08Ix,0x%08Ix)\n",whic,lParam1,lParam2); break

Function Documentation

◆ clear_compvars()

static void clear_compvars ( PCOMPVARS  pc)
static

Definition at line 1471 of file msvideo_main.c.

1472{
1473 free(pc->lpbiIn);
1474 free(pc->lpBitsPrev);
1475 free(pc->lpBitsOut);
1476 free(pc->lpState);
1477 pc->lpbiIn = pc->lpBitsPrev = pc->lpBitsOut = pc->lpState = NULL;
1478 if (pc->dwFlags & 0x80000000)
1479 {
1480 free(pc->lpbiOut);
1481 pc->lpbiOut = NULL;
1482 pc->dwFlags &= ~0x80000000;
1483 }
1484}
#define free
Definition: debug_ros.c:5
#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 205 of file msvideo_main.c.

206{
207 char fcc_str1[4];
208 char fcc_str2[4];
209 fourcc_to_string(fcc_str1, fcc1);
210 fourcc_to_string(fcc_str2, fcc2);
211 return _strnicmp(fcc_str1, fcc_str2, 4);
212}
#define _strnicmp(_String1, _String2, _MaxCount)
Definition: compat.h:23
#define fourcc_to_string(str, fcc)
Definition: msvideo_main.c:52

◆ copy_bitmapinfo()

static BITMAPINFO * copy_bitmapinfo ( const BITMAPINFO *  src)
static

Definition at line 1496 of file msvideo_main.c.

1497{
1498 int num_colors;
1499 unsigned int size;
1500 BITMAPINFO *dst;
1501
1502 if (src->bmiHeader.biClrUsed)
1503 num_colors = min(src->bmiHeader.biClrUsed, 256);
1504 else
1505 num_colors = src->bmiHeader.biBitCount > 8 ? 0 : 1 << src->bmiHeader.biBitCount;
1506
1507 size = FIELD_OFFSET(BITMAPINFO, bmiColors[num_colors]);
1508 if (src->bmiHeader.biCompression == BI_BITFIELDS)
1509 size += 3 * sizeof(DWORD);
1510
1511 if (!(dst = malloc(size)))
1512 return NULL;
1513
1514 memcpy(dst, src, size);
1515 return dst;
1516}
#define malloc
Definition: debug_ros.c:4
GLenum src
Definition: glext.h:6340
GLsizeiptr size
Definition: glext.h:5919
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 105 of file msvideo_main.c.

106{
107 TRACE("%p,%lx,%p\n", hinst, reason, reserved);
108
109 switch(reason)
110 {
114 break;
115 }
116 return TRUE;
117}
#define TRUE
Definition: types.h:120
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1971
#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:103
#define TRACE(s)
Definition: solgame.cpp:4

◆ enum_compressors()

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

Definition at line 848 of file msvideo_main.c.

849{
850 UINT id, total = 0;
851 ICINFO icinfo;
852
853 id = 0;
854
855 while (ICInfo(pcv->fccType, id, &icinfo))
856 {
857 struct codec_info *ic;
858 DWORD idx;
859 HIC hic;
860
861 id++;
862
864
865 if (hic)
866 {
867 /* for unknown reason fccHandler reported by the driver
868 * doesn't always work, use the one returned by ICInfo instead.
869 */
870 DWORD fccHandler = icinfo.fccHandler;
871
872 if (!enum_all && pcv->lpbiIn)
873 {
874 if (ICCompressQuery(hic, pcv->lpbiIn, NULL) != ICERR_OK)
875 {
876 TRACE("fccHandler %s doesn't support input DIB format %ld\n",
878 ICClose(hic);
879 continue;
880 }
881 }
882
883 ICGetInfo(hic, &icinfo, sizeof(icinfo));
884 icinfo.fccHandler = fccHandler;
885
887
888 ic = malloc(sizeof(*ic));
889 ic->icinfo = icinfo;
890 ic->hic = hic;
892 }
893 total++;
894 }
895
896 return total != 0;
897}
Definition: list.h:39
unsigned int idx
Definition: utils.c:40
unsigned long DWORD
Definition: ntddk_ex.h:95
size_t total
GLuint id
Definition: glext.h:5910
unsigned int UINT
Definition: sysinfo.c:13
LONG_PTR LPARAM
Definition: minwindef.h:175
HIC VFWAPI ICOpen(DWORD fccType, DWORD fccHandler, UINT wMode)
Definition: msvideo_main.c:428
LRESULT VFWAPI ICGetInfo(HIC hic, ICINFO *picinfo, DWORD cb)
Definition: msvideo_main.c:581
BOOL VFWAPI ICInfo(DWORD type, DWORD handler, ICINFO *info)
Definition: msvideo_main.c:257
LRESULT WINAPI ICClose(HIC hic)
#define CB_SETITEMDATA
Definition: winuser.h:1995
#define CB_ADDSTRING
Definition: winuser.h:1965
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static __inline const char * debugstr_fourcc(unsigned int cc)
Definition: debug.h:397
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:845
ULONG biCompression
Definition: precomp.h:35
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1922
#define ICERR_OK
Definition: vfw.h:50
#define ICMODE_COMPRESS
Definition: vfw.h:268
#define ICCompressQuery(hic, lpbiInput, lpbiOutput)
Definition: vfw.h:224

Referenced by icm_choose_compressor_dlgproc().

◆ get_size_image()

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

Definition at line 214 of file msvideo_main.c.

215{
216 DWORD ret = width * depth;
217 ret = (ret + 7) / 8; /* divide by byte size, rounding up */
218 ret = (ret + 3) & ~3; /* align to 4 bytes */
219 ret *= abs(height);
220 return ret;
221}
return ret
Definition: mutex.c:147
#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

Referenced by ICGetDisplayFormat(), and ICImageDecompress().

◆ GetFileNamePreview()

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

Definition at line 1626 of file msvideo_main.c.

1627{
1628 CHAR szFunctionName[20];
1629 BOOL (*fnGetFileName)(LPVOID);
1630 HMODULE hComdlg32;
1631 BOOL ret;
1632
1633 FIXME("(%p,%d,%d), semi-stub!\n",lpofn,bSave,bUnicode);
1634
1635 lstrcpyA(szFunctionName, (bSave ? "GetSaveFileName" : "GetOpenFileName"));
1636 lstrcatA(szFunctionName, (bUnicode ? "W" : "A"));
1637
1638 hComdlg32 = LoadLibraryA("COMDLG32.DLL");
1639 if (hComdlg32 == NULL)
1640 return FALSE;
1641
1642 fnGetFileName = (LPVOID)GetProcAddress(hComdlg32, szFunctionName);
1643 if (fnGetFileName == NULL)
1644 {
1645 FreeLibrary(hComdlg32);
1646 return FALSE;
1647 }
1648
1649 /* FIXME: need to add OFN_ENABLEHOOK and our own handler */
1650 ret = fnGetFileName(lpofn);
1651
1652 FreeLibrary(hComdlg32);
1653 return ret;
1654}
#define FIXME(fmt,...)
Definition: precomp.h:53
#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 LPVOID
Definition: nt_native.h:45
#define BOOL
Definition: nt_native.h:43
char CHAR
Definition: pedump.c:57

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

◆ GetOpenFileNamePreviewA()

BOOL WINAPI GetOpenFileNamePreviewA ( LPOPENFILENAMEA  lpofn)

Definition at line 1659 of file msvideo_main.c.

1660{
1661 FIXME("(%p), semi-stub!\n", lpofn);
1662
1663 return GetFileNamePreview(lpofn, FALSE, FALSE);
1664}
static BOOL GetFileNamePreview(LPVOID lpofn, BOOL bSave, BOOL bUnicode)

◆ GetOpenFileNamePreviewW()

BOOL WINAPI GetOpenFileNamePreviewW ( LPOPENFILENAMEW  lpofn)

Definition at line 1669 of file msvideo_main.c.

1670{
1671 FIXME("(%p), semi-stub!\n", lpofn);
1672
1673 return GetFileNamePreview(lpofn, FALSE, TRUE);
1674}

◆ GetSaveFileNamePreviewA()

BOOL WINAPI GetSaveFileNamePreviewA ( LPOPENFILENAMEA  lpofn)

Definition at line 1679 of file msvideo_main.c.

1680{
1681 FIXME("(%p), semi-stub!\n", lpofn);
1682
1683 return GetFileNamePreview(lpofn, TRUE, FALSE);
1684}

◆ GetSaveFileNamePreviewW()

BOOL WINAPI GetSaveFileNamePreviewW ( LPOPENFILENAMEW  lpofn)

Definition at line 1689 of file msvideo_main.c.

1690{
1691 FIXME("(%p), semi-stub!\n", lpofn);
1692
1693 return GetFileNamePreview(lpofn, TRUE, TRUE);
1694}

◆ ICClose()

LRESULT WINAPI ICClose ( HIC  hic)

Definition at line 1232 of file msvideo_main.c.

1233{
1234 WINE_HIC* whic = MSVIDEO_GetHicPtr(hic);
1235 WINE_HIC** p;
1236
1237 TRACE("(%p)\n",hic);
1238
1239 if (!whic) return ICERR_BADHANDLE;
1240
1241 if (whic->driverproc)
1242 {
1243 MSVIDEO_SendMessage(whic, DRV_CLOSE, 0, 0);
1244 MSVIDEO_SendMessage(whic, DRV_DISABLE, 0, 0);
1245 MSVIDEO_SendMessage(whic, DRV_FREE, 0, 0);
1246 }
1247 else
1248 {
1249 CloseDriver(whic->hdrv, 0, 0);
1250 }
1251
1252 /* remove whic from list */
1253 for (p = &MSVIDEO_FirstHic; *p != NULL; p = &((*p)->next))
1254 {
1255 if ((*p) == whic)
1256 {
1257 *p = whic->next;
1258 break;
1259 }
1260 }
1261
1262 free(whic);
1263 return 0;
1264}
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:228
static LRESULT MSVIDEO_SendMessage(WINE_HIC *whic, UINT msg, DWORD_PTR lParam1, DWORD_PTR lParam2)
Definition: msvideo_main.c:124
static WINE_HIC * MSVIDEO_FirstHic
Definition: msvideo_main.c:91
struct tagWINE_HIC * next
DRIVERPROC driverproc
#define ICERR_BADHANDLE
Definition: vfw.h:63

Referenced by avi_compressor_destroy(), avi_decompressor_sink_disconnect(), 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 784 of file msvideo_main.c.

789{
790 ICCOMPRESS iccmp;
791
792 TRACE("(%p,%ld,%p,%p,%p,%p,...)\n",hic,dwFlags,lpbiOutput,lpData,lpbiInput,lpBits);
793
794 iccmp.dwFlags = dwFlags;
795
796 iccmp.lpbiOutput = lpbiOutput;
797 iccmp.lpOutput = lpData;
798 iccmp.lpbiInput = lpbiInput;
799 iccmp.lpInput = lpBits;
800
801 iccmp.lpckid = lpckid;
802 iccmp.lpdwFlags = lpdwFlags;
803 iccmp.lFrameNum = lFrameNum;
804 iccmp.dwFrameSize = dwFrameSize;
805 iccmp.dwQuality = dwQuality;
806 iccmp.lpbiPrev = lpbiPrev;
807 iccmp.lpPrev = lpPrev;
808 return ICSendMessage(hic,ICM_COMPRESS,(DWORD_PTR)&iccmp,sizeof(iccmp));
809}
LRESULT VFWAPI ICSendMessage(HIC hic, UINT msg, DWORD_PTR lParam1, DWORD_PTR lParam2)
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
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

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

1086{
1087 struct choose_compressor choose_comp;
1088 BOOL ret;
1089
1090 TRACE("(%p,%08x,%p,%p,%p,%s)\n", hwnd, uiFlags, pvIn, lpData, pc, lpszTitle);
1091
1092 if (!pc || pc->cbSize != sizeof(COMPVARS))
1093 return FALSE;
1094
1095 if (!(pc->dwFlags & ICMF_COMPVARS_VALID))
1096 {
1097 pc->dwFlags = 0;
1098 pc->fccType = pc->fccHandler = 0;
1099 pc->hic = NULL;
1100 pc->lpbiIn = NULL;
1101 pc->lpbiOut = NULL;
1102 pc->lpBitsOut = pc->lpBitsPrev = pc->lpState = NULL;
1103 pc->lQ = ICQUALITY_DEFAULT;
1104 pc->lKey = -1;
1105 pc->lDataRate = 300; /* kB */
1106 pc->lpState = NULL;
1107 pc->cbState = 0;
1108 }
1109 if (pc->fccType == 0)
1110 pc->fccType = ICTYPE_VIDEO;
1111
1112 choose_comp.cv = *pc;
1113 choose_comp.flags = uiFlags;
1114 choose_comp.title = lpszTitle;
1115
1117 icm_choose_compressor_dlgproc, (LPARAM)&choose_comp);
1118
1119 if (ret)
1120 {
1121 *pc = choose_comp.cv;
1123 }
1124
1125 return ret;
1126}
#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:899
#define ICM_CHOOSE_COMPRESSOR
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
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

Referenced by AVISaveOptionsFmtChoose().

◆ ICCompressorFree()

void VFWAPI ICCompressorFree ( PCOMPVARS  pc)

Definition at line 1132 of file msvideo_main.c.

1133{
1134 TRACE("(%p)\n", pc);
1135
1136 if (pc && pc->cbSize == sizeof(COMPVARS))
1137 {
1138 if (pc->hic)
1139 {
1140 ICClose(pc->hic);
1141 pc->hic = NULL;
1142 }
1143 free(pc->lpbiIn);
1144 pc->lpbiIn = NULL;
1145 free(pc->lpBitsOut);
1146 pc->lpBitsOut = NULL;
1147 free(pc->lpBitsPrev);
1148 pc->lpBitsPrev = NULL;
1149 free(pc->lpState);
1150 pc->lpState = NULL;
1151 pc->dwFlags = 0;
1152 }
1153}

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

816{
817 ICDECOMPRESS icd;
818 DWORD ret;
819
820 TRACE("(%p,%ld,%p,%p,%p,%p)\n",hic,dwFlags,lpbiFormat,lpData,lpbi,lpBits);
821
822 icd.dwFlags = dwFlags;
823 icd.lpbiInput = lpbiFormat;
824 icd.lpInput = lpData;
825
826 icd.lpbiOutput = lpbi;
827 icd.lpOutput = lpBits;
828 icd.ckid = 0;
830
831 return ret;
832}
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 avi_decompressor_sink_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 1215 of file msvideo_main.c.

1215 {
1216 ICDRAW icd;
1217
1218 TRACE("(%p,%ld,%p,%p,%ld,%ld)\n",hic,dwFlags,lpFormat,lpData,cbData,lTime);
1219
1220 icd.dwFlags = dwFlags;
1221 icd.lpFormat = lpFormat;
1222 icd.lpData = lpData;
1223 icd.cbData = cbData;
1224 icd.lTime = lTime;
1225
1226 return ICSendMessage(hic,ICM_DRAW,(DWORD_PTR)&icd,sizeof(icd));
1227}
_In_opt_ _In_opt_ _In_ _In_ DWORD cbData
Definition: shlwapi.h:761
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 1169 of file msvideo_main.c.

1186{
1187
1188 ICDRAWBEGIN icdb;
1189
1190 TRACE("(%p,%ld,%p,%p,%p,%u,%u,%u,%u,%p,%u,%u,%u,%u,%ld,%ld)\n",
1191 hic, dwFlags, hpal, hwnd, hdc, xDst, yDst, dxDst, dyDst,
1192 lpbi, xSrc, ySrc, dxSrc, dySrc, dwRate, dwScale);
1193
1194 icdb.dwFlags = dwFlags;
1195 icdb.hpal = hpal;
1196 icdb.hwnd = hwnd;
1197 icdb.hdc = hdc;
1198 icdb.xDst = xDst;
1199 icdb.yDst = yDst;
1200 icdb.dxDst = dxDst;
1201 icdb.dyDst = dyDst;
1202 icdb.lpbi = lpbi;
1203 icdb.xSrc = xSrc;
1204 icdb.ySrc = ySrc;
1205 icdb.dxSrc = dxSrc;
1206 icdb.dySrc = dySrc;
1207 icdb.dwRate = dwRate;
1208 icdb.dwScale = dwScale;
1209 return ICSendMessage(hic,ICM_DRAW_BEGIN,(DWORD_PTR)&icdb,sizeof(icdb));
1210}
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 686 of file msvideo_main.c.

688{
689 HIC tmphic = hic;
690
691 TRACE("(%p, %p, %p, %d, %d, %d)\n", hic, in, out, depth, width, height);
692
693 if (!tmphic)
694 {
696 if (!tmphic)
697 return NULL;
698 }
699
700 if (ICDecompressQuery(tmphic, in, NULL))
701 goto err;
702
703 if (width <= 0 || height <= 0)
704 {
705 width = in->biWidth;
706 height = in->biHeight;
707 }
708
709 if (!depth)
710 depth = 32;
711
712 *out = *in;
713 out->biSize = sizeof(*out);
714 out->biWidth = width;
715 out->biHeight = height;
716 out->biCompression = BI_RGB;
717 out->biSizeImage = get_size_image(width, height, depth);
718
719 /* first try the given depth */
720 out->biBitCount = depth;
721 out->biSizeImage = get_size_image(width, height, out->biBitCount);
722 if (!ICDecompressQuery(tmphic, in, out))
723 {
724 if (depth == 8)
725 ICDecompressGetPalette(tmphic, in, out);
726 return tmphic;
727 }
728
729 /* then try 16, both with BI_RGB and BI_BITFIELDS */
730 if (depth <= 16)
731 {
732 out->biBitCount = 16;
733 out->biSizeImage = get_size_image(width, height, out->biBitCount);
734 if (!ICDecompressQuery(tmphic, in, out))
735 return tmphic;
736
737 out->biCompression = BI_BITFIELDS;
738 if (!ICDecompressQuery(tmphic, in, out))
739 return tmphic;
740 out->biCompression = BI_RGB;
741 }
742
743 /* then try 24 */
744 if (depth <= 24)
745 {
746 out->biBitCount = 24;
747 out->biSizeImage = get_size_image(width, height, out->biBitCount);
748 if (!ICDecompressQuery(tmphic, in, out))
749 return tmphic;
750 }
751
752 /* then try 32 */
753 if (depth <= 32)
754 {
755 out->biBitCount = 32;
756 out->biSizeImage = get_size_image(width, height, out->biBitCount);
757 if (!ICDecompressQuery(tmphic, in, out))
758 return tmphic;
759 }
760
761 /* as a last resort, try 32 bpp with the original width and height */
762 out->biWidth = in->biWidth;
763 out->biHeight = in->biHeight;
764 out->biBitCount = 32;
765 out->biSizeImage = get_size_image(out->biWidth, out->biHeight, out->biBitCount);
766 if (!ICDecompressQuery(tmphic, in, out))
767 return tmphic;
768
769 /* finally, ask the compressor for its default output format */
771 return tmphic;
772
773err:
774 if (hic != tmphic)
775 ICClose(tmphic);
776
777 return NULL;
778}
GLuint in
Definition: glext.h:9616
HIC VFWAPI ICLocate(DWORD type, DWORD handler, BITMAPINFOHEADER *in, BITMAPINFOHEADER *out, WORD mode)
Definition: msvideo_main.c:620
static DWORD get_size_image(LONG width, LONG height, WORD depth)
Definition: msvideo_main.c:214
#define err(...)
#define BI_RGB
Definition: uefivid.c:46
#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
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383

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

◆ ICGetInfo()

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

Definition at line 581 of file msvideo_main.c.

582{
583 LRESULT ret;
584 WINE_HIC* whic = MSVIDEO_GetHicPtr(hic);
585
586 TRACE("(%p,%p,%ld)\n", hic, picinfo, cb);
587
588 if (!whic) return ICERR_BADHANDLE;
589 if (!picinfo) return MMSYSERR_INVALPARAM;
590
591 /* (WS) The field szDriver should be initialized because the driver
592 * is not obliged and often will not do it. Some applications, like
593 * VirtualDub, rely on this field and will occasionally crash if it
594 * goes uninitialized.
595 */
596 if (cb >= sizeof(ICINFO)) picinfo->szDriver[0] = '\0';
597
598 ret = ICSendMessage(hic, ICM_GETINFO, (DWORD_PTR)picinfo, cb);
599
600 /* (WS) When szDriver was not supplied by the driver itself, apparently
601 * Windows will set its value equal to the driver file name. This can
602 * be obtained from the registry as we do here.
603 */
604 if (cb >= sizeof(ICINFO) && picinfo->szDriver[0] == 0)
605 {
606 ICINFO ii;
607
608 memset(&ii, 0, sizeof(ii));
609 ii.dwSize = sizeof(ii);
610 ICInfo(picinfo->fccType, picinfo->fccHandler, &ii);
611 lstrcpyW(picinfo->szDriver, ii.szDriver);
612 }
613
614 return ret;
615}
#define lstrcpyW
Definition: compat.h:749
static MonoProfilerRuntimeShutdownBeginCallback cb
Definition: metahost.c:118
LONG_PTR LRESULT
Definition: minwindef.h:176
#define MMSYSERR_INVALPARAM
Definition: mmsystem.h:107
#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

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

1276{
1277 FIXME("(%p,%08x,%p,%p,%p,%ld,%p)\n",
1278 hic, uiFlags, lpbiIn, lpBits, lpbiOut, lQuality, plSize);
1279
1280 return NULL;
1281}

◆ ICImageDecompress()

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

Definition at line 1287 of file msvideo_main.c.

1290{
1291 HGLOBAL hMem = NULL;
1292 BYTE* pMem = NULL;
1293 BOOL bReleaseIC = FALSE;
1294 BYTE* pHdr = NULL;
1295 ULONG cbHdr = 0;
1296 BOOL bSucceeded = FALSE;
1297 BOOL bInDecompress = FALSE;
1298 DWORD biSizeImage;
1299
1300 TRACE("(%p,%08x,%p,%p,%p)\n",
1301 hic, uiFlags, lpbiIn, lpBits, lpbiOut);
1302
1303 if ( hic == NULL )
1304 {
1305 hic = ICDecompressOpen( ICTYPE_VIDEO, 0, &lpbiIn->bmiHeader, (lpbiOut != NULL) ? &lpbiOut->bmiHeader : NULL );
1306 if ( hic == NULL )
1307 {
1308 WARN("no handler\n" );
1309 goto err;
1310 }
1311 bReleaseIC = TRUE;
1312 }
1313 if ( uiFlags != 0 )
1314 {
1315 FIXME( "unknown flag %08x\n", uiFlags );
1316 goto err;
1317 }
1318 if ( lpbiIn == NULL || lpBits == NULL )
1319 {
1320 WARN("invalid argument\n");
1321 goto err;
1322 }
1323
1324 if ( lpbiOut != NULL )
1325 {
1326 if ( lpbiOut->bmiHeader.biSize != sizeof(BITMAPINFOHEADER) )
1327 goto err;
1328 cbHdr = sizeof(BITMAPINFOHEADER);
1329 if ( lpbiOut->bmiHeader.biCompression == 3 )
1330 cbHdr += sizeof(DWORD)*3;
1331 else
1332 if ( lpbiOut->bmiHeader.biBitCount <= 8 )
1333 {
1334 if ( lpbiOut->bmiHeader.biClrUsed == 0 )
1335 cbHdr += sizeof(RGBQUAD) * (1<<lpbiOut->bmiHeader.biBitCount);
1336 else
1337 cbHdr += sizeof(RGBQUAD) * lpbiOut->bmiHeader.biClrUsed;
1338 }
1339 }
1340 else
1341 {
1342 TRACE( "get format\n" );
1343
1344 cbHdr = ICDecompressGetFormatSize(hic,lpbiIn);
1345 if ( cbHdr < sizeof(BITMAPINFOHEADER) )
1346 goto err;
1347 if (!(pHdr = calloc(1, cbHdr + sizeof(RGBQUAD) * 256)))
1348 goto err;
1349 if ( ICDecompressGetFormat( hic, lpbiIn, pHdr ) != ICERR_OK )
1350 goto err;
1351 lpbiOut = (BITMAPINFO*)pHdr;
1352 if ( lpbiOut->bmiHeader.biBitCount <= 8 &&
1353 ICDecompressGetPalette( hic, lpbiIn, lpbiOut ) != ICERR_OK &&
1354 lpbiIn->bmiHeader.biBitCount == lpbiOut->bmiHeader.biBitCount )
1355 {
1356 if ( lpbiIn->bmiHeader.biClrUsed == 0 )
1357 memcpy( lpbiOut->bmiColors, lpbiIn->bmiColors, sizeof(RGBQUAD)*(1<<lpbiOut->bmiHeader.biBitCount) );
1358 else
1359 memcpy( lpbiOut->bmiColors, lpbiIn->bmiColors, sizeof(RGBQUAD)*lpbiIn->bmiHeader.biClrUsed );
1360 }
1361 if ( lpbiOut->bmiHeader.biBitCount <= 8 &&
1362 lpbiOut->bmiHeader.biClrUsed == 0 )
1363 lpbiOut->bmiHeader.biClrUsed = 1<<lpbiOut->bmiHeader.biBitCount;
1364
1365 lpbiOut->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
1366 cbHdr = sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*lpbiOut->bmiHeader.biClrUsed;
1367 }
1368
1369 biSizeImage = lpbiOut->bmiHeader.biSizeImage;
1370 if ( biSizeImage == 0 )
1371 biSizeImage = get_size_image(lpbiOut->bmiHeader.biWidth, lpbiOut->bmiHeader.biHeight, lpbiOut->bmiHeader.biBitCount);
1372
1373 TRACE( "call ICDecompressBegin\n" );
1374
1375 if ( ICDecompressBegin( hic, lpbiIn, lpbiOut ) != ICERR_OK )
1376 goto err;
1377 bInDecompress = TRUE;
1378
1379 TRACE( "cbHdr %ld, biSizeImage %ld\n", cbHdr, biSizeImage );
1380
1381 hMem = GlobalAlloc( GMEM_MOVEABLE|GMEM_ZEROINIT, cbHdr + biSizeImage );
1382 if ( hMem == NULL )
1383 {
1384 WARN( "out of memory\n" );
1385 goto err;
1386 }
1387 pMem = GlobalLock( hMem );
1388 if ( pMem == NULL )
1389 goto err;
1390 memcpy( pMem, lpbiOut, cbHdr );
1391
1392 TRACE( "call ICDecompress\n" );
1393 if ( ICDecompress( hic, 0, &lpbiIn->bmiHeader, lpBits, &lpbiOut->bmiHeader, pMem+cbHdr ) != ICERR_OK )
1394 goto err;
1395
1396 bSucceeded = TRUE;
1397err:
1398 if ( bInDecompress )
1399 ICDecompressEnd( hic );
1400 if ( bReleaseIC )
1401 ICClose(hic);
1402 free(pHdr);
1403 if ( pMem != NULL )
1404 GlobalUnlock( hMem );
1405 if ( !bSucceeded && hMem != NULL )
1406 {
1407 GlobalFree(hMem); hMem = NULL;
1408 }
1409
1410 return hMem;
1411}
#define WARN(fmt,...)
Definition: precomp.h:61
ULONG RGBQUAD
Definition: precomp.h:47
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
static ERESOURCE GlobalLock
Definition: sys_arch.c:8
DWORD VFWAPIV ICDecompress(HIC hic, DWORD dwFlags, LPBITMAPINFOHEADER lpbiFormat, LPVOID lpData, LPBITMAPINFOHEADER lpbi, LPVOID lpBits)
Definition: msvideo_main.c:814
#define calloc
Definition: rosglue.h:14
USHORT biBitCount
Definition: precomp.h:34
RGBQUAD bmiColors[1]
Definition: wingdi.h:1923
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:330
#define GMEM_MOVEABLE
Definition: winbase.h:318
unsigned char BYTE
Definition: xxhash.c:193

◆ ICInfo()

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

Definition at line 257 of file msvideo_main.c.

258{
259 char name_buf[10], buf[2048];
260 DWORD ret_type, ret_handler;
261 struct reg_driver *driver;
262 DWORD i, count = 0;
263 LONG res;
264 HKEY key;
265
266 TRACE("type %s, handler %s, info %p.\n",
268
269 memset(info, 0, sizeof(*info));
270 info->dwSize = sizeof(*info);
271 info->dwVersionICM = ICVERSION;
272
274 {
275 i = 0;
276 for (;;)
277 {
278 DWORD name_len = ARRAY_SIZE(name_buf), driver_len = ARRAY_SIZE(info->szDriver);
279
280 res = RegEnumValueA(key, i++, name_buf, &name_len, 0, 0, (BYTE *)buf, &driver_len);
281 if (res == ERROR_NO_MORE_ITEMS) break;
282
283 if (name_len != 9 || name_buf[4] != '.') continue;
284 ret_type = mmioStringToFOURCCA(name_buf, 0);
285 ret_handler = mmioStringToFOURCCA(name_buf + 5, 0);
286 if (type && compare_fourcc(type, ret_type)) continue;
287 if (compare_fourcc(handler, ret_handler) && handler != count++) continue;
288
289 info->fccType = ret_type;
290 info->fccHandler = ret_handler;
291 MultiByteToWideChar(CP_ACP, 0, buf, -1, info->szDriver, ARRAY_SIZE(info->szDriver));
292 TRACE("Returning codec %s, driver %s.\n", debugstr_a(name_buf), debugstr_a(buf));
293 return TRUE;
294 }
296 }
297
298 if (GetPrivateProfileSectionA("drivers32", buf, sizeof(buf), "system.ini"))
299 {
300 char *s;
301 for (s = buf; *s; s += strlen(s) + 1)
302 {
303 if (s[4] != '.' || s[9] != '=') continue;
304 ret_type = mmioStringToFOURCCA(s, 0);
305 ret_handler = mmioStringToFOURCCA(s + 5, 0);
306 if (type && compare_fourcc(type, ret_type)) continue;
307 if (compare_fourcc(handler, ret_handler) && handler != count++) continue;
308
309 info->fccType = ret_type;
310 info->fccHandler = ret_handler;
311 MultiByteToWideChar(CP_ACP, 0, s + 10, -1, info->szDriver, ARRAY_SIZE(info->szDriver));
312 TRACE("Returning codec %s, driver %s.\n", debugstr_an(s, 9), debugstr_a(s + 10));
313 return TRUE;
314 }
315 }
316
318 {
319 if (type && compare_fourcc(type, driver->fccType)) continue;
320 if (compare_fourcc(handler, driver->fccHandler) && handler != count++) continue;
321 if (driver->proc(0, NULL, ICM_GETINFO, (DWORD_PTR)info, sizeof(*info)) == sizeof(*info))
322 return TRUE;
323 }
324
325 info->fccType = type;
326 info->fccHandler = handler;
327 WARN("No driver found for codec %s.%s.\n", debugstr_fourcc(type), debugstr_fourcc(handler));
328 return FALSE;
329}
#define ARRAY_SIZE(A)
Definition: main.h:20
#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:3298
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:2668
#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:7708
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
FOURCC WINAPI mmioStringToFOURCCA(LPCSTR sz, UINT uFlags)
Definition: mmio.c:1025
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble s
Definition: gl.h:2039
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:60
uint32_t entry
Definition: isohybrid.c:63
#define debugstr_a
Definition: kernel32.h:31
static struct list reg_driver_list
Definition: msvideo_main.c:101
#define HKLM_DRIVERS32
Definition: msvideo_main.c:47
#define KEY_QUERY_VALUE
Definition: nt_native.h:1019
long LONG
Definition: pedump.c:60
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:236
Definition: copy.c:22
#define ICVERSION
Definition: vfw.h:45
static WORD const char * driver
Definition: odbccp32.c:56
#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 336 of file msvideo_main.c.

337{
338 struct reg_driver *driver;
339
340 TRACE("type %s, handler %s, lparam %#Ix, desc %s, flags %#x.\n",
342
344 {
345 if (!compare_fourcc(type, driver->fccType)
346 && !compare_fourcc(handler, driver->fccHandler))
347 {
348 return FALSE;
349 }
350 }
351
352 switch (flags)
353 {
355 if (!(driver = calloc(1, sizeof(*driver))))
356 return FALSE;
357 driver->fccType = type;
358 driver->fccHandler = handler;
359 driver->proc = (DRIVERPROC)lparam;
361 return TRUE;
362 case ICINSTALL_DRIVER:
363 {
364 const char *driver = (const char *)lparam;
365 char value[10];
366 HKEY key;
367 LONG res;
368
370 return FALSE;
372 value[4] = '.';
374 value[9] = 0;
375 res = RegSetValueExA(key, value, 0, REG_SZ, (const BYTE *)driver, strlen(driver) + 1);
377 return !res;
378 }
379 default:
380 FIXME("Unhandled flags %#x.\n", flags);
381 return FALSE;
382 }
383}
@ lparam
Definition: SystemMenu.c:31
#define REG_SZ
Definition: layer.c:22
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:4799
GLbitfield flags
Definition: glext.h:7161
LRESULT(CALLBACK * DRIVERPROC)(DWORD_PTR, HDRVR, UINT, LPARAM, LPARAM)
Definition: mmsystem.h:1003
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
#define KEY_SET_VALUE
Definition: nt_native.h:1020
Definition: pdh_main.c:64
#define ICINSTALL_DRIVER
Definition: vfw.h:626
#define ICINSTALL_FUNCTION
Definition: vfw.h:625

Referenced by START_TEST(), test_ICGetDisplayFormat(), and test_ICInfo().

◆ ICLocate()

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

Definition at line 620 of file msvideo_main.c.

622{
623 ICINFO info = {sizeof(info)};
624 UINT msg;
625 HIC hic;
626 DWORD i;
627
628 TRACE("type %s, handler %s, in %p, out %p, mode %u.\n",
630
631 switch (mode)
632 {
634 case ICMODE_COMPRESS:
636 break;
640 break;
641 case ICMODE_DRAW:
643 break;
644 default:
645 FIXME("Unhandled mode %#x.\n", mode);
646 return 0;
647 }
648
649 if ((hic = ICOpen(type, handler, mode)))
650 {
651 if (!ICSendMessage(hic, msg, (DWORD_PTR)in, (DWORD_PTR)out))
652 {
653 TRACE("Found codec %s.%s.\n", debugstr_fourcc(type),
655 return hic;
656 }
657 ICClose(hic);
658 }
659
660 for (i = 0; ICInfo(type, i, &info); ++i)
661 {
662 if ((hic = ICOpen(info.fccType, info.fccHandler, mode)))
663 {
664 if (!ICSendMessage(hic, msg, (DWORD_PTR)in, (DWORD_PTR)out))
665 {
666 TRACE("Found codec %s.%s.\n", debugstr_fourcc(info.fccType),
667 debugstr_fourcc(info.fccHandler));
668 return hic;
669 }
670 ICClose(hic);
671 }
672 }
673
674 if (type == streamtypeVIDEO)
676
677 WARN("Could not find a driver for codec %s.%s.\n",
679
680 return 0;
681}
#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 avi_decompressor_sink_connect(), 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 899 of file msvideo_main.c.

900{
901 switch (msg)
902 {
903 case WM_INITDIALOG:
904 {
905 struct codec_info *ic;
906 WCHAR buf[128];
907 struct choose_compressor *choose_comp = (struct choose_compressor *)lparam;
908
910
911 /* FIXME */
913
914 if (choose_comp->title)
915 SetWindowTextA(hdlg, choose_comp->title);
916
917 if (!(choose_comp->flags & ICMF_CHOOSE_DATARATE))
918 {
922 }
923
924 if (!(choose_comp->flags & ICMF_CHOOSE_KEYFRAME))
925 {
929 }
930
931 /* FIXME */
934
935 /*if (!(choose_comp->flags & ICMF_CHOOSE_PREVIEW))
936 ShowWindow(GetDlgItem(hdlg, IDC_PREVIEW), SW_HIDE);*/
937
940
941 ic = malloc(sizeof(*ic));
944 ic->hic = 0;
946
947 enum_compressors(GetDlgItem(hdlg, IDC_COMP_LIST), &choose_comp->cv, choose_comp->flags & ICMF_CHOOSE_ALLCOMPRESSORS);
948
951
952 SetWindowLongPtrW(hdlg, DWLP_USER, (ULONG_PTR)choose_comp);
953 break;
954 }
955
956 case WM_COMMAND:
957 switch (LOWORD(wparam))
958 {
959 case IDC_COMP_LIST:
960 {
961 INT cur_sel;
962 struct codec_info *ic;
963 BOOL can_configure = FALSE, can_about = FALSE;
964 struct choose_compressor *choose_comp;
965
967 break;
968
969 choose_comp = (struct choose_compressor *)GetWindowLongPtrW(hdlg, DWLP_USER);
970
971 cur_sel = SendMessageW((HWND)lparam, CB_GETCURSEL, 0, 0);
972
973 ic = (struct codec_info *)SendMessageW((HWND)lparam, CB_GETITEMDATA, cur_sel, 0);
974 if (ic && ic->hic)
975 {
976 if (ICQueryConfigure(ic->hic) == DRVCNF_OK)
977 can_configure = TRUE;
978 if (ICQueryAbout(ic->hic) == DRVCNF_OK)
979 can_about = TRUE;
980 }
981 EnableWindow(GetDlgItem(hdlg, IDC_CONFIGURE), can_configure);
982 EnableWindow(GetDlgItem(hdlg, IDC_ABOUT), can_about);
983
984 if (choose_comp->flags & ICMF_CHOOSE_DATARATE)
985 {
986 /* FIXME */
987 }
988 if (choose_comp->flags & ICMF_CHOOSE_KEYFRAME)
989 {
990 /* FIXME */
991 }
992
993 break;
994 }
995
996 case IDC_CONFIGURE:
997 case IDC_ABOUT:
998 {
1000 INT cur_sel;
1001 struct codec_info *ic;
1002
1003 if (HIWORD(wparam) != BN_CLICKED)
1004 break;
1005
1006 cur_sel = SendMessageW(list, CB_GETCURSEL, 0, 0);
1007
1008 ic = (struct codec_info *)SendMessageW(list, CB_GETITEMDATA, cur_sel, 0);
1009 if (ic && ic->hic)
1010 {
1011 if (LOWORD(wparam) == IDC_CONFIGURE)
1012 ICConfigure(ic->hic, hdlg);
1013 else
1014 ICAbout(ic->hic, hdlg);
1015 }
1016
1017 break;
1018 }
1019
1020 case IDOK:
1021 {
1023 INT cur_sel;
1024 struct codec_info *ic;
1025
1026 if (HIWORD(wparam) != BN_CLICKED)
1027 break;
1028
1029 cur_sel = SendMessageW(list, CB_GETCURSEL, 0, 0);
1030 ic = (struct codec_info *)SendMessageW(list, CB_GETITEMDATA, cur_sel, 0);
1031 if (ic)
1032 {
1033 struct choose_compressor *choose_comp = (struct choose_compressor *)GetWindowLongPtrW(hdlg, DWLP_USER);
1034
1035 choose_comp->cv.hic = ic->hic;
1036 choose_comp->cv.fccType = ic->icinfo.fccType;
1037 choose_comp->cv.fccHandler = ic->icinfo.fccHandler;
1038 /* FIXME: fill everything else */
1039
1040 /* prevent closing the codec handle below */
1041 ic->hic = 0;
1042 }
1043 }
1044 /* fall through */
1045 case IDCANCEL:
1046 {
1048 INT idx = 0;
1049
1050 if (HIWORD(wparam) != BN_CLICKED)
1051 break;
1052
1053 while (1)
1054 {
1055 struct codec_info *ic;
1056
1057 ic = (struct codec_info *)SendMessageW(list, CB_GETITEMDATA, idx++, 0);
1058
1059 if (!ic || (LONG_PTR)ic == CB_ERR) break;
1060
1061 if (ic->hic) ICClose(ic->hic);
1062 free(ic);
1063 }
1064
1065 EndDialog(hdlg, LOWORD(wparam) == IDOK);
1066 break;
1067 }
1068
1069 default:
1070 break;
1071 }
1072 break;
1073
1074 default:
1075 break;
1076 }
1077
1078 return FALSE;
1079}
@ wparam
Definition: SystemMenu.c:30
#define IDC_COMP_LIST
Definition: resource.h:7
#define IDC_CONFIGURE
Definition: resource.h:31
#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:848
#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
short WCHAR
Definition: pedump.c:58
#define SW_HIDE
Definition: winuser.h:779
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
#define DWLP_USER
Definition: winuser.h:883
#define GetWindowLongPtrW
Definition: winuser.h:4983
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDCANCEL
Definition: winuser.h:842
#define CBN_SETFOCUS
Definition: winuser.h:2011
#define WM_COMMAND
Definition: winuser.h:1768
#define CB_ERR
Definition: winuser.h:2471
#define CB_SETCURSEL
Definition: winuser.h:1990
#define WM_INITDIALOG
Definition: winuser.h:1767
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:841
#define CBN_SELCHANGE
Definition: winuser.h:2008
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:1979
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define BN_CLICKED
Definition: winuser.h:1954
#define CB_GETCURSEL
Definition: winuser.h:1972
#define SetWindowLongPtrW
Definition: winuser.h:5512
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define LoadStringW
Definition: utils.h:64
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

Referenced by ICCompressorChoose().

◆ ICOpen()

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

Definition at line 428 of file msvideo_main.c.

429{
430 WCHAR codecname[10];
431 ICOPEN icopen;
432 WINE_HIC* whic;
433 static const WCHAR drv32W[] = {'d','r','i','v','e','r','s','3','2','\0'};
434 struct reg_driver *driver;
435 HDRVR hdrv = NULL;
436
437 TRACE("(%s,%s,0x%08x)\n", debugstr_fourcc(fccType), debugstr_fourcc(fccHandler), wMode);
438
439 if (!fccHandler) /* No specific handler, return the first valid for wMode */
440 {
441 HIC local;
442 ICINFO info;
443 DWORD loop = 0;
444 info.dwSize = sizeof(info);
445 while(ICInfo(fccType, loop++, &info))
446 {
447 /* Ensure fccHandler is not 0x0 because we will recurse on ICOpen */
448 if(!info.fccHandler)
449 continue;
450 local = ICOpen(fccType, info.fccHandler, wMode);
451 if (local != 0)
452 {
453 TRACE("Returning %s as default handler for %s\n",
455 return local;
456 }
457 }
458 }
459
461 {
462 if (!compare_fourcc(fccType, driver->fccType)
463 && !compare_fourcc(fccHandler, driver->fccHandler))
464 {
465 return ICOpenFunction(driver->fccType, driver->fccHandler, wMode, driver->proc);
466 }
467 }
468
469 /* Well, lParam2 is in fact a LPVIDEO_OPEN_PARMS, but it has the
470 * same layout as ICOPEN
471 */
472 icopen.dwSize = sizeof(ICOPEN);
473 icopen.fccType = fccType;
474 icopen.fccHandler = fccHandler;
475 icopen.dwVersion = 0x00001000; /* FIXME */
476 icopen.dwFlags = wMode;
477 icopen.dwError = 0;
478 icopen.pV1Reserved = NULL;
479 icopen.pV2Reserved = NULL;
480 icopen.dnDevNode = 0; /* FIXME */
481
482 if (!hdrv)
483 {
484 /* normalize to lower case as in 'vidc' */
485 ((char*)&fccType)[0] = tolower(((char*)&fccType)[0]);
486 ((char*)&fccType)[1] = tolower(((char*)&fccType)[1]);
487 ((char*)&fccType)[2] = tolower(((char*)&fccType)[2]);
488 ((char*)&fccType)[3] = tolower(((char*)&fccType)[3]);
489 icopen.fccType = fccType;
490 /* Seek the driver in the registry */
491 fourcc_to_string(codecname, fccType);
492 codecname[4] = '.';
493 fourcc_to_string(codecname + 5, fccHandler);
494 codecname[9] = '\0';
495
496 hdrv = OpenDriver(codecname, drv32W, (LPARAM)&icopen);
497 if (!hdrv)
498 return 0;
499 }
500
501 if (!(whic = malloc(sizeof(*whic))))
502 {
503 CloseDriver(hdrv, 0, 0);
504 return FALSE;
505 }
506 whic->hdrv = hdrv;
507 whic->driverproc = NULL;
508 whic->type = fccType;
509 whic->handler = fccHandler;
511 whic->hic = (HIC)(ULONG_PTR)IC_HandleRef++;
512 whic->next = MSVIDEO_FirstHic;
513 MSVIDEO_FirstHic = whic;
514
515 TRACE("=> %p\n", whic->hic);
516 return whic->hic;
517}
int CDECL tolower(int c)
Definition: ctype.c:572
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:522
static DWORD IC_HandleRef
Definition: msvideo_main.c:331
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:96
DWORD fccType
Definition: msvideo_main.c:95

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

523{
524 ICOPEN icopen;
525 WINE_HIC* whic;
526
527 TRACE("(%s,%s,%d,%p)\n",
528 debugstr_fourcc(fccType), debugstr_fourcc(fccHandler), wMode, lpfnHandler);
529
530 icopen.dwSize = sizeof(ICOPEN);
531 icopen.fccType = fccType;
532 icopen.fccHandler = fccHandler;
533 icopen.dwVersion = ICVERSION;
534 icopen.dwFlags = wMode;
535 icopen.dwError = 0;
536 icopen.pV1Reserved = NULL;
537 icopen.pV2Reserved = NULL;
538 icopen.dnDevNode = 0; /* FIXME */
539
540 if (!(whic = malloc(sizeof(*whic))))
541 return NULL;
542
543 whic->driverproc = lpfnHandler;
545 whic->hic = (HIC)(ULONG_PTR)IC_HandleRef++;
546 whic->next = MSVIDEO_FirstHic;
547 MSVIDEO_FirstHic = whic;
548
549 /* Now try opening/loading the driver. Taken from DRIVER_AddToList */
550 /* What if the function is used more than once? */
551
552 if (MSVIDEO_SendMessage(whic, DRV_LOAD, 0L, 0L) != DRV_SUCCESS)
553 {
554 WARN("DRV_LOAD failed for hic %p\n", whic->hic);
555 MSVIDEO_FirstHic = whic->next;
556 free(whic);
557 return 0;
558 }
559 /* return value is not checked */
561
562 whic->driverId = (DWORD)MSVIDEO_SendMessage(whic, DRV_OPEN, 0, (DWORD_PTR)&icopen);
563 /* FIXME: What should we put here? */
564 whic->hdrv = NULL;
565
566 if (whic->driverId == 0)
567 {
568 WARN("DRV_OPEN failed for hic %p\n", whic->hic);
569 MSVIDEO_FirstHic = whic->next;
570 free(whic);
571 return 0;
572 }
573
574 TRACE("=> %p\n", whic->hic);
575 return whic->hic;
576}
#define L(x)
Definition: resources.c:13
#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

Referenced by ICOpen().

◆ ICRemove()

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

Definition at line 388 of file msvideo_main.c.

389{
390 struct reg_driver *driver;
391 char value[10];
392 HKEY key;
393 LONG res;
394
395 TRACE("type %s, handler %s, flags %#x.\n",
397
399 {
400 if (!compare_fourcc(type, driver->fccType)
401 && !compare_fourcc(handler, driver->fccHandler))
402 {
403 list_remove(&driver->entry);
404 free(driver);
405 return TRUE;
406 }
407 }
408
410 {
412 value[4] = '.';
414 value[9] = 0;
417 return !res;
418 }
419
420 return FALSE;
421}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
LONG WINAPI RegDeleteValueA(HKEY hKey, LPCSTR lpValueName)
Definition: reg.c:2287

Referenced by START_TEST(), 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 1416 of file msvideo_main.c.

1417{
1418 ICCOMPRESS* icComp = pc->lpState;
1419 DWORD ret;
1420 TRACE("(%p, 0x%08x, %p, %p, %p)\n", pc, uiFlags, lpBits, pfKey, plSize);
1421
1422 if (pc->cbState != sizeof(ICCOMPRESS))
1423 {
1424 ERR("Invalid cbState %li\n", pc->cbState);
1425 return NULL;
1426 }
1427
1428 if (!pc->lKeyCount++)
1429 icComp->dwFlags = ICCOMPRESS_KEYFRAME;
1430 else
1431 {
1432 if (pc->lKey && pc->lKeyCount == (pc->lKey - 1))
1433 /* No key frames if pc->lKey == 0 */
1434 pc->lKeyCount = 0;
1435 icComp->dwFlags = 0;
1436 }
1437
1438 icComp->lpInput = lpBits;
1439 icComp->lFrameNum = pc->lFrame++;
1440 icComp->lpOutput = pc->lpBitsOut;
1441 icComp->lpPrev = pc->lpBitsPrev;
1442 ret = ICSendMessage(pc->hic, ICM_COMPRESS, (DWORD_PTR)icComp, sizeof(*icComp));
1443
1444 if (ret == ICERR_OK)
1445 {
1446 LPVOID oldprev, oldout;
1447
1448 if (icComp->dwFlags & AVIIF_KEYFRAME)
1449 {
1450 pc->lKeyCount = 1;
1451 *pfKey = TRUE;
1452 TRACE("Key frame\n");
1453 }
1454 else
1455 *pfKey = FALSE;
1456
1457 *plSize = icComp->lpbiOutput->biSizeImage;
1458
1459 /* We shift Prev and Out, so we don't have to allocate and release memory */
1460 oldprev = pc->lpBitsPrev;
1461 oldout = pc->lpBitsOut;
1462 pc->lpBitsPrev = oldout;
1463 pc->lpBitsOut = oldprev;
1464
1465 TRACE("returning: %p, compressed frame size %lu\n", icComp->lpOutput, *plSize);
1466 return icComp->lpOutput;
1467 }
1468 return NULL;
1469}
#define AVIIF_KEYFRAME
Definition: aviriff.h:131
#define ERR(fmt,...)
Definition: precomp.h:57
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 1489 of file msvideo_main.c.

1490{
1491 TRACE("(%p)\n", pc);
1493 clear_compvars(pc);
1494}
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 1521 of file msvideo_main.c.

1522{
1523 /* I'm ignoring bmiColors as I don't know what to do with it,
1524 * it doesn't appear to be used though
1525 */
1526 DWORD ret;
1527 ICCOMPRESS* icComp;
1528
1529 if (!(pc->lpbiIn = copy_bitmapinfo(lpbiIn)))
1530 return FALSE;
1531
1532 if (!(pc->lpState = malloc(sizeof(ICCOMPRESS) + sizeof(*icComp->lpckid) + sizeof(*icComp->lpdwFlags))))
1533 goto error;
1534
1535 pc->cbState = sizeof(ICCOMPRESS);
1536
1537 if (!pc->lpbiOut)
1538 {
1539 /* Ask compressor for needed header size */
1541 (DWORD_PTR)pc->lpbiIn, 0);
1542 if (size <= 0)
1543 goto error;
1544
1545 if (!(pc->lpbiOut = calloc(1, size)))
1546 goto error;
1547 /* Flag to show that we allocated lpbiOut for proper cleanup */
1548 pc->dwFlags |= 0x80000000;
1549
1551 (DWORD_PTR)pc->lpbiIn, (DWORD_PTR)pc->lpbiOut);
1552 if (ret != ICERR_OK)
1553 {
1554 ERR("Could not get output format from compressor\n");
1555 goto error;
1556 }
1557 if (!pc->lpbiOut->bmiHeader.biSizeImage)
1558 {
1559 /* If we can't know the output frame size for sure at least allocate
1560 * the same size of the input frame and also at least 8Kb to be sure
1561 * that poor compressors will have enough memory to work if the input
1562 * frame is too small.
1563 */
1565 ERR("Bad codec! Invalid output frame size, guessing from input\n");
1566 }
1567 }
1568
1569 TRACE("Input: %lux%lu, fcc %s, bpp %u, size %lu\n",
1574 TRACE("Output: %lux%lu, fcc %s, bpp %u, size %lu\n",
1579
1580 /* Buffer for compressed frame data */
1581 if (!(pc->lpBitsOut = malloc(pc->lpbiOut->bmiHeader.biSizeImage)))
1582 goto error;
1583
1584 /* Buffer for previous compressed frame data */
1585 if (!(pc->lpBitsPrev = malloc(pc->lpbiOut->bmiHeader.biSizeImage)))
1586 goto error;
1587
1588 TRACE("Compvars:\n"
1589 "\tsize: %lu\n"
1590 "\tflags: 0x%lx\n"
1591 "\thic: %p\n"
1592 "\ttype: %s\n"
1593 "\thandler: %s\n"
1594 "\tin/out: %p/%p\n"
1595 "\tkey/data/quality: %li/%li/%li\n",
1596 pc->cbSize, pc->dwFlags, pc->hic, debugstr_fourcc(pc->fccType),
1597 debugstr_fourcc(pc->fccHandler), pc->lpbiIn, pc->lpbiOut, pc->lKey,
1598 pc->lDataRate, pc->lQ);
1599
1601 if (ret == ICERR_OK)
1602 {
1603 icComp = pc->lpState;
1604 /* Initialise some variables */
1605 pc->lFrame = 0; pc->lKeyCount = 0;
1606
1607 icComp->lpbiOutput = &pc->lpbiOut->bmiHeader;
1608 icComp->lpbiInput = &pc->lpbiIn->bmiHeader;
1609 icComp->lpckid = (DWORD *)(icComp + 1);
1610 *icComp->lpckid = 0;
1611 icComp->lpdwFlags = (DWORD *)((char *)(icComp + 1) + sizeof(*icComp->lpckid));
1612 *icComp->lpdwFlags = 0;
1613 icComp->dwFrameSize = 0;
1614 icComp->dwQuality = pc->lQ;
1615 icComp->lpbiPrev = &pc->lpbiIn->bmiHeader;
1616 return TRUE;
1617 }
1618error:
1619 clear_compvars(pc);
1620 return FALSE;
1621}
#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 228 of file msvideo_main.c.

229{
230 WINE_HIC* whic;
231
232 for (whic = MSVIDEO_FirstHic; whic && whic->hic != hic; whic = whic->next);
233 return whic;
234}

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

125{
126 LRESULT ret;
127
128#define XX(x) case x: TRACE("(%p,"#x",0x%08Ix,0x%08Ix)\n",whic,lParam1,lParam2); break
129
130 switch (msg) {
131 /* DRV_* */
132 XX(DRV_LOAD);
133 XX(DRV_ENABLE);
134 XX(DRV_OPEN);
135 XX(DRV_CLOSE);
137 XX(DRV_FREE);
138 /* ICM_RESERVED+X */
139 XX(ICM_ABOUT);
141 XX(ICM_GET);
147 XX(ICM_SET);
149 /* ICM_USER+X */
171 XX(ICM_DRAW);
188 default:
189 FIXME("(%p,0x%08x,0x%08Ix,0x%08Ix) unknown message\n",whic,msg,lParam1,lParam2);
190 }
191
192#undef XX
193
194 if (whic->driverproc) {
195 /* dwDriverId parameter is the value returned by the DRV_OPEN */
196 ret = whic->driverproc(whic->driverId, whic->hdrv, msg, lParam1, lParam2);
197 } else {
198 ret = SendDriverMessage(whic->hdrv, msg, lParam1, lParam2);
199 }
200
201 TRACE(" -> %s\n", wine_dbgstr_icerr(ret));
202 return ret;
203}
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:59
#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 242 of file msvideo_main.c.

243{
244 return 0x040003B6; /* 4.950 */
245}

◆ wine_dbgstr_icerr()

static const char * wine_dbgstr_icerr ( int  ret)
static

Definition at line 59 of file msvideo_main.c.

60{
61 const char *str;
62 if (ret <= ICERR_CUSTOM)
63 return wine_dbg_sprintf("ICERR_CUSTOM (%d)", ret);
64#define XX(x) case (x): str = #x; break
65 switch (ret)
66 {
67 XX(ICERR_OK);
85 default: str = wine_dbg_sprintf("UNKNOWN (%d)", ret);
86 }
87#undef XX
88 return str;
89}
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:296
#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 331 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 91 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 101 of file msvideo_main.c.

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