All pastes #1747787 Raw Edit

Untitled

public text v1 · immutable
#1747787 ·published 2010-01-12 02:56 UTC
rendered paste body
Index: programs/mythtranscode/mpeg2fix.cpp
===================================================================
--- programs/mythtranscode/mpeg2fix.cpp	(revision 23105)
+++ programs/mythtranscode/mpeg2fix.cpp	(working copy)
@@ -75,7 +75,7 @@
     }
 }
 
-void DEBUGpts(Q3PtrList<MPEG2frame> *vFrame)
+void DEBUGpts(FrameList *vFrame)
 {
     int pos = vFrame->at();
     for (vFrame->first(); vFrame->current(); vFrame->next())
@@ -111,7 +111,7 @@
     poq_idx_t idx;
     vid_id = vidid;
     keyList = keys;
-    keyList.append(vid_id);
+    keyList.push_back(vid_id);
 
     idx.newPTS = initPTS;
     idx.pos_pts = 0;
@@ -286,37 +286,38 @@
     if (inputFC)
         av_close_input_file(inputFC);
 
-    MPEG2frame *tmpFrame;
-    int max_frames = 0;
+    uint max_frames = 0;
 
-    max_frames += vFrame.count();
-    while (vFrame.count())
+    max_frames += vFrame.size();
+    while (!vFrame.empty())
     {
-        tmpFrame = vFrame.first();
-        vFrame.remove();
-        delete tmpFrame;
+        delete vFrame.back();
+        vFrame.pop_back();
     }
-    while (vSecondary.count())
+
+    while (!vSecondary.empty())
     {
-        tmpFrame = vSecondary.first();
-        vSecondary.remove();
-        delete tmpFrame;
+        delete vSecondary.back();
+        vSecondary.pop_back();
     }
-    for (QMap<int, Q3PtrList<MPEG2frame> >::iterator it = aFrame.begin();
-            it != aFrame.end(); it++)
+
+    for (QMap<int, FrameList>::iterator it = aFrame.begin();
+         it != aFrame.end(); it++)
     {
-        Q3PtrList<MPEG2frame> *af = &(*it);
-        max_frames += af->count();
-        while (af->count())
+        max_frames += (*it).size();
+        while (!(*it).empty())
         {
-            tmpFrame = af->first();
-            af->remove();
-            delete tmpFrame;
+            delete (*it).back();
+            (*it).pop_back();
         }
     }
-    max_frames += framePool.count();
-    while (framePool.count())
-        delete framePool.dequeue();
+
+    max_frames += framePool.size();
+    while (!framePool.empty())
+    {
+        delete framePool.back();
+        framePool.pop_back();
+    }
 }
 
 //#define MPEG2trans_DEBUG
@@ -575,7 +576,7 @@
     memset(rx.exttype, 0, sizeof(rx.exttype));
     memset(rx.exttypcnt, 0, sizeof(rx.exttypcnt));
     int mp2_count = 0, ac3_count = 0;
-    for (QMap<int, Q3PtrList<MPEG2frame> >::iterator it = aFrame.begin();
+    for (QMap<int, FrameList >::iterator it = aFrame.begin();
             it != aFrame.end(); it++)
     {
         int i = aud_map[it.key()];
@@ -787,7 +788,7 @@
                     inputFC->streams[i]->codec->codec_id == CODEC_ID_MP2)
                 {
                     aud_map[i] = ext_count++;
-                    aFrame[i] = Q3PtrList<MPEG2frame> ();
+                    aFrame[i] = FrameList ();
                 }
                 else
                     VERBOSE(MPF_GENERAL, QString(
@@ -960,19 +961,18 @@
         return;
     if (! tmpFrame->isSequence)
     {
-        Q3PtrListIterator<MPEG2frame> it (vFrame);
-        while (*it)
+        FrameList::iterator it = vFrame.begin();
+        for (; it != vFrame.end(); ++it)
         {
-            if((*it)->isSequence)
+            if ((*it)->isSequence)
             {
                 AddSequence(tmpFrame, *it);
                 break;
             }
-            ++it;
         }
     }
     WriteFrame(filename, &tmpFrame->pkt);
-    framePool.enqueue(tmpFrame);
+    framePool.push_back(tmpFrame);
 }
    
 void MPEG2fixup::WriteFrame(const char *filename, AVPacket *pkt)
@@ -999,7 +999,7 @@
     }
 
     WriteYUV(filename, info);
-    framePool.enqueue(tmpFrame);
+    framePool.push_back(tmpFrame);
     mpeg2_close(tmp_decoder);
 }
 
