shithub: sox

Download patch

ref: 7590072160e1322e61a641ce5d5a08ecddefe8c7
parent: 96dab95356fe1b22d85e2e6e19d74b1a4d25ab9e
author: cbagwell <cbagwell>
date: Sun Aug 18 15:19:55 EDT 2002

Update to vorbis handler.

--- a/Changelog
+++ b/Changelog
@@ -34,6 +34,8 @@
     the file just fine.
   o Bert van Leeuwen added a file handler for Psion record.app used
     for System/Alarms in some Psion devices.
+  o Richard Bannister sent in a patch to make writing vorbis files
+    work with Vorbis 1.0 libraries.
 
 sox-12.17.3
 -----------
--- a/src/vorbis.c
+++ b/src/vorbis.c
@@ -382,27 +382,31 @@
 	{
 		/* Do the main analysis, creating a packet */
 		vorbis_analysis(&ve->vb, &ve->op);
-		
+		vorbis_bitrate_addblock(&ve->vb);
+
 		/* Add packet to bitstream */
-		ogg_stream_packetin(&ve->os,&ve->op);
+		while (vorbis_bitrate_flushpacket(&ve->vd, &ve->op)) 
+		{
+		    ogg_stream_packetin(&ve->os,&ve->op);
 		
-		/* If we've gone over a page boundary, we can do actual output,
-		   so do so (for however many pages are available) */
+    		    /* If we've gone over a page boundary, we can do actual
+		     * output, so do so (for however many pages are available) 
+		     */
 		
-		while(!eos)
-		{
+    		    while(!eos)
+    		    {
 			int result = ogg_stream_pageout(&ve->os,&ve->og);
 			if(!result) break;
 			
 			ret = oe_write_page(&ve->og, ft->fp);
 			if(!ret)
-				return (ST_EOF);
+			    return (ST_EOF);
 
 			if(ogg_page_eos(&ve->og))
-				eos = 1;
+			    eos = 1;
+    		    }
 		}
 	}
- 
 
 	return (ST_SUCCESS);	
 }