Types
VIDEOCAPTURE

Handle of VideoCapture object

Used to handle pointer (void *) to VideoCapture object

VIDEOFRAME

Handle of VideoFrame object

Used to handle pointer (void *) to VideoFrame object

Enumerations
PIXFMT

Image buffer pixel formats

PIXFMT_GRAYSCALE

Grayscale 8 bpp format

PIXFMT_RGB24

RGB 24 bpp format

PIXFMT_BGR24

BGR 24 bpp format

PIXFMT_YUV420

YUV420 format

ERR_CAPTURE

Video capture error codes

ERR_CAPTURE_OPEN_VIDEO

Error opening video source

ERR_CAPTURE_READ_FRAME

Error reading frame

ERR_CAPTURE_EOF

End of file

Callbacks
FrameCapturedCallback

Invokes by VideoCapture object on new video frame capture

Parameters
hVideoCapture

Handle of VideoCapture object

hFrame

Handle of VideoFrame object

customObject

Pointer to custom object, defined in VideoCapture_Create function

Notes

You need to delete the hFrame object after this event using VideoFrame_Destroy function.

CaptureErrorCallback

Invokes by VideoCapture object on error

Parameters
hVideoCapture

Handle of VideoCapture object

errorCode

Error code (see ERR_CAPTURE enumeration values)

customObject

Pointer to custom object, defined in VideoCapture_Create function

Video Capture Functions
VideoCapture_Create
VIDEOCAPTURE DTKVIDAPI VideoCapture_Create(
FrameCapturedCallback frameCapturedCallback,
CaptureErrorCallback captureErrorCallback,
voidcustomObject
)

Create Video Capture object

Parameters
frameCapturedCallback

FrameCapturedCallback function

captureErrorCallback

CaptureErrorCallback function

customObject
void*

Pointer to custom object

VideoCapture_Destroy
void DTKVIDAPI VideoCapture_Destroy(
VIDEOCAPTURE hVideoCapture
)

Destroy Video Capture object

Parameters
hVideoCapture

Handle of VideoCapture object

VideoCapture_StartCaptureFromFile
int DTKVIDAPI VideoCapture_StartCaptureFromFile(
VIDEOCAPTURE hVideoCapture,
const charfileName,
int repeat_count
)

Start video capture from video file

Parameters
hVideoCapture

Handle of VideoCapture object

fileName Video

file path

repeat_count
int

Repeat count, default 0 (always repeat)

Return

Value 0 on success, or one of ERR_CAPTURE enumeration values.

VideoCapture_StartCaptureFromIPCamera
int DTKVIDAPI VideoCapture_StartCaptureFromIPCamera(
VIDEOCAPTURE hVideoCapture,
const charipCameraURL
)

Start video capture from IP camera

Parameters
hVideoCapture

Handle of VideoCapture object

ipCameraURL
const char*

IP camera URL (RTSP or HTTP). The URL must include user name and password if required.

Return

Value 0 on success, or one of ERR_CAPTURE enumeration values.

VideoCapture_StartCaptureFromDevice
int DTKVIDAPI VideoCapture_StartCaptureFromDevice(
VIDEOCAPTURE hVideoCapture,
int deviceIndex,
int captureWidth,
int captureHeight
)

Start video capture from video device

Parameters
hVideoCapture

Handle of VideoCapture object

deviceIndex
int

Device index starting from 0 (0 - first video device)

captureWidth
int

Capture X-resolution in pixels

captureHeight
int

Capture Y-resolution in pixels

Return

Value 0 on success, or one of ERR_CAPTURE enumeration values.

Notes

If video device do not support defined resolution, then will be selected nearest resolution supported by this device.

VideoCapture_GetVideoWidth
int DTKVIDAPI VideoCapture_GetVideoWidth(
VIDEOCAPTURE hVideoCapture
)

Gets the width of the video stream in pixels

Parameters
hVideoCapture

Handle of VideoCapture object

Return

Width of the video stream in pixels. If the video stream is not started, the return value is 0.

VideoCapture_GetVideoHeight
int DTKVIDAPI VideoCapture_GetVideoHeight(
VIDEOCAPTURE hVideoCapture
)

Gets the height of the video stream in pixels

Parameters
hVideoCapture

Handle of VideoCapture object

Return

Height of the video stream in pixels. If the video stream is not started, the return value is 0.

VideoCapture_GetVideoFPS
int DTKVIDAPI VideoCapture_GetVideoFPS(
VIDEOCAPTURE hVideoCapture
)

Gets the frames per second (FPS) of the video stream

Parameters
hVideoCapture

Handle of VideoCapture object

Return

Frames per second (FPS) of the video stream. If the video stream is not started, the return value is 0.

VideoCapture_GetVideoFOURCC
int DTKVIDAPI VideoCapture_GetVideoFOURCC(
VIDEOCAPTURE hVideoCapture
)

Gets the FOURCC code of the video stream

Parameters
hVideoCapture

Handle of VideoCapture object

Return

FOURCC code (32 bit integer) of the video stream. If the video stream is not started, the return value is 0.

VideoCapture_StopCapture
int DTKVIDAPI VideoCapture_StopCapture(
VIDEOCAPTURE hVideoCapture
)

Stop video capture

Parameters
hVideoCapture

Handle of VideoCapture object

Return

Value 0 on success, or one of ERR_CAPTURE enumeration values.

VideoCapture_GetLibraryVersion
int DTKVIDAPI VideoCapture_GetLibraryVersion(
charbuffer,
int buff_size
)

Return library version

Parameters
buffer
char*

Pointer to string buffer which receives library version

buff_size
int

Size of string buffer

Returns

Number of bytes copied to buffer. If buffer = NULL or buff_size = 0, then function return number of bytes required for store result string

VideoFrame Functions
VideoFrame_Destroy
void DTKVIDAPI VideoFrame_Destroy(
VIDEOFRAME hFrame
)

Destroy VideoFrame object

Parameters
hFrame

Handle of VideoFrame object

VideoFrame_GetWidth
int DTKVIDAPI VideoFrame_GetWidth(
VIDEOFRAME hFrame
)

Gets frame width in pixels

Parameters
hFrame

Handle of VideoFrame object

VideoFrame_GetHeight
int DTKVIDAPI VideoFrame_GetHeight(
VIDEOFRAME hFrame
)

Gets frame height in pixels

Parameters
hFrame

Handle of VideoFrame object

VideoFrame_Timestamp
int64 DTKVIDAPI VideoFrame_Timestamp(
VIDEOFRAME hFrame
)

Gets the timestamp of a video frame

Parameters
hFrame

Handle of VideoFrame object

VideoFrame_GetImageBuffer
int DTKVIDAPI VideoFrame_GetImageBuffer(
VIDEOFRAME hFrame,
PIXFMT format,
void** pImageBuffer,
intwidth,
intheight,
intstride
)

Gets the image buffer of frame in specified pixel format

Parameters
hFrame

Handle of VideoFrame object

format

pixel format

pImageBuffer
void**

Pointer to a pointer which receives the image buffer containing pixel data of the image

width
int*

Pointer to integer variable which receives width of image

height
int*

Pointer to integer variable which receives height of image

stride
int*

Pointer to integer variable which receives size of one image row in bytes

Notes

You need to call VideoFrame_FreeImageBuffer with received pointer to free memory.  This property used for video mode only

VideoFrame_FreeImageBuffer
void DTKVIDAPI VideoFrame_FreeImageBuffer(
voidpImageBuffer
)

Deletes image buffer

Parameters
pImageBuffer
void*

Pointer to image buffer received using VideoFrame_GetImageBuffer function.