@@ -1206,7 +1206,10 @@
         frame_count++;
     }
     else
-        f = framePool.dequeue();
+    {
+        f = framePool.front();
+        framePool.pop_front();
+    }
 
     f->set_pkt(pkt);
 
@@ -1234,10 +1237,11 @@
     while (1)
     {
         bool done = 0;
-        if (unreadFrames.count())
+        if (!unreadFrames.empty())
         {
-            vFrame.append(unreadFrames.dequeue());
-            if (real_file_end && ! unreadFrames.count())
+            vFrame.push_back(unreadFrames.front());
+            unreadFrames.pop_front();
+            if (real_file_end && unreadFrames.empty())
                 file_end = true;
             return (file_end == true);
         }
@@ -1259,7 +1263,7 @@
                 MPEG2frame *tmpFrame = GetPoolFrame(&vFrame.last()->pkt);
                 if (tmpFrame == NULL)
                     return TRANSCODE_EXIT_UNKNOWN_ERROR;
-                vFrame.append(tmpFrame);
+                vFrame.push_back(tmpFrame);
                 real_file_end = true;
                 file_end = true;
                 return 1;
@@ -1302,23 +1306,23 @@
         {
 
             case CODEC_TYPE_VIDEO:
-                vFrame.append(tmpFrame);
+                vFrame.push_back(tmpFrame);
                 av_free_packet(pkt);
 
                 if (! ProcessVideo(vFrame.last(), header_decoder))
                     return 0;
-                framePool.enqueue(vFrame.last());
+                framePool.push_back(vFrame.last());
                 vFrame.removeLast();
 
                 break;
 
             case CODEC_TYPE_AUDIO:
-                aFrame[pkt->stream_index].append(tmpFrame);
+                aFrame[pkt->stream_index].push_back(tmpFrame);
                 av_free_packet(pkt);
                 return 0;
 
             default:
-                framePool.enqueue(tmpFrame);
+                framePool.push_back(tmpFrame);
                 av_free_packet(pkt);
                 return TRANSCODE_EXIT_UNKNOWN_ERROR;
         }
@@ -1359,7 +1363,7 @@
                 }
                 VERBOSE(MPF_PROCESS, "Dropping V packet");
 
-                framePool.enqueue( vFrame.first());
+                framePool.push_back( vFrame.first());
 
                 vFrame.removeFirst();
             }
@@ -1368,10 +1372,10 @@
         if (vFrame.isEmpty())
             continue;
 
-        for (QMap<int, Q3PtrList<MPEG2frame> >::iterator it = aFrame.begin();
+        for (QMap<int, FrameList >::iterator it = aFrame.begin();
                 it != aFrame.end(); it++)
         {
-            Q3PtrList<MPEG2frame> *af = &(*it);
+            FrameList *af = &(*it);
 
             if (found.contains(it.key()))
                 continue;
@@ -1404,7 +1408,7 @@
                     {
                         while (vFrame.first() != found)
                         {
-                            framePool.enqueue( vFrame.first());
+                            framePool.push_back( vFrame.first());
                             vFrame.removeFirst();
                         }
                     }
@@ -1418,11 +1422,11 @@
                                 QString("     A:%1 V:%2")
                                         .arg(PtsTime(af->first()->pkt.pts))
                                         .arg(PtsTime(vFrame.first()->pkt.pts)));
-                        framePool.enqueue( af->first());
+                        framePool.push_back( af->first());
                         af->removeFirst();
                         continue;
                 }
-                if (delta < 0 && af->count() > 1)
+                if (delta < 0 && af->size() > 1)
                 {
                     if (cmp2x33(af->next()->pkt.pts,
                                 vFrame.first()->pkt.pts) > 0)
@@ -1437,7 +1441,7 @@
                         VERBOSE(MPF_PROCESS,
                                 QString("Dropping A packet from stream %1")
                                        .arg(it.key()));
-                        framePool.enqueue( af->first());
+                        framePool.push_back( af->first());
                         af->removeFirst();
                         continue;
                     }
@@ -1450,12 +1454,12 @@
                     break;
                 }
 
-                if (af->count() == 1)
+                if (af->size() == 1)
                     break;
             }
         }
 
-        state = (found.count() == aFrame.count());
+        state = (found.size() == aFrame.size());
     }
 
     return true;
