1 Index: libs/libmythtv/eithelper.h
2 ===================================================================
3 --- libs/libmythtv/eithelper.h.orig 2006-06-20 17:31:09.000000000 -0400
4 +++ libs/libmythtv/eithelper.h 2006-06-20 17:36:06.000000000 -0400
9 - EITHelper() : QObject(NULL, "EITHelper") { ; }
10 + EITHelper() : QObject(NULL, "EITHelper")
12 + events_full = false;
16 uint GetListSize(void) const;
20 void HandleEITs(QMap_Events* events);
22 + void StopParsing(bool);
25 int GetChanID(int tid_db, const Event &event) const;
28 /// Maximum number of DB inserts per ProcessEvents call.
29 static const uint kChunkSize;
31 + // Max event list size before we stop parsing incoming events
32 + // allowing us to try and catchup.
33 + static const uint kMAXChunkSize;
39 Index: libs/libmythtv/siparser.cpp
40 ===================================================================
41 --- libs/libmythtv/siparser.cpp.orig 2006-06-20 17:36:06.000000000 -0400
42 +++ libs/libmythtv/siparser.cpp 2006-06-20 17:37:04.000000000 -0400
44 ParserInReset(false), standardChange(false),
45 PrivateTypesLoaded(false)
47 + events_full = false;
49 /* Set the PrivateTypes to default values */
62 if (!(buffer[1] & 0x80))
64 VERBOSE(VB_SIPARSER, LOC +
65 Index: libs/libmythtv/eithelper.cpp
66 ===================================================================
67 --- libs/libmythtv/eithelper.cpp.orig 2006-06-20 17:31:09.000000000 -0400
68 +++ libs/libmythtv/eithelper.cpp 2006-06-20 17:36:06.000000000 -0400
70 #include "eithelper.h"
71 #include "mythdbcon.h"
73 -const uint EITHelper::kChunkSize = 20;
75 +// TODO: Should these be configurable values based on how much ram a
76 +// backend has available?
77 +const uint EITHelper::kChunkSize = 50;
78 +const uint EITHelper::kMAXChunkSize = 1000;
80 static int get_chan_id_from_db(int tid_db, const Event&);
81 static uint update_eit_in_db(MSqlQuery&, MSqlQuery&, int, const Event&);
86 + //VERBOSE(VB_EIT,QString("EITHelper::ProcessEvents: Events: %1/%2")
87 + // .arg(eitList.size()).arg(eitList.front()->size()));
90 - if (eitList.front()->size() <= kChunkSize)
92 + QList_Events subset;
93 + while (subset.size() < kChunkSize && eitList.size())
95 QList_Events *events = eitList.front();
96 - eitList.pop_front();
98 - eitList_lock.unlock();
99 - insertCount += UpdateEITList(mplexid, *events);
100 - QList_Events::iterator it = events->begin();
101 - for (; it != events->end(); ++it)
104 - eitList_lock.lock();
105 + while (subset.size() < kChunkSize && events->size())
107 + subset.push_back(events->front());
108 + events->pop_front();
110 + if (! events->size())
112 + eitList.pop_front();
118 + eitList_lock.unlock();
119 + insertCount += UpdateEITList(mplexid, subset);
120 + QList_Events::iterator it = subset.begin();
121 + for (; it != subset.end(); ++it)
123 + eitList_lock.lock();
125 + if (((eitList.size() <= kChunkSize) && events_full)
126 + || ((eitList.size() > kMAXChunkSize) && !events_full))
128 - QList_Events *events = eitList.front();
129 - QList_Events subset;
130 + int size = eitList.size();
131 + VERBOSE(VB_GENERAL, QString ("EITHelper: ToggleParsing EIT (%1)")
134 + events_full = (size > kMAXChunkSize);
136 - QList_Events::iterator subset_end = events->begin();
137 - for (uint i = 0; i < kChunkSize; ++i) ++subset_end;
138 - subset.insert(subset.end(), events->begin(), subset_end);
139 - events->erase(events->begin(), subset_end);
141 eitList_lock.unlock();
142 - insertCount += UpdateEITList(mplexid, subset);
143 - QList_Events::iterator it = subset.begin();
144 - for (; it != subset.end(); ++it)
146 + emit(StopParsing(events_full));
150 Index: libs/libmythtv/eitscanner.cpp
151 ===================================================================
152 --- libs/libmythtv/eitscanner.cpp.orig 2006-06-20 17:31:09.000000000 -0400
153 +++ libs/libmythtv/eitscanner.cpp 2006-06-20 17:36:06.000000000 -0400
155 eitHelper, SLOT(HandleEITs(QMap_Events*)));
156 connect(channel, SIGNAL(UpdatePMTObject(const PMTObject *)),
157 this, SLOT(SetPMTObject(const PMTObject *)));
158 + connect(eitHelper, SIGNAL(StopParsing(bool)),
159 + parser, SLOT(StopParsing(bool)));
162 /** \fn EITScanner::StopPassiveScan(void)
163 Index: libs/libmythtv/siparser.h
164 ===================================================================
165 --- libs/libmythtv/siparser.h.orig 2006-06-20 17:36:06.000000000 -0400
166 +++ libs/libmythtv/siparser.h 2006-06-20 17:37:04.000000000 -0400
170 virtual void deleteLater(void);
171 + void StopParsing(bool stop)
172 + { pmap_lock.lock(); events_full = stop; pmap_lock.unlock(); }
175 void FindTransportsComplete(void);
177 QDateTime ServiceSearchEndTime;
178 QDateTime EventSearchEndTime;
185 uint CurrentTransport;