video_display_attach video_display_detach navigation bar

Table of Contents

video_display_write

Write a frame to the video display.

Description

The video_display_write function writes a frame to the video display. The length in elements must be specified, particularly for the IMAGE_FORMAT_COMPRESSED image format, for which data is not a constant size. The image_data must match the image format, data type and dimensions specified in the video_display_attach call. Note that the length is not in bytes, but in elements based on the image data type.

Prototype

t_error
video_display_write(t_video_display display, const void * image_data, size_t image_data_length);
    

Parameters

t_video_display display

The handle to the display returned by video_display_attach.

const void * image_data

The image data as an array of elements. The size and data type of this array must match the image format, data type and dimensions given in the video_display_attach call.

size_t image_data_length

The length of the image_data array in elements, not in bytes. The data type for each element was specified in the video_display_attach function.

Return value

The return value is 0 if the write is successfully. Otherwise a negative error code is returned. Error codes are defined in quanser_errors.h. A suitable error message may be retrieved using msg_get_error_message.

Error codes

QERR_INVALID_ARGUMENT

One of the arguments is invalid.

QERR_NOT_SUPPORTED

This function is not supported on this platform.

QERR_OUT_OF_MEMORY

There is not enough memory to complete the operation.

Requirements

Include Files

Libraries

quanser_video.h

quanser_media.lib;quanser_communications.lib;quanser_runtime.lib;quanser_common.lib

Examples

t_video_window window;

/* Open a video display window for displaying the captured video */
result = video_display_open("Video Capture", NULL, &window);
if (result >= 0) {
    t_video_display display;

    /* Attach a display object to the window for receiving the video stream */
    result = video_display_attach(window, 30.0, 640, 480, IMAGE_FORMAT_COL_MAJOR_PLANAR_RGB, IMAGE_DATA_TYPE_UINT8, true, &display);
    if (result >= 0) {
        ...
        
        /* Write the frame to the display */
        video_display_write(display, image, frame_width * frame_height * 3);
        
        ...
        
        /* Detach the video stream from the display */
        video_display_detach(display);
    }

    /* Close the video display window */
    video_display_close(window);
}
    

See Also

 

navigation bar