summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2002-10-06 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2002-10-06 18:00:00 +0200
commit313e33539cd22fd571fc9a0f9f841173e9faebc4 (patch)
tree29b3031574b45c44e21bcfea6128fbbcd4f959da /config.c
parentd08073815d6d9132f7fb5cd9f82877967dc6b0e4 (diff)
downloadvdr-patch-lnbsharing-313e33539cd22fd571fc9a0f9f841173e9faebc4.tar.gz
vdr-patch-lnbsharing-313e33539cd22fd571fc9a0f9f841173e9faebc4.tar.bz2
Version 1.1.12vdr-1.1.12
- Fixed a missing Flush() call in the remote control learning procedure (thanks to Oliver Endriss). - Modified channel handling to cover all parameters necessary for DVB-C and DVB-T (see man vdr(5) for the meaning of the additional parameters stored in the field previously named 'polarisation'). Thanks to Uwe Scheffler and Andy Carter for testing. If you have a system with different kinds of DVB cards, like DVB-T and DVB-C, for instance, there is no more need to distinguish the channels through the 'Ca' parameter in order to assign them to the various DVB cards. This is now taken care of by the "source" parameter. So a channel marked as "terrestrial", for example, will only be received on DVB-T cards. Note that the cChannel class has been moved into a separate file (channels.[ch]), and that all data members have been made private and are now only accessible through member functions. You may have to change any plugin code that accesses cChannel data accordingly. - The new configuration file 'sources.conf' contains the various signal sources (satellites, cable and terrestrial) which are used in 'channels.conf' and 'diseqc.conf' (thanks to Reinhard Walter Buchner for adding some satellites to 'sources.conf' and Oliver Endriss and Lauri Tischler for testing and debugging). - The 'diseqc' parameter in the channel definitions has been redefined to hold the "source" of the given channel (which can be either a satellite, cable or terrestrial). For compatibility with channels.conf files from older versions, numeric values in this parameter will be tolerated, but they have no meaning. If you want to use DiSEqC you will need to replace these old values with the proper source identifiers defined in the new configuration file 'sources.conf'. See how this is done in the 'channels.conf' file that comes with the VDR package. - The new configuration file 'diseqc.conf' can be used to set up the individual diseqc configuration (see man vdr(5) for a description of the file format). - The "Edit channel" menu has a new entry "Source:" in which the source of this channel can be selected (either a satellite, cable or terrestrial). The set of parameters at the end of this menu will change according to the type of source. - The "Use DiSEqC" parameter in the "Setup/LNB" menu has been moved to the beginning of the list and disables the rest of the parameters when set to "yes", since these are now only meaningful if DiSEqC is _not_ used. - Removed some unnecessary #includes from eit.c and changed cMenuRecordings::Del() to cMenuRecordings::Delete() to avoid warnings in gcc-3.2 (thanks to Andreas Schultz for pointing this out). - Improved skipping channels that are (currently) not available (thanks to Stefan Huelswitt). - Updated channels.conf.terr and channels.conf.cable (thanks to Uwe Scheffler). - Fixed a bug when pressing the "Blue" button in the main menu without having displayed it (thanks to Oliver Endriss for reporting this one).
Diffstat (limited to 'config.c')
-rw-r--r--config.c202
1 files changed, 5 insertions, 197 deletions
diff --git a/config.c b/config.c
index e5a5609..24c1438 100644
--- a/config.c
+++ b/config.c
@@ -4,12 +4,13 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: config.c 1.106 2002/09/28 09:43:41 kls Exp $
+ * $Id: config.c 1.107 2002/10/03 10:06:55 kls Exp $
*/
#include "config.h"
#include <ctype.h>
#include <stdlib.h>
+#include "channels.h" //XXX timers!
#include "i18n.h"
#include "interface.h"
#include "plugin.h"
@@ -19,116 +20,6 @@
// format characters in order to allow any number of blanks after a numeric
// value!
-// -- cChannel ---------------------------------------------------------------
-
-char *cChannel::buffer = NULL;
-
-cChannel::cChannel(void)
-{
- *name = 0;
-}
-
-cChannel::cChannel(const cChannel *Channel)
-{
- strcpy(name, Channel ? Channel->name : "Pro7");
- frequency = Channel ? Channel->frequency : 12480;
- polarization = Channel ? Channel->polarization : 'v';
- diseqc = Channel ? Channel->diseqc : 0;
- srate = Channel ? Channel->srate : 27500;
- vpid = Channel ? Channel->vpid : 255;
- apid1 = Channel ? Channel->apid1 : 256;
- apid2 = Channel ? Channel->apid2 : 0;
- dpid1 = Channel ? Channel->dpid1 : 257;
- dpid2 = Channel ? Channel->dpid2 : 0;
- tpid = Channel ? Channel->tpid : 32;
- ca = Channel ? Channel->ca : 0;
- pnr = Channel ? Channel->pnr : 0;
- groupSep = Channel ? Channel->groupSep : false;
-}
-
-const char *cChannel::ToText(cChannel *Channel)
-{
- char buf[MaxChannelName * 2];
- char *s = Channel->name;
- if (strchr(s, ':')) {
- s = strcpy(buf, s);
- strreplace(s, ':', '|');
- }
- free(buffer);
- if (Channel->groupSep)
- asprintf(&buffer, ":%s\n", s);
- else {
- char apidbuf[32];
- char *q = apidbuf;
- q += snprintf(q, sizeof(apidbuf), "%d", Channel->apid1);
- if (Channel->apid2)
- q += snprintf(q, sizeof(apidbuf) - (q - apidbuf), ",%d", Channel->apid2);
- if (Channel->dpid1 || Channel->dpid2)
- q += snprintf(q, sizeof(apidbuf) - (q - apidbuf), ";%d", Channel->dpid1);
- if (Channel->dpid2)
- q += snprintf(q, sizeof(apidbuf) - (q - apidbuf), ",%d", Channel->dpid2);
- *q = 0;
- asprintf(&buffer, "%s:%d:%c:%d:%d:%d:%s:%d:%d:%d\n", s, Channel->frequency, Channel->polarization, Channel->diseqc, Channel->srate, Channel->vpid, apidbuf, Channel->tpid, Channel->ca, Channel->pnr);
- }
- return buffer;
-}
-
-const char *cChannel::ToText(void)
-{
- return ToText(this);
-}
-
-bool cChannel::Parse(const char *s)
-{
- char *buffer = NULL;
- if (*s == ':') {
- if (*++s) {
- strn0cpy(name, s, MaxChannelName);
- groupSep = true;
- number = 0;
- }
- else
- return false;
- }
- else {
- groupSep = false;
- char *apidbuf = NULL;
- int fields = sscanf(s, "%a[^:]:%d :%c:%d :%d :%d :%a[^:]:%d :%d :%d ", &buffer, &frequency, &polarization, &diseqc, &srate, &vpid, &apidbuf, &tpid, &ca, &pnr);
- apid1 = apid2 = 0;
- dpid1 = dpid2 = 0;
- if (apidbuf) {
- char *p = strchr(apidbuf, ';');
- if (p)
- *p++ = 0;
- sscanf(apidbuf, "%d ,%d ", &apid1, &apid2);
- if (p)
- sscanf(p, "%d ,%d ", &dpid1, &dpid2);
- free(apidbuf);
- }
- else
- return false;
- if (fields >= 9) {
- if (fields == 9) {
- // allow reading of old format
- pnr = ca;
- ca = tpid;
- tpid = 0;
- }
- strn0cpy(name, buffer, MaxChannelName);
- free(buffer);
- }
- else
- return false;
- }
- strreplace(name, '|', ':');
- return true;
-}
-
-bool cChannel::Save(FILE *f)
-{
- return fprintf(f, ToText()) > 0;
-}
-
// -- cTimer -----------------------------------------------------------------
char *cTimer::buffer = NULL;
@@ -139,7 +30,7 @@ cTimer::cTimer(bool Instant)
recording = pending = false;
active = Instant ? taActInst : taInactive;
cChannel *ch = Channels.GetByNumber(cDevice::CurrentChannel());
- channel = ch ? ch->number : 0;
+ channel = ch ? ch->Number() : 0;
time_t t = time(NULL);
struct tm tm_r;
struct tm *now = localtime_r(&t, &tm_r);
@@ -156,7 +47,7 @@ cTimer::cTimer(bool Instant)
firstday = 0;
summary = NULL;
if (Instant && ch)
- snprintf(file, sizeof(file), "%s%s", Setup.MarkInstantRecord ? "@" : "", *Setup.NameInstantRecord ? Setup.NameInstantRecord : ch->name);
+ snprintf(file, sizeof(file), "%s%s", Setup.MarkInstantRecord ? "@" : "", *Setup.NameInstantRecord ? Setup.NameInstantRecord : ch->Name());
}
cTimer::cTimer(const cEventInfo *EventInfo)
@@ -165,7 +56,7 @@ cTimer::cTimer(const cEventInfo *EventInfo)
recording = pending = false;
active = true;
cChannel *ch = Channels.GetByServiceID(EventInfo->GetServiceID());
- channel = ch ? ch->number : 0;
+ channel = ch ? ch->Number() : 0;
time_t tstart = EventInfo->GetTime();
time_t tstop = tstart + EventInfo->GetDuration() + Setup.MarginStop * 60;
tstart -= Setup.MarginStart * 60;
@@ -573,89 +464,6 @@ bool cCaDefinition::Parse(const char *s)
cCommands Commands;
-// -- cChannels --------------------------------------------------------------
-
-cChannels Channels;
-
-bool cChannels::Load(const char *FileName, bool AllowComments)
-{
- if (cConfig<cChannel>::Load(FileName, AllowComments)) {
- ReNumber();
- return true;
- }
- return false;
-}
-
-int cChannels::GetNextGroup(int Idx)
-{
- cChannel *channel = Get(++Idx);
- while (channel && !channel->groupSep)
- channel = Get(++Idx);
- return channel ? Idx : -1;
-}
-
-int cChannels::GetPrevGroup(int Idx)
-{
- cChannel *channel = Get(--Idx);
- while (channel && !channel->groupSep)
- channel = Get(--Idx);
- return channel ? Idx : -1;
-}
-
-int cChannels::GetNextNormal(int Idx)
-{
- cChannel *channel = Get(++Idx);
- while (channel && channel->groupSep)
- channel = Get(++Idx);
- return channel ? Idx : -1;
-}
-
-void cChannels::ReNumber( void )
-{
- int Number = 0;
- cChannel *ch = (cChannel *)First();
- while (ch) {
- if (!ch->groupSep)
- ch->number = ++Number;
- ch = (cChannel *)ch->Next();
- }
- maxNumber = Number;
-}
-
-cChannel *cChannels::GetByNumber(int Number)
-{
- cChannel *channel = (cChannel *)First();
- while (channel) {
- if (!channel->groupSep && channel->number == Number)
- return channel;
- channel = (cChannel *)channel->Next();
- }
- return NULL;
-}
-
-cChannel *cChannels::GetByServiceID(unsigned short ServiceId)
-{
- cChannel *channel = (cChannel *)First();
- while (channel) {
- if (!channel->groupSep && channel->pnr == ServiceId)
- return channel;
- channel = (cChannel *)channel->Next();
- }
- return NULL;
-}
-
-bool cChannels::SwitchTo(int Number)
-{
- cChannel *channel = GetByNumber(Number);
- return channel && cDevice::PrimaryDevice()->SwitchChannel(channel, true);
-}
-
-const char *cChannels::GetChannelNameByNumber(int Number)
-{
- cChannel *channel = GetByNumber(Number);
- return channel ? channel->name : NULL;
-}
-
// -- cTimers ----------------------------------------------------------------
cTimers Timers;