smasherprog / screen_capture_lite

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

How to disable proactive mode of operation? #77

Closed ababo closed 3 years ago

ababo commented 4 years ago

I would like to capture frames on demand, without using your timer and callbacks under the hood. Is that supported? Thanks.

smasherprog commented 4 years ago

To answer your question: No, I dont believe anyone would use it. Whats your use-case? Your asking for a blocking version of this. This sounds good on the surface, but the time to retrieve the frames would vary widely due to the Waiting which must occur, and on both windows and mac these versions consume a significantly higher amount of CPU as well -- a difference between 5% and like 30% usage so I didn't implement them. This again is due the synchronization which occurs in the OS and in this library while it waits for the data from the OS.

smasherprog commented 4 years ago

If u want to do a PR for this, i'd be open to it!

smasherprog commented 4 years ago

Gonna close this soon if we cant start a dialog on this

ababo commented 4 years ago

The problem is that my code base is based on maintaining threads and timers itself instead of relying on a third party. So I have added a workaround at the cost of excess copying. Feel free to close the issue, but I'm still confident the library should provide direct access to screen capture instead of (or in addition to) passing callbacks.

smasherprog commented 4 years ago

I hear you... Ill create a blocking version of this, its actually not too bad to write the code. Ill see what I can do in the next few days.

smasherprog commented 4 years ago

If you want to take a stab at it and do a PR that would be cool too 👍

smasherprog commented 3 years ago

Im gonna close this as trying to grab a screen shot on demand is beyond the scope of this project. This library is event driven which gives the greatest performance. If a blocking version is required. PR's are accepted!