smasherprog / screen_capture_lite

cross platform screen/window capturing library
MIT License
619 stars 156 forks source link

DXGI issues: EnumDisplayDevices mismatch, and rotated monitors #46

Closed BradyBrenot closed 6 years ago

BradyBrenot commented 6 years ago
  1. screen_capture_lite assumes capture will only happen on the first DXGI adapter, and that the order of outputs from DXGI matches the order of outputs that it gets from EnumDisplayDevices.
    • These assumptions don't hold; apparently depending on where on my video card I plug things into, the ordering of outputs is wrong, and I've got reports from users with laptops with hybrid GPUs who I think are suffering from the "only adapter 0" assumption, but this is hard to confirm as I don't have any such hardware.
  2. monitors rotated by 90 or 270 degrees have width/height flipped. That's as you'd expect, except DXGI gives us a surface with an un-rotated image, which screen_capture_lite can choke on as ProcessFame is assuming it's rotated.

I have a PR I'll attach shortly, not sure if the approach is one you'd want to take straight in though. It also doesn't really fix (2), in that it allows screen_capture_lite to at least work in that case (which it wasn't), but the image it gives the client is still unrotated.

smasherprog commented 6 years ago

I'll take a look at this shortly. I am on the road right now. I'll try and address the second issue as well

smasherprog commented 6 years ago

I am still reviewing this.

smasherprog commented 6 years ago

I think your method is the best route ill be removing the old method and using the DX method as you have proposed. I just got home so let me get this done.

smasherprog commented 6 years ago

Merged this in. We can test it out and ill create a new release on this.

smasherprog commented 6 years ago

Closing let me know if this is working for you.

BradyBrenot commented 6 years ago

It looks good, I'll be able to take a look in a few days.