The branch, master has been updated
       via  8cb1ff78ac62ff0f652b0cb06369ba50d5e946c6 (commit)
      from  b80f28fcbcedbf48b760921e85c5f2ae4f2f802a (commit)


- Log -----------------------------------------------------------------
commit 8cb1ff78ac62ff0f652b0cb06369ba50d5e946c6
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Sat Sep 20 01:56:20 2025 +0200
Commit:     michaelni <[email protected]>
CommitDate: Tue Sep 30 21:13:56 2025 +0000

    avformat/dhav: Factorize some code in get_duration()
    
    Signed-off-by: Michael Niedermayer <[email protected]>

diff --git a/libavformat/dhav.c b/libavformat/dhav.c
index b3fa612ab3..614934dc68 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 + 20 > 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)

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

Summary of changes:
 libavformat/dhav.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)


hooks/post-receive
-- 

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to