2 * Copyright 1999 Marcus Meissner
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
32 HMODULE avifil32 = LoadLibrary("avifil32.dll");
38 void (WINAPI *fnAVIFileInit)(void);
39 void (WINAPI *fnAVIFileExit)(void);
40 ULONG (WINAPI *fnAVIFileRelease)(PAVIFILE);
41 ULONG (WINAPI *fnAVIStreamRelease)(PAVISTREAM);
42 HRESULT (WINAPI *fnAVIFileOpen)(PAVIFILE * ppfile,LPCTSTR szFile,UINT uMode,LPCLSID lpHandler);
43 HRESULT (WINAPI *fnAVIFileInfo)(PAVIFILE ppfile,AVIFILEINFO *afi,LONG size);
44 HRESULT (WINAPI *fnAVIFileGetStream)(PAVIFILE ppfile,PAVISTREAM *afi,DWORD fccType,LONG lParam);
45 HRESULT (WINAPI *fnAVIStreamInfo)(PAVISTREAM iface,AVISTREAMINFO *afi,LONG size);
47 #define XX(x) fn##x = (void*)GetProcAddress(avifil32,#x);assert(fn##x);
49 # define XXT(x) fn##x = (void*)GetProcAddress(avifil32,#x"W");assert(fn##x);
51 # define XXT(x) fn##x = (void*)GetProcAddress(avifil32,#x"A");assert(fn##x);
53 /* Non character dependent routines: */
57 XX (AVIStreamRelease);
58 XX (AVIFileGetStream);
67 if (GetFileAttributes(cmdline) == INVALID_FILE_ATTRIBUTES) {
68 fprintf(stderr,"Usage: aviinfo <avifilename>\n");
71 hres = fnAVIFileOpen(&avif,cmdline,OF_READ,NULL);
73 fprintf(stderr,"AVIFileOpen: 0x%08lx\n",hres);
76 hres = fnAVIFileInfo(avif,&afi,sizeof(afi));
78 fprintf(stderr,"AVIFileInfo: 0x%08lx\n",hres);
81 fprintf(stderr,"AVI File Info:\n");
82 fprintf(stderr,"\tdwMaxBytesPerSec: %ld\n",afi.dwMaxBytesPerSec);
83 #define FF(x) if (afi.dwFlags & AVIFILEINFO_##x) fprintf(stderr,#x",");
84 fprintf(stderr,"\tdwFlags: 0x%lx (",afi.dwFlags);
85 FF(HASINDEX);FF(MUSTUSEINDEX);FF(ISINTERLEAVED);FF(WASCAPTUREFILE);
87 fprintf(stderr,")\n");
89 #define FF(x) if (afi.dwCaps & AVIFILECAPS_##x) fprintf(stderr,#x",");
90 fprintf(stderr,"\tdwCaps: 0x%lx (",afi.dwCaps);
91 FF(CANREAD);FF(CANWRITE);FF(ALLKEYFRAMES);FF(NOCOMPRESSION);
92 fprintf(stderr,")\n");
94 fprintf(stderr,"\tdwStreams: %ld\n",afi.dwStreams);
95 fprintf(stderr,"\tdwSuggestedBufferSize: %ld\n",afi.dwSuggestedBufferSize);
96 fprintf(stderr,"\tdwWidth: %ld\n",afi.dwWidth);
97 fprintf(stderr,"\tdwHeight: %ld\n",afi.dwHeight);
98 fprintf(stderr,"\tdwScale: %ld\n",afi.dwScale);
99 fprintf(stderr,"\tdwRate: %ld\n",afi.dwRate);
100 fprintf(stderr,"\tdwLength: %ld\n",afi.dwLength);
101 fprintf(stderr,"\tdwEditCount: %ld\n",afi.dwEditCount);
102 fprintf(stderr,"\tszFileType: %s\n",afi.szFileType);
104 for (n = 0;n<afi.dwStreams;n++) {
108 hres = fnAVIFileGetStream(avif,&ast,0,n);
110 fprintf(stderr,"AVIFileGetStream %d: 0x%08lx\n",n,hres);
113 hres = fnAVIStreamInfo(ast,&asi,sizeof(asi));
115 fprintf(stderr,"AVIStreamInfo %d: 0x%08lx\n",n,hres);
118 fprintf(stderr,"Stream %d:\n",n);
119 buf[4]='\0';memcpy(buf,&(asi.fccType),4);
120 fprintf(stderr,"\tfccType: %s\n",buf);
121 memcpy(buf,&(asi.fccHandler),4);
122 fprintf(stderr,"\tfccHandler: %s\n",buf);
123 fprintf(stderr,"\tdwFlags: 0x%08lx\n",asi.dwFlags);
124 fprintf(stderr,"\tdwCaps: 0x%08lx\n",asi.dwCaps);
125 fprintf(stderr,"\twPriority: %d\n",asi.wPriority);
126 fprintf(stderr,"\twLanguage: %d\n",asi.wLanguage);
127 fprintf(stderr,"\tdwScale: %ld\n",asi.dwScale);
128 fprintf(stderr,"\tdwRate: %ld\n",asi.dwRate);
129 fprintf(stderr,"\tdwStart: %ld\n",asi.dwStart);
130 fprintf(stderr,"\tdwLength: %ld\n",asi.dwLength);
131 fprintf(stderr,"\tdwInitialFrames: %ld\n",asi.dwInitialFrames);
132 fprintf(stderr,"\tdwSuggestedBufferSize: %ld\n",asi.dwSuggestedBufferSize);
133 fprintf(stderr,"\tdwQuality: %ld\n",asi.dwQuality);
134 fprintf(stderr,"\tdwSampleSize: %ld\n",asi.dwSampleSize);
135 fprintf(stderr,"\tdwEditCount: %ld\n",asi.dwEditCount);
136 fprintf(stderr,"\tdwFormatChangeCount: %ld\n",asi.dwFormatChangeCount);
137 fprintf(stderr,"\tszName: %s\n",asi.szName);
138 switch (asi.fccType) {
139 case streamtypeVIDEO:
142 case streamtypeAUDIO:
147 type[4]='\0';memcpy(type,&(asi.fccType),4);
149 fprintf(stderr,"Unhandled streamtype %s\n",type);
153 fnAVIStreamRelease(ast);
155 fnAVIFileRelease(avif);