Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Video Code: installed ?

Posted on 2002-05-23
12
Medium Priority
?
645 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +2
12 Comments
 
LVL 2

Expert Comment

by:freshman3k
ID: 7030681
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
ID: 7030819
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
ID: 7031285
interested
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 12

Expert Comment

by:Lee_Nover
ID: 7031306
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
ID: 7031471
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
ID: 7032742
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
 

Author Comment

by:menorcanet
ID: 7032791
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
ID: 7032949

Can you tell me what the exception says please?



0
 
LVL 2

Expert Comment

by:freshman3k
ID: 7032954

Can you tell me what the exception says please?



0
 
LVL 2

Accepted Solution

by:
freshman3k earned 400 total points
ID: 7033286
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
ID: 7034959
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
ID: 7036746
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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

610 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