[xiph-cvs] cvs commit: vorbis/examples chaining_example.c decoder_example.c seeking_example.c vorbisfile_example.c

Jack Moffitt jack at xiph.org
Mon Oct 30 12:51:22 PST 2000



jack        00/10/30 12:51:22

  Modified:    examples Tag: branch_beta3 chaining_example.c
                        decoder_example.c seeking_example.c
                        vorbisfile_example.c
  Log:
  updated examples at least check for new error codes

Revision  Changes    Path
No                   revision

No                   revision

1.6.2.1   +2 -2      vorbis/examples/chaining_example.c

Index: chaining_example.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/examples/chaining_example.c,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -u -r1.6 -r1.6.2.1
--- chaining_example.c	2000/10/12 03:12:39	1.6
+++ chaining_example.c	2000/10/30 20:51:21	1.6.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: illustrate simple use of chained bitstream and vorbisfile.a
- last mod: $Id: chaining_example.c,v 1.6 2000/10/12 03:12:39 xiphmont Exp $
+ last mod: $Id: chaining_example.c,v 1.6.2.1 2000/10/30 20:51:21 jack Exp $
 
  ********************************************************************/
 
@@ -24,7 +24,7 @@
   int i;
 
   /* open the file/pipe on stdin */
-  if(ov_open(stdin,&ov,NULL,-1)==-1){
+  if(ov_open(stdin,&ov,NULL,-1)<0){
     printf("Could not open input as an OggVorbis file.\n\n");
     exit(1);
   }

1.13.2.1  +4 -4      vorbis/examples/decoder_example.c

Index: decoder_example.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/examples/decoder_example.c,v
retrieving revision 1.13
retrieving revision 1.13.2.1
diff -u -r1.13 -r1.13.2.1
--- decoder_example.c	2000/10/12 03:12:39	1.13
+++ decoder_example.c	2000/10/30 20:51:21	1.13.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: simple example decoder
- last mod: $Id: decoder_example.c,v 1.13 2000/10/12 03:12:39 xiphmont Exp $
+ last mod: $Id: decoder_example.c,v 1.13.2.1 2000/10/30 20:51:21 jack Exp $
 
  ********************************************************************/
 
@@ -153,7 +153,7 @@
           while(i<2){
             result=ogg_stream_packetout(&os,&op);
             if(result==0)break;
-	    if(result==-1){
+	    if(result<0){
               /* Uh oh; data at some point was corrupted or missing!
                  We can't tolerate that in a header.  Die. */
               fprintf(stderr,"Corrupt secondary header.  Exiting.\n");
@@ -202,7 +202,7 @@
       while(!eos){
         int result=ogg_sync_pageout(&oy,&og);
         if(result==0)break; /* need more data */
-	if(result==-1){ /* missing or corrupt data at this page position */
+	if(result<0){ /* missing or corrupt data at this page position */
           fprintf(stderr,"Corrupt or missing data in bitstream; "
                   "continuing...\n");
         }else{
@@ -212,7 +212,7 @@
             result=ogg_stream_packetout(&os,&op);
 
             if(result==0)break; /* need more data */
-	    if(result==-1){ /* missing or corrupt data at this page position */
+	    if(result<0){ /* missing or corrupt data at this page position */
               /* no reason to complain; already complained above */
             }else{
               /* we have a packet.  Decode it */

1.4.2.1   +2 -2      vorbis/examples/seeking_example.c

Index: seeking_example.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/examples/seeking_example.c,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -r1.4 -r1.4.2.1
--- seeking_example.c	2000/10/12 03:12:39	1.4
+++ seeking_example.c	2000/10/30 20:51:21	1.4.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: illustrate seeking, and test it too
- last mod: $Id: seeking_example.c,v 1.4 2000/10/12 03:12:39 xiphmont Exp $
+ last mod: $Id: seeking_example.c,v 1.4.2.1 2000/10/30 20:51:21 jack Exp $
 
  ********************************************************************/
 
@@ -27,7 +27,7 @@
   int i;
 
   /* open the file/pipe on stdin */
-  if(ov_open(stdin,&ov,NULL,-1)==-1){
+  if(ov_open(stdin,&ov,NULL,-1)<0){
     printf("Could not open input as an OggVorbis file.\n\n");
     exit(1);
   }

1.2.2.1   +4 -8      vorbis/examples/vorbisfile_example.c

Index: vorbisfile_example.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/examples/vorbisfile_example.c,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -r1.2 -r1.2.2.1
--- vorbisfile_example.c	2000/10/12 03:12:39	1.2
+++ vorbisfile_example.c	2000/10/30 20:51:21	1.2.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: simple example decoder using vorbisfile
- last mod: $Id: vorbisfile_example.c,v 1.2 2000/10/12 03:12:39 xiphmont Exp $
+ last mod: $Id: vorbisfile_example.c,v 1.2.2.1 2000/10/30 20:51:21 jack Exp $
 
  ********************************************************************/
 
@@ -65,20 +65,16 @@
   
   while(!eof){
     long ret=ov_read(&vf,pcmout,sizeof(pcmout),0,2,1,&current_section);
-    switch(ret){
-    case 0:
+    if (ret == 0) {
       /* EOF */
       eof=1;
-      break;
-    case -1:
+    } else if (ret < 0) {
       /* error in the stream.  Not a problem, just reporting it in
          case we (the app) cares.  In this case, we don't. */
-      break;
-    default:
+    } else {
       /* we don't bother dealing with sample rate changes, etc, but
          you'll have to*/
       fwrite(pcmout,1,ret,stdout);
-      break;
     }
   }
 

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