| 1283 | | /* Do not output twice a line with the same timestamp, this |
| 1284 | | breaks Windows' Vobsub */ |
| 1285 | | if (vob->fidx && (!last_pts_set || last_pts != pts)) { |
| 1286 | | static unsigned int last_h = 9999, last_m = 9999, last_s = 9999, last_ms = 9999; |
| | 1283 | /* Only output timestamps which differ more than one millisecond */ |
| | 1284 | if (!last_pts_set) |
| | 1285 | last_pts = -1; |
| | 1286 | double pts_diff = pts - last_pts; |
| | 1287 | double abs_pts_diff = pts_diff < 0 ? -pts_diff : pts_diff; |
| | 1288 | if (vob->fidx && abs_pts_diff > 0.001) { |
| 1297 | | if (h != last_h || m != last_m || (unsigned int) s != last_s || ms != last_ms) { |
| 1298 | | fprintf(vob->fidx, "timestamp: %02u:%02u:%02u:%03u, filepos: %09lx\n", |
| 1299 | | h, m, (unsigned int) s, ms, ftell(vob->fsub)); |
| 1300 | | last_h = h; |
| 1301 | | last_m = m; |
| 1302 | | last_s = (unsigned int) s; |
| 1303 | | last_ms = ms; |
| 1304 | | } |
| | 1299 | fprintf(vob->fidx, "timestamp: %02u:%02u:%02u:%03u, filepos: %09lx\n", |
| | 1300 | h, m, (unsigned int) s, ms, ftell(vob->fsub)); |