gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r23129 - Extractor/src/plugins


From: gnunet
Subject: [GNUnet-SVN] r23129 - Extractor/src/plugins
Date: Mon, 6 Aug 2012 01:25:37 +0200

Author: grothoff
Date: 2012-08-06 01:25:37 +0200 (Mon, 06 Aug 2012)
New Revision: 23129

Modified:
   Extractor/src/plugins/mpeg_extractor.c
   Extractor/src/plugins/test_mpeg.c
Log:
-fix gop

Modified: Extractor/src/plugins/mpeg_extractor.c
===================================================================
--- Extractor/src/plugins/mpeg_extractor.c      2012-08-05 23:16:21 UTC (rev 
23128)
+++ Extractor/src/plugins/mpeg_extractor.c      2012-08-05 23:25:37 UTC (rev 
23129)
@@ -52,7 +52,8 @@
   ssize_t avail;
   mpeg2_state_t state;
   char format[256];
-  int finished;
+  char gop_format[256];
+  int have_gop;
 
   if (NULL == (handle = mpeg2_init ()))
     return;
@@ -61,8 +62,8 @@
       mpeg2_close (handle);
       return;
     }
-  finished = 3;
-  while (0 != finished)
+  have_gop = 0;
+  while (1)
     {
       state = mpeg2_parse (handle);
       switch (state)
@@ -101,19 +102,16 @@
            ADD ("MPEG2", EXTRACTOR_METATYPE_FORMAT_VERSION);
          else
            ADD ("MPEG1", EXTRACTOR_METATYPE_FORMAT_VERSION);     
-         finished &= ~2;
          break;
        case STATE_GOP:
-         if ( (NULL != info->gop) &&
-              (0 != info->gop->pictures) )
+         if (NULL != info->gop) 
            {
-             snprintf (format, 
-                       sizeof(format),
-                       "%u:%u:%u (%u frames)",
-                       info->gop->hours,
-                       info->gop->minutes, info->gop->seconds, 
info->gop->pictures);
-             ADD (format, EXTRACTOR_METATYPE_DURATION);
-             finished &= ~1;
+             snprintf (gop_format, 
+                       sizeof (gop_format),
+                       "%02u:%02u:%02u (%u frames)",
+                       info->gop->hours, info->gop->minutes, 
info->gop->seconds,
+                       info->gop->pictures);
+             have_gop = 1;
            }
          break;
        case STATE_SLICE:
@@ -127,6 +125,8 @@
        }
     }
  EXIT:
+  if (1 == have_gop)
+    ADD (gop_format, EXTRACTOR_METATYPE_DURATION);    
   mpeg2_close (handle);
 }
 

Modified: Extractor/src/plugins/test_mpeg.c
===================================================================
--- Extractor/src/plugins/test_mpeg.c   2012-08-05 23:16:21 UTC (rev 23128)
+++ Extractor/src/plugins/test_mpeg.c   2012-08-05 23:25:37 UTC (rev 23129)
@@ -63,17 +63,14 @@
        strlen ("MPEG1") + 1,
        0 
       },
-#if 0
-      /* GOP is somehow not working for this example */
       { 
        EXTRACTOR_METATYPE_DURATION,
        EXTRACTOR_METAFORMAT_UTF8,
        "text/plain",
-       "0:0:0 (0 frames)", /* FIXME: this is obviously the wrong answer */
-       strlen ("0:0:0 (0 frames)") + 1,
+       "00:00:03 (22 frames)",
+       strlen ("00:00:03 (22 frames)") + 1,
        0 
       },
-#endif
       { 0, 0, NULL, NULL, 0, -1 }
     };
   struct ProblemSet ps[] =




reply via email to

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