Fix a segmentation fault on some samples when the memory type is 3 (OUT_SURFACE_MEM_NOT_MAPPED) and attempting to save the output (which is not supported) (#239)

* Fix a segmentation fault on some samples when the memory type is 3 (OUT_SURFACE_MEM_NOT_MAPPED) and attempting to save the output (which is not supported)

* update the videoDecodeMultiFiles sample

* update the readme for videoDecodeMultiFiles

* add comments

* use OUT_SURFACE_MEM_NOT_MAPPED instead of integer number 3

[ROCm/rocdecode commit: 31c7c7c104]
This commit is contained in:
Aryan Salmanpour
2024-02-12 16:50:17 -05:00
committed by GitHub
parent 18e32ff6c8
commit bc48060ff0
8 changed files with 30 additions and 19 deletions
@@ -53,8 +53,7 @@ void ShowHelpAndExit(const char *option = NULL) {
<< "-o Output File Path - dumps output if requested; optional" << std::endl
<< "-d GPU device ID (0 for the first device, 1 for the second, etc.); optional; default: 0" << std::endl
<< "-of Output Format name - (native, bgr, bgr48, rgb, rgb48, bgra, bgra64, rgba, rgba64; converts native YUV frame to RGB image format; optional; default: 0" << std::endl
<< "-crop crop rectangle for output (not used when using interopped decoded frame); optional; default: 0" << std::endl
<< "-m output_surface_memory_type - decoded surface memory; optional; default - 0" << std::endl;
<< "-crop crop rectangle for output (not used when using interopped decoded frame); optional; default: 0" << std::endl;
exit(0);
}
@@ -259,13 +258,6 @@ int main(int argc, char **argv) {
device_id = atoi(argv[i]);
continue;
}
if (!strcmp(argv[i], "-m")) {
if (++i == argc) {
ShowHelpAndExit("-m");
}
mem_type = static_cast<OutputSurfaceMemoryType>(atoi(argv[i]));
continue;
}
if (!strcmp(argv[i], "-crop")) {
if (++i == argc || 4 != sscanf(argv[i], "%d,%d,%d,%d", &crop_rect.l, &crop_rect.t, &crop_rect.r, &crop_rect.b)) {
ShowHelpAndExit("-crop");