Having trouble using the getPixels() method and no luck in tracking down exactly why.
VS debugger is throwing an error at processPixels(), specifically:
dstPixel = srcPixel
in the “if(src.getPixelFormat() == OF_PIXELS_BGR)” block.
I had thought that it was possible that since ‘dst’ is being reallocated in that block, that dstLine and endLine needed to be reset. Didn’t help. It’s odd to me that it’s got a problem at 'pixel and not 'pixel.
Only other error:
ERROR: SampleCB<> - buffer sizes do not match 6220800 8294400
I’m loading ‘standard’ 1080p mp4 videos that did not cause a problem before the recent github update.
Checked it again with the suggested fix and the issue persists.
One thing I noticed in the debugger in the ‘Autos’ tab:
dstLine – seems fine
dstPixel – seems fine
endPixel – seems fine
srcLine – “Error reading characters of string.” for _begin only. _end appears to be fine.
srcPixel – “Error reading characters of string.”. …for ‘pixel’. it shows componentsPerPixel = 4, and pixelFormat = OF_PIXELS_BGRA (5)
are you setting BGRA explicitly? the error in the debugger is normal, it’s just trying to interpret the unsigned char * as a string but since it’s not some chars are not valid and errors out but has nothing to do with the crash
Nope, not setting as BGRA. But your question reminded me that I had looked at DirectShowVideo::getPixels() and wondered about the switch statement. There are no ‘breaks’ in the switch(pixelFormat) block, so the srcBuffer was being set to BGR, then again to BGRA every time.
I added breaks (along with the previous suggestion), and it now runs just fine! I could be imagining a small performance hit in Debug mode, as don’t think I’m seeing it in Release, but I wasn’t paying a ton of attention to that while debugging (and dealing with 20fps vs 60fps in release).
Anyway - thanks gents for the assistance. I’d be happy to submit a PR, but I wouldn’t be able to until Friday, as this app is getting deployed tomorrow!