SourceForge RSS feed   

Overview

Documentation

Examples

VideoJack Plugin

Download

Compatibility

 

Project
Supporters:

The Imaging Source logo

 

 

 

Impressum

 

 

 

Previous:
Capturing Images
  Next:
User Buffers

Capturing Images Using System Buffers

The following code example asks the device driver to use system buffers and registers a callback which gets called on the arrival of each new frame:

Download example file 'tut_2_4.c'

Remarks:

  1. To activate system buffers, set the buffer_type field of the video format to UNICAP_BUFFER_TYPE_SYSTEM.

  2. Use unicap_register_callback to tell unicap which function to call on each new frame.

  3. unicap_start_capture activates the video devices. The registered callback gets called when new frames arrive from now on.

  4. The callback gets called in a different thread context: the capture thread context. Here we just wait until the given number of frames was seen by the callback.

  5. unicap_stop_capture deactivates the video capture device.

  6. The callback gets called in the capture thread context. The lowlevel drivers have an internal ring buffer of a size which depends on the video capture device. If a new frame arrives while the callback is still being executed, it is placed into the ring buffer. If the ring buffer is full, the new frames are dropped.

Previous:
Capturing Images
  Next:
User Buffers
  SourceForge.net Logo