ClonerAlliance Capture SDK

ClonerAlliance Capture SDK API Reference

Initiate library

CA_Initalize

Function:

int CA_Initalize(void**handle,const char* dbg_log_path,const char*productname);

Parameters:

Handle:[out] return api library handle.
Dbg_log_path:[in] log file path name, set NULL to use default log path (%appdata%\[productname]\log.txt), set an invalid path to ignore the log file creating.
Productname:[in] your program name.
Return value

1=OK,0=failed.

Remark

You must call this function before all other functions

CA_release

Function:

void CA_Release(void**handle);

Parameters:

Handle:[in] api library handle
Remark

Release api library

Device operation

CA_GetCaptureDevices

Function:

int CA_GetCaptureDevices(void*handle, DEV_NAME*pdevs,int*numofdevs);

Parameters:

Handle:[in] api library handle.
Pdevs:[out] return device info.
Numofdevs:[int,out] indicate pdevs list size and return number of capture devices.
Return value

1=OK,0=failed.

Remark

Get a list of available capture devices

CA_GetCaptureDeviceCapacity

Function:

int CA_GetCaptureDeviceCapacity(void*handle,DEV_NAME*dev, DEV_CAPACITY*cap, int*numofcap);

Parameters:

Handle:[in] api library handle.
Dev:[in] which device do you want to get capacity
Cap:[out] indicate device capacity.
Numofcap:[in,out] indicate cap memory buffer and return the number of capacity.
Return value

1=OK,0=failed.

Remark

Get device capacity list.

CA_GetCurrentDeviceCapacity

Function:

int CA_GetCurrentDeviceCapacity(void*handle,DEV_CAPACITY*cap);

Parameters:

Handle:[in] api library handle.
Cap:[out] indicate device capacity.
Return value

1=OK,0=failed.

Remark

Get current device capacity. Please call this function after starting the play.

CA_OpenDevice

Function:

int CA_OpenDevice(void*handle,HWND hVideo, HWND hmsg, int bkeepaspect, int vrender,DEV_NAME*dev,DEV_CAPACITY*cap,int bitrate);

Parameters:

Handle:[in] api library handle.
hVideo:[in] Image display window, which can be a top window or a child window.
Hmsg:[in] Receive various events in playback and recording.
Message       Param1  Param2  Mark
9900  char    int     The remaining space of the disk is insufficient. Parameter 1 is the drive letter and parameter 2 is the remaining space.
9901  0       int     An error occurred while recording, parameter 2 is the error number
1 = "AV write file error";
2 = "No found audio error";
3 = "Demux TS error";
4 = "Demux ts buffer error.";
5 = "Reach to maximum of fat32 disk space.";
6 = "Encode video stream too slow,please drop down fps";
7 = "File error";
8 = "There are no enough free space on hard disk.";
9 = "start record failed.maybe invalid parament";
other = "unknow error.";
9150  int     Int/char*       Gif recording, when parameter 1 is 0, it indicates that recording is in progress (parameter 2 is int for the number of recorded frames), and parameter 1 is 1 for recording end (parameter 2 is char* string indicating information)
6666  0       0       Received video data from the device
9214  0       0       Device accidental pull-out notification
Bkeepaspect:[in] Keep the ratio when playing images.
Vrender:[in] video render index. Can be set:
       RENDER_VMR9,RENDER_YUV,RENDER_VMR7,RENDER_D3D
Dev:[in] which device do you want to open.
Cap:[in] which device's capacity do you want to open, if set NULL will use device default capacity.
Bitirate:[in] only valid when open HDML-BOX,PRO,EVO device.
Return value

1=OK,0=failed.

Remark

Using this function to open the device and start previewing.

CA_CloseDevice

Function:

int CA_CloseDevice(void*handle);

Parameters:

Handle:[in] api library handle.
Return value

1=OK,0=failed.

Remark

Using this function to stop preview and close device.

CA_UpdateVideoSize

Function:

void CA_UpdateVideoSize(void*handle);

Parameters:

Handle:[in] api library handle.
Remark

Refresh preview window size.

CA_AdjustVolume

Function:

void CA_AdjustVolume(void*handle,int v);

Parameters:

Handle:[in] api library handle.
V:[in] volume ,0~100. -255 means silent, 255 means unmute
Remark

After starting the preview, you can use this function.

Record

CA_StartRecord

Function:

int CA_StartRecord(void*handle,const char*mp4path, int w, int h, int fps, int bitrate,int format);

Parameters:

Handle:[in] api library handle.
Mp4path:[in] the file to out put mp4 file.
W:[in] encode picture width.
H:[in] encode picture height.
Fps:[in] encode frame rate.
Bitrate:[in] encode bitrate.
Format:[in] the mp4 format
0: MP4(H264+AAC),1: MP4(H264+AC3),2:MP4(H264+MP3),3:TS(H264+AAC).
Return value

1=OK,0=failed.

Remark

Using this function to record a mp4 file. Need to be called after the preview starts. Recording parameters are not related to device capabilities, and the image or frame rate can be zoomed in and out internally.

CA_PauseRecord

Function:

int CA_PauseRecord(void*handle,int bpause);

Parameters:

Handle:[in] api library handle.
Bpause:[in] 1: indicate pause,0: indicate unpause.
Return value

