-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Open
Description
PRs
- ofVideoPlayer AVFoundation, setPosition can work with arbitrary frames. #8189
- ofVideoPlayer setPlayer std::move shared_ptr #6821
- ofBaseHasPixels is already present #6823
- ofAVFoundationPlayer - redundant code removal #6824
- ofVideoPlayer unneeded inheritance #6829
- video identation : spaces to tabs #6838
Issue to address
I'm spending some time reading ofVideoPlayer code to understand better how it is structured.
So I'm opening here to ask opinions and share thoughts.
Some things caught my attention in the process, the first of them is this function
void ofVideoPlayer::setPlayer(shared_ptr<ofBaseVideoPlayer> newPlayer)which has a shared_ptr as a parameter. and assigns a shared_ptr to another shared_ptr here
player = newPlayer;I can see they are using two different addresses if I print them
cout << "setPlayer " << &player << " " << newPlayer << endl;I've noticed there are some checks in different parts of the code which call this function, some call setPixelFormat, and some don't.
if( !player ){
setPlayer(std::make_shared<OF_VID_PLAYER_TYPE>());
player->setPixelFormat(internalPixelFormat);
}We can substitute this checks with a function which creates the shared pointer without passing as a function parameter, something like this
void ofVideoPlayer::checkPlayer(){
if( !player ){
player = std::make_shared<OF_VID_PLAYER_TYPE>();
player->setPixelFormat(internalPixelFormat);
setPixelFormat(internalPixelFormat); //this means that it will try to set the pixel format you
}
}
Metadata
Metadata
Assignees
Labels
No labels