comparison sub/av_sub.c @ 37161:6d654ac9201e

Better handling of out-of-range subtitle timestamps. Fixes decoding of PGS subtitles.
author reimar
date Sat, 23 Aug 2014 14:23:37 +0000
parents 9b88b87f5921
children
comparison
equal deleted inserted replaced
37160:bb15cab6c059 37161:6d654ac9201e
128 } 128 }
129 res = avcodec_decode_subtitle2(ctx, &sub, &got_sub, &pkt); 129 res = avcodec_decode_subtitle2(ctx, &sub, &got_sub, &pkt);
130 if (res < 0) 130 if (res < 0)
131 return res; 131 return res;
132 if (*pts != MP_NOPTS_VALUE) { 132 if (*pts != MP_NOPTS_VALUE) {
133 if (sub.end_display_time > sub.start_display_time) 133 if (sub.end_display_time > sub.start_display_time && sub.end_display_time < 0x7fffffff)
134 *endpts = *pts + sub.end_display_time / 1000.0; 134 *endpts = *pts + sub.end_display_time / 1000.0;
135 *pts += sub.start_display_time / 1000.0; 135 *pts += sub.start_display_time / 1000.0;
136 } 136 }
137 if (got_sub && vo_spudec && sub.num_rects == 0) 137 if (got_sub && vo_spudec && sub.num_rects == 0)
138 spudec_set_paletted(vo_spudec, NULL, 0, NULL, 0, 0, 0, 0, *pts, *endpts); 138 spudec_set_paletted(vo_spudec, NULL, 0, NULL, 0, 0, 0, 0, *pts, *endpts);