summaryrefslogtreecommitdiff
path: root/libsi/si.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2004-03-14 18:00:00 +0100
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2004-03-14 18:00:00 +0100
commit9384e56566f56e77d577319a42929e708936e7c7 (patch)
tree594b86bcda612612b342c667966c678394a322fc /libsi/si.c
parent5a4eb3f1041b8a53826cebe570f9d201f3d35826 (diff)
downloadvdr-patch-lnbsharing-9384e56566f56e77d577319a42929e708936e7c7.tar.gz
vdr-patch-lnbsharing-9384e56566f56e77d577319a42929e708936e7c7.tar.bz2
Version 1.3.6vdr-1.3.6
- Completed the Finnish OSD texts (thanks to Rolf Ahrenberg). - Fixed some descriptor handling in 'libsi' (thanks to Stéphane Esté-Gracias). - Fixed handling the current menu item (thanks to Marc Hoppe). - Fixed assigning events to timers (they no longer get "stuck"). - Added log entries whenever the running status of an event changes (currently only logging the first 30 channels). - Fixed handling timers in VPS margin if the EPG scan is turned on (the EPG scan switched the device away from the channel, so it wouldn't see the change of the running status). - Fixed handling "itemized" texts in EPG data (thanks to Stéphane Esté-Gracias for pointing out this problem, and Marcel Wiesweg for improving 'libsi'). - Fixed handling VPS times at year boundaries. - Avoiding too many consecutive "ring buffer overflow" messages (which only slowed down performance even more). - Taking the Sid into account when detecting version changes in processing the PMT (thanks to Stéphane Esté-Gracias for pointing out this problem). - Completed the Russian OSD texts (thanks to Vyacheslav Dikonov). - Any newline characters in the 'description' of EPG events are now preserved to allow texts to be displayed the way the tv stations have formatted them. This was also necessary to better display itemized texts. - Fixed detecting the running status in case an empty EPG event is broadcast (thanks to Michael Pennewiß for pointing this out). - Improved performance when paging through very long menu lists. - Removed cSchedule::GetEventNumber() and cSchedule::NumEvents(). There is now cSchedule::Events() that returns the list of events directly. - Avoiding occasional bad responsiveness to user interaction caused by assigning events to timers. - Now explicitly turning on the LNB power at startup, because newer drivers don't do this any more (thanks to Oliver Endriss for pointing this out).
Diffstat (limited to 'libsi/si.c')
-rw-r--r--libsi/si.c83
1 files changed, 68 insertions, 15 deletions
diff --git a/libsi/si.c b/libsi/si.c
index ee64802..9ce46f0 100644
--- a/libsi/si.c
+++ b/libsi/si.c
@@ -6,7 +6,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * $Id: si.c 1.8 2004/02/22 10:14:12 kls Exp $
+ * $Id: si.c 1.9 2004/03/07 10:50:09 kls Exp $
* *
***************************************************************************/
@@ -103,7 +103,7 @@ DescriptorTag Descriptor::getDescriptorTag(const unsigned char *d) {
Descriptor *DescriptorLoop::getNext(Iterator &it) {
if (it.i<getLength()) {
- return createDescriptor(it.i);
+ return createDescriptor(it.i, true);
}
return 0;
}
@@ -115,19 +115,18 @@ Descriptor *DescriptorLoop::getNext(Iterator &it, DescriptorTag tag, bool return
const unsigned char *end=p+getLength();
while (p < end) {
if (Descriptor::getDescriptorTag(p) == tag) {
- d=createDescriptor(it.i);
- break;
+ d=createDescriptor(it.i, returnUnimplemetedDescriptor);
+ if (d)
+ break;
}
it.i+=Descriptor::getLength(p);
p+=Descriptor::getLength(p);
}
}
- if (d && d->getDescriptorTag()==UnimplementedDescriptorTag)
- return returnUnimplemetedDescriptor ? d : 0;
return d;
}
-Descriptor *DescriptorLoop::getNext(Iterator &it, DescriptorTag *tags, int arrayLength, bool returnUnimplemetedDescriptor) {
+Descriptor *DescriptorLoop::getNext(Iterator &it, DescriptorTag *tags, int arrayLength, bool returnUnimplementedDescriptor) {
Descriptor *d=0;
if (it.i<getLength()) {
const unsigned char *p=data.getData(it.i);
@@ -135,27 +134,38 @@ Descriptor *DescriptorLoop::getNext(Iterator &it, DescriptorTag *tags, int array
while (p < end) {
for (int u=0; u<arrayLength;u++)
if (Descriptor::getDescriptorTag(p) == tags[u]) {
- d=createDescriptor(it.i);
+ d=createDescriptor(it.i, returnUnimplementedDescriptor);
break;
}
if (d)
- break;
+ break; //length is added to it.i by createDescriptor, break here
it.i+=Descriptor::getLength(p);
p+=Descriptor::getLength(p);
}
}
- if (d && d->getDescriptorTag()==UnimplementedDescriptorTag)
- return returnUnimplemetedDescriptor ? d : 0;
return d;
}
-Descriptor *DescriptorLoop::createDescriptor(int &i) {
- Descriptor *d=Descriptor::getDescriptor(data+i, domain);
+Descriptor *DescriptorLoop::createDescriptor(int &i, bool returnUnimplemetedDescriptor) {
+ Descriptor *d=Descriptor::getDescriptor(data+i, domain, returnUnimplemetedDescriptor);
+ if (!d)
+ return 0;
i+=d->getLength();
d->CheckParse();
return d;
}
+int DescriptorLoop::getNumberOfDescriptors() {
+ const unsigned char *p=data.getData();
+ const unsigned char *end=p+getLength();
+ int count=0;
+ while (p < end) {
+ count++;
+ p+=Descriptor::getLength(p);
+ }
+ return count;
+}
+
DescriptorGroup::DescriptorGroup(bool del) {
array=0;
length=0;
@@ -211,6 +221,16 @@ char *String::getText(char *buffer) {
return buffer;
}
+//taken from VDR, Copyright Klaus Schmidinger <kls@cadsoft.de>
+char *String::getText(char *buffer, char *shortVersion) {
+ if (getLength() < 0 || getLength() >4095) {
+ strncpy(buffer, "text error", getLength()+1);
+ return buffer;
+ }
+ decodeText(buffer, shortVersion);
+ return buffer;
+}
+
//taken from libdtv, Copyright Rolf Hakenes <hakenes@hippomi.de>
void String::decodeText(char *buffer) {
const unsigned char *from=data.getData(0);
@@ -228,18 +248,47 @@ void String::decodeText(char *buffer) {
if ( ((' ' <= *from) && (*from <= '~'))
|| (*from == '\n')
|| (0xA0 <= *from)
+ || (*from == 0x86 || *from == 0x87)
)
*to++ = *from;
else if (*from == 0x8A)
*to++ = '\n';
- else if (*from == 0x86 || *from == 0x87) //&& !(GDT_NAME_DESCRIPTOR & type))
+ from++;
+ }
+ *to = '\0';
+}
+
+void String::decodeText(char *buffer, char *shortVersion) {
+ const unsigned char *from=data.getData(0);
+ char *to=buffer;
+ char *toShort=shortVersion;
+ int IsShortName=0;
+
+ for (int i = 0; i < getLength(); i++) {
+ if (*from == 0)
+ break;
+ if ( ((' ' <= *from) && (*from <= '~'))
+ || (*from == '\n')
+ || (0xA0 <= *from)
+ )
+ {
*to++ = *from;
+ if (IsShortName)
+ *toShort++ = *from;
+ }
+ else if (*from == 0x8A)
+ *to++ = '\n';
+ else if (*from == 0x86)
+ IsShortName++;
+ else if (*from == 0x87)
+ IsShortName--;
from++;
}
*to = '\0';
+ *toShort = '\0';
}
-Descriptor *Descriptor::getDescriptor(CharArray da, DescriptorTagDomain domain) {
+Descriptor *Descriptor::getDescriptor(CharArray da, DescriptorTagDomain domain, bool returnUnimplemetedDescriptor) {
Descriptor *d=0;
switch (domain) {
case SI:
@@ -383,6 +432,8 @@ Descriptor *Descriptor::getDescriptor(CharArray da, DescriptorTagDomain domain)
case AdaptationFieldDataDescriptorTag:
case TransportStreamDescriptorTag:
default:
+ if (!returnUnimplemetedDescriptor)
+ return 0;
d=new UnimplementedDescriptor();
break;
}
@@ -417,6 +468,8 @@ Descriptor *Descriptor::getDescriptor(CharArray da, DescriptorTagDomain domain)
case MHP_DelegatedApplicationDescriptorTag:
case MHP_ApplicationStorageDescriptorTag:
default:
+ if (!returnUnimplemetedDescriptor)
+ return 0;
d=new UnimplementedDescriptor();
break;
}