@@ -1500,16 +1504,12 @@
 
 MPEG2frame *MPEG2fixup::FindFrameNum(int frameNum)
 {
-    Q3PtrListIterator<MPEG2frame> it (vFrame);
-
-    while (*it)
+    FrameList::iterator it = vFrame.begin();
+    for (; it != vFrame.end(); ++it)
     {
-        if (GetFrameNum(it.current()) == frameNum)
-            return it.current();
-
-        ++it;
+        if (GetFrameNum(*it) == frameNum)
+            return *it;
     }
-
     return NULL;
 }
 
@@ -1518,17 +1518,13 @@
     // FIXME: We sometimes end up here with invalid frames pointers in the list
     //        which needs fixing - symptom is segfaults of mythtranscode when
     //        dereferencing the iterator value
-    Q3PtrListIterator<MPEG2frame> it (vFrame);
-    
-    it+= start_pos;
-
-    while (!it.atLast() || (it.atFirst() && (*it)->isSequence))
+    for (uint i = start_pos; i < vFrame.size(); i++)
     {
-        SetFrameNum((*it)->framePos,
-                    GetFrameNum((*it)) + delta);
-        (*it)->mpeg2_pic.temporal_reference += delta;
+        if (1 == vFrame.size() && !vFrame.at(i)->isSequence)
+            break;
 
-        ++it;
+        SetFrameNum(vFrame.at(i)->framePos, GetFrameNum(vFrame.at(i)) + delta);
+        vFrame.at(i)->mpeg2_pic.temporal_reference += delta;
     }
 }
 
@@ -1536,15 +1532,15 @@
 {
     while (vSecondary.first())
     {
-        framePool.enqueue(vSecondary.current());
+        framePool.push_back(vSecondary.current());
         vSecondary.remove();
     }
     while (vFrame.first() != vFrame.getLast())
     {
         if (use_secondary && GetFrameTypeT(vFrame.current()) != 'B')
-            vSecondary.append(vFrame.current());
+            vSecondary.push_back(vFrame.current());
         else
-            framePool.enqueue(vFrame.current());
+            framePool.push_back(vFrame.current());
         vFrame.remove();
     }
 }
@@ -1621,7 +1617,7 @@
                 return NULL;
         }
 
-        framePool.enqueue(tmpFrame);
+        framePool.push_back(tmpFrame);
     }
 
     if ((int)info->display_picture->temporal_reference > frameNum)
@@ -1638,7 +1634,7 @@
     return spare;
 }
 
-int MPEG2fixup::ConvertToI(Q3PtrList<MPEG2frame> *orderedFrames, int headPos)
+int MPEG2fixup::ConvertToI(FrameList *orderedFrames, int headPos)
 {
     MPEG2frame *spare = NULL;
     AVPacket pkt;
@@ -1649,10 +1645,10 @@
         if (PlaybackSecondary())
             return 1;
 
-    Q3PtrListIterator<MPEG2frame> it(*orderedFrames);
-    for (it.toFirst(); *it; ++it)
+    FrameList::iterator it = orderedFrames->begin();
+    for (; it != orderedFrames->end(); ++it)
     {
-        int i = GetFrameNum(it.current());
+        int i = GetFrameNum(*it);
         if ((spare = DecodeToFrame(i, headPos == 0)) == NULL)
             return 1;
         if(GetFrameTypeT(spare) == 'I')
@@ -1680,7 +1676,7 @@
 
     vFrame.remove();
 
-    vFrame.insert(headPos + orderedFrames->count() - 1, spare);
+    vFrame.insert(headPos + orderedFrames->size() - 1, spare);
 
     vFrame.at(headPos);
     return 0;
@@ -1771,13 +1767,13 @@
             mapPtr->insert(end, 0);
         }
     }
-    if (rangelist.count())
+    if (!rangelist.empty())
         use_secondary = true;
 }
 
 void MPEG2fixup::ShowRangeMap(QMap<long long, int> *mapPtr, QString msg)
 {
-    if (mapPtr->count())
+    if (!mapPtr->empty())
     {
         int64_t start = 0;
         QMap<long long, int>::iterator it = mapPtr->begin();
@@ -1790,9 +1786,9 @@
     }
 }
 
-Q3PtrList<MPEG2frame> MPEG2fixup::ReorderDTStoPTS(Q3PtrList<MPEG2frame> *dtsOrder)
+FrameList MPEG2fixup::ReorderDTStoPTS(FrameList *dtsOrder)
 {
-    Q3PtrList<MPEG2frame> Lreorder;
+    FrameList Lreorder;
     int pos = dtsOrder->at();
 
     if (dtsOrder->current() == dtsOrder->getLast())
@@ -1802,10 +1798,10 @@
            GetFrameTypeT(dtsOrder->current()) == 'B';
          dtsOrder->next())
     {
-        Lreorder.append(dtsOrder->current());
+        Lreorder.push_back(dtsOrder->current());
     }
 
