# VCam SDK document (ds version)

## 1. Introduction

VCam SDK is a SDK of e2eSoft VCam software, which allows you to use virtual camera function in your application.

Files in SDK package:
~~~~~~~~~~~~~
[Doc] folder - Document.
VCamCOM.dll – VCamSDK COM object, which defines the IVCamSDK interface.
VCamCOM.tlb – VCamCOM object type library.
VCamCOMTestCSharp.exe - C# Demo program to show how to use VCam COM object.
VCamCOMTestCSharp.zip - VCamCOMTestCSharp.exe's source code, C# project.
VCamSource.ax - VCam Source filter (IVCamS ource interface), and Video Renderer filter (VCam Renderer), which can redirect its input to virtual camera and also defines the IVCamRenderer interface.
VCamSource.tlb - VCamSource type library.
VCamSourceTest.exe - Demo program to show how to use VCam Renderer filter and IVCamRenderer interface.
VCamSourceTest.zip - VCamSourceTest.exe's source code, VC++ 2008 project (to build it, you need to install the latest Platform SDK, which includes DirectShow SDK, or use the following package).
BaseClasses.zip - DirectShow SDK needed to build VCamSourceTest project.
install.bat - Install VCam filters and all components.
uninstall.bat - Uninstall VCam filters and all components.

Distribution need:
~~~~~~~~~~~
VCamSource.ax (need to be registered on target system)
VCamCOM.dll (need to be registered on target system. This file is optional, if you don't use IVCamSDK interface, then you don’t need to distribute this file to final user)

## 2. Getting started

1. Install virtual camera filters and register all components - run install.bat;

2. OK, run VCamCOMTestCSharp.exe and play a video file in it, then use other application to see VCam Virtual Camera video output;

3. Decompress VCamCOMTestCSharp.zip and open the project in it to see how we use VCamCOM object (IVCamSDK).

4. Run VCamSourceTest.exe and play a video file in it, then use other application to see VCam Virtual Camera video output;

5. Decompress VCamSourceTest.zip and open the VC++ 2008 project in it to see how it works (focus on class CVCamSDKImpl).

## 3. How it works

### 3.1 Using DirectShow filter

1. Play a video file in graphedit using default Video Renderer:

2: Play a video file in graphedit using VCam Renderer:

3. VCam Renderer will redirect its input to Virtual Camera output:

From this we can know it's very easy to play a video file to Virtual Camera, and you can also play a video capture device, a video stream, a VCD/DVD and .... to Virtual Camera by DirectShow filter.

You can also use IVCamRenderer interface to interact with virtual camera directly.

### 3.2 Using VCam COM object

For people who are not familiar with DirectShow, we provide VCam COM object (IVCamSDK interface) to make things easier. Using IVCamSDK, you can play a video file, play a video device, play a buffer, perform screen capture, add overlay, etc.

## 4. How to use

Part I - Virtual Camera Name
By default, VCam virtual camera's name is "e2eSoft VCam". You can change this by replacing the strings in registry:
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{860BB310-5D01-11d0-BD3B-00A0C911CE86}\Instance\e2eSoft VCam]
"FriendlyName"="The name you want"

Part II - install / uninstall
Please check install.bat and uninstall.bat file.

Part III - VCam COM object

Please check VCamCOMTestCSharp project’s source code to see how to use VCamSDK interface: IVCamSDK.
Because it’s a COM object, you can use it in other languages such as VB, Delphi, C#, etc.

Part IV - IVCamSDK interface
This interface is provided in an automation compatible .tlb file. To add it, you will have to import this file into your project.

For C++ developers, add the following lines to your projects
#import "VCamCOM.tlb" no_namespace, raw_interfaces_only exclude("UINT_PTR")

For the CLSIDs, add the following lines:
const CLSID CLSID_VCamSDK = {0x79A1C773,0xA400,0x4B07,{0xB1,0x72,0x26,0x71,0x13,0x18,0x1C,0x5B}};
const IID IID_IVCamSDK = {0x90973115,0x408F,0x428E,{0xB0,0xD8,0xBF,0x92,0xB9,0x98,0xE4,0x03}};

Functions of IVCamSDK:

HRESULT SetLicenseCode([in] BSTR pRegStr);
Set license code of VCam SDK, if it's a valid license, the water mark (unregistered e2eSoft VCam) on output video will be removed.
NOTE: Please call "ChangeDefaultFPS" or "ChangeDefaultVideoSize" once after this function to make the watermark disappear.

HRESULT PlayVideoFile([in] BSTR fileName);
Play a video file to VCam, its video will be VCam’s video.

PROPERTY [get/put] ULONG CurrentVideoPosition;
Get or set current playing video file position, time unit is ms.

PROPERTY [get] ULONG CurrentVideoDuration;
Get current playing video file’s duration.

HRESULT PlayVideoDevice([in] long idx);
Play a video device to VCam, its video will be VCam’s video. Here idx is the index of video devices in system,

PROPERTY [get] VARIANT_BOOL IsPlaying;
Is VCam playing a video file or video device?

HRESULT StopPlay();
Stop video file / video device playing.

HRESULT PlayBuffer(in] unsigned char* rgb24Buffer, in] unsigned long width, in] unsigned long height);
Send a video frame to VCam driver, driver will use it as VCam current output. The format of rgb24Buffer is RGB24, here the buffer length must >= (width*24+31)/32*4*height.

