[xiph-commits] r3346 - libfishsound/branches/1.0-stable/src/libfishsound

conrad at svn.annodex.net conrad at svn.annodex.net
Fri Jan 11 20:17:02 PST 2008


Author: conrad
Date: 2008-01-11 20:17:01 -0800 (Fri, 11 Jan 2008)
New Revision: 3346

Modified:
   libfishsound/branches/1.0-stable/src/libfishsound/flac.c
Log:
decode vorbiscomments from Ogg FLAC streams


Modified: libfishsound/branches/1.0-stable/src/libfishsound/flac.c
===================================================================
--- libfishsound/branches/1.0-stable/src/libfishsound/flac.c	2008-01-12 04:04:10 UTC (rev 3345)
+++ libfishsound/branches/1.0-stable/src/libfishsound/flac.c	2008-01-12 04:17:01 UTC (rev 3346)
@@ -46,6 +46,7 @@
 #include "convert.h"
 
 /*#define DEBUG*/
+/*#define DEBUG_VERBOSE*/
 
 #if HAVE_FLAC
 
@@ -104,7 +105,7 @@
 {
   FishSound* fsound = (FishSound*)client_data;
   FishSoundFlacInfo* fi = (FishSoundFlacInfo *)fsound->codec_data;
-#ifdef DEBUG
+#ifdef DEBUG_VERBOSE
   printf("fs_flac_read_callback: IN\n");
 #endif
   if (fi->bufferlength > *bytes) {
@@ -138,7 +139,7 @@
   channels = frame->header.channels;
   blocksize = frame->header.blocksize;
 
-#ifdef DEBUG
+#ifdef DEBUG_VERBOSE
   printf("fs_flac_write_callback: IN, blocksize %d\n", blocksize);
 #endif
 
@@ -262,7 +263,7 @@
 {
   FishSoundFlacInfo *fi = fsound->codec_data;
 
-#ifdef DEBUG
+#ifdef DEBUG_VERBOSE
   printf("fs_flac_decode: IN, fi->packetno = %ld\n", fi->packetno);
 #endif
 
@@ -288,6 +289,14 @@
     if (fi->packetno ==  1) fish_sound_comments_decode (fsound, buf, bytes);
 #endif
 
+    if ((buf[0] & 0x7) == 4) {
+      int len = (buf[1]<<16) + (buf[2]<<8) + buf[3];
+#ifdef DEBUG
+      printf ("fs_flac_decode: got vorbiscomments len %d\n", len);
+#endif
+      fish_sound_comments_decode (fsound, buf+4, len);
+    }
+
     memcpy(tmp, fi->buffer, fi->bufferlength);
     memcpy(tmp+fi->bufferlength, buf, bytes);
     fi->bufferlength += bytes;



More information about the commits mailing list