Skip to content

pr-ffstaging-48/enen92/ass_mkv_fixed_subs-v1

The matroska specification states the start time and duration of subtitle
entries are encoded in the block TimeStamp and BlockDuration. Furthermore,
for all subtitle formats except S_HDMV/PGS the BlockDuration must always be
defined and have an absolute value even if it is simply 0. ffmpeg assumes
that a duration of 0 means the duration is still unknown and tries to adjust
based on the next packet pts. This is wrong for all formats except
S_HDMV/PGS. Since changing the semantics of duration 0 is not an option
(touches too many parts of the code) this change introduces
AV_PKT_FLAG_FIXED_DURATION flag which decoders might use to flag the
duration of a given packet should not be changed.

Signed-off-by: Miguel Borges de Freitas enen92@kodi.tv

----------------------------------------------------------------------------

This is my attempt at fixing https://trac.ffmpeg.org/ticket/10135 Initially
reported to Kodi in https://github.com/xbmc/xbmc/issues/21625

Miguel Borges de Freitas (2):
  libavformat/matroskadec: set fixed duration for subtitles
  fate: update test reference data to include AV_PKT_FLAG_FIXED_DURATION

 libavcodec/packet.h                        |  5 ++
 libavformat/demux.c                        |  3 +-
 libavformat/matroskadec.c                  |  4 +
 tests/ref/fate/matroska-dvbsub-remux       | 84 ++++++++++----------
 tests/ref/fate/matroska-zero-length-block  |  4 +-
 tests/ref/fate/matroska-zlib-decompression |  2 +-
 tests/ref/fate/shortest-sub                | 92 +++++++++++-----------
 7 files changed, 102 insertions(+), 92 deletions(-)

base-commit: 94aa70d757af6b0e0919250f9def2a819aa00358

Submitted-As: https://master.gitmailbox.com/ffmpegdev/pull.48.ffstaging.FFmpeg.1673365328.ffmpegagent@gmail.com
Assets 2