Click here to Skip to main content
15,867,280 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
See more:
I am developing a Windwos form application using Directshow.
At start I was using Quarts.dll located in windows/system32 in purpose of getting the basic API of Directshow.
After a while I realized I need the whole API of Directshow, because I need to create a new Video Renderer filter (VM7).
For this to take place I need to have access to some of the interfaces provided in Directshow c++ API.
I discovered that Directshow is a COM component and I can get access to his API in C#, if I find the right way to bound with it.

Now, this is what I did to get access to the API:

I found out that the C++ API is provided in the Windows SDK. The API I need are located in devenum.idl, axcore.idl and axextend.idl.

Those are interface description language files, and I found out that I can use the midl.exe through the cmd to create a .tlb file (a typelib), now with the file's help I can get access to the interfaces I need. But to use the midl compiler I needed to create a new .idl file that contains the interfaces I want, it looks like that:

C++
import "devenum.idl";
import "axcore.idl";
import "axextend.idl";

[
uuid(A68F9934-FDB9-4AAE-A631-F9307171B2FA),
helpstring("DirectShow interfaces")
]
library DirectShow
{
    interface IFilterGraph;
    interface ICreateDevEnum;
    interface IGraphBuilder;
    interface ICaptureGraphBuilder2;
    interface IFileSinkFilter;
    interface IFileSinkFilter2;
    interface IAMAudioInputMixer;
};

That required to create a new guid.

After that I was able to run the midl and create a .tlb file, But when I tried to add reference to the .tlb file it gave an error.

I found a way to create a .dll file from this .tlb file, by running tlbimp.exe through the cmd on the .tlb file. It created a .dll that I succeeded to add to my project.
Now Visual Studio knows how to interact withh all the interfaces I was trying to get.

But for the problem I am facing now:

At runtime I am getting this error:

Retrieving the COM class factory for component with CLSID {56A868A9-0AD4-11CE-B03A-0020AF0BA770} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).


I can see that the component clsid of the problem is not the clsid of the library in the .idl file I created, it could testify that the problem is on the import files I am using, maybe a bad guid in those files?

I also think the problem can be that the .dll is not registered on my system. I tried to use the regsvr32 but It gave me an error saying:

The module "directshow.dll" was loaded but the entry-point DLLRegisterServer was not found...


Now somebody please save me and tell me how to fix the problem or suggest me a different solution of using the C++ API of Directshow through c#.
Posted
Updated 27-Sep-12 3:07am
v2
Comments
Argonia 27-Sep-12 9:59am    
Use OLE/Com object viewer (or similar program) to see if the DirectShow API isn't available for you to use directly. I use that program and it saved me a lot of time. It helps you with the exported functions as well
[no name] 27-Sep-12 11:03am    
Thank you Markus, I was searching too and found that site and realized that converting the c++'s API is very complicated and that's why this site excites.
NeonMika 27-Sep-12 11:10am    
As far as I have seen they have many examples on how to use it. Don't know if they have one for your problem, but I can imagine that they have at least something similar.
http://directshownet.sourceforge.net/about.html

1 solution

I were just googeling around some month's ago because I had to work with video in C# for the first time.
I saw this project [http://directshownet.sourceforge.net/] and probably this can help you.
I don't really know how much this really belongs to your work, just trying to help :)

Greets, Markus
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900