ScCamera Struct Reference

Public Member Functions

ScCamerasc_camera_new (void)
 
ScCamerasc_camera_new_with_buffer_count (uint32_t buffer_count)
 
ScCamerasc_camera_new_from_path (char const *device_path, uint32_t buffer_count)
 
void sc_camera_release (ScCamera *camera)
 
void sc_camera_retain (ScCamera *camera)
 
ScSize sc_camera_get_resolution (ScCamera const *camera)
 
ScImageLayout sc_camera_get_image_layout (ScCamera const *camera)
 
ScCameraMode sc_camera_get_resolution_mode (ScCamera const *camera)
 
ScCameraMode sc_camera_get_framerate_mode (ScCamera const *camera)
 
int32_t sc_camera_query_supported_resolutions (ScCamera const *camera, ScSize *resolution_array, uint32_t resolution_array_length)
 
ScBool sc_camera_query_supported_resolutions_stepwise (ScCamera const *camera, ScStepwiseResolution *resolutions)
 
int32_t sc_camera_query_supported_framerates (ScCamera const *camera, ScSize resolution, ScFramerate *framerate_array, uint32_t framerate_array_length)
 
ScBool sc_camera_query_supported_framerates_stepwise (ScCamera const *camera, ScSize resolution, ScStepwiseFramerate *framerates)
 
ScBool sc_camera_request_resolution (ScCamera *camera, ScSize resolution)
 
ScBool sc_camera_request_framerate (ScCamera *camera, ScFramerate framerate)
 
ScBool sc_camera_set_focus_mode (ScCamera *camera, ScCameraFocusMode mode)
 
ScBool sc_camera_set_manual_auto_focus_distance (ScCamera *camera, int32_t distance)
 
uint8_t const * sc_camera_get_frame (ScCamera *camera, ScImageDescription *image_description)
 
ScBool sc_camera_start_stream (ScCamera *camera)
 
ScBool sc_camera_stop_stream (ScCamera *camera)
 
ScBool sc_camera_enqueue_frame_data (ScCamera *camera, uint8_t const *frame_data)
 

Detailed Description

Opaque handle to a camera object.

Currently this camera interface is only available on Linux platforms with Video4Linux2 (v4l2) camera drivers. On other platforms, a dummy object is returned that does not do anything. On mobile platforms like Andoid and iOS the platform's native camera interface should be used.

Since
4.6.0
Examples:
CommandLineBarcodeScannerCameraSample.c, and CommandLineMatrixScanCameraSample.c.

Member Function Documentation

ScCamera * sc_camera_new ( void  )

Create a camera object using default values.

Returns
a newly allocated camera or null on error
Since
4.6.0
Examples:
CommandLineBarcodeScannerCameraSample.c, and CommandLineMatrixScanCameraSample.c.
ScCamera * sc_camera_new_with_buffer_count ( uint32_t  buffer_count)

Create a camera object with the requested number of frame buffers.

Parameters
buffer_countnumber of buffers used by the camera, e.g. 4
Returns
a newly allocated camera or null on error
Since
4.6.0
ScCamera * sc_camera_new_from_path ( char const *  device_path,
uint32_t  buffer_count 
)

Create a camera object from a device path.

Setting too many frame buffers can make the allocation fail.

Parameters
device_pathpath to the camera device, e.g. /dev/video0
buffer_countnumber of frame buffers to use, e.g. 4
Returns
a newly allocated camera or null on error
Since
4.6.0
Examples:
CommandLineBarcodeScannerCameraSample.c, and CommandLineMatrixScanCameraSample.c.
void sc_camera_release ( ScCamera camera)

Decrease reference count of camera by one.

When the reference count drops to zero, the camera is deallocated.

Parameters
cameraA valid camera object. May be null
Since
4.6.0
Examples:
CommandLineBarcodeScannerCameraSample.c, and CommandLineMatrixScanCameraSample.c.
void sc_camera_retain ( ScCamera camera)