1=OK,0=failed.

Remark

Using this function to pause the recording.

CA_StopRecord

Function:

int CA_StopRecord(void*handle);

Parameters:

Handle:[in] api library handle.
Return value

1=OK,0=failed.

Remark

Stop the recording.

CA_SetEncodeH264Parament

Function:

int CA_SetEncodeH264Parament(void*handle, int iEngine,int speed);

Parameters:

Handle:[in] api library handle.
iEngine:[in] code of encording engine, please use CA_GetEncodeH264EngineList get code.
Speed:[in] only valid when iEngine=0. Set encode speed. 0=high ~ 5=low
Return value

1=OK,0=failed.

Remark

Set encode engine and speed before start recording.

CA_GetEncodeH264Parament

Function:

int CA_GetEncodeH264Parament(void*handle, int*iEngine,int*speed);

Parameters:

Handle:[in] api library handle.
iEngine:[out] return engine code.
Speed:[out] return encode speed.
Return value

1=OK,0=failed.

Remark

Get the encoding engine and speed currently in use.

CA_GetEncodeH264EngineList

Function:

int CA_GetEncodeH264EngineList(void*handle,char**names,int*iEngines);

Parameters:

Handle:[in] api library handle.
Names:[out] return engine name list.
iEngines:[out] return engine code list.
Return value

1=OK,0=failed.

Remark

Get the available encoding engine in the current system.

CA_ScreenShot_bmp

Function:

int CA_ScreenShot_bmp(void*handle, const char*fpath);

Parameters:

Handle:[in] api library handle.
Fpath:[in] Image file storage path. The suffix name can be bmp, jpg, png.
Return value

1=OK,0=failed.

Remark

Using this function to cut a picture when previewing.

CA_ScreenShot_gif

Function:

int CA_ScreenShot_gif(void*handle, int w, int h, int keepasp,int fps,const char*fpath);

Parameters:

Handle:[in] api library handle.
W:[in] picture width. Maximum value 720.
H:[in] picture height. Maximum value 480.
Keepasp:[in] 1=keep aspect rate, Will override the height value.
Fps:[in] frame rate(1~20), recormmed 10.
Fpath:[in] gif saving path.
Return value

1=OK,0=failed.

Remark

Using this function to capture a gif

CA_ScreenShot_gif_stop

Function:

int CA_ScreenShot_gif_stop(void*handle);

Parameters:

Handle:[in] api library handle.
Return value

1=OK,0=failed.

Remark

Stop gif capture, If you do not call this function within 30 seconds after starting gif recording, it will automatically stop gif recording.

State

CA_CheckState

Function:

int CA_CheckState(void*handle,int*ispreview,int*ispictshow, int*isrecord,int*isgif);

Parameters:

Handle:[in] api library handle.
Ispreview:[out] if none NULL, Check if the device has opened.
Ispictshow:[out] if none NULL, check if the preview started.
Isrecord:[out] if none NULL, check if the recording has started.
Isgif:[out] if none NULL, check if the gif recording has started.
Return value

1=OK,0=failed.

Remark

Check various states during playback and recording.

CA_QueryDeviceLost

Function:

int CA_QueryDeviceLost(void*handle,int*lost);

Parameters:

Handle:[in] api library handle.
Lost:[out] indicate if the device has lost.
Return value

1=OK,0=failed.

Remark

Check if the playback device has been accidentally removed, This function must be called after the 9214 message is received.

CA_StartUSBDeviceListen

Function:

int CA_StartUSBDeviceListen(void*handle,HWND hwnd);

Parameters:

Handle:[in] api library handle.
Hwnd:[in] Receive plug-and-play messages from USB devices.
Return value

1=OK,0=failed.

Remark

Enable detection of plug-and-play messages for receiving USB devices.

VBS

CA_StartVBS

Function:

int CA_StartVBS(void*handle,int nPort);

Parameters:

Handle:[in] api library handle.
nPort:[in] http port number.
Return value

1=OK,0=failed.

Remark

Open VBS system service.

CA_StopVBS

Function:

int CA_StopVBS(void*handle);

Parameters:

Handle:[in] api library handle.
Return value

1=OK,0=failed.

Remark

Close VBS system service.

CA_IsVBSRunning

Function:

int CA_IsVBSRunning(void*handle);

Parameters:

Handle:[in]api library handle.
Return value

1=VBS is running

Remark

Using this function to check if the VBS server is running.

Register

CA_CheckIsRegistered

Function:

int CA_CheckIsRegistered(void*handle);

Parameters:

Handle:[in] api library handle
Return value

1=VBS is running

Remark

Check if SDK is already registered

CA_Register

Function:

int CA_Register(void*handle, const char*code, const char*name, const char*email);

Parameters:

Handle:[in] api library handle.
Code:[in] code string.
Name:[in] name string.
Email:[in] email string.
Return value

1=OK,0=failed.

Remark

Use this function to register the SDK.

CA_ClearRegisterCode

Function:

int CA_ClearRegisterCode(void*handle);

Parameters:

Handle:[in] api library handle.
Return value

1=OK,0=failed.

Remark

Using this function to clear register code.

Other

CA_Log

Function:

void CA_Log(const char*fmt, ...);
Remark

Write debug message to log file.