1 | Index: libs/libmythtv/eithelper.h
|
---|
2 | ===================================================================
|
---|
3 | --- libs/libmythtv/eithelper.h (revision 8390)
|
---|
4 | +++ libs/libmythtv/eithelper.h (working copy)
|
---|
5 | @@ -28,6 +28,8 @@
|
---|
6 |
|
---|
7 | public slots:
|
---|
8 | void HandleEITs(QMap_Events* events);
|
---|
9 | + signals:
|
---|
10 | + void StopParsing(bool);
|
---|
11 |
|
---|
12 | private:
|
---|
13 | int GetChanID(int tid_db, const Event &event) const;
|
---|
14 | Index: libs/libmythtv/siparser.cpp
|
---|
15 | ===================================================================
|
---|
16 | --- libs/libmythtv/siparser.cpp (revision 8390)
|
---|
17 | +++ libs/libmythtv/siparser.cpp (working copy)
|
---|
18 | @@ -64,6 +64,8 @@
|
---|
19 | ParserInReset(false), standardChange(false),
|
---|
20 | PrivateTypesLoaded(false)
|
---|
21 | {
|
---|
22 | + events_full = false;
|
---|
23 | +
|
---|
24 | /* Set the PrivateTypes to default values */
|
---|
25 | PrivateTypes.reset();
|
---|
26 |
|
---|
27 | Index: libs/libmythtv/eithelper.cpp
|
---|
28 | ===================================================================
|
---|
29 | --- libs/libmythtv/eithelper.cpp (revision 8390)
|
---|
30 | +++ libs/libmythtv/eithelper.cpp (working copy)
|
---|
31 | @@ -75,35 +75,39 @@
|
---|
32 | if (!eitList.size())
|
---|
33 | return 0;
|
---|
34 |
|
---|
35 | + VERBOSE(VB_EIT,QString("EITHelper::ProcessEvents: Events: %1/%2")
|
---|
36 | + .arg(eitList.size()).arg(eitList.front()->size()));
|
---|
37 | +
|
---|
38 | uint insertCount = 0;
|
---|
39 | - if (eitList.front()->size() <= kChunkSize)
|
---|
40 | +
|
---|
41 | + QList_Events subset;
|
---|
42 | + while (subset.size() < kChunkSize && eitList.size())
|
---|
43 | {
|
---|
44 | QList_Events *events = eitList.front();
|
---|
45 | - eitList.pop_front();
|
---|
46 | + while (subset.size() < kChunkSize && events->size())
|
---|
47 | + {
|
---|
48 | + subset.push_back(events->front());
|
---|
49 | + events->pop_front();
|
---|
50 | + }
|
---|
51 | + if (! events->size())
|
---|
52 | + {
|
---|
53 | + eitList.pop_front();
|
---|
54 | + delete events;
|
---|
55 | + }
|
---|
56 | + }
|
---|
57 |
|
---|
58 | - eitList_lock.unlock();
|
---|
59 | - insertCount += UpdateEITList(mplexid, *events);
|
---|
60 | - QList_Events::iterator it = events->begin();
|
---|
61 | - for (; it != events->end(); ++it)
|
---|
62 | - delete *it;
|
---|
63 | - delete events;
|
---|
64 | - eitList_lock.lock();
|
---|
65 | - }
|
---|
66 | - else
|
---|
67 | + eitList_lock.unlock();
|
---|
68 | + insertCount += UpdateEITList(mplexid, subset);
|
---|
69 | + QList_Events::iterator it = subset.begin();
|
---|
70 | + for (; it != subset.end(); ++it)
|
---|
71 | + delete *it;
|
---|
72 | + eitList_lock.lock();
|
---|
73 | +
|
---|
74 | + if (eitList.size() <= 20 || eitList.size() > 1000)
|
---|
75 | {
|
---|
76 | - QList_Events *events = eitList.front();
|
---|
77 | - QList_Events subset;
|
---|
78 | -
|
---|
79 | - QList_Events::iterator subset_end = events->begin();
|
---|
80 | - for (uint i = 0; i < kChunkSize; ++i) ++subset_end;
|
---|
81 | - subset.insert(subset.end(), events->begin(), subset_end);
|
---|
82 | - events->erase(events->begin(), subset_end);
|
---|
83 | -
|
---|
84 | + int size = eitList.size();
|
---|
85 | eitList_lock.unlock();
|
---|
86 | - insertCount += UpdateEITList(mplexid, subset);
|
---|
87 | - QList_Events::iterator it = subset.begin();
|
---|
88 | - for (; it != subset.end(); ++it)
|
---|
89 | - delete *it;
|
---|
90 | + emit(StopParsing(size > 1000));
|
---|
91 | eitList_lock.lock();
|
---|
92 | }
|
---|
93 |
|
---|
94 | Index: libs/libmythtv/eitscanner.cpp
|
---|
95 | ===================================================================
|
---|
96 | --- libs/libmythtv/eitscanner.cpp (revision 8390)
|
---|
97 | +++ libs/libmythtv/eitscanner.cpp (working copy)
|
---|
98 | @@ -176,6 +176,8 @@
|
---|
99 | eitHelper, SLOT(HandleEITs(QMap_Events*)));
|
---|
100 | connect(channel, SIGNAL(UpdatePMTObject(const PMTObject *)),
|
---|
101 | this, SLOT(SetPMTObject(const PMTObject *)));
|
---|
102 | + connect(eitHelper, SIGNAL(StopParsing(bool)),
|
---|
103 | + parser, SLOT(StopParsing(bool)));
|
---|
104 | }
|
---|
105 |
|
---|
106 | /** \fn EITScanner::StopPassiveScan(void)
|
---|
107 | Index: libs/libmythtv/siparser.h
|
---|
108 | ===================================================================
|
---|
109 | --- libs/libmythtv/siparser.h (revision 8390)
|
---|
110 | +++ libs/libmythtv/siparser.h (working copy)
|
---|
111 | @@ -111,6 +111,8 @@
|
---|
112 |
|
---|
113 | public slots:
|
---|
114 | virtual void deleteLater(void);
|
---|
115 | + void StopParsing(bool stop)
|
---|
116 | + { pmap_lock.lock(); events_full = stop; pmap_lock.unlock(); }
|
---|
117 |
|
---|
118 | signals:
|
---|
119 | void FindTransportsComplete(void);
|
---|
120 | @@ -279,6 +281,8 @@
|
---|
121 | // statistics
|
---|
122 | QMap<uint,uint> descCount;
|
---|
123 | mutable QMutex descLock;
|
---|
124 | +
|
---|
125 | + bool events_full;
|
---|
126 | };
|
---|
127 |
|
---|
128 | #endif // SIPARSER_H
|
---|