[vlc-devel] [PATCH]Win32 screensaver disable change
agent_007 at luukku.com
Sat Dec 27 23:18:13 CET 2008
This patch changes how the VLC Win32 video output modules disable screensaver activation (applies to Direct3d, directx, OpenGL and WinGDI).
Current method uses SystemParametersInfo with SPI_GETLOWPOWERTIMEOUT etc. which has few issues:
p1. there are limited Windows accounts which cannot change SPI_GETLOWPOWERTIMEOUT settings.
p2. if VLC crashes (which unfortunately isn't rare event) the original setting isn't returned
New method abuses SendInput which sends VK__none_ keyboard input once per 500 frames (so it basically same as pressing keyboard key that does nothing). This should fix issues p1 and p2, since AFAIK every Windows account can use SendInput and crash just stops SendInput, so original state is returned.
I could use SendInput after every frame, but I assumed it isn't OK. Limit 500 was chosen because lowest screensaver activation time is one minute (60 seconds) and lowest FPS video people would normally watch is 10 FPS, so 50x10 = 500 < 60x10 = 600.
Naturally my patch is ugly in few ways:
u1. there is one #DEFINE
u2. INPUT creation is duplicate code in every module
u3. Sendinput usage is duplicate code in every module
Both u2 and u3 could be turned into functions, but I don't know where should I put them.
Also OpenGL didn't have screensaver disable before and I cannot test it, because Win32 OpenGL seems to be broken (crash on Windows creation).
One option would be to move this stuff to upper level (the place where video output modules Display functions are called). After that there wouldn't be duplicate code and Sendinput wouldn't end up in video output module code. I just don't know what the place would be, maybe after vout_DisplayPicture in src/input/decoder.c ?
And finally some boosting for my non-existing ego. (so the patch should work)
Luukku Plus paketilla pääset eroon tila- ja turvallisuusongelmista.
Hanki Luukku Plus ja helpotat elämääsi. http://www.mtv3.fi/luukku
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 15852 bytes
Desc: not available
More information about the vlc-devel