Increase reference count of camera by one.

Parameters
cameraA valid camera object. Must not be null
Since
4.6.0
ScSize sc_camera_get_resolution ( ScCamera const *  camera)

Returns the resolution of the camera in pixel (width, height).

Parameters
cameraA valid camera object. Must not be null
Returns
The resolution settings of the camera
Since
4.6.0
ScImageLayout sc_camera_get_image_layout ( ScCamera const *  camera)
Parameters
cameraA valid camera object. Must not be null.
Returns
the layout used by the camera
Since
4.6.0
ScCameraMode sc_camera_get_resolution_mode ( ScCamera const *  camera)

Query the resolution mode of the camera.

This function returns the supported resolution mode of this camera. Depending on the resolution mode, either sc_camera_query_supported_resolutions(), or sc_camera_query_supported_resolutions_stepwise() must be used to query available resolutions. See ScCameraMode for a description of possible return values.

Parameters
cameraA valid camera object. Must not be null.
Returns
the resolution mode used by the camera.
See also
ScCameraMode for an explanation of the different resolution modes.
Since
4.7.0
Examples:
CommandLineBarcodeScannerCameraSample.c, and CommandLineMatrixScanCameraSample.c.
ScCameraMode sc_camera_get_framerate_mode ( ScCamera const *  camera)

Query the framerate mode of the camera.

This function returns the supported framerate mode of this camera. Depending on the framerate mode, either sc_camera_query_supported_framerates(), or sc_camera_query_supported_framerates_stepwise() must be used to query available framerates. See ScCameraMode for a description of possible return values.

Parameters
cameraA valid camera object. Must not be null.
Returns
the resolution mode used by the camera.
See also
ScCameraMode for an explanation of the different resolution modes.
Since
4.7.0
int32_t sc_camera_query_supported_resolutions ( ScCamera const *  camera,
ScSize resolution_array,
uint32_t  resolution_array_length 
)

Query supported discrete resolutions of the camera.

Use this function on camera objects whose resolution mode is SC_CAMERA_MODE_DISCRETE. For camera objects with SC_CAMERA_MODE_STEPWISE, use sc_camera_query_supported_resolutions_stepwise().

Parameters
cameraA valid camera object. Must not be null.
resolution_arrayPre-allocated array of resolution objects into which the resolutions are written.
resolution_array_lengthNumber of objects in the pre-allocated resolution array.
Returns
The number of resolution objects that were written to the resolution array. 0 is returned if the camera resolution mode is not SC_CAMERA_MODE_DISCRETE.
See also
ScCameraMode for the difference between discrete and step-wise resolution mode
Since
4.6.0
Examples:
CommandLineBarcodeScannerCameraSample.c, and CommandLineMatrixScanCameraSample.c.
ScBool sc_camera_query_supported_resolutions_stepwise ( ScCamera const *  camera,
ScStepwiseResolution resolutions 
)

Query supported step-wise resolutions of the camera.

Parameters
cameraA valid camera object. Must not be null.
resolutionspointer to a ScStepwiseResolution struct in which the result will be written
Returns
true on success and false if the camera resolution mode is not SC_CAMERA_MODE_STEPWISE.
See also
ScCameraMode for the difference between discrete and step-wise resolution mode.
Since
4.7.0
Examples:
CommandLineBarcodeScannerCameraSample.c, and CommandLineMatrixScanCameraSample.c.
int32_t sc_camera_query_supported_framerates ( ScCamera const *  camera,
ScSize  resolution,
ScFramerate framerate_array,
uint32_t  framerate_array_length 
)

Query supported discrete framerates of the camera at a given resolution.

Use this function on camera objects whose resolution mode is SC_CAMERA_MODE_DISCRETE. For camera objects with SC_CAMERA_MODE_STEPWISE, use sc_camera_query_supported_framerates_stepwise()

