Commit 676a5135 authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

Updated msvideo / vfw.h, use builtin msvfw32.dll by default, added

aviinfo and aviplay programs.
parent a2ca7b98
...@@ -32,8 +32,8 @@ typedef struct tagWINE_HIC { ...@@ -32,8 +32,8 @@ typedef struct tagWINE_HIC {
DWORD type; /* 08: */ DWORD type; /* 08: */
DWORD handler; /* 0C: */ DWORD handler; /* 0C: */
HDRVR32 hdrv; /* 10: */ HDRVR32 hdrv; /* 10: */
DWORD private; /* 14: private data passed to drv */ DWORD private; /* 14:(handled by SendDriverMessage32)*/
FARPROC32 driverproc; /* 18: */ FARPROC32 driverproc; /* 18:(handled by SendDriverMessage32)*/
DWORD x1; /* 1c: name? */ DWORD x1; /* 1c: name? */
WORD x2; /* 20: */ WORD x2; /* 20: */
DWORD x3; /* 22: */ DWORD x3; /* 22: */
...@@ -260,7 +260,7 @@ typedef struct { ...@@ -260,7 +260,7 @@ typedef struct {
WCHAR szDriver[128]; /* 138:driver that contains compressor*/ WCHAR szDriver[128]; /* 138:driver that contains compressor*/
/* 238: */ /* 238: */
} ICINFO32; } ICINFO32;
DECL_WINELIB_TYPE(ICINFO); DECL_WINELIB_TYPE(ICINFO)
/* ICINFO.dwFlags */ /* ICINFO.dwFlags */
#define VIDCF_QUALITY 0x0001 /* supports quality */ #define VIDCF_QUALITY 0x0001 /* supports quality */
...@@ -392,6 +392,9 @@ LRESULT VFWAPI ICClose32(HIC32 hic); ...@@ -392,6 +392,9 @@ LRESULT VFWAPI ICClose32(HIC32 hic);
#define ICClose WINELIB_NAME(ICClose) #define ICClose WINELIB_NAME(ICClose)
LRESULT VFWAPI ICSendMessage32(HIC32 hic, UINT32 msg, DWORD dw1, DWORD dw2); LRESULT VFWAPI ICSendMessage32(HIC32 hic, UINT32 msg, DWORD dw1, DWORD dw2);
#define ICSendMessage WINELIB_NAME(ICSendMessage) #define ICSendMessage WINELIB_NAME(ICSendMessage)
HIC32 VFWAPI ICLocate32(DWORD fccType, DWORD fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, WORD wFlags);
#define ICLocate WINELIB_NAME(ICLocate)
DWORD VFWAPIV ICDrawBegin32( DWORD VFWAPIV ICDrawBegin32(
HIC32 hic, HIC32 hic,
DWORD dwFlags,/* flags */ DWORD dwFlags,/* flags */
...@@ -414,6 +417,20 @@ DWORD VFWAPIV ICDrawBegin32( ...@@ -414,6 +417,20 @@ DWORD VFWAPIV ICDrawBegin32(
/********************* AVIFILE function declarations *************************/ /********************* AVIFILE function declarations *************************/
#define streamtypeVIDEO mmioFOURCC('v', 'i', 'd', 's')
#define streamtypeAUDIO mmioFOURCC('a', 'u', 'd', 's')
#define streamtypeMIDI mmioFOURCC('m', 'i', 'd', 's')
#define streamtypeTEXT mmioFOURCC('t', 'x', 't', 's')
/* Basic chunk types */
#define cktypeDIBbits aviTWOCC('d', 'b')
#define cktypeDIBcompressed aviTWOCC('d', 'c')
#define cktypePALchange aviTWOCC('p', 'c')
#define cktypeWAVEbytes aviTWOCC('w', 'b')
/* Chunk id to use for extra chunks for padding. */
#define ckidAVIPADDING mmioFOURCC('J', 'U', 'N', 'K')
/* AVIFileHdr.dwFlags */ /* AVIFileHdr.dwFlags */
#define AVIF_HASINDEX 0x00000010 /* Index at end of file? */ #define AVIF_HASINDEX 0x00000010 /* Index at end of file? */
#define AVIF_MUSTUSEINDEX 0x00000020 #define AVIF_MUSTUSEINDEX 0x00000020
...@@ -424,6 +441,21 @@ DWORD VFWAPIV ICDrawBegin32( ...@@ -424,6 +441,21 @@ DWORD VFWAPIV ICDrawBegin32(
#define AVI_HEADERSIZE 2048 #define AVI_HEADERSIZE 2048
typedef struct _MainAVIHeader
{
DWORD dwMicroSecPerFrame;
DWORD dwMaxBytesPerSec;
DWORD dwPaddingGranularity;
DWORD dwFlags;
DWORD dwTotalFrames;
DWORD dwInitialFrames;
DWORD dwStreams;
DWORD dwSuggestedBufferSize;
DWORD dwWidth;
DWORD dwHeight;
DWORD dwReserved[4];
} MainAVIHeader;
/* AVIStreamHeader.dwFlags */ /* AVIStreamHeader.dwFlags */
#define AVISF_DISABLED 0x00000001 #define AVISF_DISABLED 0x00000001
#define AVISF_VIDEO_PALCHANGES 0x00010000 #define AVISF_VIDEO_PALCHANGES 0x00010000
...@@ -442,7 +474,7 @@ typedef struct { ...@@ -442,7 +474,7 @@ typedef struct {
DWORD dwSuggestedBufferSize; DWORD dwSuggestedBufferSize;
DWORD dwQuality; DWORD dwQuality;
DWORD dwSampleSize; DWORD dwSampleSize;
RECT32 rcFrame; RECT16 rcFrame; /* word.word - word.word in file */
} AVIStreamHeader; } AVIStreamHeader;
/* AVIINDEXENTRY.dwFlags */ /* AVIINDEXENTRY.dwFlags */
...@@ -511,9 +543,9 @@ typedef struct _AVISTREAMINFO32W { ...@@ -511,9 +543,9 @@ typedef struct _AVISTREAMINFO32W {
DWORD dwFormatChangeCount; DWORD dwFormatChangeCount;
WCHAR szName[64]; WCHAR szName[64];
} AVISTREAMINFO32W, * LPAVISTREAMINFO32W, *PAVISTREAMINFO32W; } AVISTREAMINFO32W, * LPAVISTREAMINFO32W, *PAVISTREAMINFO32W;
DECL_WINELIB_TYPE_AW(AVISTREAMINFO); DECL_WINELIB_TYPE_AW(AVISTREAMINFO)
DECL_WINELIB_TYPE_AW(LPAVISTREAMINFO); DECL_WINELIB_TYPE_AW(LPAVISTREAMINFO)
DECL_WINELIB_TYPE_AW(PAVISTREAMINFO); DECL_WINELIB_TYPE_AW(PAVISTREAMINFO)
#define AVISTREAMINFO_DISABLED 0x00000001 #define AVISTREAMINFO_DISABLED 0x00000001
#define AVISTREAMINFO_FORMATCHANGES 0x00010000 #define AVISTREAMINFO_FORMATCHANGES 0x00010000
...@@ -557,11 +589,11 @@ typedef struct _AVIFILEINFO32A { ...@@ -557,11 +589,11 @@ typedef struct _AVIFILEINFO32A {
DWORD dwRate; DWORD dwRate;
DWORD dwLength; DWORD dwLength;
DWORD dwEditCount; DWORD dwEditCount;
CHAR szFileType[64]; CHAR szFileType[64];
} AVIFILEINFO32A, * LPAVIFILEINFO32A, *PAVIFILEINFO32A; } AVIFILEINFO32A, * LPAVIFILEINFO32A, *PAVIFILEINFO32A;
DECL_WINELIB_TYPE_AW(AVIFILEINFO); DECL_WINELIB_TYPE_AW(AVIFILEINFO)
DECL_WINELIB_TYPE_AW(PAVIFILEINFO); DECL_WINELIB_TYPE_AW(PAVIFILEINFO)
DECL_WINELIB_TYPE_AW(LPAVIFILEINFO); DECL_WINELIB_TYPE_AW(LPAVIFILEINFO)
/* AVICOMPRESSOPTIONS.dwFlags. determines presence of fields in below struct */ /* AVICOMPRESSOPTIONS.dwFlags. determines presence of fields in below struct */
#define AVICOMPRESSF_INTERLEAVE 0x00000001 #define AVICOMPRESSF_INTERLEAVE 0x00000001
...@@ -615,6 +647,9 @@ ICOM_BEGIN(IAVIStream32, IUnknown) ...@@ -615,6 +647,9 @@ ICOM_BEGIN(IAVIStream32, IUnknown)
ICOM_END(IAVIStream32) ICOM_END(IAVIStream32)
#undef ICOM_INTERFACE #undef ICOM_INTERFACE
DECL_WINELIB_TYPE(IAVIStream)
DECL_WINELIB_TYPE(PAVISTREAM)
/* IAVIFile32 interface. In Win32 this interface uses UNICODE only */ /* IAVIFile32 interface. In Win32 this interface uses UNICODE only */
#define ICOM_INTERFACE IAVIFile32 #define ICOM_INTERFACE IAVIFile32
typedef struct IAVIFile32 IAVIFile32,*PAVIFILE32; typedef struct IAVIFile32 IAVIFile32,*PAVIFILE32;
...@@ -629,6 +664,23 @@ ICOM_BEGIN(IAVIFile32,IUnknown) ...@@ -629,6 +664,23 @@ ICOM_BEGIN(IAVIFile32,IUnknown)
ICOM_END(IAVIFile32) ICOM_END(IAVIFile32)
#undef ICOM_INTERFACE #undef ICOM_INTERFACE
DECL_WINELIB_TYPE(IAVIFile)
DECL_WINELIB_TYPE(PAVIFILE)
/* IGetFrame32 interface */
#define ICOM_INTERFACE IGetFrame32
typedef struct IGetFrame32 IGetFrame32,*PGETFRAME32;
ICOM_BEGIN(IGetFrame32,IUnknown)
ICOM_METHOD1(LPVOID,GetFrame,LONG,);
ICOM_METHOD3(HRESULT,Begin,LONG,,LONG,,LONG,);
ICOM_METHOD (HRESULT,End);
ICOM_METHOD6(HRESULT,SetFormat,LPBITMAPINFOHEADER,,LPVOID,,INT32,,INT32,,INT32,,INT32,);
ICOM_END(IGetFrame32)
#undef ICOM_INTERFACE
DECL_WINELIB_TYPE(IGetFrame)
DECL_WINELIB_TYPE(PGETFRAME)
#define AVIERR_OK 0 #define AVIERR_OK 0
#define MAKE_AVIERR(error) MAKE_SCODE(SEVERITY_ERROR,FACILITY_ITF,0x4000+error) #define MAKE_AVIERR(error) MAKE_SCODE(SEVERITY_ERROR,FACILITY_ITF,0x4000+error)
...@@ -652,15 +704,6 @@ ICOM_END(IAVIFile32) ...@@ -652,15 +704,6 @@ ICOM_END(IAVIFile32)
#define AVIERR_USERABORT MAKE_AVIERR(198) #define AVIERR_USERABORT MAKE_AVIERR(198)
#define AVIERR_ERROR MAKE_AVIERR(199) #define AVIERR_ERROR MAKE_AVIERR(199)
void WINAPI AVIFileInit32(void);
#define AVIFileInit WINELIB_NAME(AVIFileInit)
HRESULT WINAPI AVIFileOpen32A(PAVIFILE32 * ppfile,LPCSTR szFile,UINT32 uMode,LPCLSID lpHandler);
#define AVIFileOpen WINELIB_NAME_AW(AVIFileOpen)
HRESULT WINAPI AVIFileCreateStream32A(PAVIFILE32 pfile,PAVISTREAM32 *ppavi,AVISTREAMINFO32A * psi);
HRESULT WINAPI AVIFileCreateStream32W(PAVIFILE32 pfile,PAVISTREAM32 *ppavi,AVISTREAMINFO32W * psi);
#define AVIFileCreateStream WINELIB_NAME_AW(AVIFileCreateStream)
HRESULT WINAPI AVIMakeCompressedStream32(PAVISTREAM32*ppsCompressed,PAVISTREAM32 ppsSource,AVICOMPRESSOPTIONS *lpOptions,CLSID*pclsidHandler); HRESULT WINAPI AVIMakeCompressedStream32(PAVISTREAM32*ppsCompressed,PAVISTREAM32 ppsSource,AVICOMPRESSOPTIONS *lpOptions,CLSID*pclsidHandler);
#define AVIMakeCompressedStream WINELIB_NAME_AW(AVIMakeCompressedStream) #define AVIMakeCompressedStream WINELIB_NAME_AW(AVIMakeCompressedStream)
HRESULT WINAPI AVIStreamSetFormat32(PAVISTREAM32 iface,LONG pos,LPVOID format,LONG formatsize); HRESULT WINAPI AVIStreamSetFormat32(PAVISTREAM32 iface,LONG pos,LPVOID format,LONG formatsize);
...@@ -669,10 +712,47 @@ HRESULT WINAPI AVIStreamWrite32(PAVISTREAM32 iface,LONG start,LONG samples,LPVOI ...@@ -669,10 +712,47 @@ HRESULT WINAPI AVIStreamWrite32(PAVISTREAM32 iface,LONG start,LONG samples,LPVOI
#define AVIStreamWrite WINELIB_NAME(AVIStreamWrite) #define AVIStreamWrite WINELIB_NAME(AVIStreamWrite)
ULONG WINAPI AVIStreamRelease32(PAVISTREAM32 iface); ULONG WINAPI AVIStreamRelease32(PAVISTREAM32 iface);
#define AVIStreamRelease WINELIB_NAME(AVIStreamRelease) #define AVIStreamRelease WINELIB_NAME(AVIStreamRelease)
LONG WINAPI AVIStreamStart32(PAVISTREAM32 iface);
#define AVIStreamStart WINELIB_NAME(AVIStreamStart)
LONG WINAPI AVIStreamLength32(PAVISTREAM32 iface);
#define AVIStreamLength WINELIB_NAME(AVIStreamLength)
HRESULT WINAPI AVIStreamReadFormat32(PAVISTREAM32 iface,LONG pos,LPVOID format,LONG *formatsize);
#define AVIStreamReadFormat WINELIB_NAME(AVIStreamReadFormat)
HRESULT WINAPI AVIStreamWrite32(PAVISTREAM32 iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten);
#define AVIStreamWrite WINELIB_NAME(AVIStreamWrite)
HRESULT WINAPI AVIStreamRead32(PAVISTREAM32 iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread);
#define AVIStreamRead WINELIB_NAME(AVIStreamRead)
HRESULT WINAPI AVIStreamWriteData32(PAVISTREAM32 iface,DWORD fcc,LPVOID lp,LONG size);
#define AVIStreamWriteData WINELIB_NAME(AVIStreamWriteData)
HRESULT WINAPI AVIStreamReadData32(PAVISTREAM32 iface,DWORD fcc,LPVOID lp,LONG *lpread);
#define AVIStreamReadData WINELIB_NAME(AVIStreamReadData)
HRESULT WINAPI AVIStreamInfo32A(PAVISTREAM32 iface,AVISTREAMINFO32A *asi,LONG size);
HRESULT WINAPI AVIStreamInfo32W(PAVISTREAM32 iface,AVISTREAMINFO32W *asi,LONG size);
#define AVIStreamInfo WINELIB_NAME_AW(AVIStreamInfo)
PGETFRAME32 WINAPI AVIStreamGetFrameOpen32(PAVISTREAM32 pavi,LPBITMAPINFOHEADER lpbiWanted);
#define AVIStreamGetFrameOpen WINELIB_NAME(AVIStreamGetFrameOpen)
HRESULT WINAPI AVIStreamGetFrameClose32(PGETFRAME32 pg);
#define AVIStreamGetFrameClose WINELIB_NAME(AVIStreamGetFrameClose)
PGETFRAME32 WINAPI AVIStreamGetFrameOpen32(PAVISTREAM32 pavi,LPBITMAPINFOHEADER lpbiWanted);
#define AVIStreamGetFrameOpen WINELIB_NAME(AVIStreamGetFrameOpen)
LPVOID WINAPI AVIStreamGetFrame32(PGETFRAME32 pg,LONG pos);
#define AVIStreamGetFrame WINELIB_NAME(AVIStreamGetFrame)
void WINAPI AVIFileInit32(void);
#define AVIFileInit WINELIB_NAME(AVIFileInit)
HRESULT WINAPI AVIFileOpen32A(PAVIFILE32 * ppfile,LPCSTR szFile,UINT32 uMode,LPCLSID lpHandler);
#define AVIFileOpen WINELIB_NAME_AW(AVIFileOpen)
HRESULT WINAPI AVIFileCreateStream32A(PAVIFILE32 pfile,PAVISTREAM32 *ppavi,AVISTREAMINFO32A * psi);
HRESULT WINAPI AVIFileCreateStream32W(PAVIFILE32 pfile,PAVISTREAM32 *ppavi,AVISTREAMINFO32W * psi);
#define AVIFileCreateStream WINELIB_NAME_AW(AVIFileCreateStream)
ULONG WINAPI AVIFileRelease32(PAVIFILE32 iface); ULONG WINAPI AVIFileRelease32(PAVIFILE32 iface);
#define AVIFileRelease WINELIB_NAME(AVIFileRelease) #define AVIFileRelease WINELIB_NAME(AVIFileRelease)
HRESULT WINAPI AVIFileInfo32A(PAVIFILE32 pfile,PAVIFILEINFO32A,LONG);
HRESULT WINAPI AVIFileInfo32W(PAVIFILE32 pfile,PAVIFILEINFO32W,LONG);
#define AVIFileInfo WINELIB_NAME_AW(AVIFileInfo)
HRESULT WINAPI AVIFileGetStream32(PAVIFILE32 pfile,PAVISTREAM32*avis,DWORD fccType,LONG lParam);
#define AVIFileGetStream WINELIB_NAME(AVIFileGetStream)
void WINAPI AVIFileExit32(void); void WINAPI AVIFileExit32(void);
#define AVIFileExit WINELIB_NAME(AVIFileExit) #define AVIFileExit WINELIB_NAME(AVIFileExit)
#endif #endif
...@@ -71,18 +71,8 @@ ICOpen32(DWORD fccType,DWORD fccHandler,UINT32 wMode) { ...@@ -71,18 +71,8 @@ ICOpen32(DWORD fccType,DWORD fccHandler,UINT32 wMode) {
memcpy(type,&fccType,4);type[4]=0; memcpy(type,&fccType,4);type[4]=0;
memcpy(handler,&fccHandler,4);handler[4]=0; memcpy(handler,&fccHandler,4);handler[4]=0;
TRACE(msvideo,"(%s,%s,0x%08lx)\n",type,handler,(DWORD)wMode); TRACE(msvideo,"(%s,%s,0x%08lx)\n",type,handler,(DWORD)wMode);
/* FIXME: When do we use 'vids' , when 'vidc'? Unclear */ sprintf(codecname,"%s.%s",type,handler);
if (!strcasecmp(type,"vids")) {
sprintf(codecname,"vidc.%s",handler);
fccType = mmioFOURCC('v','i','d','c');
} else
sprintf(codecname,"%s.%s",type,handler);
hdrv=OpenDriver32A(codecname,"drivers32",0);
if (!hdrv)
return 0;
whic = HeapAlloc(GetProcessHeap(),0,sizeof(WINE_HIC));
whic->hdrv = hdrv;
whic->driverproc= GetProcAddress32(GetDriverModuleHandle32(hdrv),"DriverProc");
/* Well, lParam2 is in fact a LPVIDEO_OPEN_PARMS, but it has the /* Well, lParam2 is in fact a LPVIDEO_OPEN_PARMS, but it has the
* same layout as ICOPEN * same layout as ICOPEN
*/ */
...@@ -91,7 +81,21 @@ ICOpen32(DWORD fccType,DWORD fccHandler,UINT32 wMode) { ...@@ -91,7 +81,21 @@ ICOpen32(DWORD fccType,DWORD fccHandler,UINT32 wMode) {
icopen.dwSize = sizeof(ICOPEN); icopen.dwSize = sizeof(ICOPEN);
icopen.dwFlags = wMode; icopen.dwFlags = wMode;
/* FIXME: do we need to fill out the rest too? */ /* FIXME: do we need to fill out the rest too? */
hdrv=OpenDriver32A(codecname,"drivers32",(LPARAM)&icopen);
if (!hdrv) {
if (!strcasecmp(type,"vids")) {
sprintf(codecname,"vidc.%s",handler);
fccType = mmioFOURCC('v','i','d','c');
}
hdrv=OpenDriver32A(codecname,"drivers32",(LPARAM)&icopen);
return 0;
}
whic = HeapAlloc(GetProcessHeap(),0,sizeof(WINE_HIC));
whic->hdrv = hdrv;
#if 0
whic->driverproc= GetProcAddress32(GetDriverModuleHandle32(hdrv),"DriverProc");
whic->private = whic->driverproc(0,hdrv,DRV_OPEN,0,&icopen); whic->private = whic->driverproc(0,hdrv,DRV_OPEN,0,&icopen);
#endif
return (HIC32)whic; return (HIC32)whic;
} }
...@@ -105,6 +109,45 @@ ICGetInfo32(HIC32 hic,ICINFO32 *picinfo,DWORD cb) { ...@@ -105,6 +109,45 @@ ICGetInfo32(HIC32 hic,ICINFO32 *picinfo,DWORD cb) {
return ret; return ret;
} }
HIC32 VFWAPI
ICLocate32(
DWORD fccType, DWORD fccHandler, LPBITMAPINFOHEADER lpbiIn,
LPBITMAPINFOHEADER lpbiOut, WORD wMode
) {
char type[5],handler[5];
HIC32 hic;
DWORD querymsg;
switch (wMode) {
case ICMODE_FASTCOMPRESS:
case ICMODE_COMPRESS:
querymsg = ICM_COMPRESS_QUERY;
break;
case ICMODE_DECOMPRESS:
case ICMODE_FASTDECOMPRESS:
querymsg = ICM_DECOMPRESS_QUERY;
break;
case ICMODE_DRAW:
querymsg = ICM_DRAW_QUERY;
break;
default:
FIXME(msvideo,"Unknown mode (%d)\n",wMode);
return 0;
}
/* Easy case: handler/type match, we just fire a query and return */
hic = ICOpen32(fccType,fccHandler,wMode);
if (hic) {
if (!ICSendMessage32(hic,querymsg,(DWORD)lpbiIn,(DWORD)lpbiOut))
return hic;
ICClose32(hic);
}
type[4]='\0';memcpy(type,&fccType,4);
handler[4]='\0';memcpy(handler,&fccHandler,4);
FIXME(msvideo,"(%s,%s,%p,%p,0x%04x),unhandled!\n",type,handler,lpbiIn,lpbiOut,wMode);
return 0;
}
DWORD VFWAPIV DWORD VFWAPIV
ICCompress32( ICCompress32(
HIC32 hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiOutput,LPVOID lpData, HIC32 hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiOutput,LPVOID lpData,
...@@ -147,14 +190,6 @@ ICDecompress32(HIC32 hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiFormat,LPVOID lpDa ...@@ -147,14 +190,6 @@ ICDecompress32(HIC32 hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiFormat,LPVOID lpDa
return ICSendMessage32(hic,ICM_DECOMPRESS,(LPARAM)&icd,sizeof(icd)); return ICSendMessage32(hic,ICM_DECOMPRESS,(LPARAM)&icd,sizeof(icd));
} }
HIC32 WINAPI
ICLocate(DWORD fccType, DWORD fccHandler, LPBITMAPINFOHEADER lpbiIn,
LPBITMAPINFOHEADER lpbiOut, WORD wFlags
) {
FIXME(msvideo,"stub!\n");
return 0;
}
LRESULT VFWAPI LRESULT VFWAPI
ICSendMessage32(HIC32 hic,UINT32 msg,DWORD lParam1,DWORD lParam2) { ICSendMessage32(HIC32 hic,UINT32 msg,DWORD lParam1,DWORD lParam2) {
LRESULT ret; LRESULT ret;
...@@ -206,7 +241,8 @@ ICSendMessage32(HIC32 hic,UINT32 msg,DWORD lParam1,DWORD lParam2) { ...@@ -206,7 +241,8 @@ ICSendMessage32(HIC32 hic,UINT32 msg,DWORD lParam1,DWORD lParam2) {
default: default:
FIXME(msvideo,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx)\n",(DWORD)hic,(DWORD)msg,lParam1,lParam2); FIXME(msvideo,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx)\n",(DWORD)hic,(DWORD)msg,lParam1,lParam2);
} }
ret = whic->driverproc(whic->private,whic->hdrv,msg,lParam1,lParam2); ret = SendDriverMessage32(whic->hdrv,msg,lParam1,lParam2);
/* ret = whic->driverproc(whic->private,whic->hdrv,msg,lParam1,lParam2);*/
TRACE(msvideo," -> 0x%08lx\n",ret); TRACE(msvideo," -> 0x%08lx\n",ret);
return ret; return ret;
} }
...@@ -232,7 +268,11 @@ DWORD VFWAPIV ICDrawBegin32( ...@@ -232,7 +268,11 @@ DWORD VFWAPIV ICDrawBegin32(
} }
LRESULT WINAPI ICClose32(HIC32 hic) { LRESULT WINAPI ICClose32(HIC32 hic) {
FIXME(msvideo,"(%d),stub!\n",hic); WINE_HIC *whic = (WINE_HIC*)hic;
TRACE(msvideo,"(%d).\n",hic);
/* FIXME: correct? */
CloseDriver32(whic->hdrv,0,0);
HeapFree(GetProcessHeap(),0,whic);
return 0; return 0;
} }
......
Makefile Makefile
icinfo icinfo
aviplay
aviinfo
...@@ -4,7 +4,7 @@ TOPOBJDIR = ../.. ...@@ -4,7 +4,7 @@ TOPOBJDIR = ../..
SRCDIR = @srcdir@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
MODULE = none MODULE = none
PROGRAMS = icinfo PROGRAMS = icinfo aviinfo aviplay
ALL_LIBS = $(WINELIB) $(X_LIBS) $(XLIB) $(LIBS) ALL_LIBS = $(WINELIB) $(X_LIBS) $(XLIB) $(LIBS)
RCFLAGS = -w32 -h RCFLAGS = -w32 -h
WRCEXTRA = -A -p $* WRCEXTRA = -A -p $*
...@@ -12,19 +12,12 @@ WRCEXTRA = -A -p $* ...@@ -12,19 +12,12 @@ WRCEXTRA = -A -p $*
LANGUAGES = LANGUAGES =
LICENSELANG = LICENSELANG =
MOSTSRCS = \ MOSTSRCS = \
icinfo.c icinfo.c \
aviinfo.c \
# Some strings need addresses >= 0x10000 aviinfo.c
STRINGSRCS = \
$(LICENSELANG:%=License_%.c)
RC_SRCS = $(LANGUAGES:%=%.rc)
C_SRCS = $(MOSTSRCS) $(STRINGSRCS)
MOSTOBJS = $(MOSTSRCS:.c=.o) MOSTOBJS = $(MOSTSRCS:.c=.o)
STRINGOBJS = $(STRINGSRCS:.c=.o) $(RC_SRCS:.rc=.o)
all: check_wrc $(PROGRAMS) all: check_wrc $(PROGRAMS)
...@@ -33,23 +26,21 @@ depend:: ...@@ -33,23 +26,21 @@ depend::
@MAKE_RULES@ @MAKE_RULES@
# Override resource compiler rules # Override resource compiler rules
.rc.s: icinfo: icinfo.o
$(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P -x c $< | $(WRC) $(WRCFLAGS) $(WRCEXTRA) -o $*.s $(CC) -o icinfo icinfo.o $(LDOPTIONS) $(ALL_LIBS)
.rc.h: aviinfo: aviinfo.o
$(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P -x c $< | $(WRC) $(WRCFLAGS) $(WRCEXTRA) -nH $*.h $(CC) -o aviinfo aviinfo.o $(LDOPTIONS) $(ALL_LIBS)
aviplay: aviplay.o
$(CC) -o aviplay aviplay.o $(LDOPTIONS) $(ALL_LIBS)
icinfo: $(MOSTOBJS) $(STRINGOBJS)
$(CC) -o icinfo $(MOSTOBJS) $(LDOPTIONS) $(ALL_LIBS) $(STRINGOBJS)
install: dummy install: dummy
$(INSTALL_PROGRAM) clock $(bindir)/clock $(INSTALL_PROGRAM) icinfo $(bindir)/icinfo
$(INSTALL_PROGRAM) aviinfo $(bindir)/aviinfo
$(INSTALL_PROGRAM) aviplay $(bindir)/aviplay
uninstall: dummy uninstall: dummy
$(RM) $(bindir)/clock $(RM) $(bindir)/aviinfo $(bindir)/icinfo $(bindir)/aviplay
$(RC_SRCS:.rc=.s): $(WRC)
dummy: dummy:
......
#include <stdio.h>
#include <assert.h>
#include <strings.h>
#include "wintypes.h"
#include "windows.h"
#include "mmsystem.h"
#include "vfw.h"
int PASCAL WinMain (HANDLE hInstance, HANDLE prev, LPSTR cmdline, int show)
{
int n;
HRESULT hres;
HMODULE avifil32 = LoadLibrary("avifil32.dll");
PAVIFILE avif;
PAVISTREAM vids,auds;
AVIFILEINFO afi;
AVISTREAMINFO asi;
void (WINAPI *fnAVIFileInit)(void);
void (WINAPI *fnAVIFileExit)(void);
ULONG (WINAPI *fnAVIFileRelease)(PAVIFILE);
ULONG (WINAPI *fnAVIStreamRelease)(PAVISTREAM);
HRESULT (WINAPI *fnAVIFileOpen)(PAVIFILE * ppfile,LPCTSTR szFile,UINT uMode,LPCLSID lpHandler);
HRESULT (WINAPI *fnAVIFileInfo)(PAVIFILE ppfile,AVIFILEINFO *afi,LONG size);
HRESULT (WINAPI *fnAVIFileGetStream)(PAVIFILE ppfile,PAVISTREAM *afi,DWORD fccType,LONG lParam);
HRESULT (WINAPI *fnAVIStreamInfo)(PAVISTREAM iface,AVISTREAMINFO *afi,LONG size);
#define XX(x) fn##x = (void*)GetProcAddress(avifil32,#x);assert(fn##x);
#ifdef UNICODE
# define XXT(x) fn##x = (void*)GetProcAddress(avifil32,#x##"W");assert(fn##x);
#else
# define XXT(x) fn##x = (void*)GetProcAddress(avifil32,#x##"A");assert(fn##x);
#endif
/* Non character dependend routines: */
XX (AVIFileInit);
XX (AVIFileExit);
XX (AVIFileRelease);
XX (AVIStreamRelease);
XX (AVIFileGetStream);
/* A/W routines: */
XXT(AVIFileOpen);
XXT(AVIFileInfo);
XXT(AVIStreamInfo);
#undef XX
#undef XXT
fnAVIFileInit();
if (-1==GetFileAttributes(cmdline)) {
fprintf(stderr,"Usage: aviinfo <avifilename>\n");
exit(1);
}
hres = fnAVIFileOpen(&avif,cmdline,OF_READ,NULL);
if (hres) {
fprintf(stderr,"AVIFileOpen: 0x%08lx\n",hres);
exit(1);
}
hres = fnAVIFileInfo(avif,&afi,sizeof(afi));
if (hres) {
fprintf(stderr,"AVIFileInfo: 0x%08lx\n",hres);
exit(1);
}
fprintf(stderr,"AVI File Info:\n");
fprintf(stderr,"\tdwMaxBytesPerSec: %ld\n",afi.dwMaxBytesPerSec);
#define FF(x) if (afi.dwFlags & AVIFILEINFO_##x) fprintf(stderr,#x##",");
fprintf(stderr,"\tdwFlags: 0x%lx (",afi.dwFlags);
FF(HASINDEX);FF(MUSTUSEINDEX);FF(ISINTERLEAVED);FF(WASCAPTUREFILE);
FF(COPYRIGHTED);
fprintf(stderr,")\n");
#undef FF
#define FF(x) if (afi.dwCaps & AVIFILECAPS_##x) fprintf(stderr,#x##",");
fprintf(stderr,"\tdwCaps: 0x%lx (",afi.dwCaps);
FF(CANREAD);FF(CANWRITE);FF(ALLKEYFRAMES);FF(NOCOMPRESSION);
fprintf(stderr,")\n");
#undef FF
fprintf(stderr,"\tdwStreams: %ld\n",afi.dwStreams);
fprintf(stderr,"\tdwSuggestedBufferSize: %ld\n",afi.dwSuggestedBufferSize);
fprintf(stderr,"\tdwWidth: %ld\n",afi.dwWidth);
fprintf(stderr,"\tdwHeight: %ld\n",afi.dwHeight);
fprintf(stderr,"\tdwScale: %ld\n",afi.dwScale);
fprintf(stderr,"\tdwRate: %ld\n",afi.dwRate);
fprintf(stderr,"\tdwLength: %ld\n",afi.dwLength);
fprintf(stderr,"\tdwEditCount: %ld\n",afi.dwEditCount);
fprintf(stderr,"\tszFileType: %s\n",afi.szFileType);
for (n = 0;n<afi.dwStreams;n++) {
char buf[5];
PAVISTREAM ast;
hres = fnAVIFileGetStream(avif,&ast,0,n);
if (hres) {
fprintf(stderr,"AVIFileGetStream %d: 0x%08lx\n",n,hres);
exit(1);
}
hres = fnAVIStreamInfo(ast,&asi,sizeof(asi));
if (hres) {
fprintf(stderr,"AVIStreamInfo %d: 0x%08lx\n",n,hres);
exit(1);
}
fprintf(stderr,"Stream %d:\n",n);
buf[4]='\0';memcpy(buf,&(asi.fccType),4);
fprintf(stderr,"\tfccType: %s\n",buf);
memcpy(buf,&(asi.fccHandler),4);
fprintf(stderr,"\tfccHandler: %s\n",buf);
fprintf(stderr,"\tdwFlags: 0x%08lx\n",asi.dwFlags);
fprintf(stderr,"\tdwCaps: 0x%08lx\n",asi.dwCaps);
fprintf(stderr,"\twPriority: %d\n",asi.wPriority);
fprintf(stderr,"\twLanguage: %d\n",asi.wLanguage);
fprintf(stderr,"\tdwScale: %ld\n",asi.dwScale);
fprintf(stderr,"\tdwRate: %ld\n",asi.dwRate);
fprintf(stderr,"\tdwStart: %ld\n",asi.dwStart);
fprintf(stderr,"\tdwLength: %ld\n",asi.dwLength);
fprintf(stderr,"\tdwInitialFrames: %ld\n",asi.dwInitialFrames);
fprintf(stderr,"\tdwSuggestedBufferSize: %ld\n",asi.dwSuggestedBufferSize);
fprintf(stderr,"\tdwQuality: %ld\n",asi.dwQuality);
fprintf(stderr,"\tdwSampleSize: %ld\n",asi.dwSampleSize);
fprintf(stderr,"\tdwEditCount: %ld\n",asi.dwEditCount);
fprintf(stderr,"\tdwFormatChangeCount: %ld\n",asi.dwFormatChangeCount);
fprintf(stderr,"\tszName: %s\n",asi.szName);
switch (asi.fccType) {
case streamtypeVIDEO:
vids = ast;
break;
case streamtypeAUDIO:
auds = ast;
break;
default: {
char type[5];
type[4]='\0';memcpy(type,&(asi.fccType),4);
fprintf(stderr,"Unhandled streamtype %s\n",type);
fnAVIStreamRelease(ast);
break;
}
}
}
fnAVIFileRelease(avif);
fnAVIFileExit();
return 0;
}
/*
* Very simple AVIPLAYER
*
* Copyright 1999 Marcus Meissner
*
* Status:
* - plays .avi streams, video only
* - requires MicroSoft avifil32.dll and builtin msvfw32.dll.
*
* Todo:
* - audio support (including synchronization etc)
* - replace DirectDraw by a 'normal' window, including dithering, controls
* etc.
*
* Bugs:
* - no time scheduling, video plays too fast using DirectDraw/XF86DGA
* - requires DirectDraw with all disadvantages.
*/
#include <stdio.h>
#include <time.h>
#include <assert.h>
#include <strings.h>
#include "wintypes.h"
#include "windows.h"
#include "wingdi.h"
#include "mmsystem.h"
#include "ddraw.h"
#include "vfw.h"
int PASCAL WinMain (HANDLE hInstance, HANDLE prev, LPSTR cmdline, int show)
{
int i,n,pos;
time_t tstart,tend;
LONG cnt;
BITMAPINFOHEADER *bmi;
HRESULT hres;
HMODULE avifil32 = LoadLibrary("avifil32.dll");
PAVIFILE avif;
PAVISTREAM vids=NULL,auds=NULL;
AVIFILEINFO afi;
AVISTREAMINFO asi;
PGETFRAME vidgetframe=NULL;
LPDIRECTDRAW ddraw;
DDSURFACEDESC dsdesc;
LPDIRECTDRAWSURFACE dsurf;
void (WINAPI *fnAVIFileInit)(void);
void (WINAPI *fnAVIFileExit)(void);
ULONG (WINAPI *fnAVIFileRelease)(PAVIFILE);
ULONG (WINAPI *fnAVIStreamRelease)(PAVISTREAM);
HRESULT (WINAPI *fnAVIFileOpen)(PAVIFILE * ppfile,LPCTSTR szFile,UINT uMode,LPCLSID lpHandler);
HRESULT (WINAPI *fnAVIFileInfo)(PAVIFILE ppfile,AVIFILEINFO *afi,LONG size);
HRESULT (WINAPI *fnAVIFileGetStream)(PAVIFILE ppfile,PAVISTREAM *afi,DWORD fccType,LONG lParam);
HRESULT (WINAPI *fnAVIStreamInfo)(PAVISTREAM iface,AVISTREAMINFO *afi,LONG size);
HRESULT (WINAPI *fnAVIStreamReadFormat)(PAVISTREAM iface,LONG pos,LPVOID format,LPLONG size);
PGETFRAME (WINAPI *fnAVIStreamGetFrameOpen)(PAVISTREAM iface,LPBITMAPINFOHEADER wanted);
LPVOID (WINAPI *fnAVIStreamGetFrame)(PGETFRAME pg,LONG pos);
HRESULT (WINAPI *fnAVIStreamGetFrameClose)(PGETFRAME pg);
#define XX(x) fn##x = (void*)GetProcAddress(avifil32,#x);assert(fn##x);
#ifdef UNICODE
# define XXT(x) fn##x = (void*)GetProcAddress(avifil32,#x##"W");assert(fn##x);
#else
# define XXT(x) fn##x = (void*)GetProcAddress(avifil32,#x##"A");assert(fn##x);
#endif
/* non character dependend routines: */
XX (AVIFileInit);
XX (AVIFileExit);
XX (AVIFileRelease);
XX (AVIFileGetStream);
XX (AVIStreamRelease);
XX (AVIStreamReadFormat);
XX (AVIStreamGetFrameOpen);
XX (AVIStreamGetFrame);
XX (AVIStreamGetFrameClose);
/* A/W routines: */
XXT(AVIFileOpen);
XXT(AVIFileInfo);
XXT(AVIStreamInfo);
#undef XX
#undef XXT
fnAVIFileInit();
if (-1==GetFileAttributes(cmdline)) {
fprintf(stderr,"Usage: aviplay <avifilename>\n");
exit(1);
}
hres = fnAVIFileOpen(&avif,cmdline,OF_READ,NULL);
if (hres) {
fprintf(stderr,"AVIFileOpen: 0x%08lx\n",hres);
exit(1);
}
hres = fnAVIFileInfo(avif,&afi,sizeof(afi));
if (hres) {
fprintf(stderr,"AVIFileInfo: 0x%08lx\n",hres);
exit(1);
}
for (n=0;n<afi.dwStreams;n++) {
char buf[5];
PAVISTREAM ast;
hres = fnAVIFileGetStream(avif,&ast,0,n);
if (hres) {
fprintf(stderr,"AVIFileGetStream %d: 0x%08lx\n",n,hres);
exit(1);
}
hres = fnAVIStreamInfo(ast,&asi,sizeof(asi));
if (hres) {
fprintf(stderr,"AVIStreamInfo %d: 0x%08lx\n",n,hres);
exit(1);
}
fprintf(stderr,"[Stream %d: ",n);
buf[4]='\0';memcpy(buf,&(asi.fccType),4);
fprintf(stderr,"%s.",buf);
buf[4]='\0';memcpy(buf,&(asi.fccHandler),4);
fprintf(stderr,"%s, %s]\n",buf,asi.szName);
switch (asi.fccType) {
case streamtypeVIDEO:
vids = ast;
break;
case streamtypeAUDIO:
auds = ast;
break;
default: {
char type[5];
type[4]='\0';memcpy(type,&(asi.fccType),4);
fprintf(stderr,"Unhandled streamtype %s\n",type);
fnAVIStreamRelease(ast);
break;
}
}
}
/********************* begin video setup ***********************************/
if (!vids) {
fprintf(stderr,"No video stream found. Good Bye.\n");
exit(0);
}
cnt = sizeof(BITMAPINFOHEADER)+256*sizeof(RGBQUAD);
bmi = HeapAlloc(GetProcessHeap(),0,cnt);
hres = fnAVIStreamReadFormat(vids,0,bmi,&cnt);
if (hres) {
fprintf(stderr,"AVIStreamReadFormat vids: 0x%08lx\n",hres);
exit(1);
}
bmi->biCompression = 0; /* we want it in raw form, uncompressed */
vidgetframe = fnAVIStreamGetFrameOpen(vids,bmi);
if (!vidgetframe) {
fprintf(stderr,"AVIStreamGetFrameOpen: failed.\n");
exit(1);
}
/********************* end video setup ***********************************/
/********************* begin display setup *******************************/
hres = DirectDrawCreate(NULL,&ddraw,NULL);
if (hres) {
fprintf(stderr,"DirectDrawCreate: 0x%08lx\n",hres);
exit(1);
}
hres = ddraw->lpvtbl->fnSetDisplayMode(ddraw,bmi->biWidth,bmi->biHeight,bmi->biBitCount);
if (hres) {
fprintf(stderr,"ddraw.SetDisplayMode: 0x%08lx (change resolution!)\n",hres);
exit(1);
}
dsdesc.dwSize=sizeof(dsdesc);
dsdesc.dwFlags = DDSD_CAPS;
dsdesc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
hres = ddraw->lpvtbl->fnCreateSurface(ddraw,&dsdesc,&dsurf,NULL);
if (hres) {
fprintf(stderr,"ddraw.CreateSurface: 0x%08lx\n",hres);
exit(1);
}
/********************* end display setup *******************************/
tstart = time(NULL);
pos = 0;
while (1) {
LPVOID decodedframe;
LPBITMAPINFOHEADER lpbmi;
LPVOID decodedbits;
int bytesline;
/* video stuff */
if (!(decodedframe=fnAVIStreamGetFrame(vidgetframe,pos++)))
break;
lpbmi = (LPBITMAPINFOHEADER)decodedframe;
decodedbits = (LPVOID)(((DWORD)decodedframe)+lpbmi->biSize);
dsdesc.dwSize = sizeof(dsdesc);
hres = dsurf->lpvtbl->fnLock(dsurf,NULL,&dsdesc,DDLOCK_WRITEONLY,0);
if (hres) {
fprintf(stderr,"dsurf.Lock: 0x%08lx\n",hres);
exit(1);
}
bytesline = dsdesc.dwWidth * dsdesc.ddpfPixelFormat.x.dwRGBBitCount/8;
/* Argh. AVIs are upside down. */
for (i=0;i<dsdesc.dwHeight;i++) {
memcpy( dsdesc.y.lpSurface+(i*dsdesc.lPitch),
decodedbits+bytesline*(dsdesc.dwHeight-i),
bytesline
);
}
dsurf->lpvtbl->fnUnlock(dsurf,dsdesc.y.lpSurface);
}
tend = time(NULL);
fnAVIStreamGetFrameClose(vidgetframe);
((IUnknown*)dsurf)->lpvtbl->fnRelease((IUnknown*)dsurf);
ddraw->lpvtbl->fnRestoreDisplayMode(ddraw);
((IUnknown*)ddraw)->lpvtbl->fnRelease((IUnknown*)ddraw);
if (vids) fnAVIStreamRelease(vids);
if (auds) fnAVIStreamRelease(auds);
fprintf(stderr,"%d frames at %g frames/s\n",pos,pos*1.0/(tend-tstart));
fnAVIFileRelease(avif);
fnAVIFileExit();
return 0;
}
...@@ -87,7 +87,7 @@ static BUILTIN32_DLL BuiltinDLLs[] = ...@@ -87,7 +87,7 @@ static BUILTIN32_DLL BuiltinDLLs[] =
{ &MPR_Descriptor, TRUE }, { &MPR_Descriptor, TRUE },
{ &MSACM32_Descriptor, FALSE }, { &MSACM32_Descriptor, FALSE },
{ &MSNET32_Descriptor, FALSE }, { &MSNET32_Descriptor, FALSE },
{ &MSVFW32_Descriptor, FALSE }, { &MSVFW32_Descriptor, TRUE },
{ &NTDLL_Descriptor, TRUE }, { &NTDLL_Descriptor, TRUE },
{ &OLE32_Descriptor, FALSE }, { &OLE32_Descriptor, FALSE },
{ &OLEAUT32_Descriptor, FALSE }, { &OLEAUT32_Descriptor, FALSE },
......
...@@ -37,7 +37,7 @@ type win32 ...@@ -37,7 +37,7 @@ type win32
32 stub ICImageDecompress 32 stub ICImageDecompress
33 stdcall ICInfo(long long ptr) ICInfo32 33 stdcall ICInfo(long long ptr) ICInfo32
34 stub ICInstall 34 stub ICInstall
35 stub ICLocate 35 stdcall ICLocate(long long ptr ptr long) ICLocate32
36 stub ICMThunk32 36 stub ICMThunk32
37 stdcall ICOpen(long long long) ICOpen32 37 stdcall ICOpen(long long long) ICOpen32
38 stub ICOpenFunction 38 stub ICOpenFunction
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment