icinfo.c 2.24 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * Copyright 1999 Marcus Meissner
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 18
 */

19
#include <stdio.h>
20
#include <string.h>
21 22 23 24 25
#include "windows.h"
#include "mmsystem.h"
#include "vfw.h"


26
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
{
    int n=0,doabout=0,doconfigure=0;
    char	buf[128],type[5],handler[5];

    if (strstr(cmdline,"-about"))
    	doabout = 1;
    if (strstr(cmdline,"-configure"))
    	doconfigure = 1;

    printf("Currently installed Video Compressors:\n");
    while (1) {
    	ICINFO	ii;
	HIC	hic;

	ii.dwSize = sizeof(ii);
42
    	if (!ICInfo(ICTYPE_VIDEO,n++,&ii))
43
	    break;
44
	if (!(hic=ICOpen(ii.fccType,ii.fccHandler,ICMODE_QUERY)))
45
	    continue;
46 47
	if (!ICGetInfo(hic,&ii,sizeof(ii))) {
	    ICClose(hic);
48 49 50 51 52 53 54 55
	    continue;
	}
#define w2s(w,s) WideCharToMultiByte(0,0,w,-1,s,128,0,NULL)

	w2s(ii.szName,buf);
	memcpy(type,&(ii.fccType),4);type[4]='\0';
	memcpy(handler,&(ii.fccHandler),4);handler[4]='\0';
	printf("%s.%s: %s\n",type,handler,buf);
56
	printf("\tdwFlags: 0x%08x (",ii.dwFlags);
57 58 59 60 61 62 63 64 65 66 67
#define XX(x) if (ii.dwFlags & x) printf(#x" ");
	XX(VIDCF_QUALITY);
	XX(VIDCF_CRUNCH);
	XX(VIDCF_TEMPORAL);
	XX(VIDCF_COMPRESSFRAMES);
	XX(VIDCF_DRAW);
	XX(VIDCF_FASTTEMPORALC);
	XX(VIDCF_FASTTEMPORALD);
	XX(VIDCF_QUALITYTIME);
#undef XX
	printf(")\n");
68 69
	printf("\tdwVersion: 0x%08x\n",ii.dwVersion);
	printf("\tdwVersionICM: 0x%08x\n",ii.dwVersionICM);
70 71 72
	w2s(ii.szDescription,buf);
	printf("\tszDescription: %s\n",buf);
	if (doabout) ICAbout(hic,0);
73
	if (doconfigure && ICQueryConfigure(hic))
74
		ICConfigure(hic,0);
75
	ICClose(hic);
76
    }
77
    return 0;
78
}