-    Lreorder.append(dtsOrder->at(pos));
+    Lreorder.push_back(dtsOrder->at(pos));
     return Lreorder;
 }
 
@@ -1882,17 +1878,17 @@
 
     VERBOSE(MPF_GENERAL, QString("#%1 PTS:%2 Delta: 0.0ms queue: %3")
                          .arg(vid_id).arg(PtsTime(vFrame.current()->pkt.pts))
-                         .arg(vFrame.count()));
+                         .arg(vFrame.size()));
 
-    for (QMap<int, Q3PtrList<MPEG2frame> >::iterator it = aFrame.begin();
+    for (QMap<int, FrameList >::iterator it = aFrame.begin();
             it != aFrame.end(); it++)
     {
-        Q3PtrList<MPEG2frame> *af = &(*it);
+        FrameList *af = &(*it);
         deltaPTS = diff2x33(vFrame.current()->pkt.pts, af->first()->pkt.pts);
         VERBOSE(MPF_GENERAL, QString("#%1 PTS:%2 Delta: %3ms queue: %4")
                              .arg(it.key())
                              .arg(PtsTime(af->current()->pkt.pts))
-                             .arg(1000.0*deltaPTS / 90000.0).arg(af->count()));
+                             .arg(1000.0*deltaPTS / 90000.0).arg(af->size()));
 
         if (cmp2x33(af->current()->pkt.pts, initPTS) < 0)
             initPTS = af->current()->pkt.pts;
@@ -1918,10 +1914,10 @@
         cutStartPTS = origvPTS / 300;
     }
 
