-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ofVideoPlayer unneeded inheritance #6829
Conversation
It was only needed if ofVideoPlayer was the object of playing video itself, but I understand now ofVideoPlayer will always have a player object inside with playing capabilities (player)
Let's merge this one @ofTheo |
hmm - I am still nervous about this one. I could see someone having something like:
That is designed to allow any class with a ofBaseVideoPlayer. eg:
I feel like we have done this in the past for a project. So I think it is there to allow maximum flexibility. |
ofVideoPlayer object is never a player (maybe only in remote past) it is only a container. void ofVideoPlayer::setPlayer(shared_ptr<ofBaseVideoPlayer> newPlayer){
player = std::move(newPlayer);
setPixelFormat(internalPixelFormat); //this means that it will try to set the pixel format you have been using before.
//if the format is not supported ofVideoPlayer's internalPixelFormat will be updated to that of the player's
} and the player object std::shared_ptr<ofBaseVideoPlayer> player; |
@dimitre oh yeah totally, I understand that. It is more that the way it currently is you can store a pointer to ofBaseVideoPlayer and it can refer to both ofVideoPlayer and ofDSVideoPlayer - which can be useful in some situations ( as you can use implementation players without ofVideoPlayer via the base functions ). obviously you wouldn't want to pass in an ofVideoPlayer to setPlayer ( which can happen now ). I do think you are correct in your thinking, I am just worried about some people storing the pointers but yeah, it is probably fine to merge. |
I can be responsible for reverting this if any issue arises in the near future. I've tried to check out ofDSVideoPlayer to see if it has other base class in common, like ofBaseVideoDraws but didn't find in any place. is that a public addon? Other info: binary code size without inheritance is 86% of the object size, so less compile time and memory
|
It was only needed if ofVideoPlayer was the object of playing video itself,
but I understand now ofVideoPlayer will always have a player object inside with playing capabilities (player)
Player itself is called for ofBaseVideoPlayer properties, so it makes no difference.
Related #6793 (comment)