10 int PASCAL
WinMain (HANDLE hInstance
, HANDLE prev
, LPSTR cmdline
, int show
)
14 HMODULE avifil32
= LoadLibrary("avifil32.dll");
20 void (WINAPI
*fnAVIFileInit
)(void);
21 void (WINAPI
*fnAVIFileExit
)(void);
22 ULONG (WINAPI
*fnAVIFileRelease
)(PAVIFILE
);
23 ULONG (WINAPI
*fnAVIStreamRelease
)(PAVISTREAM
);
24 HRESULT (WINAPI
*fnAVIFileOpen
)(PAVIFILE
* ppfile
,LPCTSTR szFile
,UINT uMode
,LPCLSID lpHandler
);
25 HRESULT (WINAPI
*fnAVIFileInfo
)(PAVIFILE ppfile
,AVIFILEINFO
*afi
,LONG size
);
26 HRESULT (WINAPI
*fnAVIFileGetStream
)(PAVIFILE ppfile
,PAVISTREAM
*afi
,DWORD fccType
,LONG lParam
);
27 HRESULT (WINAPI
*fnAVIStreamInfo
)(PAVISTREAM iface
,AVISTREAMINFO
*afi
,LONG size
);
29 #define XX(x) fn##x = (void*)GetProcAddress(avifil32,#x);assert(fn##x);
31 # define XXT(x) fn##x = (void*)GetProcAddress(avifil32,#x##"W");assert(fn##x);
33 # define XXT(x) fn##x = (void*)GetProcAddress(avifil32,#x##"A");assert(fn##x);
35 /* Non character dependend routines: */
39 XX (AVIStreamRelease
);
40 XX (AVIFileGetStream
);
49 if (-1==GetFileAttributes(cmdline
)) {
50 fprintf(stderr
,"Usage: aviinfo <avifilename>\n");
53 hres
= fnAVIFileOpen(&avif
,cmdline
,OF_READ
,NULL
);
55 fprintf(stderr
,"AVIFileOpen: 0x%08lx\n",hres
);
58 hres
= fnAVIFileInfo(avif
,&afi
,sizeof(afi
));
60 fprintf(stderr
,"AVIFileInfo: 0x%08lx\n",hres
);
63 fprintf(stderr
,"AVI File Info:\n");
64 fprintf(stderr
,"\tdwMaxBytesPerSec: %ld\n",afi
.dwMaxBytesPerSec
);
65 #define FF(x) if (afi.dwFlags & AVIFILEINFO_##x) fprintf(stderr,#x##",");
66 fprintf(stderr
,"\tdwFlags: 0x%lx (",afi
.dwFlags
);
67 FF(HASINDEX
);FF(MUSTUSEINDEX
);FF(ISINTERLEAVED
);FF(WASCAPTUREFILE
);
69 fprintf(stderr
,")\n");
71 #define FF(x) if (afi.dwCaps & AVIFILECAPS_##x) fprintf(stderr,#x##",");
72 fprintf(stderr
,"\tdwCaps: 0x%lx (",afi
.dwCaps
);
73 FF(CANREAD
);FF(CANWRITE
);FF(ALLKEYFRAMES
);FF(NOCOMPRESSION
);
74 fprintf(stderr
,")\n");
76 fprintf(stderr
,"\tdwStreams: %ld\n",afi
.dwStreams
);
77 fprintf(stderr
,"\tdwSuggestedBufferSize: %ld\n",afi
.dwSuggestedBufferSize
);
78 fprintf(stderr
,"\tdwWidth: %ld\n",afi
.dwWidth
);
79 fprintf(stderr
,"\tdwHeight: %ld\n",afi
.dwHeight
);
80 fprintf(stderr
,"\tdwScale: %ld\n",afi
.dwScale
);
81 fprintf(stderr
,"\tdwRate: %ld\n",afi
.dwRate
);
82 fprintf(stderr
,"\tdwLength: %ld\n",afi
.dwLength
);
83 fprintf(stderr
,"\tdwEditCount: %ld\n",afi
.dwEditCount
);
84 fprintf(stderr
,"\tszFileType: %s\n",afi
.szFileType
);
86 for (n
= 0;n
<afi
.dwStreams
;n
++) {
90 hres
= fnAVIFileGetStream(avif
,&ast
,0,n
);
92 fprintf(stderr
,"AVIFileGetStream %d: 0x%08lx\n",n
,hres
);
95 hres
= fnAVIStreamInfo(ast
,&asi
,sizeof(asi
));
97 fprintf(stderr
,"AVIStreamInfo %d: 0x%08lx\n",n
,hres
);
100 fprintf(stderr
,"Stream %d:\n",n
);
101 buf
[4]='\0';memcpy(buf
,&(asi
.fccType
),4);
102 fprintf(stderr
,"\tfccType: %s\n",buf
);
103 memcpy(buf
,&(asi
.fccHandler
),4);
104 fprintf(stderr
,"\tfccHandler: %s\n",buf
);
105 fprintf(stderr
,"\tdwFlags: 0x%08lx\n",asi
.dwFlags
);
106 fprintf(stderr
,"\tdwCaps: 0x%08lx\n",asi
.dwCaps
);
107 fprintf(stderr
,"\twPriority: %d\n",asi
.wPriority
);
108 fprintf(stderr
,"\twLanguage: %d\n",asi
.wLanguage
);
109 fprintf(stderr
,"\tdwScale: %ld\n",asi
.dwScale
);
110 fprintf(stderr
,"\tdwRate: %ld\n",asi
.dwRate
);
111 fprintf(stderr
,"\tdwStart: %ld\n",asi
.dwStart
);
112 fprintf(stderr
,"\tdwLength: %ld\n",asi
.dwLength
);
113 fprintf(stderr
,"\tdwInitialFrames: %ld\n",asi
.dwInitialFrames
);
114 fprintf(stderr
,"\tdwSuggestedBufferSize: %ld\n",asi
.dwSuggestedBufferSize
);
115 fprintf(stderr
,"\tdwQuality: %ld\n",asi
.dwQuality
);
116 fprintf(stderr
,"\tdwSampleSize: %ld\n",asi
.dwSampleSize
);
117 fprintf(stderr
,"\tdwEditCount: %ld\n",asi
.dwEditCount
);
118 fprintf(stderr
,"\tdwFormatChangeCount: %ld\n",asi
.dwFormatChangeCount
);
119 fprintf(stderr
,"\tszName: %s\n",asi
.szName
);
120 switch (asi
.fccType
) {
121 case streamtypeVIDEO
:
124 case streamtypeAUDIO
:
129 type
[4]='\0';memcpy(type
,&(asi
.fccType
),4);
131 fprintf(stderr
,"Unhandled streamtype %s\n",type
);
132 fnAVIStreamRelease(ast
);
137 fnAVIFileRelease(avif
);