vdr-plugin-wirbelscan: fix segv, interface channel counts and device detection

This commit is contained in:
mglae 2018-11-09 19:13:36 +01:00
parent 20def8fccc
commit bbfab943a6
3 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,12 @@
--- a/statemachine.c
+++ b/statemachine.c
@@ -309,7 +309,8 @@ void cStateMachine::Action(void) {
else
newState = eAddChannels;
if (time(0) != tm) {
- MenuScanning->SetProgress(lProgress);
+ if (MenuScanning)
+ MenuScanning->SetProgress(lProgress);
tm = time(0);
}
}

View File

@ -0,0 +1,22 @@
--- a/wirbelscan.c
+++ b/wirbelscan.c
@@ -13,6 +13,8 @@
#include "countries.h"
#include "satellites.h"
+extern TChannels NewChannels;
+
static const char *VERSION = "2017.06.04";
static const char *DESCRIPTION = "DVB channel scan for VDR";
static const char *MAINMENUENTRY = NULL; /* main menu -> use wirbelscancontrol plugin */
@@ -201,8 +203,8 @@ bool cPluginWirbelscan::Service(const ch
strcpy(s->transponder, lTransponder.length()? lTransponder.c_str():"none");
s->progress = s->status == StatusScanning?lProgress:0;
s->strength = s->status == StatusScanning?lStrength:0;
- s->numChannels = 0; // Channels.Count(); // not possible any longer.
- s->newChannels = channelcount; // ((Channels.Count() - channelcount) > 0) && channelcount?Channels.Count() - channelcount:0;
+ s->numChannels = cChannels::MaxNumber();
+ s->newChannels = (NewChannels.Count() > cChannels::MaxNumber()) ? NewChannels.Count() - cChannels::MaxNumber():0;
s->nextTransponders = nextTransponders;
return true;
}

View File

@ -0,0 +1,27 @@
--- a/common.c
+++ b/common.c
@@ -46,20 +46,10 @@ void cMySetup::InitSystems(void) {
for(int i = 0; i < cDevice::NumDevices(); i++) {
cDevice* device = cDevice::GetDevice(i);
if (device == NULL) continue;
- std::string t = *device->DeviceType();
- if (t == "DVB-C" ) systems[SCAN_CABLE ] = 1;
- if (t == "DVB-T" ) systems[SCAN_TERRESTRIAL ] = 1;
- if (t == "DSS" ) systems[SCAN_SATELLITE ] = 1;
- if (t == "DVB-S" ) systems[SCAN_SATELLITE ] = 1;
- if (t == "DVB-S2") systems[SCAN_SATELLITE ] = 1;
- if (t == "ATSC" ) systems[SCAN_TERRCABLE_ATSC] = 1;
- if (t == "DVB-T2") systems[SCAN_TERRESTRIAL ] = 1;
- if (t == "TURBO" ) systems[SCAN_SATELLITE ] = 1;
- if (t == "SAT>IP") {
- if (device->ProvidesSource(cSource::FromString("S"))) systems[SCAN_SATELLITE ] = 1;
- if (device->ProvidesSource(cSource::FromString("T"))) systems[SCAN_TERRESTRIAL ] = 1;
- if (device->ProvidesSource(cSource::FromString("C"))) systems[SCAN_CABLE ] = 1;
- }
+ if (device->ProvidesSource(cSource::stSat)) systems[SCAN_SATELLITE] = 1;
+ if (device->ProvidesSource(cSource::stTerr)) systems[SCAN_TERRESTRIAL] = 1;
+ if (device->ProvidesSource(cSource::stCable)) systems[SCAN_CABLE] = 1;
+ if (device->ProvidesSource(cSource::stAtsc)) systems[SCAN_TERRCABLE_ATSC] = 1;
}
if (DVB_Type >= SCAN_NO_DEVICE || ! systems[DVB_Type]) {