TV-Server Version: 1.0 Final
MediaPortal Version: 1.0 Final
MediaPortal Skin: Blue3
Windows Version: Vista Home Premium 32bit SP1
CPU Type: AMD Phenom X4
HDD: Samsung 640GB
Memory: 2GB
Motherboard: Gigabyte MA78GPM-DS2H
Video Card: HD3200
Video Card Driver: Catalyst 8.12
Sound Card:
Sound Card AC3:
Sound Card Driver:
1. TV Card: Terratec Cinergy DVB-S2 HD
1. TV Card Type:
1. TV Card Driver:
2. TV Card: Terratec Cinergy DVB-S2 HD CI
2. TV Card Type:
2. TV Card Driver:
3. TV Card:
3. TV Card Type:
3. TV Card Driver:
4. TV Card:
4. TV Card Type:
4. TV Card Driver:
MPEG2 Video Codec:
MPEG2 Audio Codec:
h.264 Video Codec:
Satelite/CableTV Provider:
HTPC Case:
Cooling:
Power Supply:
Remote:
TV:
TV - HTPC Connection:
Hi,
I faced the same problems as reported in the threads
Reinitalize Tuner Prevents Scheduled Recording
and
TV Problems In Vista
After downloading the source from subversion I digged through Service1.cs::OnPowerEvent. The routine works fine as long as no reinitialization of the service is requested. In this case the current code calls all entries is the list of powerhandlerevents that are registered to the service. If reinitialization is requested the routine calls at first the powereventhandler of the service and there DeInit() is called. DeInit() causes all plugins to unregister from tvservice. As a consequence powerscheduler also unregisters not only from tvservice but also removes its own powereventhandler from the service. When the powereventhandler of the service returns there is no additional entry left in the list of powereventhandlers and so powerscheduler does not get informed about the shutdown.
I modified the code to make sure that the list of powereventhandlers is worked through from the last to the first entry. This solves IMHO two problems
1) The powereventhandler of the service is called as last and therefore all other registered powereventhandlers have been called before and have been executed. So when standby is requested the powerscheduler can set the next wakeup time
2) If entries of a list are removed, while the program runs through the list, it might be possible that the program flow is interrupted, or parts of the list are not taken into account (At least this I faced when doing some programs in C++ and I guess there is no difference in C# ).
Okay here is the original code I'm talking about, taken from Service1.cs::OnPowerEvent
And this is the modified code, where the list is worked through from the end.
MediaPortal Version: 1.0 Final
MediaPortal Skin: Blue3
Windows Version: Vista Home Premium 32bit SP1
CPU Type: AMD Phenom X4
HDD: Samsung 640GB
Memory: 2GB
Motherboard: Gigabyte MA78GPM-DS2H
Video Card: HD3200
Video Card Driver: Catalyst 8.12
Sound Card:
Sound Card AC3:
Sound Card Driver:
1. TV Card: Terratec Cinergy DVB-S2 HD
1. TV Card Type:
1. TV Card Driver:
2. TV Card: Terratec Cinergy DVB-S2 HD CI
2. TV Card Type:
2. TV Card Driver:
3. TV Card:
3. TV Card Type:
3. TV Card Driver:
4. TV Card:
4. TV Card Type:
4. TV Card Driver:
MPEG2 Video Codec:
MPEG2 Audio Codec:
h.264 Video Codec:
Satelite/CableTV Provider:
HTPC Case:
Cooling:
Power Supply:
Remote:
TV:
TV - HTPC Connection:
Hi,
I faced the same problems as reported in the threads
Reinitalize Tuner Prevents Scheduled Recording
and
TV Problems In Vista
After downloading the source from subversion I digged through Service1.cs::OnPowerEvent. The routine works fine as long as no reinitialization of the service is requested. In this case the current code calls all entries is the list of powerhandlerevents that are registered to the service. If reinitialization is requested the routine calls at first the powereventhandler of the service and there DeInit() is called. DeInit() causes all plugins to unregister from tvservice. As a consequence powerscheduler also unregisters not only from tvservice but also removes its own powereventhandler from the service. When the powereventhandler of the service returns there is no additional entry left in the list of powereventhandlers and so powerscheduler does not get informed about the shutdown.
I modified the code to make sure that the list of powereventhandlers is worked through from the last to the first entry. This solves IMHO two problems
1) The powereventhandler of the service is called as last and therefore all other registered powereventhandlers have been called before and have been executed. So when standby is requested the powerscheduler can set the next wakeup time
2) If entries of a list are removed, while the program runs through the list, it might be possible that the program flow is interrupted, or parts of the list are not taken into account (At least this I faced when doing some programs in C++ and I guess there is no difference in C# ).
Okay here is the original code I'm talking about, taken from Service1.cs::OnPowerEvent
Code:
foreach (PowerEventHandler handler in _powerEventHandlers)
{
bool result = handler(powerStatus);
if (result == false)
{
accept = false;
powerEventPreventers.Add(handler);
}
else
powerEventAllowers.Add(handler);
}
Code:
for (int i = (_powerEventHandlers.Count - 1); i >= 0; i--)
{
PowerEventHandler handler = _powerEventHandlers[i];
if (handler(powerStatus) == false)
{
accept = false;
powerEventPreventers.Add(handler);
}
else
powerEventAllowers.Add(handler);
}