Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 650
  • Last Modified:

Video Code: installed ?

How can I get a list of video codecs installed
on the system to check if codec whatever is
installed ? (any version of it)

Thanks
0
menorcanet
Asked:
menorcanet
  • 5
  • 3
  • 2
  • +2
1 Solution
 
freshman3kCommented:
Hello

First download Delphi import unit for the VFW SDK(you need to include this unit) in order the functions ICInfo,ICGetInfo and ICOpen to be available:

http://www.torry.net/vcl/mmedia/video/vfw.zip

And here is code how to get the list of codecs:
 
procedure TForm1.Button1Click(Sender: TObject);
var
  Count: Integer;
  Info: TICInfo;
  ic: HIC;
begin
ListBox1.Items.Clear;
Count:=0;
repeat
  if not ICInfo(0,Count,Info) then
    Break;
  ic:=ICOpen(Info.fccType,Info.fccHandler,ICMODE_QUERY);
  ICGetInfo(ic,Info,SizeOf(Info));
  ICClose(ic);
 
  ListBox1.Items.Add(Info.szDescription);
 
  Inc(Count);
until
  false;
end;

Good Luck :-)
0
 
Lee_NoverCommented:
I use DirectShow :)

great DirectShow components are DSPack at www.progdigy.com

and a standalone example:

function CodecInstalled(const CodecName: string): Boolean;
const
  IID_IPropertyBag: TGUID = '{55272A00-42CB-11CE-8135-00AA004BB851}';

var
  SysDevEnum: ICreateDevEnum;
  EnumCat: IEnumMoniker;
  Moniker: IMoniker;
  PropBag: IPropertyBag;
  varName: OleVariant;
  n: integer;
  s: string;
begin
  Result:=false;
  if (CoCreateInstance(CLSID_SystemDeviceEnum, nil, CLSCTX_INPROC, IID_ICreateDevEnum, SysDevEnum) = S_OK) then
  begin
    if (SysDevEnum.CreateClassEnumerator(CLSID_VideoCompressorCategory, EnumCat, 0)= S_OK) then
      while EnumCat.Next(1, Moniker, nil) = S_OK do
      begin
        if (Moniker.BindToStorage(nil, nil, IID_IPropertyBag, PropBag) = S_OK) and (PropBag<>nil) then
        begin
          PropBag.Read('FriendlyName', varName, nil);
          s:= varName;
          if AnsiCompareText(s, CodecName) = 0 then
          begin
            Result:=true;
            break;
          end;
        end;
      end;
  end;
end;
0
 
ginsonicCommented:
interested
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Lee_NoverCommented:
you can also check for audio codecs with CLSID_AudioCompressorCategory .. you can enumerate lots of things this way
check out DirectShow.pas :) and the MSDN
0
 
menorcanetAuthor Commented:
freshman I get an error in the vfw unit..

function    ICQueryAbout(hic: HIC): BOOL;
begin
    Result := ICSendMessage(hic, ICM_ABOUT, -1, ICMF_ABOUT_QUERY) = ICERR_OK;
end;

Constant Expression violates subrange bounds

here too

function    MCIWndHome(hwnd: HWND): DWORD;
begin
    Result  := MCIWndSeek(hwnd, MCIWND_START);
end;

------

I'd rather use VFW than DirectShow, this way my app will
work even on win95 without Directx

Thanks.
0
 
freshman3kCommented:
Hello!

I found out that the link to the unit that I gave you will work for delphi 3 ,so if you use delphi 4,5,6 you need to download the following instead:

ftp://delphi-jedi.org/api/vfw.zip

This unit is modified to work with delphi 4,5,6  

Good luck! ;-)

0
 
menorcanetAuthor Commented:
still doesn't work :( it says
Incompatible types: TICNFO and PICINFO

then I changed the var ticinfo by picinfo then
it raises an exception when i click the button.
0
 
freshman3kCommented:

Can you tell me what the exception says please?



0
 
freshman3kCommented:

Can you tell me what the exception says please?



0
 
freshman3kCommented:
Hello!

Here is the latest code ,I tryed it myself and it works:

procedure TForm1.Button1Click(Sender: TObject);
var
 Count: Integer;
 Info: TICInfo;
 ic: HIC;
begin
ListBox1.Items.Clear;
Count:=0;
repeat
 if not ICInfo(0,Count,@Info) then
   Break;
 ic:=ICOpen(Info.fccType,Info.fccHandler,ICMODE_QUERY);
 ICGetInfo(ic,@Info,SizeOf(TICInfo));
 ICClose(ic);

 ListBox1.Items.Add(Info.szDescription);

 Inc(Count);
until
 false;
end;

Took me about 1 hour to find the problem :-)
0
 
lopemCommented:
I found this browsing the www:

From: Peter Haas <PeterJHaas@t-online.de>
Newsgroups: borland.public.delphi.graphics
Subject: Re: Help with Video Capture CODEC Selection


Hi Alan,

Alan Miller wrote in <3B258A89.7D0C6291@san.rr.com>:
> I'm fairly new at this video world but I am amazed that I can find no
> examples of an application doing video cam capture that doesn't use a
> popup window from wfw of which i don't have the source of course.  In
> other words all the components and examples actually calls this in the
> wfw.pas file:
>
> function capDlgVideoCompression(hwnd:THandle):boolean;
> begin
>  Result := boolean(SendMessage(hwnd, WM_CAP_DLG_VIDEOCOMPRESSION, 0,
> 0));
> end;

This is the a documented and easy way to choose and initialize all
usefully properties.


> This brings up a list of available codecs that the user can select
> from.  However, since that window is controlled from within windows, I
> need an example to get the ICinfo on the codecs available to the system
> that my app can pick from, (ie. mpeg-4) instead of it always choosing
> the default AVI output which is a huge file believe me.  I looked up all
> the win sdk info on icinfo and icchoose etc. and i just can't seem to
> make it work.

There is a undocumented way, you can find a list of the installed codecs
in the registry:

On my computer (Win98SE, german) I have found the entries on:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\MediaResources\icm

The relevant codes will begin with vidc. See in the WinSDK for another
FOURCC's and more infos:
http://msdn.microsoft.com/library/default.asp?URL=/library/psdk/multimed/avicomp_7bar.htm

Bye Peter.



Hope this helps,
best regards,

manuel lopez (lopem)
0
 
menorcanetAuthor Commented:
lopem, that branch doesn't exist in Windows XP,
"Media" is missing from here "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control"

freshman it works now, big thanks.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 5
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now