-    for (QMap<int, Q3PtrList<MPEG2frame> >::iterator it = aFrame.begin();
+    for (QMap<int, FrameList >::iterator it = aFrame.begin();
             it != aFrame.end(); it++)
     {
-        Q3PtrList<MPEG2frame> *af = &(*it);
+        FrameList *af = &(*it);
         origaPTS[it.key()] = af->first()->pkt.pts * 300;
         expectedPTS[it.key()] = udiff2x33(af->first()->pkt.pts, initPTS);
         af_dlta_cnt[it.key()] = 0;
@@ -1944,7 +1940,7 @@
         else
             break;
 
-        if (vFrame.count() && (file_end || vFrame.getLast()->isSequence))
+        if (!vFrame.empty() && (file_end || vFrame.getLast()->isSequence))
         {
             MPEG2frame *seqFrame;
             if (ptsIncrement != vFrame.first()->mpeg2_seq.frame_period / 300)
@@ -1967,7 +1963,7 @@
                 bool ptsorder_eq_dtsorder = false;
                 int frame_pos = vFrame.at();
                 int64_t dtsExtra = 0, PTSdiscrep = 0;
-                Q3PtrList<MPEG2frame> Lreorder;
+                FrameList Lreorder;
                 MPEG2frame *markedFrame = NULL, *markedFrameP = NULL;
 
                 if (expectedvPTS != expectedDTS + ptsIncrement * 300)
@@ -2001,9 +1997,9 @@
                 // beforehand
                 if (PTSdiscrep && ! file_end)
                 {
-                    int pos = vFrame.count();
-                    int count = Lreorder.count();
-                    while (vFrame.count() - frame_pos - count < 20 && !file_end)
+                    int pos = vFrame.size();
+                    int count = Lreorder.size();
+                    while (vFrame.size() - frame_pos - count < 20 && !file_end)
                         if ((ret = GetFrame(&pkt)) < 0)
                             return ret;
                     if (! file_end)
@@ -2012,9 +2008,9 @@
                         int numframes = (maxframes > 1) ? maxframes - 1 : 1;
                         bool done = false;
                         while (!done &&
-                               (uint)(frame_pos + count + 1) < vFrame.count())
+                               (uint)(frame_pos + count + 1) < vFrame.size())
                         {
-                            Q3PtrList<MPEG2frame> tmpReorder;
+                            FrameList tmpReorder;
                             vFrame.at(frame_pos + count);
                             tmpReorder = ReorderDTStoPTS(&vFrame);
                             for (MPEG2frame *curFrame = tmpReorder.first();
@@ -2034,14 +2030,14 @@
                                     tmpPTSdiscrep != PTSdiscrep)
                                     PTSdiscrep = tmpPTSdiscrep;
                             }
-                            count += tmpReorder.count();
+                            count += tmpReorder.size();
                         }
                     }
                     // push frames onto 'unreadFrames' queue
                     vFrame.at(pos);
                     while (vFrame.at() == pos)
                     {
-                        unreadFrames.enqueue(vFrame.current());
+                        unreadFrames.push_back(vFrame.current());
                         vFrame.remove();
                     }
                     file_end = false;
@@ -2051,11 +2047,11 @@
                 for (MPEG2frame *curFrame = Lreorder.first();
                      curFrame; curFrame = Lreorder.next())
                 {
-                    if (saveMap.count())
+                    if (!saveMap.empty())
                     {
                         if (saveMap.begin().key() <= frame_count)
                            saveMap.remove(saveMap.begin());
-                        if (saveMap.count() && saveMap.begin().data() == 0)
+                        if (saveMap.size() && saveMap.begin().data() == 0)
                         {
                             VERBOSE(MPF_IMPORTANT, QString("Saving frame #%1")
                                                .arg(frame_count));
@@ -2066,7 +2062,7 @@
                                        curFrame);
                         }
                     }
-                    if (delMap.count() && delMap.begin().key() <= frame_count)
+                    if (!delMap.empty() && delMap.begin().key() <= frame_count)
                     {
                         new_discard_state = delMap.begin().data();
                         delMap.remove(delMap.begin());
@@ -2084,7 +2080,7 @@
                             cutStartPTS = add2x33(markedFrameP->pkt.pts,
                                           ptsIncrement * 
                                           GetNbFields(markedFrameP) / 2);
-                            QMap<int, Q3PtrList<MPEG2frame> >::iterator it;
+                            QMap<int, FrameList >::iterator it;
                             for (it = aFrame.begin(); it != aFrame.end(); it++)
                             {
                                 cutState[it.key()] = 1;
@@ -2205,13 +2201,13 @@
                                                deltaPTS, ptsIncrement, 0);
                         if(ret < 0)
                             return TRANSCODE_BUGGY_EXIT_WRITE_FRAME_ERROR;
-                        for (vFrame.at(frame_pos + Lreorder.count()); ret;
+                        for (vFrame.at(frame_pos + Lreorder.size()); ret;
                              vFrame.next(), --ret)
                         {
                             lastPTS = expectedvPTS;
                             expectedvPTS += 150 * ptsIncrement *
                                             GetNbFields(vFrame.current());
-                            Lreorder.append(vFrame.current());
+                            Lreorder.push_back(vFrame.current());
                         }
                     }
 
@@ -2219,7 +2215,7 @@
                     //multiplexer
                     vFrame.at(frame_pos);
 
-                    for (uint i = 0; i < Lreorder.count(); i++, vFrame.next())
+                    for (uint i = 0; i < Lreorder.size(); i++, vFrame.next())
                     {
                         if (discard)
                         {
@@ -2259,7 +2255,7 @@
                 }
                 else
                 {
-                    vFrame.at(frame_pos + Lreorder.count());
+                    vFrame.at(frame_pos + Lreorder.size());
                 }
                 if (PTSdiscrep)
                     poq.SetNextPos(add2x33(poq.Get(vid_id, &lastRealvPkt),
@@ -2271,18 +2267,18 @@
 
             if (file_end)
                 use_secondary = false;
-            if (vFrame.count() > 1 || file_end)
+            if (vFrame.size() > 1 || file_end)
                 StoreSecondary();
         }
 
-        for (QMap<int, Q3PtrList<MPEG2frame> >::iterator it = aFrame.begin();
+        for (QMap<int, FrameList >::iterator it = aFrame.begin();
                 it != aFrame.end(); it++)
         {
-            Q3PtrList<MPEG2frame> *af = &(*it);
+            FrameList *af = &(*it);
             AVCodecContext *CC = getCodecContext(it.key());
             bool backwardsPTS = false;
 
-            while (af->count())
+            while (!af->empty())
             {
                 // What to do if the CC is corrupt?
                 // Just wait and hope it repairs itself
@@ -2320,7 +2316,7 @@
                             .arg(PtsTime(af->first()->pkt.pts))
                             .arg(PtsTime(origaPTS[it.key()] / 300)));
 #endif
-                    framePool.enqueue(af->first());
+                    framePool.push_back(af->first());
                     af->remove();
                     af_dlta_cnt[it.key()] = 0;
                     continue;
@@ -2384,7 +2380,7 @@
                         .arg(PtsTime(af->first()->pkt.pts))
                         .arg(PtsTime(cutEndPTS)));
 #endif
-                    framePool.enqueue(af->first());
+                    framePool.push_back(af->first());
                     af->remove();
                     cutState[it.key()] = 2;
                     ptsinc((uint64_t *)&origaPTS[it.key()], incPTS * 300);
@@ -2418,7 +2414,7 @@
                         .arg(af->current()->pkt.pos));
                 if (AddFrame(af->current()))
                     return TRANSCODE_BUGGY_EXIT_DEADLOCK;
-                framePool.enqueue(af->first());
+                framePool.push_back(af->first());
 
                 af->remove();
             }
@@ -2521,7 +2517,7 @@
                 break;
 
             case 'c':
-                cutlist.append(optarg);
+                cutlist.push_back(optarg);
                 break;
 
             case 't':
@@ -2532,7 +2528,7 @@
                 break;
 
             case 's':
-                savelist.append(optarg);
+                savelist.push_back(optarg);
                 break;
 
             case 'p':
@@ -2555,9 +2551,9 @@
                    no_repeat, fix_PTS, max_frames,
                    showprogress, otype);
 
-    if (cutlist.count())
+    if (!cutlist.empty())
         m2f.AddRangeList(cutlist, MPF_TYPE_CUTLIST);
-    if (savelist.count())
+    if (!savelist.empty())
         m2f.AddRangeList(savelist, MPF_TYPE_SAVELIST);
     return m2f.Start();
 }
Index: programs/mythtranscode/mpeg2fix.h
===================================================================
--- programs/mythtranscode/mpeg2fix.h	(revision 23105)
+++ programs/mythtranscode/mpeg2fix.h	(working copy)
@@ -24,8 +24,6 @@
 #include <QDateTime>
 
 #include <Q3PtrList>
-#include <Q3PtrQueue>
-#include <Q3ValueList>
 
 #include "transcodedefs.h"
 
@@ -82,6 +80,16 @@
     mpeg2_gop_t mpeg2_gop;
     mpeg2_picture_t mpeg2_pic;
 };
