1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Optimized cNitFilter::Process()

This commit is contained in:
Klaus Schmidinger 2007-08-17 14:06:09 +02:00
parent 9fa6d9f9dd
commit cb03e38a07
3 changed files with 53 additions and 48 deletions

View File

@ -2141,6 +2141,7 @@ Tobias Bratfisch <tobias@reel-multimedia.com>
for suggesting to make skipspace() an inline function for suggesting to make skipspace() an inline function
for making some optimizations in cDvbDevice::SetChannelDevice() for making some optimizations in cDvbDevice::SetChannelDevice()
for optimizing cMenuEditChrItem::Set() for optimizing cMenuEditChrItem::Set()
for optimizing cNitFilter::Process()
Bruno Roussel <bruno.roussel@free.fr> Bruno Roussel <bruno.roussel@free.fr>
for translating OSD texts to the French language for translating OSD texts to the French language

View File

@ -5367,3 +5367,4 @@ Video Disk Recorder Revision History
Matthias Schwarzott). Matthias Schwarzott).
- Some optimizations in cDvbDevice::SetChannelDevice() (thanks to Tobias Bratfisch). - Some optimizations in cDvbDevice::SetChannelDevice() (thanks to Tobias Bratfisch).
- Optimized cMenuEditChrItem::Set() (thanks to Tobias Bratfisch). - Optimized cMenuEditChrItem::Set() (thanks to Tobias Bratfisch).
- Optimized cNitFilter::Process() (thanks to Tobias Bratfisch).

