Opened 9 years ago

Closed 9 years ago

#2224 closed defect (fixed)

MPlayer does not display DVB subtitles when timestamp is bigger than 0xffffffffu / 90000

Reported by: banastasov Owned by: beastd
Priority: normal Component: undetermined
Version: unspecified Severity: blocker
Keywords: Cc:
Blocked By: Blocking:
Reproduced by developer: no Analyzed by developer: no

Description

MPlayer does not display DVB subtitles for timestamps bigger than 0xffffffffu/90000. The reason is that pts for transport streams is 33bit. So DVB subtitles with pts bigger than 47721.859 is discarded.
I have bisected MPlayer and the offending patch is:

commit be85c2e8d3bd6822612f65b00af87677c392629d
Author: reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>
Date: Sat Aug 23 14:23:37 2014 +0000

Better handling of out-of-range subtitle timestamps.


Fixes decoding of PGS subtitles.


git-svn-id: svn://git.mplayerhq.hu/mplayer/trunk@37257 b3059339-0415-0410-9bf9-f77b7e298cf2

Particularly reverting the part of this commit for sub/spudec.c fixes the problem:

diff --git a/sub/spudec.c b/sub/spudec.c
index 56ce8f6..ea5cbdb 100644
--- a/sub/spudec.c
+++ b/sub/spudec.c
@@ -1426,9 +1426,9 @@ void spudec_packet_send(void *spu, packet_t *packet, double pts, double endpts)
 {
   packet->start_pts = 0;
   packet->end_pts = 0x7fffffff;
-  if (pts != MP_NOPTS_VALUE)
+  if (pts != MP_NOPTS_VALUE && pts < 0xffffffffu / 90000)
     packet->start_pts = pts * 90000;
-  if (endpts != MP_NOPTS_VALUE)
+  if (endpts != MP_NOPTS_VALUE && endpts < 0xffffffffu / 90000)
     packet->end_pts = endpts * 90000;
   spudec_queue_packet(spu, packet);
 }

Change History (2)

comment:1 by reimar, 9 years ago

Unfortunately the code does not handle overflows correctly, so the cases that break never worked 100%.
One possibility would be to change start_pts/end_pts to double, however that seems likely to run into wrapping issues in normal vobsub cases.
As the spudec.c part isn't really needed for the PGS fix but was more paranoia, just reverting it might be the best solution.

comment:2 by reimar, 9 years ago

Resolution: fixed
Status: newclosed

Reverted for now. Thanks for the debugging.

Note: See TracTickets for help on using tickets.