Skip to main content

Post-processing tools 2024 R2

shared_memory_image_client

Last update: 16.07.2025
Go to the documentation of this file.
1/* *************************************************************
2 * Copyright 2017-2020 ANSYS, Inc.
3 * All Rights Reserved.
4 *
5 * Restricted Rights Legend
6 *
7 * Use, duplication, or disclosure of this
8 * software and its documentation by the
9 * Government is subject to restrictions as
10 * set forth in subdivision [(b)(3)(ii)] of
11 * the Rights in Technical Data and Computer
12 * Software clause at 52.227-7013.
13 * *************************************************************
14 */
15
16#ifndef ___ENSIGHT_GRPC_SHMEM_CLIENT_H___
17#define ___ENSIGHT_GRPC_SHMEM_CLIENT_H___
18
75#ifdef __cplusplus
76extern "C" {
77#endif
78
79#include <stdint.h>
80
81#define IMAGESTREAM_API_VERSION "1.0"
83/* SharedMemoryImageError Error values */
84#define IMAGESTREAM_UNCONNECTED 4
85#define IMAGESTREAM_RECONNECTING 3
86#define IMAGESTREAM_NO_FRAMEAVAILABLE 2
87#define IMAGESTREAM_NO_BUFFERAVAILABLE 1
88#define IMAGESTREAM_NOERROR 0
89/* negative numbers are actual errors, positive numbers are not actually errors */
90#define IMAGESTREAM_BAD_ARGS -1
91#define IMAGESTREAM_NOT_LOCKED -2
92#define IMAGESTREAM_BAD_FILE_SIZE -3
93#define IMAGESTREAM_UNABLE_TO_OPEN_FILE -4
94#define IMAGESTREAM_UNABLE_TO_MAP_FILE -5
95#define IMAGESTREAM_MEMORY_ALLOC_ERROR -6
96#define IMAGESTREAM_THREAD_CREATE_ERROR -7
97#define IMAGESTREAM_IS_SERVER -8
98#define IMAGESTREAM_IS_NOTSERVER -9
99#define IMAGESTREAM_FRAME_TOO_LARGE -10
100#define IMAGESTREAM_LOCKED -11
102/* valid stream creation options */
103#define IMAGESTREAM_OPTIONS_NONE 0x00000000
104/* server options consume first 8 bits */
105#define IMAGESTREAM_OPTIONS_FLIPVERTICAL 0x00000100
107/* core type definitions */
108/* error codes, see defines above */
110/* stream interface handle */
111typedef struct _SharedMemoryImageStream *SharedMemoryImageStream;
112
115typedef struct _SharedMemoryFrame {
116 uint32_t iFrame;
117 uint32_t iWidth;
118 uint32_t iHeight;
119 uint8_t *buffer;
121
150 uint32_t options, SharedMemoryImageStream *stream);
151
176 SharedMemoryFrame *frame);
177
190
201
212
213#ifdef __cplusplus
214}
215#endif
216
217#endif
SharedMemoryImageError SharedMemoryImageStream_create(const char *filename, uint32_t options, SharedMemoryImageStream *stream)
SharedMemoryImageStream_create create a stream client instance.
int SharedMemoryImageError
common error codes see the non-hex, non-string IMAGESTREAM macros
const char * SharedMemoryImageStream_errorstring(SharedMemoryImageError err)
SharedMemoryImageStream_errorstring convert an error code into a human string.
SharedMemoryImageError SharedMemoryImageStream_destroy(SharedMemoryImageStream stream)
SharedMemoryImageStream_destroy destroy a stream interface, releasing its resources.
struct _SharedMemoryFrame * SharedMemoryFrame
A reference to a frame of imagery. Note it does not own the buffer pointer.
SharedMemoryImageError SharedMemoryImageStream_unlock(SharedMemoryImageStream stream)
SharedMemoryImageStream_unlock release a frame obtained by SharedMemoryImageStream_lock.
struct _SharedMemoryImageStream * SharedMemoryImageStream
image transport stream pointer
SharedMemoryImageError SharedMemoryImageStream_lock(SharedMemoryImageStream stream, SharedMemoryFrame *frame)
SharedMemoryImageStream_lock get a frame of pixels from the server.
uint32_t iFrame
monotonically increasing frame number
uint32_t iWidth
width of a frame in pixels
uint8_t * buffer
pointer to a packed RGBRGBRGB... (iWidth*iHeight*3) bytes array of pixels
uint32_t iHeight
height of a frame in pixels

Connect with Ansys