summaryrefslogtreecommitdiff
path: root/channels.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2004-02-08 18:00:00 +0100
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2004-02-08 18:00:00 +0100
commit3fc29659759abb10154b78f9e3568407e523e1fc (patch)
treefdc9df96602026fc353d90733b74b61a8f679cf7 /channels.c
parent7c5ef5dbbada89f55aa15a7c5ac653f4390ce9b4 (diff)
downloadvdr-patch-lnbsharing-3fc29659759abb10154b78f9e3568407e523e1fc.tar.gz
vdr-patch-lnbsharing-3fc29659759abb10154b78f9e3568407e523e1fc.tar.bz2
Version 1.3.4vdr-1.3.4
- Fixed handling language codes in case there is no audio or Dolby PID. - Fixed handling CA ids (was broken in 1.3.3). - Fixed the SVDRP command 'STAT DISK' to avoid a 'division by 0' in case the disk is full (thanks to Jens Rosenboom). - Fixed handling bitmap indexes for 256 color mode (thanks to Andreas Regel). - Now handling "linked services" (based on the 'autopid' patch from Andreas Schultz). Linked channels are detected and added to 'channels.conf', but currently they are not yet presented to the user other than being in the normal channel list (this will come later). - Preliminary fix for the "Unknown picture type error" (thanks to Sascha Volkenandt for his support in debugging this one). This may slow down switching between channels on different transponders for now, but a better solution will come later. - Fixed the validity check for channel IDs, because some providers use TIDs with value 0 (thanks to Thomas Bergwinkl). - Enabled switching to a channel even if it has no Vpid or Apid set, because these might be automatically set when tuned to that transponder. - No longer closing the Channels menu after trying to switch to a channel that is currently not available. - Removed the now obsolete CaCaps stuff. The Setup/CICAM menu now displays the actual CAM type as reported by the CAM. The 'ca.conf' file has been stripped down to the values 0..4.
Diffstat (limited to 'channels.c')
-rw-r--r--channels.c92
1 files changed, 86 insertions, 6 deletions
diff --git a/channels.c b/channels.c
index d49d7a4..b5bd9bd 100644
--- a/channels.c
+++ b/channels.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: channels.c 1.20 2004/01/25 15:32:08 kls Exp $
+ * $Id: channels.c 1.23 2004/02/08 11:05:22 kls Exp $
*/
#include "channels.h"
@@ -169,11 +169,13 @@ cChannel::cChannel(void)
guard = GUARD_INTERVAL_AUTO;
hierarchy = HIERARCHY_AUTO;
modification = CHANNELMOD_NONE;
+ linkChannels = NULL;
+ refChannel = NULL;
}
-cChannel::cChannel(const cChannel *Channel)
+cChannel::cChannel(const cChannel &Channel)
{
- *this = *Channel;
+ *this = Channel;
*name = 0;
vpid = 0;
ppid = 0;
@@ -188,6 +190,28 @@ cChannel::cChannel(const cChannel *Channel)
number = 0;
groupSep = false;
modification = CHANNELMOD_NONE;
+ linkChannels = NULL;
+ refChannel = NULL;
+}
+
+cChannel::~cChannel()
+{
+ delete linkChannels;
+ linkChannels = NULL; // more than one channel can link to this one, so we need the following loop
+ for (cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) {
+ if (Channel->linkChannels) {
+ for (cLinkChannel *lc = Channel->linkChannels->First(); lc; lc = Channel->linkChannels->Next(lc)) {
+ if (lc->Channel() == this) {
+ Channel->linkChannels->Del(lc);
+ break;
+ }
+ }
+ if (Channel->linkChannels->Count() == 0) {
+ delete Channel->linkChannels;
+ Channel->linkChannels = NULL;
+ }
+ }
+ }
}
cChannel& cChannel::operator= (const cChannel &Channel)
@@ -320,8 +344,10 @@ static int IntArrayToString(char *s, const int *a, int Base = 10, const char n[]
int i = 0;
while (a[i] || i == 0) {
q += sprintf(q, Base == 16 ? "%s%X" : "%s%d", i ? "," : "", a[i]);
- if (n && *n[i])
+ if (a[i] && n && *n[i])
q += sprintf(q, "=%s", n[i]);
+ if (!a[i])
+ break;
i++;
}
*q = 0;
@@ -375,8 +401,11 @@ void cChannel::SetCaIds(const int *CaIds)
IntArrayToString(OldCaIdsBuf, caids, 16);
IntArrayToString(NewCaIdsBuf, CaIds, 16);
dsyslog("changing caids of channel %d from %s to %s", Number(), OldCaIdsBuf, NewCaIdsBuf);
- for (int i = 0; i <= MAXCAIDS && CaIds[i]; i++) // <= to copy the terminating 0
+ for (int i = 0; i <= MAXCAIDS; i++) { // <= to copy the terminating 0
caids[i] = CaIds[i];
+ if (!CaIds[i])
+ break;
+ }
modification |= CHANNELMOD_CA;
Channels.SetModified();
}
@@ -392,6 +421,57 @@ void cChannel::SetCaDescriptors(int Level)
}
}
+void cChannel::SetLinkChannels(cLinkChannels *LinkChannels)
+{
+ if (!linkChannels && !LinkChannels)
+ return;
+ if (linkChannels && LinkChannels) {
+ cLinkChannel *lca = linkChannels->First();
+ cLinkChannel *lcb = LinkChannels->First();
+ while (lca && lcb) {
+ if (lca->Channel() != lcb->Channel()) {
+ lca = NULL;
+ break;
+ }
+ lca = linkChannels->Next(lca);
+ lcb = LinkChannels->Next(lcb);
+ }
+ if (!lca && !lcb) {
+ delete LinkChannels;
+ return; // linkage has not changed
+ }
+ }
+ char buffer[((linkChannels ? linkChannels->Count() : 0) + (LinkChannels ? LinkChannels->Count() : 0)) * 6 + 256]; // 6: 5 digit channel number plus blank, 256: other texts (see below) plus reserve
+ char *q = buffer;
+ q += sprintf(q, "linking channel %d from", Number());
+ if (linkChannels) {
+ for (cLinkChannel *lc = linkChannels->First(); lc; lc = linkChannels->Next(lc)) {
+ lc->Channel()->SetRefChannel(NULL);
+ q += sprintf(q, " %d", lc->Channel()->Number());
+ }
+ delete linkChannels;
+ }
+ else
+ q += sprintf(q, " none");
+ q += sprintf(q, " to");
+ linkChannels = LinkChannels;
+ if (linkChannels) {
+ for (cLinkChannel *lc = linkChannels->First(); lc; lc = linkChannels->Next(lc)) {
+ lc->Channel()->SetRefChannel(this);
+ q += sprintf(q, " %d", lc->Channel()->Number());
+ //dsyslog("link %4d -> %4d: %s", Number(), lc->Channel()->Number(), lc->Channel()->Name());
+ }
+ }
+ else
+ q += sprintf(q, " none");
+ dsyslog(buffer);
+}
+
+void cChannel::SetRefChannel(cChannel *RefChannel)
+{
+ refChannel = RefChannel;
+}
+
static int PrintParameter(char *p, char Name, int Value)
{
return Value >= 0 && Value != 999 ? sprintf(p, "%c%d", Name, Value) : 0;
@@ -771,7 +851,7 @@ cChannel *cChannels::NewChannel(const cChannel *Transponder, const char *Name, i
{
if (Transponder) {
dsyslog("creating new channel '%s' on %s transponder %d with id %d-%d-%d-%d", Name, cSource::ToString(Transponder->Source()), Transponder->Transponder(), Nid, Tid, Sid, Rid);
- cChannel *NewChannel = new cChannel(Transponder);
+ cChannel *NewChannel = new cChannel(*Transponder);
Add(NewChannel);
ReNumber();
NewChannel->SetId(Nid, Tid, Sid, Rid, false);