4

I'm trying to build a crucial part for my application in which I need to be able to fake a virtual cam video stream. The video stream that I want to fake as a virtual webcam is streamed through my PC, where I can set the video source from my webcam or somewhere from my hdd. To sum up, something I can set as MediaElement.SourceProperty or Image.Source in WPF.

I've seen Vivek's Vcam, a directshow filter here in tmhare.com which seems like it is extremely related to what I'm looking for. But I couldn't find a way to compile it with VS2010, I also don't really know what to do with it. I think I need to change the input pin but how?

Anyhow, to sum up, I'm trying to build a partial code that needs to work like a small version of ManyCam. I'm building a WPF application where I stream the source from a 64 bit PC.

I would also appreciate some sample code for the filter since I have nearly forgotten everything I ever knew about C++ since DirectShow filter needs to be written in C++...

Thanks for everything!


Edit:

enter image description here

errors i got;

1   IntelliSense: identifier "REFERENCE_TIME" is undefined  c:\program files (x86)\microsoft sdks\windows\v7.0a\include\dvdmedia.h  307 5 // and 6 more
6   IntelliSense: not a class or struct name    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  8   22  Filters
7   IntelliSense: identifier "CUnknown" is undefined    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  14  12  Filters
8   IntelliSense: identifier "IFilterGraph" is undefined    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  17  5   Filters
9   IntelliSense: not a class or struct name    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  23  28  Filters
10  IntelliSense: not a class or struct name    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  23  50  Filters
11  IntelliSense: not a class or struct name    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  23  74  Filters
12  IntelliSense: identifier "IBaseFilter" is undefined c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  37  25  Filters
13  IntelliSense: identifier "Quality" is undefined c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  37  48  Filters
14  IntelliSense: identifier "AM_MEDIA_TYPE" is undefined   c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  42  41  Filters // and 7 more
17  IntelliSense: identifier "IMediaSample" is undefined    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  60  24  Filters
18  IntelliSense: identifier "IMemAllocator" is undefined   c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  61  30  Filters
19  IntelliSense: identifier "ALLOCATOR_PROPERTIES" is undefined    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  61  57  Filters
20  IntelliSense: identifier "CMediaType" is undefined  c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  62  34  Filters
21  IntelliSense: identifier "CMediaType" is undefined  c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  63  41  Filters
22  IntelliSense: identifier "CMediaType" is undefined  c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  64  32  Filters 69  5   Filters
24  IntelliSense: identifier "CCritSec" is undefined    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  71  5   Filters
25  IntelliSense: identifier "IReferenceClock" is undefined c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  72  5   Filters
26  IntelliSense: cannot open source file "streams.h"   c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    4   1   Filters
27  IntelliSense: identifier "CUnknown" is undefined    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    13  1   Filters
28  IntelliSense: identifier "ASSERT" is undefined  c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    15  5   Filters
29  IntelliSense: identifier "CUnknown" is undefined    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    16  5   Filters
30  IntelliSense: identifier "punk" is undefined    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    16  15  Filters
31  IntelliSense: "CSource" is not a nonstatic data member or base class of class "CVCam"   c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    21  5   Filters
32  IntelliSense: identifier "NAME" is undefined    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    21  13  Filters
33  IntelliSense: expected a ')'    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    21  32  Filters
34  IntelliSense: identifier "ASSERT" is undefined  c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    23  5   Filters
35  IntelliSense: identifier "CAutoLock" is undefined   c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    24  5   Filters
36  IntelliSense: identifier "m_cStateLock" is undefined    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    24  26  Filters
37  IntelliSense: identifier "m_paStreams" is undefined c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    26  5   Filters
38  IntelliSense: identifier "CSourceStream" is undefined   c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    26  20  Filters
39  IntelliSense: expected an expression    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    26  36  Filters
40  IntelliSense: expected a ';'    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    26  38  Filters
41  IntelliSense: identifier "IAMStreamConfig" is undefined c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    33  24  Filters
42  IntelliSense: identifier "IKsPropertySet" is undefined  c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    33  60  Filters
43  IntelliSense: identifier "m_paStreams" is undefined c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    34  16  Filters
44  IntelliSense: name followed by '::' must be a class or namespace name   c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    36  16  Filters
45  IntelliSense: identifier "IMediaSample" is undefined    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    74  33  Filters
46  IntelliSense: identifier "IBaseFilter" is undefined c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    99  34  Filters
47  IntelliSense: identifier "Quality" is undefined c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    99  57  Filters
48  IntelliSense: identifier "CMediaType" is undefined  c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    107 41  Filters // and 3 more
51  IntelliSense: identifier "IMemAllocator" is undefined   c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    166 39  Filters
52  IntelliSense: identifier "ALLOCATOR_PROPERTIES" is undefined    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    166 62  Filters
umutto
  • 7,460
  • 4
  • 43
  • 53
  • 1
    What compile errors are you getting? Once compiled, you need to com register it (regsvr32) and after that it will show up as a capture device on the system. – Ralf Aug 31 '11 at 04:40
  • Thanks for the reply! I can do the registering part with the precompiled ax files attached with the zip file no problem there. But i'm having too many errors most of them are related to the missing directshow library files (I've installed the windows sdk and i can see it on program files but I don't know how to reference it to the solution in VC++), VS2010 wanted me to convert the solution once i've opened than gave me some warning.. i'm updating my question with the related warning and errors. Sorry for lack of information. – umutto Aug 31 '11 at 05:22
  • 1
    If you have the ax you don't need to compile it unless you want to change the source, you can just register it and test the capture source using GraphEdit or GraphStudio. BTW the intellisense errors are not compile errors: they will be resolved once you setup your IDE correctly to have the include, lib and bin paths of the Windows SDK, the DirectShow base classes, etc. In VS2010 this can be accomplished using the property manager to edit the property sheets. – Ralf Aug 31 '11 at 10:15
  • Thanks again! I didn't knew i was able to edit the property sheets to point the bin paths, i'm such a noob when it comes to C++ and VC++. And yes i need to change the source, i don't really know how but i think i should change the IKsProperty or the input pins. This is the first time I'm hearing about GraphEdit, i'll take a look at that also but i need to build the filter first! Thanks again! – umutto Aug 31 '11 at 11:48

1 Answers1

4

In order to work with directshow filters, you need to have the Windows SDK installed and comiple the BaseClasses solution. look at: C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples\multimedia\directshow\baseclasses

Afterward you need to add the BaseClasses header files and libs directories to your project properties.

Now your project will know the DirectShow classes and you can start changing the VCam source filter pin.

Sasha Chedygov
  • 127,549
  • 26
  • 102
  • 115
Horonchik
  • 477
  • 2
  • 11