Log in

View Full Version : How to read what codecs are installed?


Guest
23rd March 2005, 03:06
I'm looking for a way to code(wxbasic) a way to read what codecs are installed on the harddisk. Can someone explain how this is done? Under what location my proggy should look and how the types of codec are read in the info part of the codec files?

That info am I going to use as user-codec-suggestions for exporting with avs2avi.

(I'm not looking for a program to do this - but a way to code it)

Tin2tin

Joe Fenton
24th March 2005, 08:33
In Windows, codecs can be anywhere and are registered with the system in the registry. Most codecs tend to be copied into the system32 folder in the windows folder before being registered, but some don't.

Koepi
24th March 2005, 11:08
For Win 2k/XP you need to look at the following registry key:

HKLM based,
char* search_key="Software\\Microsoft\\Windows NT\\CurrentVersion\\Drivers32\\"

the vidc.*-entries represent codecs assigned to fourccs.

IHTH

Cheers
Koepi

Dmitry Vergheles
15th April 2005, 12:46
There is a sample code of console app, that enumerates VFW decoders by Fourcc.

// FVfwEnum.cpp : Defines the entry point for the console application.
//

#define WINVER 0x0500

#include "stdafx.h"
#include <windows.h>
#include <vfw.h>


#define SetTextR SetConsoleTextAttribute(handle,FOREGROUND_RED | FOREGROUND_INTENSITY)
#define SetTextG SetConsoleTextAttribute(handle,FOREGROUND_GREEN | FOREGROUND_INTENSITY)
#define SetTextB SetConsoleTextAttribute(handle,FOREGROUND_BLUE | FOREGROUND_INTENSITY)

#define SetTextRB SetConsoleTextAttribute(handle,FOREGROUND_RED | FOREGROUND_BLUE |FOREGROUND_INTENSITY)
#define SetTextW SetConsoleTextAttribute(handle,FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE )

#define ICTYPE_VSSH mmioFOURCC('V', 'S', 'S', 'H')


//#define ICTYPE_VSSH ICTYPE_VIDEO
int main(int argc, char* argv[])
{

char fn[100] = {'V','S','S','H'};
char fnout[100];
int nSize = 0 ;

HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE );

SetTextW;
printf("\n\t vfw_enum.exe enumerates intalled Video For Windows decompressors with specified FourCC\n");
printf("\t by default VSSH to be set--\n\n");
printf("Arguments:\n");
printf("\t -fcc: fourCC to be set\n\n");
printf("\t -allV: to enumerate all VFW decoders\n\n");


printf("Example:\n");
SetTextRB;
printf("\t vfw_enum.exe -fcc AVC1 \n\n\n");
SetTextW;


int narg =argc;
BOOL bALL = FALSE;
while(narg > 1)
{

if( !strcmp(argv[narg -1],"-fcc") )
{
strcpy(fn,argv[narg]);
narg --;
}else {
if( !strcmp(argv[narg -1],"-allV") )
{
bALL = TRUE;
narg --;
}

}

narg --;
}


DWORD fccType = ICTYPE_VIDEO;//NULL;
ICINFO icinfo = {0};
HIC hic = {0};


BITMAPINFOHEADER bit = { 0 };
bit.biSize = sizeof(BITMAPINFOHEADER);
//bit.biCompression = ICTYPE_VSSH;
bit.biCompression = mmioFOURCC(fn[0],fn[1],fn[2],fn[3]);


BITMAPINFOHEADER *pvIn = &bit;

BOOL Find = FALSE;


for (int i = 0; ICInfo(fccType, i, &icinfo); i++)
{
hic = ICOpen(icinfo.fccType, icinfo.fccHandler, ICMODE_QUERY);

if ( hic )
{
// Skip this compressor if it can't handle the format.
if ( fccType == ICTYPE_VIDEO &&
pvIn != NULL &&
ICDecompressQuery(hic, pvIn, NULL) != ICERR_OK )
{

if(bALL == FALSE)
{
ICClose(hic);
continue;
}
}

// Find out the compressor name.
ICGetInfo(hic, &icinfo, sizeof(icinfo));

printf("-------------------------------------------------\n");
printf("--- Name ---\t\t");
SetTextG;
printf("%S\n",icinfo.szName);
SetTextW;

printf("--- Description ---\t");
SetTextG;
printf("%S\n",icinfo.szDescription);
SetTextW;

printf("--- Location ---\t");
SetTextG;
printf("%S\n",icinfo.szDriver);
SetTextW;
printf("-------------------------------------------------\n\n");
Find = TRUE;
}
}

if (hic){
ICClose(hic);
}


if(!Find ){
SetTextR;
printf("\t There is no decompressors installed to handle %s fourCC\n",fn);
SetTextW;
}
return S_OK;
}