# HG changeset patch # User Sebastien Jodogne # Date 1606750420 -3600 # Node ID b2366bc023f8941f9af96635bfe594a7dde74cc7 # Parent a85e74235a78a24b8bb3568ecf69a050656dc4de Fix access to videos as a single raw frame diff -r a85e74235a78 -r b2366bc023f8 NEWS --- a/NEWS Fri Nov 27 06:57:23 2020 +0100 +++ b/NEWS Mon Nov 30 16:33:40 2020 +0100 @@ -18,6 +18,7 @@ * C-GET SCP: Fix responses and handling of cancel * Fix decoding sequence if "BuiltinDecoderTranscoderOrder" is "Before" * Fix keep-alive in the embedded HTTP server by setting the "Keep-Alive" HTTP header +* Fix access to videos as a single raw frame (feature broken since Orthanc 1.6.0) * REST API now returns 404 error if deleting an inexistent peer or modality * Upgraded dependencies for static builds (notably on Windows and LSB): - civetweb 1.13 diff -r a85e74235a78 -r b2366bc023f8 OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp --- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp Fri Nov 27 06:57:23 2020 +0100 +++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp Mon Nov 30 16:33:40 2020 +0100 @@ -2618,9 +2618,16 @@ { throw OrthancException(ErrorCode_InternalError); } - - DcmDataset& dataset = *dicom.getDataset(); - + else + { + return LookupOrthancTransferSyntax(target, *dicom.getDataset()); + } + } + + + bool FromDcmtkBridge::LookupOrthancTransferSyntax(DicomTransferSyntax& target, + DcmDataset& dataset) + { E_TransferSyntax xfer = dataset.getCurrentXfer(); if (xfer == EXS_Unknown) { diff -r a85e74235a78 -r b2366bc023f8 OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h --- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h Fri Nov 27 06:57:23 2020 +0100 +++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h Mon Nov 30 16:33:40 2020 +0100 @@ -219,5 +219,8 @@ static bool LookupOrthancTransferSyntax(DicomTransferSyntax& target, DcmFileFormat& dicom); + + static bool LookupOrthancTransferSyntax(DicomTransferSyntax& target, + DcmDataset& dicom); }; } diff -r a85e74235a78 -r b2366bc023f8 OrthancFramework/Sources/DicomParsing/Internals/DicomFrameIndex.cpp --- a/OrthancFramework/Sources/DicomParsing/Internals/DicomFrameIndex.cpp Fri Nov 27 06:57:23 2020 +0100 +++ b/OrthancFramework/Sources/DicomParsing/Internals/DicomFrameIndex.cpp Mon Nov 30 16:33:40 2020 +0100 @@ -311,6 +311,28 @@ unsigned int DicomFrameIndex::GetFramesCount(DcmDataset& dicom) { + DicomTransferSyntax transferSyntax; + if (FromDcmtkBridge::LookupOrthancTransferSyntax(transferSyntax, dicom) && + (transferSyntax == DicomTransferSyntax_MPEG2MainProfileAtMainLevel || + transferSyntax == DicomTransferSyntax_MPEG2MainProfileAtHighLevel || + transferSyntax == DicomTransferSyntax_MPEG4HighProfileLevel4_1 || + transferSyntax == DicomTransferSyntax_MPEG4BDcompatibleHighProfileLevel4_1 || + transferSyntax == DicomTransferSyntax_MPEG4HighProfileLevel4_2_For2DVideo || + transferSyntax == DicomTransferSyntax_MPEG4HighProfileLevel4_2_For3DVideo || + transferSyntax == DicomTransferSyntax_MPEG4StereoHighProfileLevel4_2 || + transferSyntax == DicomTransferSyntax_HEVCMainProfileLevel5_1 || + transferSyntax == DicomTransferSyntax_HEVCMain10ProfileLevel5_1)) + { + /** + * Fixes an issue that was present from Orthanc 1.6.0 until + * 1.8.0 for the special case of the videos: In a video, the + * number of frames doesn't correspond to the number of + * fragments. We consider that there is one single frame (the + * video itself). + **/ + return 1; + } + const char* tmp = NULL; if (!dicom.findAndGetString(DCM_NumberOfFrames, tmp).good() || tmp == NULL)