I’ve been playing around with various ways to refactor ofVideoPlayer such that the details of say the QuickTime implementation are separated from the gstreamer implementation. My motivations were to work toward keeping the logic of the player separate from the details of a particular API and as a result make things more maintainable and manageable.
This is a rough first pass, but gets the idea across. In doing this, I found the logic to be tightly intertwined with the various APIs, so before I put in the fairly large effort it will take to complete the refactor and make it really clean, I want to see if this approach to x-platform/x-api design is viable within the OF project.
I’ve tested this on OSX and Ubuntu. I’m not sure about Windows, but I assume with QT is being used on windows, it will work.
What I implemented is the “pointer to implementation” design pattern aka PIMPL. The design keeps ofVideoPlayer as a generic interface so no code using it need change. Inside ofVideoPlayer, there’s a pointer to an ofVideoPlayerImpl which is specific to QT or gst. All ofVideoPlayer functions dependent on API-specific calls follow a naming convention like implLoadMovie, etc. I zipped up the entire modified OF Video folder and it can be downloaded here if you want to take a look: http://mat.ucsb.edu/whsmith/temp/ofVideo.zip