diff options
author | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2005-05-08 18:00:00 +0200 |
---|---|---|
committer | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2005-05-08 18:00:00 +0200 |
commit | c23522ade253e23b5bf6141d7d7e7335d6abcd1d (patch) | |
tree | 283ea2d0dd325e6614ea031f3fcdcd9534a103ee /channels.c | |
parent | 782b517c51eaa6d2641fe9b6801afdad50be8586 (diff) | |
download | vdr-patch-lnbsharing-c23522ade253e23b5bf6141d7d7e7335d6abcd1d.tar.gz vdr-patch-lnbsharing-c23522ade253e23b5bf6141d7d7e7335d6abcd1d.tar.bz2 |
Version 1.3.24vdr-1.3.24
- Now including the optional user defined Make.config from the 'libsi' Makefile
(thanks to Ville Skyttä).
- Updated the Danish OSD texts (thanks to Mogens Elneff).
- Fixed a memory leak in tComponent (thanks to Stefan Huelswitt and Daniel Thompson).
- Fixed a memory leak in cDvbPlayer (thanks to Stefan Huelswitt).
- Added missing text internationalization for "Starting EPG scan" (thanks to
Matthias Lötzke).
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
- Fixed handling transparent areas in cDvbSpuBitmap (thanks to Marco Schlüßler).
- Now also considering the "EPG linger time" when saving the EPG data to file or
listing it via LSTE (thanks to Roman Krenický).
- Fixed handling fragments of less than 4 byte in cPesAssembler (thanks to
Reinhard Nissl).
- Fixed a bug in libsi's SubtitlingDescriptor::getLength() (thanks to Marco
Schlüßler).
- When reading the channels.conf file, duplicate channels (i.e. ones that have
the same channel ID) are now automatically deleted and only the first one is
actually stored.
- Fixed handling lifetime when deciding whether to delete a recording (thanks to
Udo Richter).
- Fixed timeout handling in cRwLock::Lock() (thanks to Sascha Volkenandt for reporting
this one).
- Since there are several places in thread.c where a timeout value is calculated,
this has been put into a separate function.
- The timer status now has a new bit that is set when that timer is currently
recording (suggested by Matthias Schniedermeyer). See man vdr(5) for details.
- Removed scaling coordinates in letterbox mode from cDvbSpu - the DVD plugin, which
was the only one needing this, doesn't need it any more (thanks to Marco Schlüßler).
- No longer retuning or restarting a recording if only the language code of an
audio or Dolby PID changes.
- Now preferring budget cards when selecting a DVB device for recording.
- Recordings now avoid zero sized video data files (thanks to Wolfgang Fitz).
- Some rearrangements in cDvbPlayer::Action() to avoid lockups on NPTL systems
(thanks to Reinhard Nissl).
- Fixed a wrong inheritance in libsi's SubtitlingDescriptor::Subtitling (thanks to
Marco Schlüßler).
Diffstat (limited to 'channels.c')
-rw-r--r-- | channels.c | 66 |
1 files changed, 47 insertions, 19 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: channels.c 1.36 2005/03/19 15:56:38 kls Exp $ + * $Id: channels.c 1.38 2005/05/07 13:14:32 kls Exp $ */ #include "channels.h" @@ -389,15 +389,21 @@ void cChannel::SetPortalName(const char *PortalName) } } -static bool IntArraysDiffer(const int *a, const int *b, const char na[][4] = NULL, const char nb[][4] = NULL) +#define STRDIFF 0x01 +#define VALDIFF 0x02 + +static int IntArraysDiffer(const int *a, const int *b, const char na[][4] = NULL, const char nb[][4] = NULL) { - int i = 0; - while (a[i] && b[i]) { - if (a[i] != b[i] || na && nb && strcmp(na[i], nb[i]) != 0) - return true; - i++; - } - return a[i] != b[i] || a[i] && na && nb && strcmp(na[i], nb[i]) != 0; + int result = 0; + for (int i = 0; a[i] || b[i]; i++) { + if (a[i] && na && nb && strcmp(na[i], nb[i]) != 0) + result |= STRDIFF; + if (a[i] != b[i]) + result |= VALDIFF; + if (!a[i] || !b[i]) + break; + } + return result; } static int IntArrayToString(char *s, const int *a, int Base = 10, const char n[][4] = NULL) @@ -418,10 +424,15 @@ static int IntArrayToString(char *s, const int *a, int Base = 10, const char n[] void cChannel::SetPids(int Vpid, int Ppid, int *Apids, char ALangs[][4], int *Dpids, char DLangs[][4], int Tpid) { - bool modified = vpid != Vpid || ppid != Ppid || tpid != Tpid; - if (!modified) - modified = IntArraysDiffer(apids, Apids, alangs, ALangs) || IntArraysDiffer(dpids, Dpids, dlangs, DLangs); - if (modified) { + int mod = CHANNELMOD_NONE; + if (vpid != Vpid || ppid != Ppid || tpid != Tpid) + mod |= CHANNELMOD_PIDS; + int m = IntArraysDiffer(apids, Apids, alangs, ALangs) | IntArraysDiffer(dpids, Dpids, dlangs, DLangs); + if (m & STRDIFF) + mod |= CHANNELMOD_LANGS; + if (m & VALDIFF) + mod |= CHANNELMOD_PIDS; + if (mod) { char OldApidsBuf[(MAXAPIDS + MAXDPIDS) * 10 + 10]; // 10: 5 digits plus delimiting ',' or ';' plus optional '=cod', +10: paranoia char NewApidsBuf[(MAXAPIDS + MAXDPIDS) * 10 + 10]; char *q = OldApidsBuf; @@ -450,7 +461,7 @@ void cChannel::SetPids(int Vpid, int Ppid, int *Apids, char ALangs[][4], int *Dp strn0cpy(dlangs[i], DLangs[i], 4); } tpid = Tpid; - modification |= CHANNELMOD_PIDS; + modification |= mod; Channels.SetModified(); } } @@ -648,7 +659,7 @@ cString cChannel::ToText(void) const return ToText(this); } -bool cChannel::Parse(const char *s, bool AllowNonUniqueID) +bool cChannel::Parse(const char *s) { bool ok = true; if (*s == ':') { @@ -791,10 +802,6 @@ bool cChannel::Parse(const char *s, bool AllowNonUniqueID) esyslog("ERROR: channel data results in invalid ID!"); return false; } - if (!AllowNonUniqueID && Channels.GetByChannelID(GetChannelID())) { - esyslog("ERROR: channel data not unique!"); - return false; - } } else return false; @@ -817,9 +824,30 @@ cChannels::cChannels(void) modified = CHANNELSMOD_NONE; } +void cChannels::DeleteDuplicateChannels(void) +{ + for (cChannel *channel = First(); channel; channel = Next(channel)) { + if (!channel->GroupSep()) { + tChannelID ChannelID = channel->GetChannelID(); + cChannel *other = Next(channel); + while (other) { + cChannel *d = NULL; + if (!other->GroupSep() && other->GetChannelID() == ChannelID) + d = other; + other = Next(other); + if (d) { + dsyslog("deleting duplicate channel %s", *d->ToText()); + Del(d); + } + } + } + } +} + bool cChannels::Load(const char *FileName, bool AllowComments, bool MustExist) { if (cConfig<cChannel>::Load(FileName, AllowComments, MustExist)) { + DeleteDuplicateChannels(); ReNumber(); return true; } |