Page 1 of 2
Screen saver & power saving killed by VLC
Posted: 18 Aug 2007 12:14
by cfuse
After VLC has been run and has terminated, the screen saver and monitor power saving on my computer are disabled. Killing both those things makes sense whilst playing video (and it's what I have selected in the preferences/video), however, I would have thought that the original settings would have been restored on exiting VLC. This does not appear to be the case.
Windows screen saver and power settings dialogs don't show any changes, and to get the screen saver and monitor power saving to work again I have to select a different setting, apply that, then select the original setting and apply that - just applying the same setting again doesn't work (which appears to be an issue with Windows itself).
Could someone please tell me what I'm doing wrong.
Pentium M running Windows XP SP2
VLC 0.8.6c
Re: Screen saver & power saving killed by VLC
Posted: 31 Aug 2007 12:12
by blygman
I have got the same problem : when I launch VLC It changes the "turn off monitor" option to a blank field causing the screen to be turned off after 1 second of inactivity. When VLC is shut down, the parameters are back to their standard value.
I have already posted a message on this problem but no one has replied yet.
viewtopic.php?f=14&t=39969
It is also related to the following post :
viewtopic.php?f=14&t=39497
All of this has to do with VLC interfering with the power management settings.
Even uninstalling VLC could not solve this.
Update : I have unchecked the "Disable screensaver option" ( go to Preferences > Video > and check the "Advanced option" box) and it seems to have solved the problem. For how long ? Last time I thought I had solved it is when I updated the video driver but the problem was back the following day.
Francois
Re: Screen saver & power saving killed by VLC
Posted: 31 Aug 2007 22:11
by alex1015
I have this same problem. I am on Windows XP SP2 (media center edition). I'm not sure why but VLC changes my power settings. Even if I change them back and click apply. If I change the power settings to how I want them it is ok, but then as soon as I use VLC again it will switch them back.
Re: Screen saver & power saving killed by VLC
Posted: 08 Apr 2008 18:59
by Bjurran
Picking up this topic again, as I am experiencing the same thing as you, and have done so for a really long time now.
Did you ever find a sollution for this?
Re: Screen saver & power saving killed by VLC
Posted: 09 Apr 2008 02:22
by cfuse
Unfortunately, I haven't found a solution. I have just gotten into the habit of turning my monitor off if I'm going to be away from the computer for any length of time.
As an addition to my previous description of the problem, if I reboot, the settings return to normal (ie. they reflect the settings in the power saving dialog). If I run VLC again, the problem returns until the next reboot (if I don't address it otherwise).
Re: Screen saver & power saving killed by VLC
Posted: 09 Apr 2008 06:58
by Bjurran
Well, I usually don't have to reboot, it's enough to use
Display properties -> Screen Saver -> Power...
Change to another power scheme and hit apply, change back to your prefered scheme and apply settings.
That works for me, but it's a shame that this feature is not working as it's supposed to.
Re: Screen saver & power saving killed by VLC
Posted: 09 Apr 2008 07:31
by cfuse
I don't have to reboot, but if I do nothing but reboot the problem resolves itself.
If you go into the power saving dialog after using VLC the initial settings are unchanged - but they simply no longer work, so the dialog isn't accurately reflecting the state of the system. But this screen/power saving behaviour isn't persistent between reboots - meaning that whatever is happening is probably in memory or otherwise transitory. It really just comes down to how the screen/power saving is suspended within VLC's code, and the fact that whatever is being done programmatically isn't being reversed prior to VLC shutting down.
Re: Screen saver & power saving killed by VLC
Posted: 12 Jun 2008 19:23
by mar9tin
I've noticed that every time I use VLC my monitor would not shut-off after 10 mins (my power option setting). I upgraded to h to see if it had been fixed. Does not happen with other players, and altho I have an ATI card, I had previously disabled ATI Hotkey Puller so that is not the cause. Media players are set up to ignore monitor shutdown or screensavers, because you are sitting watching a movie and may not therefore ever touch a key or the mouse for a long period of time. Some players will allow shut-down if the player is paused and/or minimized. Anyway, VLC definitely has a problem removing this after exit, so I'll not be using VLC until it is fixed.
Re: Screen saver & power saving killed by VLC
Posted: 05 Oct 2008 17:49
by EJPutz
The problem is not with the player, but with the codecs (Lib*.dll files). I know this because I have the same problem with Miro player, which uses the vlc libraries as it's codec package. I also thought it was a problem with VLC, and quit using the player a long time ago because of it. However; I like Miro player because of it's library, and that it has a built-in video subscription service. But now the old VLC power problem is back to haunt me. Just thought you'd like to know.
Re: Screen saver & power saving killed by VLC
Posted: 06 Oct 2008 01:13
by cfuse
If it is specific to VLC's libraries it should be reproducible in any application that uses said libraries. I can't really find any evidence supporting this (which doesn't mean that it doesn't exist, simply that I cannot find it).
As far as I can tell Miro actually uses VLC, not just it's libraries. So, if that is the case the issue still remains with VLC as an application rather than as a library.
Given that the bulk of the video decoding is done by libavcodec (ffmpeg) within VLC, I would think that if the problem is located in the library it would be evident within the ffmpeg project. Once again, I cannot find any supporting evidence for this.
Given that not everyone has this issue with VLC it would be reasonable to assume that it isn't a hardware or driver issue (because by sheer volume of users there would be heaps of results on google reporting this) or a commonly used application (same rationale). It could be some obscure application or setting, it really could be anything. I am scratching my head as to what it might be. The only thing I can reliably document is my own case: this only happens in VLC, I don't have any exotic hardware or drivers and I'm not using any obscure software. There is no setting I've changed or action that I have taken that I can even remotely link to this issue. Short of listing my hardware, software and a detailed listing of the setup and usage of a bare metal OS install, I'm not sure how to document this issue any better than I have.
The issue is reliably reproducible for me, but it's clear that overall this issue's occurrence is quite rare - otherwise there would be far more complaint. I don't know what more I can do.
Re: Screen saver & power saving killed by VLC
Posted: 06 Oct 2008 11:00
by VLC_help
I try to fix this issue this week. Power saving code is currently in each video output module, so if any program uses those, the issues will also show up in them also.
Re: Screen saver & power saving killed by VLC
Posted: 06 Oct 2008 17:57
by cfuse
Power saving code is currently in each video output module, so if any program uses those, the issues will also show up in them also.
That's kind of a strange place for it but I'm sure that there is some good reason for it (or that may just be my naivety in regards to the code base - it could be held together with duct tape for all I know). I would have thought that it would live above the level of the output modules, in pre/post playback code (given that I know nothing about the structure or flow of VLC I don't really know if what I'm saying makes sense or is appropriate).
Screen and power saving is presumably a toggle: If/when the option is set in the VLC preferences then switch the screen/power saving off while (
and only while) video is playing (given that is the only context that it makes sense to do so) and back on when playback terminates. I cannot find the 'proper/best practice' way that disabling screen/power saving should be done, so if such a thing exists it could obviate all of the thinking above.
Any suggestions as to other apps that use the output modules so that I can test/reproduce the bug on my system? I don't know if you've had a chance to look at the code, but have you been able to reproduce the bug yourself? I only ask the question because as I've said before, this bug seems to be fairly rare. I know how difficult it can be to bug fix if you cannot reliably reproduce it on the development machine. Let me know if you want me to test anything.
Re: Screen saver & power saving killed by VLC
Posted: 07 Oct 2008 18:43
by VLC_help
I will remove current registry modification code because it doesn't work for all (limited user accounts for example) and because if VLC crashes, right state isn't returned. I will prolly use phantom key to prevent screen saver/power save activation while video is playing (so when paused, screen saver will activate).
Re: Screen saver & power saving killed by VLC
Posted: 07 Oct 2008 22:28
by Mercury048
The correct way to do this is with message handling. (Again!) Compared to the WM_APPCOMMAND stuff, this should be a piece of cake.
The active window receives a WM_COMMAND/SC_SCREENSAVE message when the screensaver is supposed to come on. Simply process the message: do nothing and return 0.
As long as the message does not get passed to DefWindowProc, the screensaver won't turn on!
http://msdn.microsoft.com/en-us/library/cc144066.aspx
Once a screen saver is chosen, Windows monitors keystrokes and mouse movements and then starts the screen saver after a period of inactivity. However, Windows does not start the screen saver if any of the following conditions exist:
The active application is not a Windows-based application.
A computer-based training (CBT) window is present.
The active application receives the WM_SYSCOMMAND message with the wParam parameter set to the SC_SCREENSAVE value, but it does not pass the message to the DefWindowProc function.
Re: Screen saver & power saving killed by VLC
Posted: 07 Oct 2008 22:44
by Mercury048
Or, use
Code: Select all
SystemParametersInfo( SPI_SETSCREENSAVEACTIVE, FALSE, 0, SPIF_SENDWININICHANGE);
and
Code: Select all
SystemParametersInfo( SPI_SETSCREENSAVEACTIVE, TRUE, 0, SPIF_SENDWININICHANGE);
This has the advantage of working even when VLC is in the background.
Re: Screen saver & power saving killed by VLC
Posted: 08 Oct 2008 00:51
by cfuse
Do either of the above include/handle power-saving? I would have thought that it would be a part of ACPI - it does make (a perverse sort of) sense, you might wish to turn screen saving off and leave power saving on.
That isn't the desire here, but I can see the sense in having that level of granularity.
Re: Screen saver & power saving killed by VLC
Posted: 08 Oct 2008 01:59
by Mercury048
The first method does, I think... also include the case for wParam = SC_MONITORPOWER.
The second method should also work using SPI_SETLOWPOWERACTIVE and SPI_SETPOWEROFFACTIVE.
But as always Vista gives trouble: The first method cannot be used to disable a password-protected screensaver, and the second is completely different for the power-off case and I'm not sure where the proper documentation would be.
VLC_Help's idea of simulating keystrokes sounds like it would probably run into issues on Vista as well, but I really don't know.
Re: Screen saver & power saving killed by VLC
Posted: 08 Oct 2008 20:17
by VLC_help
http://www.codeguru.com/forum/archive/i ... 04863.html
according to that, SC_SCREENSAVE doesn't work like that.
Re: Screen saver & power saving killed by VLC
Posted: 08 Oct 2008 20:48
by Mercury048
I believe the second poster there is wrong. In fact, his advice is eerily similar to
some I was given that turned out to be wrong. (VladimirF and VictorN are twins?
)
There are multiple sites that claim this method works. I think the problem might be in the return value (should be -1 instead of 0 ?)
Re: Screen saver & power saving killed by VLC
Posted: 09 Oct 2008 21:17
by VLC_help
If SC_SCREENSAVE is posted to every program running, some loop jammed program wouldn't handle it all. That would prevent screensaver completely, so I assume there is certain very short time limit to answer to that message. And on some performance critical situations, VLC might not handle it fast enough.
and also from
http://msdn.microsoft.com/en-us/library/cc144066.aspx
Windows Vista and later: If password protection is enabled by policy, the screen saver is started regardless of what an application does with the SC_SCREENSAVE notification.
makes it clear that SC_SCREENSAVE isn't best solution.
Re: Screen saver & power saving killed by VLC
Posted: 09 Oct 2008 22:51
by Mercury048
-This message is only sent to the program in the foreground (the active application).
-I expect the timeout is on the order of several seconds.
-Vista poses a problem but reading it more closely, it says "password protection is enabled by policy". I think this isn't the same thing as just regular password protection, but a Group Policy setting. This would be an extremely rare situation for home users; I would only expect to find it on domain-bound computers.
I'm not a dev though, it's up to you what the best method is.
Re: Screen saver & power saving killed by VLC
Posted: 09 Oct 2008 23:45
by js2756
I'd like to point out that this bug has gotten worse in 0.9.4. In prior versions, you could go into the power management settings and reset your settings after using VLC and it would work. Now, you can't even do that anymore. VLC now totally disables being able to shut off your monitor automatically, even if you go into the power management settings and reset it to shut your monitor off.
Re: Screen saver & power saving killed by VLC
Posted: 10 Oct 2008 00:24
by cfuse
I feel extremely guilty for what I'm about to suggest, given that I raised the whole issue of best practice.
Would it not be possible (and very easy) to send a keystroke, thereby convincing the computer that a human is at the helm? I use numlock to wake up sleeping screens all the time.
I've done a quick test, and hitting numlock during VLC fullscreen doesn't effect playback. However, as I'm running some logitech crapware for my keyboard, a giant lime green notification appears on screen from that (which is a fairly big flaw in my cunning plan). I don't know if it would work, but could the ASCII null character (or some other unused char, maybe extended ASCII or an ALT code? ▄█▄ No idea if windows copes with them like a normal char.) be used (given that it is non printing)?
If VLC has focus, couldn't any char be used and dealt with by VLC? This clearly won't work when VLC doesn't have focus - but that might actually be a desirable behaviour. You could be playing a video and using an app that you are just looking at (like a status app or a terminal), so that's a problem. I've never used VLC and an app giving passive visual information and requiring no input at the same time, but it's certainly possible. There's no point shifting a problem around, that's not a fix at all (so please don't think that I'm suggesting that).
Re: Screen saver & power saving killed by VLC
Posted: 10 Oct 2008 02:14
by Mercury048
This is doable. The most harmless key would be Shift, since it never (AFAIK) does anything by itself. Better yet would be the Fake Shift (which is not a real key but is a scancode sent by keyboards as part of an antiquated backward-compatibility kludge) but I'm not sure if it would prevent the screensaver starting.
One way to find out...
SendInput (recommended)
keybd_event (I used this, it's much simpler than the above but it's deprecated - might not work in Vista.)
Re: Screen saver & power saving killed by VLC
Posted: 10 Oct 2008 16:30
by VLC_help
SendInput is the method that I am going to use unless something better comes up. I will try that tomorrow because it seems my skins2 and QT4 updates are little bit jammed ATM.