Demo applications and examples, C source code – Sensoray 819 Windows SDK User Manual

Page 15

Advertising
background image

Demo Applications and Examples

C# Visual Studio .NET Demo

A full feature demo application written in C# .NET is provided. This includes a class file to
communicate with all the functions in the DLL. The different channels may be controlled by right-
clicking on the channel of interest.

C source code

The following code demonstrates the ease of use for the SDK.

JPEG capture

Opens channel 2 in JPEG streaming mode and saves the first 30 JPEG files to disk (in the temp
directory).

int

_tmain(

int

argc, _TCHAR* argv[])

{

int

channels;

S819_CHAN s819chan;
HCNODE hcnode;
BUFFER buf;

int

rc;

FILE *fin;

int

i;

char

name[60];

rc = S819_Enumerate(&channels);
S819_SetMode (0, &s819chan);
hcnode = S819_CreateCnode();
S819_AttachStreams(hcnode, 2, SMASK(STREAM_JPEG));
S819_StartStreams(hcnode, 2, SMASK(STREAM_JPEG));

for

(i = 0; i < 30; i++) {

S819_WaitBuffer (hcnode, &buf);
sprintf(name,

"c:\\temp\\test%d.jpg"

, i);

fin = fopen(name,

"wb"

);

fwrite(buf.buf, 1, buf.length, fin);
fclose(fin);

}
S819_StopStreams(hcnode, 2, SMASK(STREAM_JPEG));
S819_DetachStreams(hcnode);
S819_DeleteCnode(hcnode);
S819_Close();

return

0;

}

H.264 Recording

Saves one file as raw H.264 output (test0.264) and another as ISO 14996-14 compliant .mp4.

15

Advertising