openframeworks / openframeworks/openFrameworks
ofVideoPlayer room for improvement
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
PRs
- https://github.com/openframeworks/openFrameworks/pull/8189
- https://github.com/openframeworks/openFrameworks/pull/6821
- https://github.com/openframeworks/openFrameworks/pull/6823
- https://github.com/openframeworks/openFrameworks/pull/6824
- https://github.com/openframeworks/openFrameworks/pull/6829
- https://github.com/openframeworks/openFrameworks/pull/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
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the ofVideoPlayer implementation around setPlayer, player initialization, and setPixelFormat, then review PR 8189 and issue 5797 for related context. The issue does not define a final change or acceptance criteria; completion would require maintainer agreement on the proposed refactor and its scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- audio-video-rtc
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100