Ticket #7876: mpegts-33bit.diff
| File mpegts-33bit.diff, 1.3 KB (added by , 7 years ago) |
|---|
-
libavformat/mpegts.c
old new 163 163 /** structure to keep track of Program->pids mapping */ 164 164 unsigned int nb_prg; 165 165 struct Program *prg; 166 167 /** base timestamp for smooth rolling over 33bits */ 168 int64_t base_ts; 166 169 167 170 int8_t crc_validity[NB_PID_MAX]; 168 171 /** filters for various streams specified by PMT + for the PAT and PMT */ … … 982 985 pkt->size = len; 983 986 } 984 987 988 static int64_t unroll_timestamp(MpegTSContext *ts, int64_t t) 989 { 990 int64_t dt; 991 992 if (t == AV_NOPTS_VALUE) 993 return t; 994 995 if (!ts->base_ts) 996 ts->base_ts = t; 997 998 dt = (t - ts->base_ts) & 0x01ffffffffll; 999 if (dt & 0x0100000000ll) { 1000 dt |= 0xffffffff00000000ll; 1001 } 1002 1003 ts->base_ts += dt; 1004 1005 return ts->base_ts; 1006 } 1007 985 1008 static int new_pes_packet(PESContext *pes, AVPacket *pkt) 986 1009 { 987 1010 uint8_t *sd; … … 1005 1028 pkt->stream_index = pes->sub_st->index; 1006 1029 else 1007 1030 pkt->stream_index = pes->st->index; 1008 pkt->pts = pes->pts;1009 pkt->dts = pes->dts;1031 pkt->pts = unroll_timestamp(pes->ts, pes->pts); 1032 pkt->dts = unroll_timestamp(pes->ts, pes->dts); 1010 1033 /* store position of first TS packet of this PES packet */ 1011 1034 pkt->pos = pes->ts_packet_pos; 1012 1035 pkt->flags = pes->flags;
