Updated: October 26, 2022

Send a request to Screen to add new buffers to a stream


#include <screen/screen.h>
int screen_create_stream_buffers(screen_stream_t stream,
                                 int count)


The handle of the stream for which the new buffers must be allocated.
The number of buffers to be created for this stream. The maximum number of buffers allowed is 35.




Function Type: Flushing Execution

This function adds buffers to a stream. Streams must have at least one buffer to be usable. After the producer creates buffers for a stream, or after it attaches buffers to a stream, it must call screen_destroy_stream_buffers() before calling screen_create_stream_buffers() again. Buffers are created with the size of SCREEN_PROPERTY_BUFFER_SIZE as set on the stream.

Before calling this function, ensure that you set the SCREEN_PROPERTY_USAGE property on the stream to indicate your intended usage of the stream's buffer(s). For example, to retrieve SCREEN_PROPERTY_POINTER from the buffer(s), you must have set the SCREEN_PROPERTY_USAGE property to include the SCREEN_USAGE_READ and/or SCREEN_USAGE_WRITE flags on the stream prior to calling screen_create_stream_buffers().


0 if successful, or -1 if an error occurred (errno is set; refer to errno.h for more details).