[xiph-cvs] cvs commit: ogg/src framing.c

Monty xiphmont at xiph.org
Mon Oct 30 14:18:25 PST 2000



xiphmont    00/10/30 14:18:24

  Modified:    src      Tag: branch_beta3 framing.c
  Log:
  Not all of the previous change was necessary; backed that out in
  interests of staying streamlined.
  
  Monty

Revision  Changes    Path
No                   revision

No                   revision

1.6.2.2   +15 -48    ogg/src/framing.c

Index: framing.c
===================================================================
RCS file: /usr/local/cvsroot/ogg/src/framing.c,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -u -r1.6.2.1 -r1.6.2.2
--- framing.c	2000/10/30 08:03:35	1.6.2.1
+++ framing.c	2000/10/30 22:18:24	1.6.2.2
@@ -13,7 +13,7 @@
 
  function: code raw [Vorbis] packets into framed OggSquish stream and
            decode Ogg streams back into raw packets
- last mod: $Id: framing.c,v 1.6.2.1 2000/10/30 08:03:35 xiphmont Exp $
+ last mod: $Id: framing.c,v 1.6.2.2 2000/10/30 22:18:24 xiphmont Exp $
 
  note: The CRC code is directly derived from public domain code by
  Ross Williams (ross at guest.adelaide.edu.au).  See docs/framing.html
@@ -158,7 +158,6 @@
   if(os){
     if(os->body_data)free(os->body_data);
     if(os->lacing_vals)free(os->lacing_vals);
-    if(os->page_vals)free(os->page_vals);
     if(os->granule_vals)free(os->granule_vals);
 
     memset(os,0,sizeof(ogg_stream_state));    
@@ -184,7 +183,7 @@
   }
 }
 
-static void _os_lacing_expand_en(ogg_stream_state *os,int needed){
+static void _os_lacing_expand(ogg_stream_state *os,int needed){
   if(os->lacing_storage<=os->lacing_fill+needed){
     os->lacing_storage+=(needed+32);
     os->lacing_vals=realloc(os->lacing_vals,os->lacing_storage*sizeof(int));
@@ -192,23 +191,6 @@
   }
 }
 
-static void _os_lacing_expand_de(ogg_stream_state *os,int needed){
-  if(os->lacing_storage<=os->lacing_fill+needed){
-    os->lacing_storage+=(needed+32);
-    os->lacing_vals=realloc(os->lacing_vals,os->lacing_storage*sizeof(int));
-
-    if(!os->page_vals)
-      os->page_vals=malloc(os->lacing_storage*sizeof(long));
-    else
-      os->page_vals=realloc(os->page_vals,os->lacing_storage*sizeof(long));
-
-    os->granule_vals=realloc(os->granule_vals,os->lacing_storage*sizeof(ogg_int64_t));
-  }else{
-    if(!os->page_vals)
-      os->page_vals=malloc(os->lacing_storage*sizeof(long));
-  }
-}
-
 /* checksum the page */
 /* Direct table CRC; note that this will be faster in the future if we
    perform the checksum silmultaneously with other copies */
@@ -246,7 +228,7 @@
  
   /* make sure we have the buffer storage */
   _os_body_expand(os,op->bytes);
-  _os_lacing_expand_en(os,lacing_vals);
+  _os_lacing_expand(os,lacing_vals);
 
   /* Copy in the submitted packet.  Yes, the copy is a waste; this is
      the liability of overly clean abstraction for the time being.  It
@@ -666,8 +648,6 @@
       if(os->lacing_fill-lr){
         memmove(os->lacing_vals,os->lacing_vals+lr,
                 (os->lacing_fill-lr)*sizeof(int));
-	memmove(os->page_vals,os->page_vals+lr,
-		(os->lacing_fill-lr)*sizeof(long));
         memmove(os->granule_vals,os->granule_vals+lr,
                 (os->lacing_fill-lr)*sizeof(ogg_int64_t));
       }
@@ -681,7 +661,7 @@
   if(serialno!=os->serialno)return(-1);
   if(version>0)return(-1);
 
-  _os_lacing_expand_de(os,segments+1);
+  _os_lacing_expand(os,segments+1);
 
   /* are we in sequence? */
   if(pageno!=os->pageno){
@@ -725,7 +705,6 @@
     while(segptr<segments){
       int val=header[27+segptr];
       os->lacing_vals[os->lacing_fill]=val;
-      os->page_vals[os->lacing_fill]=pageno;
       os->granule_vals[os->lacing_fill]=-1;
       
       if(bos){
@@ -826,7 +805,6 @@
     }
 
     op->packetno=os->packetno;
-    op->pageno=os->page_vals[ptr];
     op->granulepos=os->granule_vals[ptr];
     op->bytes=bytes;
 
@@ -843,7 +821,7 @@
 ogg_stream_state os_en, os_de;
 ogg_sync_state oy;
 
-void checkpacket(ogg_packet *op,int len, int no, int pos, int pageno){
+void checkpacket(ogg_packet *op,int len, int no, int pos){
   long j;
   static int sequence=0;
   static int lastno=0;
@@ -852,10 +830,6 @@
     fprintf(stderr,"incorrect packet length!\n");
     exit(1);
   }
-  if(op->pageno!=pageno){
-    fprintf(stderr,"incorrect pageno in packet!\n");
-    exit(1);
-  }
   if(op->granulepos!=pos){
     fprintf(stderr,"incorrect packet position!\n");
     exit(1);
@@ -1216,13 +1190,6 @@
             while(ogg_stream_packetout(&os_de,&op_de)>0){
               
               /* verify the packet! */
-	      /* check page assignment */
-	      if(op_de.pageno!=ogg_page_pageno(&og_de)){
-		fprintf(stderr,"packet completion pageno %ld != pageno %ld!\n",
-			op_de.pageno,ogg_page_pageno(&og_de));
-		exit(1);
-	      }
-
               /* check data */
               if(memcmp(data+depacket,op_de.packet,op_de.bytes)){
                 fprintf(stderr,"packet data mismatch in decode! pos=%ld\n",
@@ -1464,19 +1431,19 @@
       /* do we get the expected results/packets? */
       
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,0,0,0,0);
+      checkpacket(&test,0,0,0);
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,100,1,-1,1);
+      checkpacket(&test,100,1,-1);
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,4079,2,3000,1);
+      checkpacket(&test,4079,2,3000);
       if(ogg_stream_packetout(&os_de,&test)!=-1){
         fprintf(stderr,"Error: loss of page did not return error\n");
         exit(1);
       }
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,76,5,-1,3);
+      checkpacket(&test,76,5,-1);
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,34,6,-1,3);
+      checkpacket(&test,34,6,-1);
       fprintf(stderr,"ok.\n");
     }
 
@@ -1511,19 +1478,19 @@
       /* do we get the expected results/packets? */
       
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,0,0,0,0);
+      checkpacket(&test,0,0,0);
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,100,1,-1,1);
+      checkpacket(&test,100,1,-1);
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,4079,2,3000,1);
+      checkpacket(&test,4079,2,3000);
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,2956,3,4000,2);
+      checkpacket(&test,2956,3,4000);
       if(ogg_stream_packetout(&os_de,&test)!=-1){
         fprintf(stderr,"Error: loss of page did not return error\n");
         exit(1);
       }
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,300,13,14000,4);
+      checkpacket(&test,300,13,14000);
       fprintf(stderr,"ok.\n");
     }
     

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