+class FrameList : public Q3PtrList<MPEG2frame>
+{
+  public:
+    void push_back(MPEG2frame *f) { append(f); }
+    uint size(void) { return count(); }
+    bool empty(void) { return isEmpty(); }
+    MPEG2frame *back(void) { return getLast(); }
+    void pop_back(void) { removeLast(); }
+};
+typedef QList<MPEG2frame*> FrameQueue;
 
 typedef struct {
     int64_t newPTS;
@@ -182,11 +190,11 @@
     void StoreSecondary();
     int  PlaybackSecondary();
     MPEG2frame *DecodeToFrame(int frameNum, int skip_reset);
-    int ConvertToI(Q3PtrList<MPEG2frame> *orderedFrames, int headPos);
+    int ConvertToI(FrameList *orderedFrames, int headPos);
     int InsertFrame(int frameNum, int64_t deltaPTS,
                      int64_t ptsIncrement, int64_t initPTS);
     void AddSequence(MPEG2frame *frame1, MPEG2frame *frame2);
-    Q3PtrList<MPEG2frame> ReorderDTStoPTS(Q3PtrList<MPEG2frame> *dtsOrder);
+    FrameList ReorderDTStoPTS(FrameList *dtsOrder);
     void InitialPTSFixup(MPEG2frame *curFrame, int64_t &origvPTS,
                          int64_t &PTSdiscrep, int numframes, bool fix);
     void SetFrameNum(uint8_t *ptr, int num);
@@ -221,13 +229,14 @@
     int (*check_abort)();
     void (*update_status)(float percent_done);
 
-    Q3PtrList<MPEG2frame> vSecondary;
+    FrameList vSecondary;
     bool use_secondary;
 
-    Q3PtrList<MPEG2frame> vFrame;
-    QMap<int, Q3PtrList<MPEG2frame> > aFrame;
-    Q3PtrQueue<MPEG2frame> framePool;
-    Q3PtrQueue<MPEG2frame> unreadFrames;
+    FrameList vFrame;
+    QMap<int, FrameList> aFrame;
+    typedef QList<MPEG2frame*> FrameQueue;
+    FrameQueue framePool;
+    FrameQueue unreadFrames;
     Q3PtrListIterator<MPEG2frame> *displayFrame;
     mpeg2dec_t *header_decoder;
     mpeg2dec_t *img_decoder;