HRESULT PlayBufferEx(in] VARIANT rgb24Buffer, in] unsigned long width, in] unsigned long height);
Just like PlayBuffer, but support automation, you should use this in C#/VB/Delphi instead of PlayBuffer, rgb24Buffer is a BYTE array, whose size must >= (width*24+31)/32*4*height.

HRESULT CaptureScreenFixed(in] long x, in] long y, in] unsigned long width, in] unsigned long height);
Begin screen capturing, from point [x, y], with size: width x height.

HRESULT CaptureScreen();
Begin screen capturing, mouse tracking capture.

HRESULT StopCaptureScreen();
Stop screen capture.

HRESULT ChangeDefaultFPS([in] unsigned long fps);
Set VCam default output video frame rate (1 ~ 30).

HRESULT ChangeDefaultVideoSize([in] ULONG width, [in] ULONG height);
Set VCam default output video size [width * height], will be available on next run.

HRESULT AddOverlay([in] VARIANT pRgb32Buffer, [in] ULONG width, [in] ULONG height, [in] LONG px, [in] LONG py, [in] ULONG whichOne);
Add an image overlay to current VCam video.
pRgb32Buffer: overlay image buffer, in RGB32 format (with alpha channel), size is [width x height], if it's NULL, this overlay (whichOne) will be removed;
px, py: overlay position, [0, 0] is left-top point;
whichOne: VCam support 5 image overlay (0~4).

HRESULT AddText(BSTR olText, BSTR ftName, [in] LONG ftSize, [in] ULONG ftStyle, [in] ULONG ftColor, [in] ULONG bkColor, [in] LONG px, [in] LONG py, [in] ULONG bkType, [in] ULONG whichOne);
Add a text overlay to current VCam video.
olText: text to be overlayed;
ftName: font face name;
ftSize: font size;
ftStyle: 0, reserved for later use.
ftColor: text color;
bkColor: text background color;
px, py: overlay position, [0, 0] is left-top point;
bkType: 0 - transparent, 1 - use outline color, 2 - use background color, 3 - use a text band (for text scrolling);
whichOne: VCam support 5 text overlay (0~4).
Remarks:
If olText is NULL or pLogFont is NULL, this overlay (whichOne) will be removed.

Part V - VCam Source Filter

This is the virtual camera source filter, you can configure or use it through its interface: IVCam Source .

Part VI - IVCamSource interface
This interface is provided in an automation compatible .tlb file. To add it, you will have to import this file into your project.

For C++ developers, add the following lines to your projects
#import "VCamSource.tlb" no_namespace, raw_interfaces_only exclude("UINT_PTR")

For the CLSIDs, add the following lines:
const CLSID CLSID_VCamSource = {0x1A5C04B6,0x140D,0x4c05,{0x99,0x02,0x2E,0x17,0x00,0x17,0x1F,0x3E}};
const IID IID_IVCamSource = {0xF8AF4078,0xA31A,0x4651,{0x98,0x35,0x47,0xE5,0x4E,0x41,0x52,0x0E}};

Functions of IVCamSource:

HRESULT SetLicenseCode([in] BSTR pRegStr);
HRESULT GetProp([in] ULONG lIndex, [retval][out] LONG *plValue);
HRESULT SetProp([in] ULONG lIndex, [in] long lValue);
HRESULT CaptureScreen();
HRESULT CaptureScreenFixed([in] LONG x, [in] LONG y, [in] ULONG width, [in] ULONG height);
HRESULT StopCaptureScreen();

Part VII - VCam Renderer Filter

You can use it as a normal video renderer filter, and use it through its interface: IVCamRendere r .

Part VIII - IVCamRenderer interface
This interface is provided in an automation compatible .tlb file. To add it, you will have to import this file into your project.

For C++ developers, add the following lines to your projects
#import "VCamSource.tlb" no_namespace, raw_interfaces_only exclude("UINT_PTR")

For the CLSIDs, add the following lines:
const CLSID CLSID_VCamRenderer = {0xB6A665C1,0x955A,0x4d53,{0xBF,0x7B,0xA2,0x6D,0x9D,0x4D,0xC2,0x7A}};
const IID IID_IVCamRenderConfig = {0xCCFBFF50,0xED42,0x4ce4,{0x8E,0x89,0x73,0x24,0xFB,0x08,0x27,0x11}};

Functions of IVCamRenderer:

HRESULT PlayBuffer24([in] VARIANT rgb24Buffer, [in] ULONG width, [in] ULONG height);
HRESULT PlayBuffer32([in] VARIANT rgb32Buffer, [in] ULONG width, [in] ULONG height);
HRESULT AddOverlay([in] VARIANT pRgb32Buffer, [in] ULONG width, [in] ULONG height, [in] LONG px, [in] LONG py, [in] ULONG whichOne);
HRESULT AddText(BSTR olText, BSTR ftName, [in] LONG ftSize, [in] ULONG ftStyle, [in] ULONG ftColor, [in] ULONG bkColor, [in] LONG px, [in] LONG py, [in] ULONG bkType, [in] ULONG whichOne);

## 5. Build sample application

To build sample application VCamSourceTest, you need platform SDK. If you don't have it, you can use the BaseClasses project in the SDK package (BaseClasses.zip), extract it to a folder and add this folder to VC include path, then build this project, it will generate the LIB file "strmbase.lib", which is needed to link with sample application.

## 6. License

You can try VCam SDK freely without any limitation, except that there's a water mark in the virtual camera output video, you may purchase VCam SDK to remove it.

Please contact us if you want to buy it or have any advice, question, etc.

Our website: www.e2esoft.cn
Mail: vcam@e2esoft.cn

e2eSoft.cn
All right reserved