secondstory / ofxDSHapVideoPlayer

ofxDSHapVideoPlayer is a Hap video player addon for openFrameworks (Windows-only)
Other
37 stars 21 forks source link

Incorrect format when used with ofVideoPlayer #10

Open prisonerjohn opened 8 years ago

prisonerjohn commented 8 years ago

I'm trying to use the ofxDSHapVidePlayer inside ofVideoPlayer:

shared_ptr<ofxDSHapVideoPlayer> hapPlayer = make_shared<ofxDSHapVideoPlayer>();
videoPlayer.setPlayer(hapPlayer);
videoPlayer.load("sample-1080p30-Hap.avi");

It's running but interpreting the format wrong:

capture-hap
mantissa commented 8 years ago

hey prisonerjohn-just confirmed the issue over here and am looking into it

mantissa commented 8 years ago

using a shared_ptr to ofxDSHapVideoPlayer, ofVideoPlayer both overwrites the HAP texture data in ofVideoPlayer::update and never calls ofxDSHapVideoPlayer::draw, which contains some critical logic.

ofVideoPlayer::update isn't a virtual function, so ofxDSHapVideoPlayer::update cant override it.

unfortunately, it looks like this addon doesn't align with OF's intended architecture for extending video players. i'm happy to chat about mitigating this if you have any ideas.

prisonerjohn commented 8 years ago

Ah I see. It would be nice to solve this if possible, I can look into it more closely and reply here if I find a suitable solution.

mantissa commented 8 years ago

I spent a bit more time on this the other day. If the ofxDSHapVideoPlayer extends ofBaseVideoDraws then it can override the virtual draw() function but ofBaseVideoPlayer doesn't have a virtual update() function that can be overridden. You can cast the player pointer from getplayer() and then call update on it.

mantissa commented 8 years ago

I was wrong in my last post: ofxDSHapVideoPlayer::update() will be called if ofxDSHapVideoPlayer extends ofBaseVideoDraws, but due to the way ofVideoPlayer is structured, ofxDSHapVideoPlayer::draw() will never be called. This is critical if ofxDSHapVideoPlayer is playing a DXT5 encoded file. Let me know if you can think of any other workarounds.

indefinit commented 7 years ago

@mantissa Just curious if this issue was ever resolved? found myself bumping into this issue because I was creating a vector of shared_ptr<ofxDSHapVideoPlayer> and I need a reliable way to call update on each of the players.

When I switch from a vector of shared pointers to a vector<ofxDSHapVideoPlayer> I throw a read access exception in the updatePlayState() method in ofxDSHapVideoPlayer.cpp:

ln 919: hr = controlInterface->GetState(4000, (OAFilterState*)&fs)

Any suggestions? Thanks for your help in advance!

visiblegroup commented 6 years ago

Hi,

I am facing a very similar issue in my cinder port of this of addon. Did you ever found a way to solve this problem in OF?

Thanks!