[xiph-commits] r3367 - liboggz/trunk/src/liboggz

conrad at svn.annodex.net conrad at svn.annodex.net
Sun Jan 20 18:04:28 PST 2008


Author: conrad
Date: 2008-01-20 18:04:28 -0800 (Sun, 20 Jan 2008)
New Revision: 3367

Modified:
   liboggz/trunk/src/liboggz/oggz_auto.c
Log:
decode FLAC vorbiscomments packet


Modified: liboggz/trunk/src/liboggz/oggz_auto.c
===================================================================
--- liboggz/trunk/src/liboggz/oggz_auto.c	2008-01-21 01:52:54 UTC (rev 3366)
+++ liboggz/trunk/src/liboggz/oggz_auto.c	2008-01-21 02:04:28 UTC (rev 3367)
@@ -970,6 +970,7 @@
                          ogg_packet * op)
 {
   int offset = -1;
+  long len = -1;
 
   switch (stream->content) {
     case OGGZ_CONTENT_VORBIS:
@@ -982,12 +983,22 @@
       if (op->bytes > 7 && memcmp (op->packet, "\201theora", 7) == 0)
         offset = 7;
       break;
+    case OGGZ_CONTENT_FLAC:
+      if (op->bytes > 4 && (op->packet[0] & 0x7) == 4) {
+        len = (op->packet[1]<<16) + (op->packet[2]<<8) + op->packet[3];
+        offset = 4;
+      }
     default:
       break;
   }
 
+  /* The length of the comments to decode is the rest of the packet,
+   * unless otherwise determined (ie. for FLAC) */
+  if (len == -1)
+    len = op->bytes - offset;
+
   if (offset >= 0) {
-    oggz_comments_decode (oggz, serialno, op->packet+offset, op->bytes-offset);
+    oggz_comments_decode (oggz, serialno, op->packet+offset, len);
   }
 
   return 0;



More information about the commits mailing list