[xiph-cvs] cvs commit: vorbis/examples chaining_example.c encoder_example.c

Monty xiphmont at xiph.org
Wed Nov 21 22:19:53 PST 2001



xiphmont    01/11/21 22:19:53

  Modified:    examples Tag: branch_monty_20011009 chaining_example.c
                        encoder_example.c
  Log:
  Bitrate management mark II running and running mcorrectly in 'full
  blown' mode.  Testing to continue.

Revision  Changes    Path
No                   revision

No                   revision

1.13.2.1  +6 -3      vorbis/examples/chaining_example.c

Index: chaining_example.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/examples/chaining_example.c,v
retrieving revision 1.13
retrieving revision 1.13.2.1
diff -u -r1.13 -r1.13.2.1
--- chaining_example.c	2001/09/17 01:06:18	1.13
+++ chaining_example.c	2001/11/22 06:19:52	1.13.2.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: illustrate simple use of chained bitstream and vorbisfile.a
- last mod: $Id: chaining_example.c,v 1.13 2001/09/17 01:06:18 cwolf Exp $
+ last mod: $Id: chaining_example.c,v 1.13.2.1 2001/11/22 06:19:52 xiphmont Exp $
 
  ********************************************************************/
 
@@ -60,10 +60,13 @@
            ov_serialnumber(&ov,i));
     printf("\t\theader length: %ld bytes\n",(long)
            (ov.dataoffsets[i]-ov.offsets[i]));
-    printf("\t\tcompressed length: %ld bytes ",(long)(ov_raw_total(&ov,i)));
-    printf(" play time: %lds\n",(long)ov_time_total(&ov,i));
+    printf("\t\tcompressed length: %ld bytes\n",(long)(ov_raw_total(&ov,i)));
+    printf("\t\tuncompressed length: %ld bytes\n",
+	   (long)(ov_pcm_total(&ov,i))*vi->channels*2+44);
+    printf("\t\tplay time: %lds\n",(long)ov_time_total(&ov,i));
   }
 
   ov_clear(&ov);
   return 0;
 }
+

1.27.2.3  +20 -17    vorbis/examples/encoder_example.c

Index: encoder_example.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/examples/encoder_example.c,v
retrieving revision 1.27.2.2
retrieving revision 1.27.2.3
diff -u -r1.27.2.2 -r1.27.2.3
--- encoder_example.c	2001/10/11 20:34:14	1.27.2.2
+++ encoder_example.c	2001/11/22 06:19:52	1.27.2.3
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: simple example encoder
- last mod: $Id: encoder_example.c,v 1.27.2.2 2001/10/11 20:34:14 xiphmont Exp $
+ last mod: $Id: encoder_example.c,v 1.27.2.3 2001/11/22 06:19:52 xiphmont Exp $
 
  ********************************************************************/
 
@@ -176,24 +176,27 @@
        block for encoding now */
     while(vorbis_analysis_blockout(&vd,&vb)==1){
 
-      /* analysis */
-      vorbis_analysis(&vb,&op);
-      
-      /* weld the packet into the bitstream */
-      ogg_stream_packetin(&os,&op);
-
-      /* write out pages (if any) */
-      while(!eos){
-	int result=ogg_stream_pageout(&os,&og);
-	if(result==0)break;
-	fwrite(og.header,1,og.header_len,stdout);
-	fwrite(og.body,1,og.body_len,stdout);
+      /* analysis, assume we want to use bitrate management */
+      vorbis_analysis(&vb,NULL);
+      vorbis_bitrate_addblock(&vb);
 
-	/* this could be set above, but for illustrative purposes, I do
-	   it here (to show that vorbis does know where the stream ends) */
+      while(vorbis_bitrate_flushpacket(&vd,&op)){
         
-	if(ogg_page_eos(&og))eos=1;
-
+	/* weld the packet into the bitstream */
+	ogg_stream_packetin(&os,&op);
+	
+	/* write out pages (if any) */
+	while(!eos){
+	  int result=ogg_stream_pageout(&os,&og);
+	  if(result==0)break;
+	  fwrite(og.header,1,og.header_len,stdout);
+	  fwrite(og.body,1,og.body_len,stdout);
+	  
+	  /* this could be set above, but for illustrative purposes, I do
+	     it here (to show that vorbis does know where the stream ends) */
+	  
+	  if(ogg_page_eos(&og))eos=1;
+	}
       }
     }
   }

--- >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