Ticket #11213: mpeg2fix.cpp.patch20131027

File mpeg2fix.cpp.patch20131027, 915 bytes (added by finlay@…, 10 years ago)

patch file for workaround fix for lost pts in converted B & P frames

Line 
1--- mpeg2fix.cpp~       2013-10-21 08:58:31.000000000 -0500
2+++ mpeg2fix.cpp        2013-10-27 11:18:09.516570857 -0600
3@@ -1667,6 +1667,7 @@
4          it != orderedFrames->end(); it++)
5     {
6         int i = GetFrameNum((*it));
7+        AVPacket pkttmp;
8         if ((spare = DecodeToFrame(i, headPos == 0)) == NULL)
9         {
10             LOG(VB_GENERAL, LOG_WARNING,
11@@ -1677,7 +1678,7 @@
12         if (GetFrameTypeT(spare) == 'I')
13             continue;
14         
15-        pkt = spare->pkt;
16+        pkt = pkttmp = spare->pkt;
17         //pkt.data is a newly malloced area
18 
19         {
20@@ -1697,6 +1698,9 @@
21         }
22 
23         spare->set_pkt(&pkt);
24+        // restore frame pts and dts
25+        spare->pkt.pts = pkttmp.pts;
26+        spare->pkt.dts = pkttmp.dts;
27         av_free(pkt.data);
28         SetFrameNum(spare->pkt.data, GetFrameNum(spare));
29         ProcessVideo(spare, header_decoder); //process this new frame