Skip to main content
Python interface to the shared_memory_image_client.h API. author
Randy Frank (randy.frank@ansys.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:

Includes

Macros

Macro MAX_STREAMS

the maximum number of active streams we allow

Variables

Variable streamlist

the table of active stream objects Type: SharedMemoryImageStream

Functions

Function stream_create

Create a shared memory image stream. Python wrapper for SharedMemoryImageStream_create(). Function in the ensight_grpc_shmem python module Python module. Parameters:
  • filename: the name of the shared memory file to use.
  • options: the stream creation options
Exceptions: Returns: the allocated stream id. See also: SharedMemoryImageStream_create(). Parameters: Return type: stream_id

Function stream_lock

Get any available image frame. Python wrapper for SharedMemoryImageStream_lock(). Function in the ensight_grpc_shmem python module Python module. Parameters:
  • id: the stream to read from.
Exceptions: Returns: SharedMemoryImageError if no images are read or a dictionary with the same fields as _SharedMemoryFrame. See also: SharedMemoryImageStream_lock().
Parameters:
  • stream_id id
Return type: frame

Function stream_unlock

Unlock the frame allocated by stream_lock(). Python wrapper for SharedMemoryImageStream_unlock(). Function in the ensight_grpc_shmem python module Python module. Parameters:
  • id: the stream to read from.
Exceptions: Returns: SharedMemoryImageError if no images are read or a dictionary with the same fields as _SharedMemoryFrame. See also: SharedMemoryImageStream_unlock().
Parameters:
  • stream_id id
Return type: SharedMemoryImageError

Function stream_destroy

Close down and destroy a shared memory transport interface. Python wrapper for SharedMemoryImageStream_destroy(). Function in the ensight_grpc_shmem python module Python module. Parameters:
  • id: the stream to be destroyed.
Exceptions: Returns: IMAGESTREAM_NOERROR See also: SharedMemoryImageStream_destroy().
Parameters:
  • stream_id id
Return type: SharedMemoryImageError

Function stream_putframe

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. 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 widthheight3 bytes in size
Exceptions: Returns: SharedMemoryImageError IMAGESTREAM_UNCONNECTED, IMAGESTREAM_NO_BUFFERAVAILABLE, IMAGESTREAM_NOERROR See also: SharedMemoryImageStream_putframe().
Parameters:
  • stream_id id
  • int width
  • int height
  • int framenumber
  • bytes pixeldata
Return type: SharedMemoryImageError

Function PyDict_SetItemString_DECREF

Parameters:
  • PyObject * dict
  • const char * key
  • PyObject * val
Return type: int

Function return_error

Parameters:
  • int err
Return type: PyObject *

Function Py_stream_create

Parameters:
  • PyObject * self
  • PyObject * args
  • PyObject * keywds
Return type: PyObject *

Function Py_stream_lock

Parameters:
  • PyObject * self
  • PyObject * args
  • PyObject * keywds
Return type: PyObject *

Function Py_stream_unlock

Parameters:
  • PyObject * self
  • PyObject * args
  • PyObject * keywds
Return type: PyObject *

Function Py_stream_putframe

Parameters:
  • PyObject * self
  • PyObject * args
  • PyObject * keywds
Return type: PyObject *

Function Py_stream_destroy

Parameters:
  • PyObject * self
  • PyObject * args
  • PyObject * keywds
Return type: PyObject *

Function stream_python_shutdown

Parameters:
  • void
Return type: void

Source