shared_memory_image_client_python.c File Reference
Last update: 17.04.2023Python interface to the shared_memory_image_client.h API. More...
Go to the source code of this file.
Macros | |
#define | MAX_STREAMS 50 |
Functions | |
stream_id | stream_create (str filename, int options=IMAGESTREAM_OPTIONS_NONE) |
Create a shared memory image stream. More... | |
frame | stream_lock (stream_id id) |
Get any available image frame. More... | |
SharedMemoryImageError | stream_unlock (stream_id id) |
Unlock the frame allocated by stream_lock(). More... | |
SharedMemoryImageError | stream_destroy (stream_id id) |
Close down and destroy a shared memory transport interface. More... | |
SharedMemoryImageError | stream_putframe (stream_id id, int width, int height, int framenumber, bytes pixeldata) |
Push an image into the shared memory transport buffer. More... | |
Detailed Description
Python interface to the shared_memory_image_client.h API.
- Author
- Randy Frank (randy.nosp@m..fra.nosp@m.nk@an.nosp@m.sys..nosp@m.com)
- Version
- 1.0
ensight_grpc_shmem python module
This module implements a set of Python bindings to the shared memory image transport API.
A simple example exercising the API might be:
Definition in file shared_memory_image_client_python.c.
Macro Definition Documentation
◆ MAX_STREAMS
#define MAX_STREAMS 50 |
the maximum number of active streams we allow
Definition at line 30 of file shared_memory_image_client_python.c.
Function Documentation
◆ stream_create()
stream_id stream_create | ( | str | filename, |
int | options = IMAGESTREAM_OPTIONS_NONE |
||
) |
Create a shared memory image stream.
Python wrapper for SharedMemoryImageStream_create(). Function in the ensight_grpc_shmem python module Python module.
- See also
- SharedMemoryImageStream_create().
- Parameters
-
filename the name of the shared memory file to use. options the stream creation options
- Exceptions
-
IMAGESTREAM_BAD_ARGS IMAGESTREAM_BAD_FILE_SIZE IMAGESTREAM_UNABLE_TO_OPEN_FILE IMAGESTREAM_UNABLE_TO_MAP_FILE IMAGESTREAM_MEMORY_ALLOC_ERROR IMAGESTREAM_THREAD_CREATE_ERROR
- Returns
- the allocated stream id.
◆ stream_destroy()
SharedMemoryImageError stream_destroy | ( | stream_id | id | ) |
Close down and destroy a shared memory transport interface.
Python wrapper for SharedMemoryImageStream_destroy(). Function in the ensight_grpc_shmem python module Python module.
- See also
- SharedMemoryImageStream_destroy().
- Parameters
-
id the stream to be destroyed.
- Exceptions
-
IMAGESTREAM_BAD_ARGS
- Returns
- IMAGESTREAM_NOERROR
◆ stream_lock()
frame stream_lock | ( | stream_id | id | ) |
Get any available image frame.
Python wrapper for SharedMemoryImageStream_lock(). Function in the ensight_grpc_shmem python module Python module.
- See also
- SharedMemoryImageStream_lock().
- Parameters
-
id the stream to read from.
- Exceptions
-
IMAGESTREAM_BAD_ARGS IMAGESTREAM_IS_SERVER IMAGESTREAM_LOCKED
- Returns
- SharedMemoryImageError if no images are read or a dictionary with the same fields as _SharedMemoryFrame.
◆ stream_putframe()
SharedMemoryImageError stream_putframe | ( | stream_id | id, |
int | width, | ||
int | height, | ||
int | framenumber, | ||
bytes | pixeldata | ||
) |
Push an image into the shared memory transport buffer.
Python wrapper for SharedMemoryImageStream_putframe(). Only used by server connections. Function in the ensight_grpc_shmem python module Python module.
- See also
- SharedMemoryImageStream_putframe().
- Parameters
-
id the stream to write to. width width of the frame in pixels height height of the frame in pixels framenumber the sequence number of this frame pixeldata a bytes() object of at least width*height*3 bytes in size
- Exceptions
-
IMAGESTREAM_BAD_ARGS IMAGESTREAM_IS_NOTSERVER IMAGESTREAM_FRAME_TOO_LARGE
- Returns
- SharedMemoryImageError IMAGESTREAM_UNCONNECTED, IMAGESTREAM_NO_BUFFERAVAILABLE, IMAGESTREAM_NOERROR
◆ stream_unlock()
SharedMemoryImageError stream_unlock | ( | stream_id | id | ) |
Unlock the frame allocated by stream_lock().
Python wrapper for SharedMemoryImageStream_unlock(). Function in the ensight_grpc_shmem python module Python module.
- See also
- SharedMemoryImageStream_unlock().
- Parameters
-
id the stream to read from.
- Exceptions
-
IMAGESTREAM_BAD_ARGS IMAGESTREAM_IS_SERVER IMAGESTREAM_NOT_LOCKED
- Returns
- SharedMemoryImageError if no images are read or a dictionary with the same fields as _SharedMemoryFrame.