Moved mciseq to the top-level dlls directory.
[wine/multimedia.git] / programs / avitools / aviinfo.c
blob7c79f67b120de507b6643a30742ea3f3612c2228
1 /*
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
19 #include <stdio.h>
20 #include <assert.h>
21 #include <string.h>
22 #include "windef.h"
23 #include "windows.h"
24 #include "mmsystem.h"
25 #include "vfw.h"
28 int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
30 unsigned int n;
31 HRESULT hres;
32 PAVIFILE avif;
33 PAVISTREAM vids,auds;
34 AVIFILEINFO afi;
35 AVISTREAMINFO asi;
37 AVIFileInit();
38 if (GetFileAttributes(cmdline) == INVALID_FILE_ATTRIBUTES) {
39 fprintf(stderr,"Usage: aviinfo <avifilename>\n");
40 exit(1);
42 hres = AVIFileOpen(&avif,cmdline,OF_READ,NULL);
43 if (hres) {
44 fprintf(stderr,"AVIFileOpen: 0x%08lx\n",hres);
45 exit(1);
47 hres = AVIFileInfo(avif,&afi,sizeof(afi));
48 if (hres) {
49 fprintf(stderr,"AVIFileInfo: 0x%08lx\n",hres);
50 exit(1);
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);
57 FF(COPYRIGHTED);
58 fprintf(stderr,")\n");
59 #undef FF
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");
64 #undef FF
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++) {
76 char buf[5];
77 PAVISTREAM ast;
79 hres = AVIFileGetStream(avif,&ast,0,n);
80 if (hres) {
81 fprintf(stderr,"AVIFileGetStream %d: 0x%08lx\n",n,hres);
82 exit(1);
84 hres = AVIStreamInfo(ast,&asi,sizeof(asi));
85 if (hres) {
86 fprintf(stderr,"AVIStreamInfo %d: 0x%08lx\n",n,hres);
87 exit(1);
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:
111 vids = ast;
112 break;
113 case streamtypeAUDIO:
114 auds = ast;
115 break;
116 default: {
117 char type[5];
118 type[4]='\0';memcpy(type,&(asi.fccType),4);
120 fprintf(stderr,"Unhandled streamtype %s\n",type);
121 break;
124 AVIStreamRelease(ast);
126 AVIFileRelease(avif);
127 AVIFileExit();
128 return 0;