Ticket #892: dvbdiff.3

File dvbdiff.3, 4.2 KB (added by nooneimprt4nt@…, 18 years ago)

Third time for sure. Dunno why building the patch was so hard.

Line 
1Index: 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;
14Index: 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@@ -515,6 +517,12 @@
28     (void) pid;
29 #endif
30 
31+    if (events_full)
32+    {
33+        pmap_lock.unlock();
34+        return;
35+    }
36+
37     if (!(buffer[1] & 0x80))
38     {
39         VERBOSE(VB_SIPARSER, LOC +
40Index: libs/libmythtv/eithelper.cpp
41===================================================================
42--- libs/libmythtv/eithelper.cpp        (revision 8390)
43+++ libs/libmythtv/eithelper.cpp        (working copy)
44@@ -75,35 +75,39 @@
45     if (!eitList.size())
46         return 0;
47 
48+    VERBOSE(VB_EIT,QString("EITHelper::ProcessEvents: Events: %1/%2")
49+            .arg(eitList.size()).arg(eitList.front()->size()));
50+
51     uint insertCount = 0;
52-    if (eitList.front()->size() <= kChunkSize)
53+
54+    QList_Events  subset;
55+    while (subset.size() < kChunkSize && eitList.size())
56     {
57         QList_Events *events = eitList.front();
58-        eitList.pop_front();
59+        while (subset.size() < kChunkSize && events->size())
60+        {
61+            subset.push_back(events->front());
62+            events->pop_front();
63+        }
64+        if (! events->size())
65+        {
66+            eitList.pop_front();
67+            delete events;
68+        }
69+    }
70 
71-        eitList_lock.unlock();
72-        insertCount += UpdateEITList(mplexid, *events);
73-        QList_Events::iterator it = events->begin();
74-        for (; it != events->end(); ++it)
75-            delete *it;
76-        delete events;
77-        eitList_lock.lock();
78-    }
79-    else
80+    eitList_lock.unlock();
81+    insertCount += UpdateEITList(mplexid, subset);
82+    QList_Events::iterator it = subset.begin();
83+    for (; it != subset.end(); ++it)
84+        delete *it;
85+    eitList_lock.lock();
86+
87+    if (eitList.size() <= 20 || eitList.size() > 1000)
88     {
89-        QList_Events *events = eitList.front();
90-        QList_Events  subset;
91-
92-        QList_Events::iterator subset_end = events->begin();
93-        for (uint i = 0; i < kChunkSize; ++i) ++subset_end;
94-        subset.insert(subset.end(), events->begin(), subset_end);
95-        events->erase(events->begin(), subset_end);
96-       
97+        int size = eitList.size();
98         eitList_lock.unlock();
99-        insertCount += UpdateEITList(mplexid, subset);
100-        QList_Events::iterator it = subset.begin();
101-        for (; it != subset.end(); ++it)
102-            delete *it;
103+        emit(StopParsing(size > 1000));
104         eitList_lock.lock();
105     }
106 
107Index: libs/libmythtv/eitscanner.cpp
108===================================================================
109--- libs/libmythtv/eitscanner.cpp       (revision 8390)
110+++ libs/libmythtv/eitscanner.cpp       (working copy)
111@@ -176,6 +176,8 @@
112             eitHelper, SLOT(HandleEITs(QMap_Events*)));
113     connect(channel,   SIGNAL(UpdatePMTObject(const PMTObject *)),
114             this,      SLOT(SetPMTObject(const PMTObject *)));
115+    connect(eitHelper, SIGNAL(StopParsing(bool)),
116+            parser,    SLOT(StopParsing(bool)));
117 }
118 
119 /** \fn EITScanner::StopPassiveScan(void)
120Index: libs/libmythtv/siparser.h
121===================================================================
122--- libs/libmythtv/siparser.h   (revision 8390)
123+++ libs/libmythtv/siparser.h   (working copy)
124@@ -111,6 +111,8 @@
125 
126   public slots:
127     virtual void deleteLater(void);
128+    void StopParsing(bool stop)
129+         { pmap_lock.lock(); events_full = stop; pmap_lock.unlock(); }
130 
131   signals:
132     void FindTransportsComplete(void);
133@@ -279,6 +281,8 @@
134     // statistics
135     QMap<uint,uint>     descCount;
136     mutable QMutex      descLock;
137+
138+    bool events_full;
139 };
140 
141 #endif // SIPARSER_H