Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linux-dvb] vdr patch: remember last channel after restart
... now non binary .... grrr.
--
Deti Fliegl
Phone: +49 179 2198419 Fax: +49-1805-05255556258
e-mailto:deti@fliegl.de http://www.fliegl.de
-- Attached file included as plaintext by Listar --
-- File: vdr-20010109.patch
--- VDR-0.68/vdr.c Sat Nov 18 14:46:56 2000
+++ VDR/vdr.c Tue Jan 9 23:28:27 2001
@@ -203,6 +203,9 @@
cOsdBase *Menu = NULL;
cReplayControl *ReplayControl = NULL;
int LastChannel = -1;
+ cChannel *channel = Channels.GetByNumber(Setup.LastChannel);
+ if (channel)
+ channel->Switch();
int PreviousChannel = cDvbApi::CurrentChannel();
while (!Interrupted) {
@@ -310,6 +313,8 @@
EITScanner.Process();
}
isyslog(LOG_INFO, "caught signal %d", Interrupted);
+ Setup.LastChannel=cDvbApi::CurrentChannel();
+ Setup.Save();
delete Menu;
delete ReplayControl;
delete Interface;
--- VDR-0.68/config.h Sat Nov 18 14:25:53 2000
+++ VDR/config.h Tue Jan 9 23:14:19 2001
@@ -258,6 +258,7 @@
int SetSystemTime;
int MarginStart, MarginStop;
int EPGScanTimeout;
+ int LastChannel;
cSetup(void);
bool Load(const char *FileName);
bool Save(const char *FileName = NULL);
--- VDR-0.68/config.c Sun Nov 19 22:08:30 2000
+++ VDR/config.c Tue Jan 9 23:16:09 2001
@@ -207,12 +207,17 @@
const char *cChannel::ToText(cChannel *Channel)
{
+ char buf[MaxChannelName * 2];
char *s = Channel->name;
+ if (strchr(s, ':')) {
+ s = strcpy(buf, s);
+ strreplace(s, ':', '|');
+ }
delete buffer;
if (Channel->groupSep)
- asprintf(&buffer, "\t%s\n", s);
+ asprintf(&buffer, ":%s\n", s);
else
- asprintf(&buffer, "%s\t%d\t%c\t%d\t%d\t%d\t%d\t%d\t%d\n", s, Channel->frequency, Channel->polarization, Channel->diseqc, Channel->srate, Channel->vpid, Channel->apid, Channel->ca, Channel->pnr);
+ asprintf(&buffer, "%s:%d:%c:%d:%d:%d:%d:%d:%d\n", s, Channel->frequency, Channel->polarization, Channel->diseqc, Channel->srate, Channel->vpid, Channel->apid, Channel->ca, Channel->pnr);
return buffer;
}
@@ -224,7 +229,7 @@
bool cChannel::Parse(const char *s)
{
char *buffer = NULL;
- if (*s == '\t' || *s ==':' ) {
+ if (*s == ':') {
if (*++s) {
strn0cpy(name, s, MaxChannelName);
name[strlen(name) - 1] = 0; // strip the '\n'
@@ -235,11 +240,7 @@
}
else {
groupSep = false;
- int fields = sscanf(s, "%a[^\t]\t%d\t%c\t%d\t%d\t%d\t%d\t%d\t%d", &buffer, &frequency, &polarization, &diseqc, &srate, &vpid, &apid, &ca, &pnr);
- if(fields!=9)
- fields = sscanf(s, "%a[^:]:%d:%c:%d:%d:%d:%d:%d:%d", &buffer, &frequency, &polarization, &diseqc, &srate, &vpid, &apid, &ca, &pnr);
- if(fields!=9)
- fields = sscanf(s, "%a[^|]|%d|%c|%d|%d|%d|%d|%d|%d", &buffer, &frequency, &polarization, &diseqc, &srate, &vpid, &apid, &ca, &pnr);
+ int fields = sscanf(s, "%a[^:]:%d:%c:%d:%d:%d:%d:%d:%d", &buffer, &frequency, &polarization, &diseqc, &srate, &vpid, &apid, &ca, &pnr);
if (fields == 9) {
strn0cpy(name, buffer, MaxChannelName);
delete buffer;
@@ -247,6 +248,7 @@
else
return false;
}
+ strreplace(name, '|', ':');
return true;
}
@@ -721,6 +723,7 @@
MarginStart = 2;
MarginStop = 10;
EPGScanTimeout = 5;
+ LastChannel = -1;
}
bool cSetup::Parse(char *s)
@@ -740,6 +743,7 @@
else if (!strcasecmp(Name, "MarginStart")) MarginStart = atoi(Value);
else if (!strcasecmp(Name, "MarginStop")) MarginStop = atoi(Value);
else if (!strcasecmp(Name, "EPGScanTimeout")) EPGScanTimeout = atoi(Value);
+ else if (!strcasecmp(Name, "LastChannel")) LastChannel = atoi(Value);
else
return false;
return true;
@@ -791,6 +795,7 @@
fprintf(f, "SetSystemTime = %d\n", SetSystemTime);
fprintf(f, "MarginStart = %d\n", MarginStart);
fprintf(f, "EPGScanTimeout = %d\n", EPGScanTimeout);
+ fprintf(f, "LastChannel = %d\n", LastChannel);
fclose(f);
isyslog(LOG_INFO, "saved setup to %s", FileName);
return true;
---
Info:
To unsubscribe send a mail to listar@linuxtv.org with unsubscribe as subject.
Home |
Main Index |
Thread Index