Cast time_t to long for printing.
[wine] / programs / avitools / icinfo.c
1 /*
2  * Copyright 1999 Marcus Meissner
3  *
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.
8  *
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.
13  *
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
17  */
18
19 #include <stdio.h>
20 #include <string.h>
21 #include "windows.h"
22 #include "mmsystem.h"
23 #include "vfw.h"
24
25
26 int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
27 {
28     int n=0,doabout=0,doconfigure=0;
29     char        buf[128],type[5],handler[5];
30     HMODULE     msvfw32 = LoadLibrary("msvfw32.dll");
31
32 BOOL  (VFWAPI  *fnICInfo)(DWORD fccType, DWORD fccHandler, ICINFO * lpicinfo);
33 LRESULT (VFWAPI *fnICClose)(HIC hic);
34 HIC     (VFWAPI *fnICOpen)(DWORD fccType, DWORD fccHandler, UINT wMode);
35 LRESULT (VFWAPI *fnICGetInfo)(HIC hic,ICINFO *picinfo, DWORD cb);
36 LRESULT (VFWAPI *fnICSendMessage)(HIC hic, UINT msg, DWORD dw1, DWORD dw2);
37
38 #define XX(x) fn##x = (void*)GetProcAddress(msvfw32,#x);
39         XX(ICInfo);
40         XX(ICOpen);
41         XX(ICClose);
42         XX(ICGetInfo);
43         XX(ICSendMessage);
44 #undef XX
45
46     if (strstr(cmdline,"-about"))
47         doabout = 1;
48     if (strstr(cmdline,"-configure"))
49         doconfigure = 1;
50
51     printf("Currently installed Video Compressors:\n");
52     while (1) {
53         ICINFO  ii;
54         HIC     hic;
55
56         ii.dwSize = sizeof(ii);
57         if (!fnICInfo(ICTYPE_VIDEO,n++,&ii))
58             break;
59         if (!(hic=fnICOpen(ii.fccType,ii.fccHandler,ICMODE_QUERY)))
60             continue;
61         if (!fnICGetInfo(hic,&ii,sizeof(ii))) {
62             fnICClose(hic);
63             continue;
64         }
65 #define w2s(w,s) WideCharToMultiByte(0,0,w,-1,s,128,0,NULL)
66
67         w2s(ii.szName,buf);
68         memcpy(type,&(ii.fccType),4);type[4]='\0';
69         memcpy(handler,&(ii.fccHandler),4);handler[4]='\0';
70         printf("%s.%s: %s\n",type,handler,buf);
71         printf("\tdwFlags: 0x%08lx (",ii.dwFlags);
72 #define XX(x) if (ii.dwFlags & x) printf(#x" ");
73         XX(VIDCF_QUALITY);
74         XX(VIDCF_CRUNCH);
75         XX(VIDCF_TEMPORAL);
76         XX(VIDCF_COMPRESSFRAMES);
77         XX(VIDCF_DRAW);
78         XX(VIDCF_FASTTEMPORALC);
79         XX(VIDCF_FASTTEMPORALD);
80         XX(VIDCF_QUALITYTIME);
81 #undef XX
82         printf(")\n");
83         printf("\tdwVersion: 0x%08lx\n",ii.dwVersion);
84         printf("\tdwVersionICM: 0x%08lx\n",ii.dwVersionICM);
85         w2s(ii.szDescription,buf);
86         printf("\tszDescription: %s\n",buf);
87         if (doabout) ICAbout(hic,0);
88         if (doconfigure && ICQueryConfigure(hic))
89                 ICConfigure(hic,0);
90         fnICClose(hic);
91     }
92     return 0;
93 }
94