Ticket #11213: mpeg2fix.cpp.patch20131031

File mpeg2fix.cpp.patch20131031, 818 bytes (added by finlay@…, 13 years ago)

Patch to MPEG2fixup::BuildFrame to restore original pts value

Line 
1--- mpeg2fix.cpp.orig 2013-10-21 08:58:31.000000000 -0500
2+++ mpeg2fix.cpp 2013-10-31 16:34:13.236055366 -0600
3@@ -1071,6 +1071,7 @@
4 AVFrame *picture;
5 AVCodecContext *c = NULL;
6 AVCodec *out_codec;
7+ int64_t savedPts = pkt->pts; // save the original pts
8
9 info = mpeg2_info(img_decoder);
10 if (!info->display_fbuf)
11@@ -1193,6 +1194,7 @@
12 int delta = FindMPEG2Header(pkt->data, pkt->size, 0x00);
13 // out_size=avcodec_encode_video(c, outbuf, outbuf_size, picture);
14 pkt->size -= delta; // a hack to get to the picture frame
15+ pkt->pts = savedPts; // restore the original pts
16 memmove(pkt->data, pkt->data + delta, pkt->size);
17 SetRepeat(pkt->data, pkt->size, info->display_picture->nb_fields,
18 !!(info->display_picture->flags & PIC_FLAG_TOP_FIELD_FIRST));