Using external camera drivers

Cameras that aren't already supported by the QNX Platform for ADAS can be provided by an external camera driver library that you create.

You must write hooks and create a library to support your external camera driver. To use an external camera driver library, you must:

  1. Provide your external camera driver library with implementations for the following functions (mandatory): Optionally, you can provide implementations for these functions: For more information about the specifics to implement, see external_camera_api.h in “Camera Library Reference” for each of the functions.
  2. Create an instance called external_camera_defs and assign your camera driver functions using the camera_external_camera_t structure. For optional functions you didn't implement, you can assign NULL.
    camera_external_camera_t external_camera_defs = {
    open :                        my_open_external_camera,
    close :                       my_close_external_camera,
    init :                        my_init_camera,
    deinit :                      my_deinit_camera,
    start_preview :               my_start_preview,
    stop_preview :                my_stop_preview,
    get_preview_frame :           my_get_preview_frame,
    get_preview_num_buffers :     my_get_preview_num_buffers,
    get_supported_vf_frametype :  my_get_supported_vf_frame_types,
    get_supported_vf_resolution : my_get_supported_vf_resolutions,
    get_supported_vf_framerates : my_get_supported_vf_frame_rates,
    get_time :                    my_get_time,
    set_framerate :               my_set_framerate,
    get_framerate :               my_get_framerate,
    parse_config :                NULL
    };
    Note: In your camera driver library, you must use external_camera_defs to declare your variable name for the structure camera_external_camera_t.
    The Sensor service dynamically loads the structure to retrieve the function pointers so that it can interface with your camera driver library.
  3. Configure the type as external_camera and the address with the path to your camera driver library in the sensor configuration file and the input representing your camera. See the “Sensor configuration file” in the Sensor chapter of the System Services guide.

An example of an external camera driver implementation is available with the QNX Platform for ADAS from the QNX Software Center. See the source directory for more information in your host installation at $QNX_BASE/source/adas-camera-examples-version.zip. After you extract the ZIP file, you'll find the example at extraction_directory/source_package_adas_camera/lib/sensor_drivers/external_camera_example.