hecomi / uDesktopDuplication

Desktop Duplication API implementation for Unity (only for Windows 8/10)
http://tips.hecomi.com/entry/2016/12/04/125641
MIT License
563 stars 97 forks source link

Desktop Duplication get buffer #15

Closed AhmedX6 closed 7 years ago

AhmedX6 commented 7 years ago

Hello!

I would like to implement my own mirroring protocol, I'm trying to use Windows Desktop Duplication API for the client. https://msdn.microsoft.com/en-us/library/windows/desktop/hh404487(v=vs.85).aspx

My server is an Android device with an OpenGL surface to display the buffer.

I send only when desktop pixels are modified. I would like to retrieve a buffer with position of pixel that has been moved and send only that to the Android device. Is it possible to do it with the Desktop Duplication API ?

Thank you for your help !

hecomi commented 7 years ago

Desktop Duplication API provides dirty rects and move rects as written in the document. Using dirty rects as update areas is simple and nice method as your first step, I think.

AhmedX6 commented 7 years ago

The problem is how to get the buffer of pixels that I have to send ? I think I understood Dirty Rect : it's like a merge of all rects that have been updated to make a single rect. But how to get pixels that is inside and send them to update the framebuffer on client side ?

hecomi commented 7 years ago

IDXGIOutputDuplication has GetFrameDirtyRects() and you can get RECT list through this API.

Please see the implementation of Duplicator.cpp as your reference.

The question seems to be a general one and is not related to this plugin. So I closed this issue.

AhmedX6 commented 7 years ago

Thank you very much for your answer. I do not know if you can or not to help me by e-mail or skype to implement this API on a QT project. This is a final project in computer engineering and I really need help. I will never thank you enough ...

I already encounter difficulties on a structure that would be unrecognized while the DirectX paths are added: DXGI_OUTDUPL_FRAME_INFO yet I have included and the -ldxgi is in my .pro file.