[solved] ofAVFoundationPlayer - getPixels() results in error after an unsuccessful movie load


There seems to be a bug with the ofAVFoundationPlayer. Well maybe I am doing something wrong, but the same thing works fine in of_v0.8.1 where the old player is used afaik.

Using getPixels() to grab a frame of a movie throws an error if there was an unsuccessful movie load before.

These lines works fine:

ofVideoPlayer loadedMovie;
ofPixels tempPixels;
tempPixels = loadedMovie.getPixels();

These lines result in an error:

ofVideoPlayer loadedMovie;
ofPixels tempPixels;
loadedMovie.load("NonExistingMovie.mp4"); // failed movie load, no movie gets loaded
tempPixels = loadedMovie.getPixels();


[ error ] ofAVFoundationPlayer: getPixels(): Returning pixels that may be unallocated. Make sure to initialize the video player before calling getPixels.

I also tried to close() the player after the failed movie load and before loading a new one, but that made no difference. How can I initialize the video player again or is there something else wrong? Any ideas would greatly be appreciated?

There was another post regarding this error, but for the ofxiOSVideoPlayer. Are they maybe related?
Video to sequence

My setup:
Using of v0.9.2 with Qt Creator 3.6.0 on OS X 10.11

I just wondered if anyone can reproduce this behavior or knows if that is really a bug?

Another update to this behaviour.

Apparently it only produces the getPixels() error when the first movie load is not successful.
If the first one is successful and sometime later you load e.g. an non-existing movie then there is no error.

Thanks to @theo.
He fixed the bug. The fix will AFAIK go into 0.9.3 release.
If you can’t wait, see - https://github.com/openframeworks/openFrameworks/issues/4967