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)
38 if (GetFileAttributes(cmdline) == INVALID_FILE_ATTRIBUTES) {
39 fprintf(stderr,"Usage: aviinfo <avifilename>\n");
42 hres = AVIFileOpen(&avif,cmdline,OF_READ,NULL);
44 fprintf(stderr,"AVIFileOpen: 0x%08lx\n",hres);
47 hres = AVIFileInfo(avif,&afi,sizeof(afi));
49 fprintf(stderr,"AVIFileInfo: 0x%08lx\n",hres);
52 fprintf(stderr,"AVI File Info:\n");
53 fprintf(stderr,"\tdwMaxBytesPerSec: %ld\n",afi.dwMaxBytesPerSec);
54 #define FF(x) if (afi.dwFlags & AVIFILEINFO_##x) fprintf(stderr,#x",");
55 fprintf(stderr,"\tdwFlags: 0x%lx (",afi.dwFlags);
56 FF(HASINDEX);FF(MUSTUSEINDEX);FF(ISINTERLEAVED);FF(WASCAPTUREFILE);
58 fprintf(stderr,")\n");
60 #define FF(x) if (afi.dwCaps & AVIFILECAPS_##x) fprintf(stderr,#x",");
61 fprintf(stderr,"\tdwCaps: 0x%lx (",afi.dwCaps);
62 FF(CANREAD);FF(CANWRITE);FF(ALLKEYFRAMES);FF(NOCOMPRESSION);
63 fprintf(stderr,")\n");
65 fprintf(stderr,"\tdwStreams: %ld\n",afi.dwStreams);
66 fprintf(stderr,"\tdwSuggestedBufferSize: %ld\n",afi.dwSuggestedBufferSize);
67 fprintf(stderr,"\tdwWidth: %ld\n",afi.dwWidth);
68 fprintf(stderr,"\tdwHeight: %ld\n",afi.dwHeight);
69 fprintf(stderr,"\tdwScale: %ld\n",afi.dwScale);
70 fprintf(stderr,"\tdwRate: %ld\n",afi.dwRate);
71 fprintf(stderr,"\tdwLength: %ld\n",afi.dwLength);
72 fprintf(stderr,"\tdwEditCount: %ld\n",afi.dwEditCount);
73 fprintf(stderr,"\tszFileType: %s\n",afi.szFileType);
75 for (n = 0;n<afi.dwStreams;n++) {
79 hres = AVIFileGetStream(avif,&ast,0,n);
81 fprintf(stderr,"AVIFileGetStream %d: 0x%08lx\n",n,hres);
84 hres = AVIStreamInfo(ast,&asi,sizeof(asi));
86 fprintf(stderr,"AVIStreamInfo %d: 0x%08lx\n",n,hres);
89 fprintf(stderr,"Stream %d:\n",n);
90 buf[4]='\0';memcpy(buf,&(asi.fccType),4);
91 fprintf(stderr,"\tfccType: %s\n",buf);
92 memcpy(buf,&(asi.fccHandler),4);
93 fprintf(stderr,"\tfccHandler: %s\n",buf);
94 fprintf(stderr,"\tdwFlags: 0x%08lx\n",asi.dwFlags);
95 fprintf(stderr,"\tdwCaps: 0x%08lx\n",asi.dwCaps);
96 fprintf(stderr,"\twPriority: %d\n",asi.wPriority);
97 fprintf(stderr,"\twLanguage: %d\n",asi.wLanguage);
98 fprintf(stderr,"\tdwScale: %ld\n",asi.dwScale);
99 fprintf(stderr,"\tdwRate: %ld\n",asi.dwRate);
100 fprintf(stderr,"\tdwStart: %ld\n",asi.dwStart);
101 fprintf(stderr,"\tdwLength: %ld\n",asi.dwLength);
102 fprintf(stderr,"\tdwInitialFrames: %ld\n",asi.dwInitialFrames);
103 fprintf(stderr,"\tdwSuggestedBufferSize: %ld\n",asi.dwSuggestedBufferSize);
104 fprintf(stderr,"\tdwQuality: %ld\n",asi.dwQuality);
105 fprintf(stderr,"\tdwSampleSize: %ld\n",asi.dwSampleSize);
106 fprintf(stderr,"\tdwEditCount: %ld\n",asi.dwEditCount);
107 fprintf(stderr,"\tdwFormatChangeCount: %ld\n",asi.dwFormatChangeCount);
108 fprintf(stderr,"\tszName: %s\n",asi.szName);
109 switch (asi.fccType) {
110 case streamtypeVIDEO:
113 case streamtypeAUDIO:
118 type[4]='\0';memcpy(type,&(asi.fccType),4);
120 fprintf(stderr,"Unhandled streamtype %s\n",type);
124 AVIStreamRelease(ast);
126 AVIFileRelease(avif);