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

Monty xiphmont at xiph.org
Sun Nov 5 15:50:22 PST 2000



xiphmont    00/11/05 15:50:22

  Modified:    include/ogg ogg.h os_types.h
               src      bitwise.c framing.c
  Log:
  Merge branch_beta3 onto the mainline.
  
  Monty

Revision  Changes    Path
1.7       +14 -14    ogg/include/ogg/ogg.h

Index: ogg.h
===================================================================
RCS file: /usr/local/cvsroot/ogg/include/ogg/ogg.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ogg.h	2000/10/10 05:42:34	1.6
+++ ogg.h	2000/11/05 23:50:21	1.7
@@ -35,10 +35,10 @@
   long    body_returned;         /* elements of fill returned */
 
 
-  int     *lacing_vals;    /* The values that will go to the segment table */
-  ogg_int64_t *granule_vals;      /* granulepos values for headers. Not compact
-                             this way, but it is simple coupled to the
-                             lacing fifo */
+  int     *lacing_vals;      /* The values that will go to the segment table */
+  ogg_int64_t *granule_vals; /* granulepos values for headers. Not compact
+				this way, but it is simple coupled to the
+				lacing fifo */
   long    lacing_storage;
   long    lacing_fill;
   long    lacing_packet;
@@ -51,8 +51,8 @@
                              logical bitstream */
   int     b_o_s;          /* set after we've written the initial page
                              of a logical bitstream */
-  long     serialno;
-  int      pageno;
+  long    serialno;
+  long    pageno;
   ogg_int64_t  packetno;      /* sequence number for decode; the framing
                              knows where there's a hole in the data,
                              but we need coupling so that the codec
@@ -72,12 +72,12 @@
   long  e_o_s;
 
   ogg_int64_t  granulepos;
-  ogg_int64_t  packetno;       /* sequence number for decode; the framing
-                             knows where there's a hole in the data,
-                             but we need coupling so that the codec
-                             (which is in a seperate abstraction
-                             layer) also knows about the gap */
-
+  
+  ogg_int64_t  packetno;     /* sequence number for decode; the framing
+				knows where there's a hole in the data,
+				but we need coupling so that the codec
+				(which is in a seperate abstraction
+				layer) also knows about the gap */
 } ogg_packet;
 
 typedef struct {
@@ -144,8 +144,8 @@
 extern int      ogg_page_eos(ogg_page *og);
 extern ogg_int64_t  ogg_page_granulepos(ogg_page *og);
 extern int      ogg_page_serialno(ogg_page *og);
-extern int      ogg_page_pageno(ogg_page *og);
-  extern int      ogg_page_packets(ogg_page *og);
+extern long     ogg_page_pageno(ogg_page *og);
+extern int      ogg_page_packets(ogg_page *og);
 
 
 #ifdef __cplusplus

1.2       +12 -6     ogg/include/ogg/os_types.h

Index: os_types.h
===================================================================
RCS file: /usr/local/cvsroot/ogg/include/ogg/os_types.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- os_types.h	2000/10/06 07:32:30	1.1
+++ os_types.h	2000/11/05 23:50:21	1.2
@@ -1,22 +1,28 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: #ifdef jail to whip a few platforms into the UNIX ideal.
- last mod: $Id: os_types.h,v 1.1 2000/10/06 07:32:30 jack Exp $
+ last mod: $Id: os_types.h,v 1.2 2000/11/05 23:50:21 xiphmont Exp $
 
  ********************************************************************/
 #ifndef _OS_TYPES_H
 #define _OS_TYPES_H
+
+/* make it easy on the folks that want to compile the libs with a
+   different malloc than stdlib */
+#define _ogg_malloc malloc
+#define _ogg_calloc calloc
+#define _ogg_realloc realloc
 
 #ifdef _WIN32 
 #  ifndef __GNUC__

1.3       +8 -8      ogg/src/bitwise.c

Index: bitwise.c
===================================================================
RCS file: /usr/local/cvsroot/ogg/src/bitwise.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- bitwise.c	2000/09/07 00:38:33	1.2
+++ bitwise.c	2000/11/05 23:50:21	1.3
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
   function: packing variable sized words into an octet stream
-  last mod: $Id: bitwise.c,v 1.2 2000/09/07 00:38:33 jack Exp $
+  last mod: $Id: bitwise.c,v 1.3 2000/11/05 23:50:21 xiphmont Exp $
 
  ********************************************************************/
 
@@ -36,7 +36,7 @@
 
 void oggpack_writeinit(oggpack_buffer *b){
   memset(b,0,sizeof(oggpack_buffer));
-  b->ptr=b->buffer=malloc(BUFFER_INCREMENT);
+  b->ptr=b->buffer=_ogg_malloc(BUFFER_INCREMENT);
   b->buffer[0]='\0';
   b->storage=BUFFER_INCREMENT;
 }
@@ -61,7 +61,7 @@
 /* Takes only up to 32 bits. */
 void oggpack_write(oggpack_buffer *b,unsigned long value,int bits){
   if(b->endbyte+4>=b->storage){
-    b->buffer=realloc(b->buffer,b->storage+BUFFER_INCREMENT);
+    b->buffer=_ogg_realloc(b->buffer,b->storage+BUFFER_INCREMENT);
     b->storage+=BUFFER_INCREMENT;
     b->ptr=b->buffer+b->endbyte;
   }

1.7       +24 -24    ogg/src/framing.c

Index: framing.c
===================================================================
RCS file: /usr/local/cvsroot/ogg/src/framing.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- framing.c	2000/10/10 05:46:06	1.6
+++ framing.c	2000/11/05 23:50:21	1.7
@@ -1,11 +1,11 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
  * by Monty <monty at xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
@@ -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 2000/10/10 05:46:06 xiphmont Exp $
+ last mod: $Id: framing.c,v 1.7 2000/11/05 23:50:21 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
@@ -63,7 +63,7 @@
          (og->header[17]<<24));
 }
  
