On Tue, 26 Nov 2024, Manuel Lauss wrote:
SMUSH ANIM files with subversion 2 provide additional fields for framerate and samplerate, use them if available, otherwise default to 12 fps which is the default for almost all ANIMv2 since 1995. Fixes the too-fast playback of test files from LucasArts games released 1995-1997. It was not noticed since Audio for those isn't decoded by ffmpeg. Signed-off-by: Manuel Lauss <manuel.la...@gmail.com> --- libavformat/smush.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
Thanks, applied a slightly modified version. Regards, Marton
diff --git a/libavformat/smush.c b/libavformat/smush.c index 0877f7faff..25730e5816 100644 --- a/libavformat/smush.c +++ b/libavformat/smush.c @@ -51,7 +51,7 @@ static int smush_read_header(AVFormatContext *ctx) AVStream *vst, *ast; uint32_t magic, nframes, size, subversion, i; uint32_t width = 0, height = 0, got_audio = 0, read = 0; - uint32_t sample_rate, channels, palette[256]; + uint32_t sample_rate, channels, palette[256], frame_rate = 15; int ret; magic = avio_rb32(pb); @@ -76,7 +76,16 @@ static int smush_read_header(AVFormatContext *ctx) for (i = 0; i < 256; i++) palette[i] = avio_rb24(pb); - avio_skip(pb, size - (3 * 256 + 6)); + if (subversion > 1) { + frame_rate = avio_rl32(pb); + avio_skip(pb, 4); // max size of FRME chunk in file + sample_rate = avio_rl32(pb); + avio_skip(pb, size - (3 * 256 + 6 + 3 * 4)); + if (frame_rate < 1 || frame_rate > 70) + frame_rate = 12; + } else { + avio_skip(pb, size - (3 * 256 + 6)); + } } else if (magic == MKBETAG('S', 'A', 'N', 'M')) { if (avio_rb32(pb) != MKBETAG('S', 'H', 'D', 'R')) return AVERROR_INVALIDDATA; @@ -146,7 +155,7 @@ static int smush_read_header(AVFormatContext *ctx) smush->video_stream_index = vst->index; - avpriv_set_pts_info(vst, 64, 1, 15); + avpriv_set_pts_info(vst, 64, 1, frame_rate); vst->start_time = 0; vst->duration = -- 2.47.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".