[xiph-cvs] cvs commit: vorbis/examples encoder_example.c
Michael Smith
msmith at xiph.org
Wed Sep 6 06:28:34 PDT 2000
msmith 00/09/06 06:28:34
Modified: examples Tag: branch_postbeta2 encoder_example.c
Log:
Changes to flush pages after the header packets, so that everyone copying
the example code gets it right. This is just the same change as was made to
oggenc (and vorbiscomment)
Revision Changes Path
No revision
No revision
1.13.2.2 +12 -2 vorbis/examples/encoder_example.c
Index: encoder_example.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/examples/encoder_example.c,v
retrieving revision 1.13.2.1
retrieving revision 1.13.2.2
diff -u -r1.13.2.1 -r1.13.2.2
--- encoder_example.c 2000/08/31 08:59:58 1.13.2.1
+++ encoder_example.c 2000/09/06 13:28:33 1.13.2.2
@@ -12,7 +12,7 @@
********************************************************************
function: simple example encoder
- last mod: $Id: encoder_example.c,v 1.13.2.1 2000/08/31 08:59:58 xiphmont Exp $
+ last mod: $Id: encoder_example.c,v 1.13.2.2 2000/09/06 13:28:33 msmith Exp $
********************************************************************/
@@ -113,7 +113,17 @@
ogg_stream_packetin(&os,&header_comm);
ogg_stream_packetin(&os,&header_code);
- /* no need to write out here. We'll get to that in the main loop */
+ /* We don't have to write out here, but doing so makes streaming
+ * much easier, so we do, flushing ALL pages. This ensures the actual
+ * audio data will start on a new page
+ */
+ while(!eos){
+ int result=ogg_stream_flush(&os,&og);
+ if(result==0)break;
+ fwrite(og.header,1,og.header_len,stdout);
+ fwrite(og.body,1,og.body_len,stdout);
+ }
+
}
while(!eos){
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list