-int ogg_page_pageno(ogg_page *og){
+long ogg_page_pageno(ogg_page *og){
   return(og->header[18] |
          (og->header[19]<<8) |
          (og->header[20]<<16) |
@@ -137,11 +137,11 @@
   if(os){
     memset(os,0,sizeof(ogg_stream_state));
     os->body_storage=16*1024;
-    os->body_data=malloc(os->body_storage*sizeof(char));
+    os->body_data=_ogg_malloc(os->body_storage*sizeof(char));
 
     os->lacing_storage=1024;
-    os->lacing_vals=malloc(os->lacing_storage*sizeof(int));
-    os->granule_vals=malloc(os->lacing_storage*sizeof(ogg_int64_t));
+    os->lacing_vals=_ogg_malloc(os->lacing_storage*sizeof(int));
+    os->granule_vals=_ogg_malloc(os->lacing_storage*sizeof(ogg_int64_t));
 
     /* initialize the crc_lookup table if not done */
     _ogg_crc_init();
@@ -179,15 +179,15 @@
 static void _os_body_expand(ogg_stream_state *os,int needed){
   if(os->body_storage<=os->body_fill+needed){
     os->body_storage+=(needed+1024);
-    os->body_data=realloc(os->body_data,os->body_storage);
+    os->body_data=_ogg_realloc(os->body_data,os->body_storage);
   }
 }
 
 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));
-    os->granule_vals=realloc(os->granule_vals,os->lacing_storage*sizeof(ogg_int64_t));
+    os->lacing_vals=_ogg_realloc(os->lacing_vals,os->lacing_storage*sizeof(int));
+    os->granule_vals=_ogg_realloc(os->granule_vals,os->lacing_storage*sizeof(ogg_int64_t));
   }
 }
 
@@ -462,9 +462,9 @@
     long newsize=size+oy->fill+4096; /* an extra page to be nice */
 
     if(oy->data)
-      oy->data=realloc(oy->data,newsize);
+      oy->data=_ogg_realloc(oy->data,newsize);
     else
-      oy->data=malloc(newsize);
+      oy->data=_ogg_malloc(newsize);
     oy->storage=newsize;
   }
 
@@ -627,7 +627,7 @@
   int eos=ogg_page_eos(og);
   ogg_int64_t granulepos=ogg_page_granulepos(og);
   int serialno=ogg_page_serialno(og);
-  int pageno=ogg_page_pageno(og);
+  long pageno=ogg_page_pageno(og);
   int segments=header[26];
   
   /* clean up 'returned data' */
@@ -894,12 +894,12 @@
           og->header[0],og->header[1],og->header[2],og->header[3],
           (int)og->header[4],(int)og->header[5]);
 
-  fprintf(stderr,"  granulepos: %d  serialno: %d  pageno: %d\n",
+  fprintf(stderr,"  granulepos: %d  serialno: %d  pageno: %ld\n",
           (og->header[9]<<24)|(og->header[8]<<16)|
           (og->header[7]<<8)|og->header[6],
           (og->header[17]<<24)|(og->header[16]<<16)|
           (og->header[15]<<8)|og->header[14],
-	  (og->header[21]<<24)|(og->header[20]<<16)|
+	  ((long)(og->header[21])<<24)|(og->header[20]<<16)|
           (og->header[19]<<8)|og->header[18]);
 
   fprintf(stderr,"  checksum: %02x:%02x:%02x:%02x\n  segments: %d (",
@@ -913,11 +913,11 @@
 }
 
 void copy_page(ogg_page *og){
-  unsigned char *temp=malloc(og->header_len);
+  unsigned char *temp=_ogg_malloc(og->header_len);
   memcpy(temp,og->header,og->header_len);
   og->header=temp;
 
-  temp=malloc(og->body_len);
+  temp=_ogg_malloc(og->body_len);
   memcpy(temp,og->body,og->body_len);
   og->body=temp;
 }
@@ -1114,13 +1114,13 @@
                        1,0};
 
 void test_pack(const int *pl, const int **headers){
-  unsigned char *data=malloc(1024*1024); /* for scripted test cases only */
+  unsigned char *data=_ogg_malloc(1024*1024); /* for scripted test cases only */
   long inptr=0;
   long outptr=0;
   long deptr=0;
   long depacket=0;
-  long granule_pos=7;
-  int i,j,packets,pageno=0,pageout=0;
+  long granule_pos=7,pageno=0;
+  int i,j,packets,pageout=0;
   int eosflag=0;
   int bosflag=0;
 
@@ -1154,7 +1154,7 @@
       while(ogg_stream_pageout(&os_en,&og)){
         /* We have a page.  Check it carefully */
 
-	fprintf(stderr,"%d, ",pageno);
+	fprintf(stderr,"%ld, ",pageno);
 
         if(headers[pageno]==NULL){
           fprintf(stderr,"coded too many pages!\n");
@@ -1371,7 +1371,7 @@
 
   {
     /* build a bunch of pages for testing */
-    unsigned char *data=malloc(1024*1024);
+    unsigned char *data=_ogg_malloc(1024*1024);
     int pl[]={0,100,4079,2956,2057,76,34,912,0,234,1000,1000,1000,300,-1};
     int inptr=0,i,j;
     ogg_page og[5];

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