From 2849be6c83f019a0eeee7cd530e7b473dc6da33f Mon Sep 17 00:00:00 2001 From: Jakub Wlodek Date: Mon, 27 Apr 2026 16:49:30 -0400 Subject: [PATCH] Use NDCodecName array to lookup codec name, instead of hard-coded string --- eigerApp/src/stream2Api.cpp | 6 ++++-- eigerApp/src/streamApi.cpp | 10 ++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/eigerApp/src/stream2Api.cpp b/eigerApp/src/stream2Api.cpp index 735f0a3..d9a378e 100644 --- a/eigerApp/src/stream2Api.cpp +++ b/eigerApp/src/stream2Api.cpp @@ -15,6 +15,8 @@ #include #include #include +#include "NDCodec.h" + #define ZMQ_PORT 31001 @@ -286,11 +288,11 @@ int Stream2API::getFrame (NDArray **pArrayOut, NDArrayPool *pNDArrayPool, int th const unsigned char *pInput = pSB->ptr; if (strcmp(encoding, "lz4") == 0) { - pArray->codec.name = "lz4hdf5"; + pArray->codec.name = NDCodecName[NDCODEC_LZ4HDF5]; } else if (strcmp(encoding, "bslz4") == 0) { - pArray->codec.name = "bslz4"; + pArray->codec.name = NDCodecName[NDCODEC_BSLZ4]; pInput += 12; compressedSize -= 12; } diff --git a/eigerApp/src/streamApi.cpp b/eigerApp/src/streamApi.cpp index e47d838..38fbcb8 100644 --- a/eigerApp/src/streamApi.cpp +++ b/eigerApp/src/streamApi.cpp @@ -9,6 +9,8 @@ #include #include #include +#include "NDCodec.h" + #define ZMQ_PORT 9999 #define MAX_JSON_TOKENS 512 @@ -387,15 +389,15 @@ int StreamAPI::getFrame (NDArray **pArrayOut, NDArrayPool *pNDArrayPool, int dec uncompress(temp, (char *)pArray->pData, encoding, uncompressedSize, frameType); } else - { - char *pInput = temp; + { + char *pInput = temp; if (strcmp(encoding, "lz4<") == 0) { - pArray->codec.name = "lz4"; + pArray->codec.name = NDCodecName[NDCODEC_LZ4]; } else if ((strcmp(encoding, "bs32-lz4<") == 0) || (strcmp(encoding, "bs16-lz4<") == 0) || (strcmp(encoding, "bs8-lz4<") == 0)) { - pArray->codec.name = "bslz4"; + pArray->codec.name = NDCodecName[NDCODEC_BSLZ4]; pInput += 12; compressedSize -= 12; }