Mercurial > hg > orthanc-gdcm
changeset 58:f237a8095e86
fix
| author | Alain Mazy <am@osimis.io> |
|---|---|
| date | Mon, 25 Oct 2021 14:48:00 +0200 |
| parents | ca604fa6714a |
| children | fa14f508d244 |
| files | Plugin/Plugin.cpp |
| diffstat | 1 files changed, 29 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/Plugin/Plugin.cpp Mon Oct 25 13:01:27 2021 +0200 +++ b/Plugin/Plugin.cpp Mon Oct 25 14:48:00 2021 +0200 @@ -111,6 +111,20 @@ } } +static bool IsTransferSyntaxEnabled(const std::string& transferSyntax) +{ + if (!restrictTransferSyntaxes_) + { + return true; + } + + if (enabledTransferSyntaxes_.find(transferSyntax) != enabledTransferSyntaxes_.end()) + { + return true; + } + + return false; +} static OrthancPluginErrorCode DecodeImageCallback(OrthancPluginImage** target, const void* dicom, @@ -270,11 +284,24 @@ { try { - if (!IsTransferSyntaxEnabled(buffer, size)) + std::string sourceTransferSyntax; + ExtractTransferSyntax(sourceTransferSyntax, buffer, size); + + bool pluginShouldHandleTranscoding = false; + for (uint32_t i = 0; i < countSyntaxes; i++) { - return OrthancPluginErrorCode_Plugin; + if (IsTransferSyntaxEnabled(sourceTransferSyntax) || IsTransferSyntaxEnabled(allowedSyntaxes[i])) + { + pluginShouldHandleTranscoding = true; + } } + if (!pluginShouldHandleTranscoding) + { + return OrthancPluginErrorCode_Plugin; // not really an error but only way to tell Orthanc that the plugin did not handle transcoding + } + + std::unique_ptr<Orthanc::Semaphore::Locker> locker; if (hasThrottling_)
