From a9f1297022319c97e16f6d904254a6d0bae4442e Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 9 Mar 2014 12:11:32 +0100 Subject: [PATCH] Fixed adding new source types in case they are already registered --- CONTRIBUTORS | 2 ++ HISTORY | 4 +++- sourceparams.c | 6 +++--- sources.c | 11 ++++++++++- sources.h | 3 ++- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index e4231eec..36ce5331 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1183,6 +1183,8 @@ Rolf Ahrenberg existing edited version of a recording for adding code for parsing LCN and AVC descriptors to libsi for fixing clearing non-editable members in the channel editor + for reporting a problem with adding new source types in case they are already + registered Ralf Klueber for reporting a bug in cutting a recording if there is only a single editing mark diff --git a/HISTORY b/HISTORY index 56cfa23e..79986831 100644 --- a/HISTORY +++ b/HISTORY @@ -8203,7 +8203,7 @@ Video Disk Recorder Revision History - Fixed detecting broken video data streams when recording. - Fixed handling frame detection buffer length (reported by Eike Sauer). -2014-03-08: Version 2.1.6 +2014-03-09: Version 2.1.6 - Revoked "Fixed some compiler warnings with Clang 3.4.1" from ci.c, because this did not compile with older versions of gcc (thanks to Sören Moch). @@ -8215,3 +8215,5 @@ Video Disk Recorder Revision History on some HD channels to get stuck and resulted in buffer overflows. - Fixed handling PAT packets when detecting frames, so that they can be properly taken into account when regenerating the index of a recording. +- Fixed adding new source types in case they are already registered (reported by Rolf + Ahrenberg). diff --git a/sourceparams.c b/sourceparams.c index 04317895..3eec406a 100644 --- a/sourceparams.c +++ b/sourceparams.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: sourceparams.c 1.2 2010/03/06 11:13:39 kls Exp $ + * $Id: sourceparams.c 3.1 2014/03/09 12:03:09 kls Exp $ */ #include "sourceparams.h" @@ -21,8 +21,8 @@ cSourceParam::cSourceParam(char Source, const char *Description) return; } SourceParams.Add(this); - if (!strchr("ACST", Source)) // no, it's not "ATSC" ;-) - Sources.Add(new cSource(Source, Description)); + if (!Sources.ContainsSourceType(source)) + Sources.Add(new cSource(source, Description)); dsyslog("registered source parameters for '%c - %s'", source, Description); } else diff --git a/sources.c b/sources.c index c2a3dba1..f0a34327 100644 --- a/sources.c +++ b/sources.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: sources.c 3.5 2013/12/28 11:33:08 kls Exp $ + * $Id: sources.c 3.6 2014/03/09 12:05:42 kls Exp $ */ #include "sources.h" @@ -124,3 +124,12 @@ cSource *cSources::Get(int Code) } return NULL; } + +bool cSources::ContainsSourceType(char SourceType) +{ + for (cSource *p = First(); p; p = Next(p)) { + if (cSource::ToChar(p->Code()) == SourceType) + return true; + } + return false; +} diff --git a/sources.h b/sources.h index 8c2fdfb8..1cd05b83 100644 --- a/sources.h +++ b/sources.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: sources.h 3.2 2013/08/21 10:27:32 kls Exp $ + * $Id: sources.h 3.3 2014/03/09 11:59:49 kls Exp $ */ #ifndef __SOURCES_H @@ -62,6 +62,7 @@ public: class cSources : public cConfig { public: cSource *Get(int Code); + bool ContainsSourceType(char SourceType); }; extern cSources Sources;