• James Almer's avatar
    matroskadec: Improve TTA duration calculation · af248fa1
    James Almer authored
    Calculate the duration as accurately as possible to improve decoding of samples
    where the last frame is smaller than the rest.
    
    Example:
    Take lossless-audio/luckynight-partial.tak from the FATE suit and convert it
    to TTA muxed into matroska:
    
    ffmpeg -i $(SAMPLES)/lossless-audio/luckynight-partial.tak -c:a tta lucky.mka
    
    The framemd5 output for lucky.mka without this patch:
    
    0,          0,          0,    46080,   184320, 7c3751ddd571d2903c3cf0ab4b3e3d0a
    0,      46080,      46080,    46080,   184320, 6b70c782ba1da3f933fde2daa4f96b73
    0,      92160,      92160,    46080,   184320, dcf70d89c54b9a4f0b302d4ec4fb302d
    0,     138240,     138240,    46080,   184320, 48713ca38b388d2ea4abf5b86ed1226f
    0,     184320,     184320,    46080,   184320, 12188a23648e7ebfb07cd6fe9197b2ea
    0,     230400,     230400,    46080,   184320, 49653ab8186a5d4a044ed284671a26e0
    0,     276480,     276480,    46080,   184320, 5e82c6a7fe58c7ea612c03a0a2927dd4
    0,     322560,     322560,    46080,   184320, 83dc449dbd9eab5f2e8ad2b4403d6a21
    0,     368640,     368640,    46080,   184320, bdd6b92c23d30978d4e802d305b0fc49
    
    With this patch:
    
    0,          0,          0,    46080,   184320, 7c3751ddd571d2903c3cf0ab4b3e3d0a
    0,      46080,      46080,    46080,   184320, 6b70c782ba1da3f933fde2daa4f96b73
    0,      92160,      92160,    46080,   184320, dcf70d89c54b9a4f0b302d4ec4fb302d
    0,     138240,     138240,    46080,   184320, 48713ca38b388d2ea4abf5b86ed1226f
    0,     184320,     184320,    46080,   184320, 12188a23648e7ebfb07cd6fe9197b2ea
    0,     230400,     230400,    46080,   184320, 49653ab8186a5d4a044ed284671a26e0
    0,     276480,     276480,    46080,   184320, 5e82c6a7fe58c7ea612c03a0a2927dd4
    0,     322560,     322560,    46080,   184320, 83dc449dbd9eab5f2e8ad2b4403d6a21
    0,     368640,     368640,    46080,   184320, bdd6b92c23d30978d4e802d305b0fc49
    0,     414720,     414720,     4230,    16920, b50b440c5bbcecb8e9fbece643447593
    
    The duration without this patch was calculated as 418950000000, which is bigger
    than uint32_t and as such stored as 2338172288.
    With this patch the duration is correctly calculated as 418950.
    Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
    Approved-by: 's avatarPaul B Mahol <onemda@gmail.com>
    Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
    af248fa1
Name
Last commit
Last update
compat Loading commit data...
doc Loading commit data...
libavcodec Loading commit data...
libavdevice Loading commit data...
libavfilter Loading commit data...
libavformat Loading commit data...
libavresample Loading commit data...
libavutil Loading commit data...
libpostproc Loading commit data...
libswresample Loading commit data...
libswscale Loading commit data...
presets Loading commit data...
tests Loading commit data...
tools Loading commit data...
.gitignore Loading commit data...
COPYING.GPLv2 Loading commit data...
COPYING.GPLv3 Loading commit data...
COPYING.LGPLv2.1 Loading commit data...
COPYING.LGPLv3 Loading commit data...
CREDITS Loading commit data...
Changelog Loading commit data...
INSTALL Loading commit data...
LICENSE Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README Loading commit data...
RELEASE Loading commit data...
arch.mak Loading commit data...
cmdutils.c Loading commit data...
cmdutils.h Loading commit data...
cmdutils_common_opts.h Loading commit data...
common.mak Loading commit data...
configure Loading commit data...
ffmpeg.c Loading commit data...
ffmpeg.h Loading commit data...
ffmpeg_filter.c Loading commit data...
ffmpeg_opt.c Loading commit data...
ffplay.c Loading commit data...
ffprobe.c Loading commit data...
ffserver.c Loading commit data...
library.mak Loading commit data...
version.sh Loading commit data...