diff options
Diffstat (limited to 'epg.c')
-rw-r--r-- | epg.c | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -7,7 +7,7 @@ * Original version (as used in VDR before 1.3.0) written by * Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>. * - * $Id: epg.c 1.58 2006/02/03 13:16:54 kls Exp $ + * $Id: epg.c 1.61 2006/02/19 12:50:26 kls Exp $ */ #include "epg.h" @@ -23,14 +23,14 @@ cString tComponent::ToString(void) { char buffer[256]; - snprintf(buffer, sizeof(buffer), "%X %02X %-3s %s", stream, type, language, description ? description : ""); + snprintf(buffer, sizeof(buffer), "%X %02X %s %s", stream, type, language, description ? description : ""); return buffer; } bool tComponent::FromString(const char *s) { unsigned int Stream, Type; - int n = sscanf(s, "%X %02X %3c %a[^\n]", &Stream, &Type, language, &description); + int n = sscanf(s, "%X %02X %7s %a[^\n]", &Stream, &Type, language, &description); // 7 = MAXLANGCODE2 - 1 if (n != 4 || isempty(description)) { free(description); description = NULL; @@ -78,9 +78,23 @@ void cComponents::SetComponent(int Index, uchar Stream, uchar Type, const char * p->stream = Stream; p->type = Type; strn0cpy(p->language, Language, sizeof(p->language)); + char *q = strchr(p->language, ','); + if (q) + *q = 0; // strips rest of "normalized" language codes p->description = strcpyrealloc(p->description, !isempty(Description) ? Description : NULL); } +tComponent *cComponents::GetComponent(int Index, uchar Stream, uchar Type) +{ + for (int i = 0; i < numComponents; i++) { + if (components[i].stream == Stream && components[i].type == Type) { + if (!Index--) + return &components[i]; + } + } + return NULL; +} + // --- cEvent ---------------------------------------------------------------- cEvent::cEvent(u_int16_t EventID) |