PR #20560 opened by michaelni URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20560 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20560.patch
Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc> >From 798c4c50d53a01eb24f172575869738c9e26d93c Mon Sep 17 00:00:00 2001 From: Michael Niedermayer <mich...@niedermayer.cc> Date: Sat, 20 Sep 2025 01:56:20 +0200 Subject: [PATCH] avformat/dhav: Factrorize some code in get_duration() Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc> --- libavformat/dhav.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libavformat/dhav.c b/libavformat/dhav.c index 21c9c530d6..e28631770d 100644 --- a/libavformat/dhav.c +++ b/libavformat/dhav.c @@ -242,7 +242,7 @@ static int64_t get_duration(AVFormatContext *s) int64_t start_pos = avio_tell(s->pb); int64_t pos = -1; - int64_t start = 0, end = 0; + int64_t start = 0; struct tm timeinfo; uint8_t *buffer; int64_t buffer_size; @@ -250,6 +250,7 @@ static int64_t get_duration(AVFormatContext *s) int64_t offset; unsigned date; int64_t size = avio_size(s->pb); + int64_t ret = 0; if (start_pos + 16 > size) return 0; @@ -284,17 +285,12 @@ static int64_t get_duration(AVFormatContext *s) date = AV_RL32(buffer + (pos - buffer_pos) + 16); get_timeinfo(date, &timeinfo); - end = av_timegm(&timeinfo) * 1000LL; - av_freep(&buffer); - - avio_seek(s->pb, start_pos, SEEK_SET); - - return end - start; + ret = av_timegm(&timeinfo) * 1000LL - start; fail: av_freep(&buffer); avio_seek(s->pb, start_pos, SEEK_SET); - return 0; + return ret; } static int dhav_read_header(AVFormatContext *s) -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-le...@ffmpeg.org