Solved

Video Code: installed ?

Posted on 2002-05-23
12
607 Views
Last Modified: 2010-04-04
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
Comment
Question by:menorcanet
  • 5
  • 3
  • 2
  • +2
12 Comments
 
LVL 2

Expert Comment

by:freshman3k
Comment Utility
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
 
LVL 12

Expert Comment

by:Lee_Nover
Comment Utility
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
 
LVL 9

Expert Comment

by:ginsonic
Comment Utility
interested
0
 
LVL 12

Expert Comment

by:Lee_Nover
Comment Utility
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
 

Author Comment

by:menorcanet
Comment Utility
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
 
LVL 2

Expert Comment

by:freshman3k
Comment Utility
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:menorcanet
Comment Utility
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
 
LVL 2

Expert Comment

by:freshman3k
Comment Utility

Can you tell me what the exception says please?



0
 
LVL 2

Expert Comment

by:freshman3k
Comment Utility

Can you tell me what the exception says please?



0
 
LVL 2

Accepted Solution

by:
freshman3k earned 100 total points
Comment Utility
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
 
LVL 3

Expert Comment

by:lopem
Comment Utility
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
 

Author Comment

by:menorcanet
Comment Utility
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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now