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/eithelper.cpp |
---|
15 | =================================================================== |
---|
16 | --- libs/libmythtv/eithelper.cpp (revision 8390) |
---|
17 | +++ libs/libmythtv/eithelper.cpp (working copy) |
---|
18 | @@ -75,35 +75,39 @@ |
---|
19 | if (!eitList.size()) |
---|
20 | return 0; |
---|
21 | |
---|
22 | + VERBOSE(VB_EIT,QString("EITHelper::ProcessEvents: Events: %1/%2") |
---|
23 | + .arg(eitList.size()).arg(eitList.front()->size())); |
---|
24 | + |
---|
25 | uint insertCount = 0; |
---|
26 | - if (eitList.front()->size() <= kChunkSize) |
---|
27 | + |
---|
28 | + QList_Events subset; |
---|
29 | + while (subset.size() < kChunkSize && eitList.size()) |
---|
30 | { |
---|
31 | QList_Events *events = eitList.front(); |
---|
32 | - eitList.pop_front(); |
---|
33 | + while (subset.size() < kChunkSize && events->size()) |
---|
34 | + { |
---|
35 | + subset.push_back(events->front()); |
---|
36 | + events->pop_front(); |
---|
37 | + } |
---|
38 | + if (! events->size()) |
---|
39 | + { |
---|
40 | + eitList.pop_front(); |
---|
41 | + delete events; |
---|
42 | + } |
---|
43 | + } |
---|
44 | |
---|
45 | - eitList_lock.unlock(); |
---|
46 | - insertCount += UpdateEITList(mplexid, *events); |
---|
47 | - QList_Events::iterator it = events->begin(); |
---|
48 | - for (; it != events->end(); ++it) |
---|
49 | - delete *it; |
---|
50 | - delete events; |
---|
51 | - eitList_lock.lock(); |
---|
52 | - } |
---|
53 | - else |
---|
54 | + eitList_lock.unlock(); |
---|
55 | + insertCount += UpdateEITList(mplexid, subset); |
---|
56 | + QList_Events::iterator it = subset.begin(); |
---|
57 | + for (; it != subset.end(); ++it) |
---|
58 | + delete *it; |
---|
59 | + eitList_lock.lock(); |
---|
60 | + |
---|
61 | + if (eitList.size() <= 20 || eitList.size() > 1000) |
---|
62 | { |
---|
63 | - QList_Events *events = eitList.front(); |
---|
64 | - QList_Events subset; |
---|
65 | - |
---|
66 | - QList_Events::iterator subset_end = events->begin(); |
---|
67 | - for (uint i = 0; i < kChunkSize; ++i) ++subset_end; |
---|
68 | - subset.insert(subset.end(), events->begin(), subset_end); |
---|
69 | - events->erase(events->begin(), subset_end); |
---|
70 | - |
---|
71 | + int size = eitList.size(); |
---|
72 | eitList_lock.unlock(); |
---|
73 | - insertCount += UpdateEITList(mplexid, subset); |
---|
74 | - QList_Events::iterator it = subset.begin(); |
---|
75 | - for (; it != subset.end(); ++it) |
---|
76 | - delete *it; |
---|
77 | + emit(StopParsing(size > 1000)); |
---|
78 | eitList_lock.lock(); |
---|
79 | } |
---|
80 | |
---|
81 | Index: libs/libmythtv/eitscanner.cpp |
---|
82 | =================================================================== |
---|
83 | --- libs/libmythtv/eitscanner.cpp (revision 8390) |
---|
84 | +++ libs/libmythtv/eitscanner.cpp (working copy) |
---|
85 | @@ -176,6 +176,8 @@ |
---|
86 | eitHelper, SLOT(HandleEITs(QMap_Events*))); |
---|
87 | connect(channel, SIGNAL(UpdatePMTObject(const PMTObject *)), |
---|
88 | this, SLOT(SetPMTObject(const PMTObject *))); |
---|
89 | + connect(eitHelper, SIGNAL(StopParsing(bool)), |
---|
90 | + parser, SLOT(StopParsing(bool))); |
---|
91 | } |
---|
92 | |
---|
93 | /** \fn EITScanner::StopPassiveScan(void) |
---|