Hello,
I need a C++ DirectShow virtual webcam driver.
The software will capture the default (0) webcam (or the choosen webcam number) on the input.
It will be possible to capture/broadcast multiples webcams at the same time, if the computer have 2 or more webcams devices availables. If this functionality is not easy, please tell me. But I think it's not so hard, why not with a thread-based system.
It will be possible to extract BMP frames of a selected webcam, for a future
streaming use. This functionality will not consume too many CPU.
The software will broadcast the selected webcam to an output pin. Programs like MSN, or Skype, will choose this output pin by default to access to the webcam.
Once a pin is used by another program, the software will create a new available output pin for another program. The outputing will not consume too many CPU.
If it is possible, the program will "hide" the real Webcam from the devices list for the others applications. I think it's not possible, but tell me if you know
About the image resolution, the maximum available
resolution will be choosen by default. Probably 320x240 or 640x480, depends of the webcams.
Obviously, the software will works with every USB or FireWire webcams. But it's not a problem with DirectShow. The output will works with all the programs like MSN, Skype, etc. And, no memory leaks are tolerated.
## Deliverables
The output pins devices names will be the same name of the original device.
The routines I need are simple :
- unsigned int numberOfWebcams(); -> number of availables webcam devices
- bool driverStart(unsigned int WebcamNumber = 0); -> start the driver for the selected webcam
- (struct) deviceInformations(unsigned int WebcamNumber = 0); -> return in a structure the height and the weight of each frame. Used on my side to allocate a unsigned char* for the capturing.
- string getDeviceName(unsigned int WebcamNumber = 0); -> get the device name of the web camera
- bool isFrameNew(unsigned int WebcamNumber = 0); -> tells if a new frame is available before capturing it
- unsigned char* captureFrame(unsigned int WebcamNumber = 0
); -> returns a BMP (without info and file header - just the data) frame of the choosen camera
- void enableOutput(bool) -> enable or disable the output. If the output is switched to off, the current output pins will be killed. Output is "0" by default.
- bool isDriverStarted(unsigned int WebcamNumber = 0); -> is the driver started on this device ?
- bool driverStop(unsigned int WebcamNumber = 0); -> kill the output pins, and release the web camera.
I'm currently using Dev-Cpp for my project. I know, it's not so good. But it would be a great plus if you can create a code who works in this compiler.
If it's not possible, your code must compile with Visual Studio C++ 2010 "Express".
You will provide me all the elements I need to compile your project in Dev-Cpp, or VS C++. The compilation must works on Windows 7.
To give you an idea about the cpu consumption, it will be at 10% (of each core) maximum on a mobile Core2Duo @ 2,6ghz with a capturing loop (@ ~10fps) AND a broadcast to another application (@ ~10fps). Tell me if you think it will takes more.
You will compile a "test" program (in console mode) I can use to test your work. The main() will be like this :
int main() {
for (int i = 0; i < numberOfWebcams(); i++) {
startDriver(i);
enableOutput(i);
cout<<"The name of the webcam "<<i<<" is "<<getDeviceName(i);
}
while(1) {
for (int i = 0; i < numberOfWebcams(); i++) {
while (!isFrameNew(i)) {
Sleep(200);
}
*** BMP allocation, capture of the frame with captureFrame() ***
*** Saving to [login to view URL] on C:/ ***
}
Sleep(2000);
}
}
During this test, the webcam(s) will be available for others programs, like I described before.
---- TIPS ----
I'm currently using the great videoInput library (here: [login to view URL])
This code just works fine with my Dev-Cpp. You can use it to have a "base" if you want.
Finally, my only needs compared with this library is :
- Multi webcam access at the same time (not working in the library)
- Broadcast currently used devices for another programs
I can provide the code I'm currently using with this library (with the BMP allocation / creation).
In your bids, please tell me what points is my requirements you can't do.
And sorry for my light english, this is not my natal language.