Start of trail video_display_set_caption navigation bar

Table of Contents

video_display_open

Open a video display window.

Description

The video_display_open function opens a video display window that may be used for displaying live video. The window supports a number of features that are useful for video display, such as showing the current pixel colour under the cursor, saving the current frame, pausing and resuming, scaling the window to the original size of the image and more. It can handle images in a variety of formats, including JPEG compressed images.

The function returns a handle to the window that may be used in other video display functions. The handle must be closed using the video_capture_close function when the window is no longer in use.

Prototype

t_error
video_display_open(const char * name, const t_video_window_attributes * attributes, t_video_window * window);
    

Parameters

const char * name

A string containing the name to assign to the window caption.

const t_video_window_attributes * attributes

Attributes to apply to the window such as its position and size. The argument is a pointer to a t_video_window_attributes structure, which contains the following fields. The argument may be NULL to use default attributes.

Field

Description

size

This field must be set to the size of the structure i.e., sizeof(t_video_window_attributes) for future compatibility.

x

The x-coordinate of the window in screen pixel coordinates.

y

The y-coordinate of the window in screen pixel coordinates.

cx

The width of the window in pixels.

cy

The height of the window in pixels.

t_video_window * window

The address of a t_video_window variable in which the handle to the window will be stored. This handle is then passed to the other video display functions to identify the window.

Return value

The return value is 0 if the window is opened 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;
t_error result = video_display_open("Live Video Feed", NULL, &window);
if (result >= 0) {
        ...
        video_display_close(window);
} else {
    TCHAR message[512];
    msg_get_error_message(NULL, result, message, sizeof(message));
    _tprintf(_T("Failed to open window for video display. %s (error %d)\n"), message, -result);
}
    

See Also

 

navigation bar