I create a video mov file using ofxQtVideoSaver.
If I try to play the movie just after the saver.finishMovie() call, the application crash:
saver.finishMovie();
ofVideoPlayer * player = new ofVideoPlayer();
player->loadMovie("theMovie.mov"); // Crash!!!
I guess this is because the file isn’t “finalized” so quickly.
If I wait 2 seconds, and then try to load the movie, it work.
But I guess this delay may not fit all cases.
Do you know how can I check if the file creation is complete? Thank you very much.
After some others tries, I see that my application can crash even if I wait 30 seconds before the loadMovie
I try to detect if the file is available doing:
try {
fstream f (ofToDataPath(_file), ios::in | ios::out | ios::binary); // Open the file using the std lib
if (!f.is_open()) { // check if it's possible to open the file
ofLogWarning("!f.is_open()"); // this message never appear
return;
}
if (!f.good()) { // check if file is ready for read/write operations
f.close();
ofLogWarning("!f.good()"); // this message never appear
return;
}
f.close();
_content.loadMovie(_file); // load the movie
} catch (...) {
ofLogWarning("loading error"); // this message never appear. But the program crash.
return;
}
I’ve got no ofLogWarning displayed, the program crash, the debugger say:
Program received signal SIGSEGV, Segmentation fault.
In QuickTime!AVC0_ComponentDispatch () (C:\Program Files (x86)\QuickTime\QTSystem\QuickTime.qts)