mirror of https://github.com/mpv-player/mpv
sd_lavc: display DVD subs with unknown duration
DVD subs (rarely) have subtitle events without end timestamp. The duration is unknown, and they should be displayed until they're replaced by the next event. FFmpeg fails hard to make us aware whether duration is unknown or actually 0, so we can't distinguish between these two cases. It fails at this twice: AVPacket.duration is set to 0 if duration is unknown, and AVSubtitle.end_display_time has the same issue. Add a hack that considers all bitmap subtitles with duration==0 as events with uknown length. I'd rather accidentally display a hidden subtitle (if they exist at all), instead of not displaying random subtitles at all. See github issue #325.
This commit is contained in:
parent
75261165af
commit
2537f6f467
|
@ -136,6 +136,12 @@ static void decode(struct sd *sd, struct demux_packet *packet)
|
||||||
AVSubtitle sub;
|
AVSubtitle sub;
|
||||||
AVPacket pkt;
|
AVPacket pkt;
|
||||||
|
|
||||||
|
// libavformat sets duration==0, even if the duration is unknown.
|
||||||
|
// Assume there are no bitmap subs that actually use duration==0 for
|
||||||
|
// hidden subtitle events.
|
||||||
|
if (duration == 0)
|
||||||
|
duration = -1;
|
||||||
|
|
||||||
clear(priv);
|
clear(priv);
|
||||||
av_init_packet(&pkt);
|
av_init_packet(&pkt);
|
||||||
pkt.data = packet->buffer;
|
pkt.data = packet->buffer;
|
||||||
|
|
Loading…
Reference in New Issue