Parameters
cameraA valid camera object. Must not be null.
resolutionThe resolution at which we want to know the the supported framerates.
framerate_arrayPre-allocated array of framerate objects into which the framerates are written.
framerate_array_lengthNumber of objects in the pre-allocated resolution array.
Returns
The n umber of framrate objects that were written in the framerate array. 0 is returned if the camera framerate mode is not SC_CAMERA_MODE_DISCRETE
See also
ScCameraMode for the differences between discrete and step-wise framerate mode
Since
4.7.0
Examples:
CommandLineBarcodeScannerCameraSample.c, and CommandLineMatrixScanCameraSample.c.
ScBool sc_camera_query_supported_framerates_stepwise ( ScCamera const *  camera,
ScSize  resolution,
ScStepwiseFramerate framerates 
)

Query supported step-wise framerates of the camera at a given resolution.

Parameters
cameraA valid camera object. Must not be null.
resolutionThe resolution at which we want to know the supported framerates.
frameratesPointer to a ScStepwiseFramerate struct in which the result will be written
Returns
true on success and false if the camera resolution mode is not SC_CAMERA_MODE_STEPWISE
Since
4.7.0
ScBool sc_camera_request_resolution ( ScCamera camera,
ScSize  resolution 
)

Tries to set the camera resolution.

Parameters
cameraA valid camera object. Must not be null
resolutionA resolution object. Must not be null
Returns
true on success and false on failure
Since
4.6.0
Examples:
CommandLineBarcodeScannerCameraSample.c, and CommandLineMatrixScanCameraSample.c.
ScBool sc_camera_request_framerate ( ScCamera camera,
ScFramerate  framerate 
)

Tries to set the camera framerate.

Parameters
cameraA valid camera object. Must not be null
framerateA framerate object. Must not be null
Returns
true on success and false on failure
Since
5.15.0
ScBool sc_camera_set_focus_mode ( ScCamera camera,
ScCameraFocusMode  mode 
)

Tries to set the autofocus mode of the camera.

Parameters
cameraA valid camera object. Must not be null
modedesired focus mode
Returns
true on success and false on failure
Since
4.6.0
ScBool sc_camera_set_manual_auto_focus_distance ( ScCamera camera,
int32_t  distance 
)

Sets the autofocus distance manually. Only possible when the autofocusmode is OFF.

Parameters
cameraA valid camera object. Must not be null
distancedevice specific focus distance value
Returns
true on success and false on failure
Since
4.6.0
uint8_t const * sc_camera_get_frame ( ScCamera camera,
ScImageDescription image_description 
)
Parameters
cameraA valid camera object. Must not be null
image_descriptionimage description of the returned frame data. Can be null to ignore the output.
Returns
the latest frame data that the camera captured or null on error.
Since
4.6.0
Examples:
CommandLineBarcodeScannerCameraSample.c, and CommandLineMatrixScanCameraSample.c.
ScBool sc_camera_start_stream ( ScCamera camera)

Tells the camera to start capturing images.

Parameters
cameraA valid camera object. Must not be null
Returns
true on success and false on failure
Since
4.6.0
Examples:
CommandLineBarcodeScannerCameraSample.c, and CommandLineMatrixScanCameraSample.c.
ScBool sc_camera_stop_stream ( ScCamera camera)

Tells the camera to stop capturing images.

Parameters
cameraA valid camera object. Must not be null
Returns
true on success and false on failure
Since
4.6.0
ScBool sc_camera_enqueue_frame_data ( ScCamera camera,
uint8_t const *  frame_data 
)

Requeues the buffer after the data has been used.

Parameters
cameraA valid camera object. Must not be null
frame_dataImage data pointer from this camera. Must not be null
Returns
true on success and false on failure
Since
4.6.0
Examples:
CommandLineBarcodeScannerCameraSample.c, and CommandLineMatrixScanCameraSample.c.

The documentation for this struct was generated from the following file: