[cvs-annodex] commit (/annodex): libfishsound/trunk/src/examples/Makefile.am libfishsound/trunk/src/examples/fishsound-encode.c

conrad nobody at lists.annodex.net
Mon Sep 13 11:30:08 EST 2004


Update of /annodex (new revision 569)

Modified files:
   libfishsound/trunk/src/examples/Makefile.am
   libfishsound/trunk/src/examples/fishsound-encode.c

Log Message:
hack to flush pages every 10th of a second in fishsound-encode


Modified: libfishsound/trunk/src/examples/Makefile.am
===================================================================
--- libfishsound/trunk/src/examples/Makefile.am	2004-09-13 01:29:31 UTC (rev 568)
+++ libfishsound/trunk/src/examples/Makefile.am	2004-09-13 01:30:08 UTC (rev 569)
@@ -5,7 +5,7 @@
 INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src/libfishsound \
 	$(OGGZ_CFLAGS)
 
-FISHSOUNDDIR = ../libfishsound
+FISHSOUNDDIR = $(top_builddir)/src/libfishsound
 FISHSOUND_LIBS = $(FISHSOUNDDIR)/libfishsound.la $(VORBIS_LIBS) $(SPEEX_LIBS)
 
 if HAVE_OGGZ

Modified: libfishsound/trunk/src/examples/fishsound-encode.c
===================================================================
--- libfishsound/trunk/src/examples/fishsound-encode.c	2004-09-13 01:29:31 UTC (rev 568)
+++ libfishsound/trunk/src/examples/fishsound-encode.c	2004-09-13 01:30:08 UTC (rev 569)
@@ -42,24 +42,36 @@
 #include <fishsound/fishsound.h>
 #include <sndfile.h>
 
-long serialno;
-int b_o_s = 1;
+static long serialno;
+static int b_o_s = 1;
 
+static SF_INFO sfinfo;
+static long last_flush_frameno = 0;
+
 static int
 encoded (FishSound * fsound, unsigned char * buf, long bytes, void * user_data)
 {
   OGGZ * oggz = (OGGZ *)user_data;
   ogg_packet op;
   int err;
+  int flush = 0;
+  long frameno;
 
+  frameno =  fish_sound_get_frameno (fsound);
+
   op.packet = buf;
   op.bytes = bytes;
   op.b_o_s = b_o_s;
   op.e_o_s = 0;
-  op.granulepos = 0; /* frameno */
+  op.granulepos = frameno;
   op.packetno = -1;
 
-  err = oggz_write_feed (oggz, &op, serialno, 0, NULL);
+  if (frameno - last_flush_frameno > sfinfo.samplerate / 10) {
+    flush = OGGZ_FLUSH_AFTER;
+    last_flush_frameno = frameno;
+  }
+
+  err = oggz_write_feed (oggz, &op, serialno, flush, NULL);
   if (err) printf ("err: %d\n", err);
 
   b_o_s = 0;
@@ -74,7 +86,6 @@
   FishSound * fsound;
   FishSoundInfo fsinfo;
   SNDFILE * sndfile;
-  SF_INFO sfinfo;
 
   char * infilename, * outfilename;
   char * ext = NULL;


-- 
conrad



More information about the cvs-annodex mailing list