Quantcast
Channel: openFrameworks - Latest posts
Viewing all articles
Browse latest Browse all 40524

ofDirectShowPlayer, setVolume() & update() tweaks

$
0
0

Been working on a video heavy app for a corporate lobby and have come across 2 small but significant changes to ofDirectShowPlayer that have been necessary. I'll happily submit a pull request if folks agree with my changes, or have better suggestions (very welcome):

1 - setVolume()
known issue: https://github.com/openframeworks/openFrameworks/issues/3818
the DirectShow player uses a log scale for volume, and setting the volume to tiny, non-zero positive float results in an 'invalid' value that is rejected. My suggested change ( ~line 733 )

if (vol < -8000) vol = -10000;
// addition - do not allow values < -10000:
vol = MAX(-10000, vol);

2 - update()
the ofPixels instance is reallocated if player->getWidth() != pix.getWidth(), the issue is that the possibility of a video with the same width, but different height exists (poignantly so in my project, where 1080p/720p videos exist alongside one outlier: a 1920 x 1072 video)
my suggestion (~line 1130):

if( pix.getWidth() != player->getWidth() || pix.getHeight() != player->getHeight()){
   pix.allocate(player->getWidth(), player->getHeight(), OF_IMAGE_COLOR);
}

Hopefully this is the right place to run these relatively minor things past y'all - so far 0.9.0 is working great and I'll be posting something about the project in the next few days.

Cheers!


Viewing all articles
Browse latest Browse all 40524

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>