[xiph-commits] r11917 - in trunk/vorbose: . src
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Thu Oct 12 10:32:38 PDT 2006
Author: xiphmont
Date: 2006-10-12 10:32:34 -0700 (Thu, 12 Oct 2006)
New Revision: 11917
Modified:
trunk/vorbose/configure.ac
trunk/vorbose/src/codebook.c
trunk/vorbose/src/codec.h
trunk/vorbose/src/floor.c
trunk/vorbose/src/info.c
trunk/vorbose/src/map.c
trunk/vorbose/src/res.c
trunk/vorbose/src/vorbose.c
Log:
Update the vorbose source to new ogg2 namespace
Modified: trunk/vorbose/configure.ac
===================================================================
--- trunk/vorbose/configure.ac 2006-10-11 14:44:12 UTC (rev 11916)
+++ trunk/vorbose/configure.ac 2006-10-12 17:32:34 UTC (rev 11917)
@@ -12,7 +12,7 @@
# Checks for libraries.
-AC_CHECK_LIB(ogg2, oggpack_eop, [], [
+AC_CHECK_LIB(ogg2, ogg2pack_eop, [], [
AC_MSG_ERROR([$PACKAGE requires libogg2])
])
Modified: trunk/vorbose/src/codebook.c
===================================================================
--- trunk/vorbose/src/codebook.c 2006-10-11 14:44:12 UTC (rev 11916)
+++ trunk/vorbose/src/codebook.c 2006-10-12 17:32:34 UTC (rev 11917)
@@ -19,7 +19,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <ogg2/ogg.h>
+#include <ogg/ogg2.h>
#include "codec.h"
extern int codebook_p;
@@ -147,7 +147,7 @@
}
}
-int vorbis_book_unpack(oggpack_buffer *opb,codebook *s){
+int vorbis_book_unpack(ogg2pack_buffer *opb,codebook *s){
char *lengthlist=0;
long quantvals=0;
long i,j;
@@ -155,8 +155,8 @@
unsigned long ret;
memset(s,0,sizeof(*s));
- oggpack_read(opb,24,&ret);
- if(oggpack_eop(opb))goto eop;
+ ogg2pack_read(opb,24,&ret);
+ if(ogg2pack_eop(opb))goto eop;
if(ret!=0x564342 && (warn_p || codebook_p || headerinfo_p)){
printf("WARN codebk: Sync sequence (0x%lx) incorrect (!=0x564342)\n"
" Corrupt codebook.\n",ret);
@@ -164,14 +164,14 @@
}
/* first the basic parameters */
- oggpack_read(opb,16,&ret);
+ ogg2pack_read(opb,16,&ret);
s->dim=ret;
- oggpack_read(opb,24,&ret);
+ ogg2pack_read(opb,24,&ret);
s->entries=ret;
/* codeword ordering.... length ordered or unordered? */
- oggpack_read(opb,1,&ret);
- if(oggpack_eop(opb))goto eop;
+ ogg2pack_read(opb,1,&ret);
+ if(ogg2pack_eop(opb))goto eop;
switch(ret){
case 0:
@@ -179,14 +179,14 @@
lengthlist=alloca(sizeof(*lengthlist)*s->entries);
/* allocated but unused entries? */
- if(oggpack_read1(opb)){
+ if(ogg2pack_read1(opb)){
/* yes, unused entries */
for(i=0;i<s->entries;i++){
- if(oggpack_read1(opb)){
+ if(ogg2pack_read1(opb)){
unsigned long num;
- oggpack_read(opb,5,&num);
- if(oggpack_eop(opb))goto eop;
+ ogg2pack_read(opb,5,&num);
+ if(ogg2pack_eop(opb))goto eop;
lengthlist[i]=num+1;
s->used_entries++;
}else
@@ -204,8 +204,8 @@
s->used_entries=s->entries;
for(i=0;i<s->entries;i++){
unsigned long num;
- oggpack_read(opb,5,&num);
- if(oggpack_eop(opb))goto eop;
+ ogg2pack_read(opb,5,&num);
+ if(ogg2pack_eop(opb))goto eop;
lengthlist[i]=num+1;
}
@@ -222,15 +222,15 @@
/* ordered */
{
unsigned long length;
- oggpack_read(opb,5,&length);
+ ogg2pack_read(opb,5,&length);
length++;
s->used_entries=s->entries;
lengthlist=alloca(sizeof(*lengthlist)*s->entries);
for(i=0;i<s->entries;){
unsigned long num;
- oggpack_read(opb,_ilog(s->entries-i),&num);
- if(oggpack_eop(opb))goto eop;
+ ogg2pack_read(opb,_ilog(s->entries-i),&num);
+ if(ogg2pack_eop(opb))goto eop;
for(j=0;j<(signed)num && i<s->entries;j++,i++)
lengthlist[i]=length;
length++;
@@ -253,7 +253,7 @@
/* Do we have a mapping to unpack? */
- oggpack_read(opb,4,&maptype);
+ ogg2pack_read(opb,4,&maptype);
if(maptype>0){
unsigned long q_min,q_del,q_bits,q_seq;
@@ -263,12 +263,12 @@
quantvals=s->entries*s->dim;
}
- oggpack_read(opb,32,&q_min);
- oggpack_read(opb,32,&q_del);
- oggpack_read(opb,4,&q_bits);
+ ogg2pack_read(opb,32,&q_min);
+ ogg2pack_read(opb,32,&q_del);
+ ogg2pack_read(opb,4,&q_bits);
q_bits++;
- oggpack_read(opb,1,&q_seq);
- if(oggpack_eop(opb))goto eop;
+ ogg2pack_read(opb,1,&q_seq);
+ if(ogg2pack_eop(opb))goto eop;
if(codebook_p)
printf(" Value mapping : %lu (%s)\n"
@@ -285,9 +285,9 @@
q_bits,q_seq?"set":"unset");
for(i=0;i<quantvals;i++)
- oggpack_read(opb,q_bits,&ret);
+ ogg2pack_read(opb,q_bits,&ret);
- if(oggpack_eop(opb))goto eop;
+ if(ogg2pack_eop(opb))goto eop;
}else{
if(codebook_p)
@@ -308,17 +308,17 @@
return -1;
}
-long vorbis_book_decode(codebook *book, oggpack_buffer *b){
+long vorbis_book_decode(codebook *book, ogg2pack_buffer *b){
unsigned long chase=0;
int read=32;
unsigned long lok;
long i;
- int eop=oggpack_look(b,read,&lok);
+ int eop=ogg2pack_look(b,read,&lok);
while(eop && read>1)
- eop = oggpack_look(b, --read, &lok);
+ eop = ogg2pack_look(b, --read, &lok);
if(eop<0){
- oggpack_adv(b,32); /* make sure to trigger EOP! */
+ ogg2pack_adv(b,32); /* make sure to trigger EOP! */
return -1;
}
@@ -330,10 +330,10 @@
chase&=0x7fffffffUL;
if(i<read){
- oggpack_adv(b,i+1);
+ ogg2pack_adv(b,i+1);
return chase;
}
- oggpack_adv(b,32); /* make sure to trigger EOP! */
+ ogg2pack_adv(b,32); /* make sure to trigger EOP! */
return -1;
}
Modified: trunk/vorbose/src/codec.h
===================================================================
--- trunk/vorbose/src/codec.h 2006-10-11 14:44:12 UTC (rev 11916)
+++ trunk/vorbose/src/codec.h 2006-10-12 17:32:34 UTC (rev 11917)
@@ -112,31 +112,31 @@
};
extern int vorbis_info_blocksize(vorbis_info *vi,ogg_int16_t zo);
-extern int vorbis_info_headerin(vorbis_info *vi,ogg_packet *op);
+extern int vorbis_info_headerin(vorbis_info *vi,ogg2_packet *op);
extern int vorbis_info_clear(vorbis_info *vi);
extern int vorbis_book_clear(codebook *b);
-extern int vorbis_book_unpack(oggpack_buffer *b,codebook *c);
-extern long vorbis_book_decode(codebook *book, oggpack_buffer *b);
+extern int vorbis_book_unpack(ogg2pack_buffer *b,codebook *c);
+extern long vorbis_book_decode(codebook *book, ogg2pack_buffer *b);
-extern int floor_info_unpack(vorbis_info *vi,oggpack_buffer *opb,
+extern int floor_info_unpack(vorbis_info *vi,ogg2pack_buffer *opb,
vorbis_info_floor *fi);
extern int res_unpack(vorbis_info_residue *info,
- vorbis_info *vi,oggpack_buffer *opb);
+ vorbis_info *vi,ogg2pack_buffer *opb);
extern int res_inverse(vorbis_info *vi,
vorbis_info_residue *info,
int *nonzero,int ch,
- oggpack_buffer *opb);
+ ogg2pack_buffer *opb);
extern int mapping_info_unpack(vorbis_info_mapping *info,vorbis_info *vi,
- oggpack_buffer *opb);
+ ogg2pack_buffer *opb);
extern int floor0_inverse(vorbis_info *vi,vorbis_info_floor0 *info,
- oggpack_buffer *opb);
+ ogg2pack_buffer *opb);
extern int floor1_inverse(vorbis_info *vi,vorbis_info_floor1 *info,
- oggpack_buffer *opb);
+ ogg2pack_buffer *opb);
extern int mapping_inverse(vorbis_info *vi,vorbis_info_mapping *info,
- oggpack_buffer *opb);
-extern int vorbis_decode(vorbis_info *vi,ogg_packet *op);
+ ogg2pack_buffer *opb);
+extern int vorbis_decode(vorbis_info *vi,ogg2_packet *op);
Modified: trunk/vorbose/src/floor.c
===================================================================
--- trunk/vorbose/src/floor.c 2006-10-11 14:44:12 UTC (rev 11916)
+++ trunk/vorbose/src/floor.c 2006-10-12 17:32:34 UTC (rev 11917)
@@ -1,6 +1,6 @@
#include <stdlib.h>
#include <stdio.h>
-#include <ogg2/ogg.h>
+#include <ogg/ogg2.h>
#include "codec.h"
extern int headerinfo_p;
@@ -18,26 +18,26 @@
}
static int floor0_info_unpack(vorbis_info *vi,
- oggpack_buffer *opb,
+ ogg2pack_buffer *opb,
vorbis_info_floor0 *info){
int j;
unsigned long ret;
- oggpack_read(opb,8,&ret);
+ ogg2pack_read(opb,8,&ret);
info->order=ret;
- oggpack_read(opb,16,&ret);
+ ogg2pack_read(opb,16,&ret);
info->rate=ret;
- oggpack_read(opb,16,&ret);
+ ogg2pack_read(opb,16,&ret);
info->barkmap=ret;
- oggpack_read(opb,6,&ret);
+ ogg2pack_read(opb,6,&ret);
info->ampbits=ret;
- oggpack_read(opb,8,&ret);
+ ogg2pack_read(opb,8,&ret);
info->ampdB=ret;
- oggpack_read(opb,4,&ret);
+ ogg2pack_read(opb,4,&ret);
info->numbooks=ret+1;
- if(oggpack_eop(opb))goto eop;
+ if(ogg2pack_eop(opb))goto eop;
if(info->order<1)goto err;
if(info->rate<1)goto err;
if(info->barkmap<1)goto err;
@@ -55,8 +55,8 @@
info->numbooks);
for(j=0;j<info->numbooks;j++){
- oggpack_read(opb,8,&ret);
- if(oggpack_eop(opb))goto eop;
+ ogg2pack_read(opb,8,&ret);
+ if(ogg2pack_eop(opb))goto eop;
info->books[j]=ret;
if(info->books[j]>=vi->books){
if(headerinfo_p || warn_p)
@@ -74,7 +74,7 @@
}
}
- if(oggpack_eop(opb))goto eop;
+ if(ogg2pack_eop(opb))goto eop;
return(0);
eop:
if(headerinfo_p || warn_p)
@@ -86,12 +86,12 @@
}
int floor0_inverse(vorbis_info *vi,vorbis_info_floor0 *info,
- oggpack_buffer *opb){
+ ogg2pack_buffer *opb){
int j;
unsigned long ampraw;
- oggpack_read(opb,info->ampbits,&raw);
- if(oggpack_eop(opb))goto eop;
+ ogg2pack_read(opb,info->ampbits,&raw);
+ if(ogg2pack_eop(opb))goto eop;
if(ampraw>0){
unsigned long booknum;
@@ -102,14 +102,14 @@
(float)ampraw/maxval*info->ampdB-info->ampdB,ampraw);
}
- oggpack_read(opb,ilog(info->numbooks),&booknum);
- if(oggpack_eop(opb))goto eop;
+ ogg2pack_read(opb,ilog(info->numbooks),&booknum);
+ if(ogg2pack_eop(opb))goto eop;
if((signed)booknum<info->numbooks){ /* be paranoid */
codebook *b=vi->book_param+info->books[booknum];
for(j=0;j<info->order;j+=b->dim)
vorbis_book_decode(b,opb);
- if(oggpack_eop(opb))goto eop;
+ if(ogg2pack_eop(opb))goto eop;
return 1;
}else{
if(packetinfo_p || warn_p)
@@ -133,23 +133,23 @@
static const int quant_look[4]={256,128,86,64};
static int floor1_info_unpack(vorbis_info *vi,
- oggpack_buffer *opb,
+ ogg2pack_buffer *opb,
vorbis_info_floor1 *info){
int j,k,count=0,maxclass=-1,rangebits;
unsigned long ret;
/* read partitions */
- oggpack_read(opb,5,&ret);
+ ogg2pack_read(opb,5,&ret);
info->partitions=ret;
if(headerinfo_p)
printf("(type 1; log piecewise)\n"
" partitions : %lu\n"
" partition classes: ",ret);
- if(oggpack_eop(opb))goto eop;
+ if(ogg2pack_eop(opb))goto eop;
for(j=0;j<info->partitions;j++){
- oggpack_read(opb,4,&ret);
- if(oggpack_eop(opb))goto eop;
+ ogg2pack_read(opb,4,&ret);
+ if(ogg2pack_eop(opb))goto eop;
info->partitionclass[j]=ret;
if(headerinfo_p){
printf("%lu",ret);
@@ -165,16 +165,16 @@
for(j=0;j<maxclass+1;j++){
if(headerinfo_p)
printf(" class %d config : ",j);
- oggpack_read(opb,3,&ret);
+ ogg2pack_read(opb,3,&ret);
info->class[j].class_dim=ret+1;
- oggpack_read(opb,2,&ret);
+ ogg2pack_read(opb,2,&ret);
info->class[j].class_subs=ret;
- if(oggpack_eop(opb)) goto eop;
+ if(ogg2pack_eop(opb)) goto eop;
if(info->class[j].class_subs){
- oggpack_read(opb,8,&ret);
+ ogg2pack_read(opb,8,&ret);
info->class[j].class_book=ret;
- if(oggpack_eop(opb)) goto eop;
+ if(ogg2pack_eop(opb)) goto eop;
if(headerinfo_p)
printf("dim=%d, subs=%d (1<<%d), book=%lu\n",
@@ -199,9 +199,9 @@
if(headerinfo_p)
printf(" (subbooks: ");
for(k=0;k<(1<<info->class[j].class_subs);k++){
- oggpack_read(opb,8,&ret);
+ ogg2pack_read(opb,8,&ret);
info->class[j].class_subbook[k]=ret-1;
- if(oggpack_eop(opb))goto eop;
+ if(ogg2pack_eop(opb))goto eop;
if(headerinfo_p){
if(info->class[j].class_subbook[k]==-1)
printf(" x");
@@ -224,13 +224,13 @@
}
/* read the post list */
- oggpack_read(opb,2,&ret);
+ ogg2pack_read(opb,2,&ret);
info->mult=ret+1; /* only 1,2,3,4 legal now */
if(headerinfo_p)
printf(" multiplier : %d (number %d)\n",quant_look[ret],
info->mult);
- oggpack_read(opb,4,&ret);
+ ogg2pack_read(opb,4,&ret);
rangebits=ret;
if(headerinfo_p)
printf(" post range : %d bits\n"
@@ -241,7 +241,7 @@
count+=info->class[info->partitionclass[j]].class_dim;
for(;k<count;k++){
int t;
- oggpack_read(opb,rangebits,&ret);
+ ogg2pack_read(opb,rangebits,&ret);
t=ret;
if(headerinfo_p){
@@ -262,7 +262,7 @@
if(headerinfo_p)
printf("\n -----------------\n");
- if(oggpack_eop(opb))goto eop;
+ if(ogg2pack_eop(opb))goto eop;
info->posts=count+2;
return 0;
@@ -276,18 +276,18 @@
}
int floor1_inverse(vorbis_info *vi,vorbis_info_floor1 *info,
- oggpack_buffer *opb){
+ ogg2pack_buffer *opb){
int i,j,k;
codebook *books=vi->book_param;
unsigned long ret;
/* unpack wrapped/predicted values from stream */
- if(oggpack_read1(opb)==1){
+ if(ogg2pack_read1(opb)==1){
int quant_q=quant_look[info->mult-1];
if(packetinfo_p)
printf("amplitude nonzero\n");
- oggpack_read(opb,ilog(quant_q-1),&ret);
- oggpack_read(opb,ilog(quant_q-1),&ret);
+ ogg2pack_read(opb,ilog(quant_q-1),&ret);
+ ogg2pack_read(opb,ilog(quant_q-1),&ret);
/* partition by partition */
/* partition by partition */
@@ -329,12 +329,12 @@
}
int floor_info_unpack(vorbis_info *vi,
- oggpack_buffer *opb,
+ ogg2pack_buffer *opb,
vorbis_info_floor *fi){
unsigned long ret,i;
- oggpack_read(opb,16,&ret);
+ ogg2pack_read(opb,16,&ret);
fi->type=ret;
- if(oggpack_eop(opb)){
+ if(ogg2pack_eop(opb)){
if(headerinfo_p || warn_p)
printf("WARN header: Premature EOP parsing floor setup.\n");
return 1;
Modified: trunk/vorbose/src/info.c
===================================================================
--- trunk/vorbose/src/info.c 2006-10-11 14:44:12 UTC (rev 11916)
+++ trunk/vorbose/src/info.c 2006-10-12 17:32:34 UTC (rev 11917)
@@ -1,7 +1,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
-#include <ogg2/ogg.h>
+#include <ogg/ogg2.h>
#include "codec.h"
extern int codebook_p;
@@ -11,7 +11,7 @@
/* Header packing/unpacking ********************************************/
-static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){
+static int _vorbis_unpack_info(vorbis_info *vi,ogg2pack_buffer *opb){
unsigned long version;
unsigned long channels;
unsigned long rate;
@@ -20,18 +20,18 @@
long bitrate_lower;
unsigned long ret;
- oggpack_read(opb,32,&version);
- oggpack_read(opb,8,&channels);
- oggpack_read(opb,32,&rate);
- oggpack_read(opb,32,&bitrate_upper);
- oggpack_read(opb,32,&bitrate_nominal);
- oggpack_read(opb,32,&bitrate_lower);
+ ogg2pack_read(opb,32,&version);
+ ogg2pack_read(opb,8,&channels);
+ ogg2pack_read(opb,32,&rate);
+ ogg2pack_read(opb,32,&bitrate_upper);
+ ogg2pack_read(opb,32,&bitrate_nominal);
+ ogg2pack_read(opb,32,&bitrate_lower);
vi->channels=channels;
- oggpack_read(opb,4,&ret);
+ ogg2pack_read(opb,4,&ret);
vi->blocksizes[0]=1<<ret;
- oggpack_read(opb,4,&ret);
+ ogg2pack_read(opb,4,&ret);
vi->blocksizes[1]=1<<ret;
ret=0;
@@ -79,7 +79,7 @@
ret=1;
}
- if((warn_p || headerinfo_p) && oggpack_eop(opb)){
+ if((warn_p || headerinfo_p) && ogg2pack_eop(opb)){
printf("WARN header: premature end of packet.\n\n");
ret=1;
}
@@ -90,7 +90,7 @@
return(ret);
}
-static int _vorbis_unpack_comment(oggpack_buffer *opb){
+static int _vorbis_unpack_comment(ogg2pack_buffer *opb){
unsigned long i,j;
unsigned long temp;
unsigned long len;
@@ -98,15 +98,15 @@
if(headerinfo_p)
printf("info header: Vorbis comment header parsed:\n");
- oggpack_read(opb,32,&len);
- if(oggpack_eop(opb))goto err_out;
+ ogg2pack_read(opb,32,&len);
+ if(ogg2pack_eop(opb))goto err_out;
if(headerinfo_p)
printf(" vendor length : %lu\n",len);
if(headerinfo_p)
printf(" vendor string : \"");
for(i=0;i<len;i++){
- oggpack_read(opb,8,&temp);
+ ogg2pack_read(opb,8,&temp);
if(headerinfo_p)
putchar((int)temp);
}
@@ -115,22 +115,22 @@
putchar('\n');
}
- oggpack_read(opb,32,&comments);
- if(oggpack_eop(opb))goto err_out;
+ ogg2pack_read(opb,32,&comments);
+ if(ogg2pack_eop(opb))goto err_out;
if(headerinfo_p)
printf(" total comments : %lu (comments follow)\n\n",
comments);
for(j=0;j<comments;j++){
- oggpack_read(opb,32,&len);
+ ogg2pack_read(opb,32,&len);
if(headerinfo_p)
printf(" comment %lu length: %lu\n",j,len);
- if(oggpack_eop(opb))goto err_out;
+ if(ogg2pack_eop(opb))goto err_out;
if(headerinfo_p)
printf(" comment %lu key : \"",j);
for(i=0;i<len;i++){
- oggpack_read(opb,8,&temp);
- if(oggpack_eop(opb))goto err_out;
+ ogg2pack_read(opb,8,&temp);
+ if(ogg2pack_eop(opb))goto err_out;
if(temp=='='){
i++;
break;
@@ -141,8 +141,8 @@
if(headerinfo_p)
printf("\"\n comment %lu value : \"",j);
for(;i<len;i++){
- oggpack_read(opb,8,&temp);
- if(oggpack_eop(opb))goto err_out;
+ ogg2pack_read(opb,8,&temp);
+ if(ogg2pack_eop(opb))goto err_out;
if(headerinfo_p)
putchar(temp);
}
@@ -157,7 +157,7 @@
return(0);
}
-static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
+static int _vorbis_unpack_books(vorbis_info *vi,ogg2pack_buffer *opb){
int i;
unsigned long ret;
@@ -165,7 +165,7 @@
printf("info header: Vorbis I setup header parsed\n\n");
/* codebooks */
- oggpack_read(opb,8,&ret);
+ ogg2pack_read(opb,8,&ret);
vi->books=ret+1;
if(headerinfo_p)
printf("info header: Codebooks: %d\n\n",vi->books);
@@ -178,20 +178,20 @@
printf("\n");
/* time backend settings, not actually used */
- oggpack_read(opb,6,&ret);
+ ogg2pack_read(opb,6,&ret);
i=ret;
for(;i>=0;i--){
- oggpack_read(opb,16,&ret);
+ ogg2pack_read(opb,16,&ret);
if(ret!=0){
if(headerinfo_p || warn_p)
printf("WARN header: Time %d is an illegal type (%lu).\n\n",
i,ret);
}
}
- if(oggpack_eop(opb))goto eop;
+ if(ogg2pack_eop(opb))goto eop;
/* floor backend settings */
- oggpack_read(opb,6,&ret);
+ ogg2pack_read(opb,6,&ret);
vi->floors=ret+1;
if(headerinfo_p)
printf("info header: Floors: %d\n\n",vi->floors);
@@ -208,7 +208,7 @@
printf("\n");
/* residue backend settings */
- oggpack_read(opb,6,&ret);
+ ogg2pack_read(opb,6,&ret);
vi->residues=ret+1;
if(headerinfo_p)
printf("info header: Residues: %d\n\n",vi->residues);
@@ -225,7 +225,7 @@
printf("\n");
/* map backend settings */
- oggpack_read(opb,6,&ret);
+ ogg2pack_read(opb,6,&ret);
vi->maps=ret+1;
if(headerinfo_p)
printf("info header: Mappings: %d\n\n",vi->maps);
@@ -243,21 +243,21 @@
printf("\n");
/* mode settings */
- oggpack_read(opb,6,&ret);
+ ogg2pack_read(opb,6,&ret);
vi->modes=ret+1;
if(headerinfo_p)
printf("info header: Modes: %d\n\n",vi->modes);
for(i=0;i<vi->modes;i++){
if(headerinfo_p)
printf("info header: Parsing mode %d\n",i);
- oggpack_read(opb,1,&ret);
- if(oggpack_eop(opb))goto eop;
+ ogg2pack_read(opb,1,&ret);
+ if(ogg2pack_eop(opb))goto eop;
vi->mode_param[i].blockflag=ret;
if(headerinfo_p)
printf(" block size flag: %lu (%d)\n",
ret,vi->blocksizes[ret]);
- oggpack_read(opb,16,&ret);
+ ogg2pack_read(opb,16,&ret);
if(ret){
if(headerinfo_p || warn_p)
printf("WARN header: Window in map %d is an illegal type (%lu).\n\n",
@@ -267,7 +267,7 @@
if(headerinfo_p)
printf(" window type : 0 (Vorbis window)\n");
- oggpack_read(opb,16,&ret);
+ ogg2pack_read(opb,16,&ret);
if(ret){
if(headerinfo_p || warn_p)
printf("WARN header: Transform in map %d is an illegal type (%lu).\n\n",
@@ -277,7 +277,7 @@
if(headerinfo_p)
printf(" transform type : 0 (MDCT)\n");
- oggpack_read(opb,8,&ret);
+ ogg2pack_read(opb,8,&ret);
vi->mode_param[i].mapping=ret;
if(vi->mode_param[i].mapping>=vi->maps){
if(headerinfo_p || warn_p)
@@ -294,7 +294,7 @@
printf("\n");
- if(oggpack_eop(opb))goto eop;
+ if(ogg2pack_eop(opb))goto eop;
return(0);
eop:
@@ -304,11 +304,11 @@
return 1;
}
-int vorbis_info_headerin(vorbis_info *vi,ogg_packet *op){
- oggpack_buffer *opb=alloca(oggpack_buffersize());
+int vorbis_info_headerin(vorbis_info *vi,ogg2_packet *op){
+ ogg2pack_buffer *opb=alloca(ogg2pack_buffersize());
if(op){
- oggpack_readinit(opb,op->packet);
+ ogg2pack_readinit(opb,op->packet);
/* Which of the three types of header is this? */
/* Also verify header-ness, vorbis */
@@ -317,9 +317,9 @@
unsigned long packtype;
int i;
- oggpack_read(opb,8,&packtype);
+ ogg2pack_read(opb,8,&packtype);
for(i=0;i<6;i++)
- oggpack_read(opb,8,temp+i);
+ ogg2pack_read(opb,8,temp+i);
if(temp[0]!='v' ||
temp[1]!='o' ||
Modified: trunk/vorbose/src/map.c
===================================================================
--- trunk/vorbose/src/map.c 2006-10-11 14:44:12 UTC (rev 11916)
+++ trunk/vorbose/src/map.c 2006-10-12 17:32:34 UTC (rev 11917)
@@ -1,7 +1,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
-#include <ogg2/ogg.h>
+#include <ogg/ogg2.h>
#include "codec.h"
extern int codebook_p;
@@ -21,13 +21,13 @@
}
int mapping_info_unpack(vorbis_info_mapping *info,vorbis_info *vi,
- oggpack_buffer *opb){
+ ogg2pack_buffer *opb){
int i;
unsigned long ret;
memset(info,0,sizeof(*info));
- oggpack_read(opb,16,&ret);
- if(oggpack_eop(opb))goto eop;
+ ogg2pack_read(opb,16,&ret);
+ if(ogg2pack_eop(opb))goto eop;
switch(ret){
case 0:
if(headerinfo_p)
@@ -40,10 +40,10 @@
return 1;
}
- if(oggpack_read1(opb)){
- oggpack_read(opb,4,&ret);
+ if(ogg2pack_read1(opb)){
+ ogg2pack_read(opb,4,&ret);
info->submaps=ret+1;
- if(oggpack_eop(opb))goto eop;
+ if(ogg2pack_eop(opb))goto eop;
if(headerinfo_p)
printf(" multi-submap mapping\n"
" submaps : %d\n",info->submaps);
@@ -55,10 +55,10 @@
" submaps : %d\n",info->submaps);
}
- if(oggpack_read1(opb)){
- oggpack_read(opb,8,&ret);
+ if(ogg2pack_read1(opb)){
+ ogg2pack_read(opb,8,&ret);
info->coupling_steps=ret+1;
- if(oggpack_eop(opb))goto eop;
+ if(ogg2pack_eop(opb))goto eop;
if(headerinfo_p)
printf(" channel coupling flag : set\n"
" coupling steps : %d\n",
@@ -68,11 +68,11 @@
unsigned long testM;
unsigned long testA;
- oggpack_read(opb,ilog(vi->channels),&testM);
- oggpack_read(opb,ilog(vi->channels),&testA);
+ ogg2pack_read(opb,ilog(vi->channels),&testM);
+ ogg2pack_read(opb,ilog(vi->channels),&testA);
info->coupling[i].mag=testM;
info->coupling[i].ang=testA;
- if(oggpack_eop(opb))goto eop;
+ if(ogg2pack_eop(opb))goto eop;
if(headerinfo_p)
printf(" coupling step %3d : %lu <-> %lu\n",
@@ -94,14 +94,14 @@
printf(" channel coupling flag: not set\n");
}
- if(oggpack_read1(opb)){
- if(oggpack_eop(opb))goto eop;
+ if(ogg2pack_read1(opb)){
+ if(ogg2pack_eop(opb))goto eop;
if(headerinfo_p || warn_p)
printf("WARN header: Reserved fields not zeroed\n\n");
goto err_out; /* 2:reserved */
}
- if(oggpack_read1(opb)){
- if(oggpack_eop(opb))goto eop;
+ if(ogg2pack_read1(opb)){
+ if(ogg2pack_eop(opb))goto eop;
if(headerinfo_p || warn_p)
printf("WARN header: Reserved fields not zeroed\n\n");
goto err_out; /* 3:reserved */
@@ -112,9 +112,9 @@
printf(" channel->submap list : ");
for(i=0;i<vi->channels;i++){
- oggpack_read(opb,4,&ret);
+ ogg2pack_read(opb,4,&ret);
info->chmuxlist[i]=ret;
- if(oggpack_eop(opb))goto eop;
+ if(ogg2pack_eop(opb))goto eop;
if(headerinfo_p)
printf("%d/%lu ",i,ret);
@@ -133,10 +133,10 @@
for(i=0;i<info->submaps;i++){
if(headerinfo_p)
printf(" submap %2d config : ",i);
- oggpack_read(opb,8,&ret);
- oggpack_read(opb,8,&ret);
+ ogg2pack_read(opb,8,&ret);
+ ogg2pack_read(opb,8,&ret);
info->submaplist[i].floor=ret;
- if(oggpack_eop(opb))goto eop;
+ if(ogg2pack_eop(opb))goto eop;
if(headerinfo_p)
printf("floor %lu, ",ret);
if(info->submaplist[i].floor>=vi->floors){
@@ -144,8 +144,8 @@
printf("WARN header: Requested floor (%lu) out of range.\n\n",ret);
goto err_out;
}
- oggpack_read(opb,8,&ret);
- if(oggpack_eop(opb))goto eop;
+ ogg2pack_read(opb,8,&ret);
+ if(ogg2pack_eop(opb))goto eop;
info->submaplist[i].residue=ret;
if(headerinfo_p)
printf("res %lu ",ret);
@@ -172,7 +172,7 @@
}
int mapping_inverse(vorbis_info *vi,vorbis_info_mapping *info,
- oggpack_buffer *opb){
+ ogg2pack_buffer *opb){
int i,j;
int *zerobundle=alloca(sizeof(*zerobundle)*vi->channels);
int *nonzero=alloca(sizeof(*nonzero)*vi->channels);
@@ -226,27 +226,27 @@
}
-int vorbis_decode(vorbis_info *vi,ogg_packet *op){
+int vorbis_decode(vorbis_info *vi,ogg2_packet *op){
int mode;
unsigned long ret;
- oggpack_buffer *opb=alloca(oggpack_buffersize());
- oggpack_readinit(opb,op->packet);
+ ogg2pack_buffer *opb=alloca(ogg2pack_buffersize());
+ ogg2pack_readinit(opb,op->packet);
if(packetinfo_p)
printf("info packet: decoding Vorbis stream packet %ld\n",
(long)op->packetno);
/* Check the packet type */
- if(oggpack_read1(opb)!=0){
+ if(ogg2pack_read1(opb)!=0){
if(warn_p || packetinfo_p)
printf("WARN packet: packet is not an audio packet! Skipping...\n\n");
return 1 ;
}
/* read our mode and pre/post windowsize */
- oggpack_read(opb,ilog(vi->modes),&ret);
+ ogg2pack_read(opb,ilog(vi->modes),&ret);
mode=ret;
- if(oggpack_eop(opb))goto eop;
+ if(ogg2pack_eop(opb))goto eop;
if(packetinfo_p)
printf(" packet mode : %d\n",mode);
if(mode>=vi->modes){
@@ -260,13 +260,13 @@
vi->blocksizes[vi->mode_param[mode].blockflag]);
if(vi->mode_param[mode].blockflag){
- oggpack_read(opb,1,&ret);
- if(oggpack_eop(opb))goto eop;
+ ogg2pack_read(opb,1,&ret);
+ if(ogg2pack_eop(opb))goto eop;
if(packetinfo_p)
printf(" previous : %d\n",
vi->blocksizes[ret!=0]);
- oggpack_read(opb,1,&ret);
- if(oggpack_eop(opb))goto eop;
+ ogg2pack_read(opb,1,&ret);
+ if(ogg2pack_eop(opb))goto eop;
if(packetinfo_p)
printf(" next : %d\n",
vi->blocksizes[ret!=0]);
Modified: trunk/vorbose/src/res.c
===================================================================
--- trunk/vorbose/src/res.c 2006-10-11 14:44:12 UTC (rev 11916)
+++ trunk/vorbose/src/res.c 2006-10-12 17:32:34 UTC (rev 11917)
@@ -1,7 +1,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <ogg2/ogg.h>
+#include <ogg/ogg2.h>
#include "codec.h"
extern int headerinfo_p;
@@ -11,25 +11,25 @@
/* vorbis_info is for range checking */
int res_unpack(vorbis_info_residue *info,
- vorbis_info *vi,oggpack_buffer *opb){
+ vorbis_info *vi,ogg2pack_buffer *opb){
int j,k;
unsigned long ret;
memset(info,0,sizeof(*info));
- oggpack_read(opb,16,&ret);
+ ogg2pack_read(opb,16,&ret);
info->type=ret;
- oggpack_read(opb,24,&ret);
+ ogg2pack_read(opb,24,&ret);
info->begin=ret;
- oggpack_read(opb,24,&ret);
+ ogg2pack_read(opb,24,&ret);
info->end=ret;
- oggpack_read(opb,24,&ret);
+ ogg2pack_read(opb,24,&ret);
info->grouping=ret+1;
- oggpack_read(opb,6,&ret);
+ ogg2pack_read(opb,6,&ret);
info->partitions=ret+1;
- oggpack_read(opb,8,&ret);
+ ogg2pack_read(opb,8,&ret);
info->groupbook=ret;
- if(oggpack_eop(opb))goto eop;
+ if(ogg2pack_eop(opb))goto eop;
if(info->type>2 || info->type<0){
if(warn_p || headerinfo_p)
@@ -67,9 +67,9 @@
for(j=0;j<info->partitions;j++){
unsigned long cascade;
- oggpack_read(opb,3,&cascade);
- if(oggpack_read1(opb)){
- oggpack_read(opb,5,&ret);
+ ogg2pack_read(opb,3,&cascade);
+ if(ogg2pack_read1(opb)){
+ ogg2pack_read(opb,5,&ret);
cascade|=(ret<<3);
}
info->stagemasks[j]=cascade;
@@ -80,7 +80,7 @@
printf(" partition %2d books: ",j);
for(k=0;k<8;k++){
if((info->stagemasks[j]>>k)&1){
- oggpack_read(opb,8,&ret);
+ ogg2pack_read(opb,8,&ret);
if((signed)ret>=vi->books){
printf("\nWARN header: requested residue book (%lu) greater than\n"
" highest numbered available codebook (%d)\n\n",
@@ -103,7 +103,7 @@
if(headerinfo_p)
printf(" ------------------\n");
- if(oggpack_eop(opb))goto eop;
+ if(ogg2pack_eop(opb))goto eop;
return 0;
eop:
if(headerinfo_p || warn_p)
@@ -117,7 +117,7 @@
int res_inverse(vorbis_info *vi,
vorbis_info_residue *info,
int *nonzero,int ch,
- oggpack_buffer *opb){
+ ogg2pack_buffer *opb){
long i,j,k,l,s,used=0;
codebook *phrasebook=vi->book_param+info->groupbook;
@@ -166,7 +166,7 @@
for(j=0;j<ch;j++){
ogg_int32_t temp=vorbis_book_decode(phrasebook,opb);
- if(oggpack_eop(opb))goto eopbreak1;
+ if(ogg2pack_eop(opb))goto eopbreak1;
/* this can be done quickly in assembly due to the quotient
always being at most six bits */
Modified: trunk/vorbose/src/vorbose.c
===================================================================
--- trunk/vorbose/src/vorbose.c 2006-10-11 14:44:12 UTC (rev 11916)
+++ trunk/vorbose/src/vorbose.c 2006-10-12 17:32:34 UTC (rev 11917)
@@ -3,7 +3,7 @@
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
-#include <ogg2/ogg.h>
+#include <ogg/ogg2.h>
#include "codec.h"
void usage(FILE *out){
@@ -48,10 +48,10 @@
{NULL,0,NULL,0}
};
-static ogg_sync_state *oy;
-static ogg_stream_state *os;
-static ogg_page og;
-static ogg_packet op;
+static ogg2_sync_state *oy;
+static ogg2_stream_state *os;
+static ogg2_page og;
+static ogg2_packet op;
static vorbis_info vi;
int codebook_p=0;
@@ -66,34 +66,34 @@
int get_data(){
unsigned char *buf;
int ret;
- buf = ogg_sync_bufferin(oy,256);
+ buf = ogg2_sync_bufferin(oy,256);
if(!buf){
- fprintf(stderr,"ERROR internal: Failed to allocate managed buffer; ogg_sync_buffer() failed.\n");
+ fprintf(stderr,"ERROR internal: Failed to allocate managed buffer; ogg2_sync_buffer() failed.\n");
exit(1);
}
ret=fread(buf,1,256,stdin);
- if(ret>0)ogg_sync_wrote(oy,ret);
+ if(ret>0)ogg2_sync_wrote(oy,ret);
return ret;
}
-void dump_page(ogg_page *og){
- oggpack_buffer *opb=alloca(oggpack_buffersize());
+void dump_page(ogg2_page *og){
+ ogg2pack_buffer *opb=alloca(ogg2pack_buffersize());
unsigned long ret,ret2,flag;
unsigned int i,count=0,postp;
unsigned long lacing[255];
- oggpack_readinit(opb,og->header);
+ ogg2pack_readinit(opb,og->header);
/* capture pattern */
- oggpack_read(opb,32,&ret);
- oggpack_read(opb,8,&ret2);
+ ogg2pack_read(opb,32,&ret);
+ ogg2pack_read(opb,8,&ret2);
printf("INFO page: Capture pattern %c%c%c%c, ",
(char)(ret),(char)(ret>>8),(char)(ret>>16),(char)(ret>>24));
/* version */
printf("format version %lu\n",ret2);
/* flags */
- oggpack_read(opb,8,&flag);
+ ogg2pack_read(opb,8,&flag);
printf(" Flags: %s%s%s",
(flag&1 ?
"packet continued from previous page"
@@ -107,24 +107,24 @@
if(!(flag&7))printf("none\n");
/* granpos */
- oggpack_read(opb,32,&ret);
- oggpack_read(opb,32,&ret2);
+ ogg2pack_read(opb,32,&ret);
+ ogg2pack_read(opb,32,&ret2);
printf("\n Granule position: 0x%08lx%08lx\n",ret2,ret);
/* serial number */
- oggpack_read(opb,32,&ret);
+ ogg2pack_read(opb,32,&ret);
printf(" Stream serialno : 0x%08lx\n",ret);
/* sequence number */
- oggpack_read(opb,32,&ret);
+ ogg2pack_read(opb,32,&ret);
printf(" Sequence number : %ld\n",ret);
/* checksum */
- oggpack_read(opb,32,&ret);
+ ogg2pack_read(opb,32,&ret);
printf(" Checksum : 0x%08lx\n",ret);
/* segments (packets) */
- oggpack_read(opb,8,&ret);
+ ogg2pack_read(opb,8,&ret);
printf(" Total segments : %ld\n",ret);
/* segment list and packet count */
for(i=0;i<ret;i++){
- oggpack_read(opb,8,lacing+i);
+ ogg2pack_read(opb,8,lacing+i);
postp=1;
if(lacing[i]<255){
count++;
@@ -209,8 +209,8 @@
/* set up sync */
- oy=ogg_sync_create();
- os=ogg_stream_create(0);
+ oy=ogg2_sync_create();
+ os=ogg2_stream_create(0);
while(!eof){
@@ -226,7 +226,7 @@
while(1){
/* is there a packet available? */
- if(ogg_stream_packetout(os,&op)>0){
+ if(ogg2_stream_packetout(os,&op)>0){
/* yes, process it */
if(packetcounter<3){
@@ -278,7 +278,7 @@
/* is there a page available? */
- ret=ogg_sync_pageseek(oy,&og);
+ ret=ogg2_sync_pageseek(oy,&og);
if(ret<0){
garbagecounter-=ret;
}
@@ -291,7 +291,7 @@
garbagecounter=0;
}
- if(initialphase && !ogg_page_bos(&og)){
+ if(initialphase && !ogg2_page_bos(&og)){
/* initial header pages phase has ended */
if(streaminfo_p || headerinfo_p){
printf("info stream: All identification header pages parsed.\n"
@@ -310,17 +310,17 @@
/* is this a stream transition? */
- if(ogg_page_bos(&og) || pagecounter==0){
+ if(ogg2_page_bos(&og) || pagecounter==0){
if(initialphase){
/* we're in a muxed stream, which is illegal for Vorbis I
audio-only, but perfectly legal for Ogg. */
if(!syncp){
/* we've not yet seen the Vorbis header go past; keep trying new streams */
- ogg_stream_reset_serialno(os,ogg_page_serialno(&og));
+ ogg2_stream_reset_serialno(os,ogg2_page_serialno(&og));
}
}else{
/* first new packet, signals new stream link. Dump the current vorbis stream, if any */
- ogg_stream_reset_serialno(os,ogg_page_serialno(&og));
+ ogg2_stream_reset_serialno(os,ogg2_page_serialno(&og));
memset(&vi,0,sizeof(vi));
packetcounter=0;
vorbis_info_clear(&vi);
@@ -328,12 +328,12 @@
initialphase++;
/* got an initial page. Is it beginning of stream? */
- if(!ogg_page_bos(&og) && pagecounter==0 && streaminfo_p)
+ if(!ogg2_page_bos(&og) && pagecounter==0 && streaminfo_p)
if(warn_p || streaminfo_p)
fprintf(stdout,"WARN stream: first page (0) is not marked beginning of stream.\n\n");
}
- ogg_stream_pagein(os,&og);
+ ogg2_stream_pagein(os,&og);
pagecounter++;
continue;
}
@@ -357,9 +357,9 @@
fprintf(stdout,"Done.\n");
- ogg_page_release(&og);
- ogg_stream_destroy(os);
- ogg_sync_destroy(oy);
+ ogg2_page_release(&og);
+ ogg2_stream_destroy(os);
+ ogg2_sync_destroy(oy);
return 0;
}
More information about the commits
mailing list