gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r6070 - Extractor/src/plugins
Date: Mon, 31 Dec 2007 06:24:42 -0700 (MST)

Author: holindho
Date: 2007-12-31 06:24:42 -0700 (Mon, 31 Dec 2007)
New Revision: 6070

Modified:
   Extractor/src/plugins/flvextractor.c
Log:
add some metadata items


Modified: Extractor/src/plugins/flvextractor.c
===================================================================
--- Extractor/src/plugins/flvextractor.c        2007-12-31 12:59:21 UTC (rev 
6069)
+++ Extractor/src/plugins/flvextractor.c        2007-12-31 13:24:42 UTC (rev 
6070)
@@ -597,8 +597,11 @@
   FLV_WIDTH,
   FLV_HEIGHT,
   FLV_FRAMERATE,
+  FLV_STEREO,
   FLV_VDATARATE,
   FLV_ADATARATE,
+  FLV_VCODECID,
+  FLV_ACODECID,
 } FLVStreamAttribute;
 
 typedef struct {
@@ -610,8 +613,11 @@
   { "width", FLV_WIDTH },
   { "height", FLV_HEIGHT },
   { "framerate", FLV_FRAMERATE },
+  { "stereo", FLV_STEREO },
   { "videodatarate", FLV_VDATARATE },
   { "audiodatarate", FLV_ADATARATE },
+  { "videocodecid", FLV_VCODECID },
+  { "audiocodecid", FLV_ACODECID },
   { NULL, FLV_NONE }
 };
 
@@ -714,9 +720,30 @@
       case FLV_ADATARATE:
         state->streamInfo->audioDataRate = n;
         break;
+      case FLV_VCODECID:
+        if (state->streamInfo->videoCodec == -1) {
+          state->streamInfo->videoCodec = n;
+          state->streamInfo->videoCodec &= 0x07; /* prevent index overflows */
+        }
+        break;
+      case FLV_ACODECID:
+        if (state->streamInfo->audioCodec == -1) {
+          state->streamInfo->audioCodec = n;
+          state->streamInfo->audioCodec &= 0x07; /* prevent index overflows */
+        }
+        break;
     }
   }
 
+  if (state->onMetaData && (state->parsingDepth == 1) && 
+      (state->currentAttribute == FLV_STEREO) && 
+      (type == ASTYPE_BOOLEAN))
+  {
+    int n = *((int *)value);
+    if (state->streamInfo->audioChannels == -1)
+      state->streamInfo->audioChannels = (n == 0) ? 0 : 1;
+  }
+
   /* metadata that maps straight to extractor keys */
   if (state->onMetaData && (state->parsingDepth == 1) && 
       (state->currentKeyType != EXTRACTOR_UNKNOWN))
@@ -832,6 +859,7 @@
   soundSize = (*data & 0x02) >> 1;
   soundRate = (*data & 0x0C) >> 2;
   soundFormat = (*data & 0xF0) >> 4;
+  soundFormat &= 0x07;  /* prevent index overflow */
 
   stinfo->audioCodec = soundFormat;
   stinfo->audioRate = soundRate;
@@ -872,6 +900,7 @@
 
   codecId = *data & 0x0F;
   frameType = (*data & 0xF0) >> 4;
+  codecId &= 0x07; /* prevent index overflow */
   data++;
 
   /* try to get video dimensions */





reply via email to

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