gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [libextractor] 06/27: fix duration initialization in ffmpeg


From: gnunet
Subject: [GNUnet-SVN] [libextractor] 06/27: fix duration initialization in ffmpeg extractor (badly positioned #if)
Date: Sun, 15 Oct 2017 21:34:30 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository libextractor.

commit 0de5693026e9e2bd2799f3e1e4e7d929a14271b7
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun Oct 15 19:51:49 2017 +0200

    fix duration initialization in ffmpeg extractor (badly positioned #if)
---
 ChangeLog                               |  3 ++-
 src/plugins/thumbnailffmpeg_extractor.c | 28 ++++++++++++----------------
 2 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c2a27af6..82c4262b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,7 +2,8 @@ Sun Oct 15 19:36:41 CEST 2017
        Fix potential file descriptor leak (on error handling path).
        Fix potential assign-after-free (on IPC error handling path).
        Make sure to only pass "unsigned char" to functions like isspace().
-       Avoid malloc(0) in DEB extractor under certain conditions. -CG
+       Avoid malloc(0) in DEB extractor under certain conditions.
+       Properly initialize 'duration' in ffmpeg extractor. -CG
 
 Fri Oct 13 12:30:37 CEST 2017
        Properly check read error in NSF plugin (from signedness confusion) 
found by Leon Zhao. -CG
diff --git a/src/plugins/thumbnailffmpeg_extractor.c 
b/src/plugins/thumbnailffmpeg_extractor.c
index 0619efd1..c2af2409 100644
--- a/src/plugins/thumbnailffmpeg_extractor.c
+++ b/src/plugins/thumbnailffmpeg_extractor.c
@@ -621,6 +621,7 @@ extract_video (struct EXTRACTOR_ExtractContext *ec)
   int err;
   int frame_finished;
   unsigned char *iob;
+  int duration;
 
   if (NULL == (iob = av_malloc (16 * 1024)))
     return;
@@ -704,32 +705,27 @@ extract_video (struct EXTRACTOR_ExtractContext *ec)
       av_free (io_ctx);
       return;
     }
-  int duration;
+
   if (format_ctx->duration == AV_NOPTS_VALUE)
-       {
-       duration = -1;
+    {
+      duration = -1;
 #if DEBUG
-    fprintf (stderr,
-            "Duration unknown\n");
+      fprintf (stderr,
+               "Duration unknown\n");
 #endif
-       }
+    }
   else
-  {
-#if DEBUG
-       duration = format_ctx->duration;
-    fprintf (stderr,
-            "Duration: %lld\n",
-            format_ctx->duration);
-#endif
-       }
+    {
+      duration = format_ctx->duration;
+    }
 
   /* if duration is known, seek to first tried,
    * else use 10 sec into stream */
 
   if(-1 != duration)
-       err = av_seek_frame (format_ctx, -1, (duration/3), 0);
+    err = av_seek_frame (format_ctx, -1, (duration/3), 0);
   else
-       err = av_seek_frame (format_ctx, -1, 10 * AV_TIME_BASE, 0);
+    err = av_seek_frame (format_ctx, -1, 10 * AV_TIME_BASE, 0);
 
   if (err >= 0)
     avcodec_flush_buffers (codec_ctx);

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]