Better error messages when giving wrong input files
I made the mistake of giving a gdf file to an openvibe stream reader (.ov file reader). A tool was generating the file and copied a gdf file into the name "datafile.ov" (which is required by my scenario).
The error message is really not very helpful.
[ ERROR ] At time 0.000 sec <Box algorithm::(0x00004731, 0x00002af9) aka Generic stream reader> {Error description} : {Unexpected EOF in ../datafile.ov}, {Error type} : {ErrorType::BadParsing (code 15)}, {Error location} : {/home/papadop/src/Git/OpenViBe/sdk/plugins/processing/file-io/src/box-algorithms/openvibe/ovpCBoxAlgorithmGenericStreamReader.cpp::97}
[ ERROR ] {Error description} : {Box algorithm processInput function failed}, {Error type} : {ErrorType::Internal (code 2)}, {Error location} : {/home/papadop/src/Git/OpenViBe/sdk/kernel/src/kernel/player/ovkCSimulatedBox.cpp::173}
[ ERROR ] {Error description} : {Process failed for box with id (0x00004731, 0x00002af9)}, {Error type} : {ErrorType::Internal (code 2)}, {Error location} : {/home/papadop/src/Git/OpenViBe/sdk/kernel/src/kernel/player/ovkCScheduler.cpp::571}
Unfortunately, there is no "magic cookie" at the beginning of the file, so I'm unsure that the file content can be checked easily. As it seems to be an EBML stream that is directly written to the file, it might be possible to check the initial packet if it is always of the same type....
Unless there is some magic we can rely on, it is a very poor design to not have such a magic cookie. It would be nice to introduce one, but how can this be done without breaking compatibility....