35
nit.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: nit.c 1.14 2007/04/29 11:35:33 kls Exp $ * $Id: nit.c 1.15 2007/08/17 14:02:45 kls Exp $
*/ */
#include "nit.h" #include "nit.h"
@ -140,13 +140,14 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
} }
break; break;
} }
if (Setup.UpdateChannels >= 5) {
bool found = false; bool found = false;
for (cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) { for (cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) {
if (!Channel->GroupSep() && Channel->Source() == Source && Channel->Nid() == ts.getOriginalNetworkId() && Channel->Tid() == ts.getTransportStreamId()) { if (!Channel->GroupSep() && Channel->Source() == Source && Channel->Nid() == ts.getOriginalNetworkId() && Channel->Tid() == ts.getTransportStreamId()) {
if (Setup.UpdateChannels >= 5) { int transponder = Channel->Transponder();
if (!ISTRANSPONDER(cChannel::Transponder(Frequency, Polarization), Channel->Transponder())) { if (!ISTRANSPONDER(cChannel::Transponder(Frequency, Polarization), transponder)) {
for (int n = 0; n < NumFrequencies; n++) { for (int n = 0; n < NumFrequencies; n++) {
if (ISTRANSPONDER(cChannel::Transponder(Frequencies[n], Polarization), Channel->Transponder())) { if (ISTRANSPONDER(cChannel::Transponder(Frequencies[n], Polarization), transponder)) {
Frequency = Frequencies[n]; Frequency = Frequencies[n];
break; break;
} }
@ -157,8 +158,7 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
} }
found = true; found = true;
} }
} if (!found) {
if (!found && Setup.UpdateChannels >= 5) {
for (int n = 0; n < NumFrequencies; n++) { for (int n = 0; n < NumFrequencies; n++) {
cChannel *Channel = new cChannel; cChannel *Channel = new cChannel;
Channel->SetId(ts.getOriginalNetworkId(), ts.getTransportStreamId(), 0, 0); Channel->SetId(ts.getOriginalNetworkId(), ts.getTransportStreamId(), 0, 0);
@ -169,6 +169,7 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
} }
} }
} }
}
break; break;
case SI::CableDeliverySystemDescriptorTag: { case SI::CableDeliverySystemDescriptorTag: {
SI::CableDeliverySystemDescriptor *sd = (SI::CableDeliverySystemDescriptor *)d; SI::CableDeliverySystemDescriptor *sd = (SI::CableDeliverySystemDescriptor *)d;
@ -190,13 +191,14 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
} }
break; break;
} }
if (Setup.UpdateChannels >= 5) {
bool found = false; bool found = false;
for (cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) { for (cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) {
if (!Channel->GroupSep() && Channel->Source() == Source && Channel->Nid() == ts.getOriginalNetworkId() && Channel->Tid() == ts.getTransportStreamId()) { if (!Channel->GroupSep() && Channel->Source() == Source && Channel->Nid() == ts.getOriginalNetworkId() && Channel->Tid() == ts.getTransportStreamId()) {
if (Setup.UpdateChannels >= 5) { int transponder = Channel->Transponder();
if (!ISTRANSPONDER(Frequency / 1000, Channel->Transponder())) { if (!ISTRANSPONDER(Frequency / 1000, transponder)) {
for (int n = 0; n < NumFrequencies; n++) { for (int n = 0; n < NumFrequencies; n++) {
if (ISTRANSPONDER(Frequencies[n] / 1000, Channel->Transponder())) { if (ISTRANSPONDER(Frequencies[n] / 1000, transponder)) {
Frequency = Frequencies[n]; Frequency = Frequencies[n];
break; break;
} }
@ -207,8 +209,7 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
} }
found = true; found = true;
} }
} if (!found) {
if (!found && Setup.UpdateChannels >= 5) {
for (int n = 0; n < NumFrequencies; n++) { for (int n = 0; n < NumFrequencies; n++) {
cChannel *Channel = new cChannel; cChannel *Channel = new cChannel;
Channel->SetId(ts.getOriginalNetworkId(), ts.getTransportStreamId(), 0, 0); Channel->SetId(ts.getOriginalNetworkId(), ts.getTransportStreamId(), 0, 0);
@ -219,6 +220,7 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
} }
} }
} }
}
break; break;
case SI::TerrestrialDeliverySystemDescriptorTag: { case SI::TerrestrialDeliverySystemDescriptorTag: {
SI::TerrestrialDeliverySystemDescriptor *sd = (SI::TerrestrialDeliverySystemDescriptor *)d; SI::TerrestrialDeliverySystemDescriptor *sd = (SI::TerrestrialDeliverySystemDescriptor *)d;
@ -247,13 +249,14 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
} }
break; break;
} }
if (Setup.UpdateChannels >= 5) {
bool found = false; bool found = false;
for (cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) { for (cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) {
if (!Channel->GroupSep() && Channel->Source() == Source && Channel->Nid() == ts.getOriginalNetworkId() && Channel->Tid() == ts.getTransportStreamId()) { if (!Channel->GroupSep() && Channel->Source() == Source && Channel->Nid() == ts.getOriginalNetworkId() && Channel->Tid() == ts.getTransportStreamId()) {
if (Setup.UpdateChannels >= 5) { int transponder = Channel->Transponder();
if (!ISTRANSPONDER(Frequency / 1000000, Channel->Transponder())) { if (!ISTRANSPONDER(Frequency / 1000000, transponder)) {
for (int n = 0; n < NumFrequencies; n++) { for (int n = 0; n < NumFrequencies; n++) {
if (ISTRANSPONDER(Frequencies[n] / 1000000, Channel->Transponder())) { if (ISTRANSPONDER(Frequencies[n] / 1000000, transponder)) {
Frequency = Frequencies[n]; Frequency = Frequencies[n];
break; break;
} }
@ -264,8 +267,7 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
} }
found = true; found = true;
} }
} if (!found) {
if (!found && Setup.UpdateChannels >= 5) {
for (int n = 0; n < NumFrequencies; n++) { for (int n = 0; n < NumFrequencies; n++) {
cChannel *Channel = new cChannel; cChannel *Channel = new cChannel;
Channel->SetId(ts.getOriginalNetworkId(), ts.getTransportStreamId(), 0, 0); Channel->SetId(ts.getOriginalNetworkId(), ts.getTransportStreamId(), 0, 0);
@ -276,6 +278,7 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
} }
} }
} }
}
break; break;
default: ; default: ;
} }