[xiph-commits] r7199 - branches/ogg2-arc/src
arc at dactyl.lonelymoon.com
arc
Tue Jul 20 20:11:45 PDT 2004
Author: arc
Date: Tue Jul 20 20:11:45 2004
New Revision: 7199
Modified:
branches/ogg2-arc/src/ogginternal.h
branches/ogg2-arc/src/stream.c
Log:
Discontinuous encoding is now working with ogg_stream_state.
Am not sure this is the best way to accomplish it, however.
I'm thinking the addition of a function for setting discontinuous may be
better for decode because you won't know what kind of stream it is until
you read page0, and granulepos doesn't matter for page0, so it's ok to
switch the behavior of granulepos handling at this point.
I'll be working on this more tomarrow.
Modified: branches/ogg2-arc/src/ogginternal.h
===================================================================
--- branches/ogg2-arc/src/ogginternal.h 2004-07-21 01:35:06 UTC (rev 7198)
+++ branches/ogg2-arc/src/ogginternal.h 2004-07-21 03:11:44 UTC (rev 7199)
@@ -124,6 +124,7 @@
unsigned int watermark;
oggbyte_buffer header_build;
int continued;
+ int packets;
/* decode-side state data */
int holeflag;
Modified: branches/ogg2-arc/src/stream.c
===================================================================
--- branches/ogg2-arc/src/stream.c 2004-07-21 01:35:06 UTC (rev 7198)
+++ branches/ogg2-arc/src/stream.c 2004-07-21 03:11:44 UTC (rev 7199)
@@ -77,7 +77,7 @@
if(os->e_o_s)ctemp|=0x04; /* last page flag? */
oggbyte_set1(obb,ctemp,5);
- /* 64 bits of PCM position */
+ /* 64 bits of granule position */
if(!os->b_o_s)
oggbyte_set8(obb,0,6);
else
@@ -91,10 +91,10 @@
/* 32 bits of page counter (we have both counter and page header
because this val can roll over) */
if(os->pageno==-1)os->pageno=0; /* because someone called
- stream_reset; this would be a
- strange thing to do in an
- encode stream, but it has
- plausible uses */
+ stream_reset; this would be a
+ strange thing to do in an
+ encode stream, but it has
+ plausible uses */
oggbyte_set4(obb,os->pageno++,18);
/* CRC filled in later */
@@ -152,8 +152,9 @@
granulepos et al and then finish packet lacing */
os->body_fill+=remainder;
- os->granulepos=op->granulepos;
+ if(!os->mode||!os->packets)os->granulepos=op->granulepos;
os->packetno++; /* for the sake of completeness */
+ os->packets++; /* packets in current page, used for discontinuous */
if(op->e_o_s)os->e_o_s=1;
oggbyte_set1(&os->header_build,remainder,27+os->lacing_fill++);
@@ -201,7 +202,7 @@
if(!os->header_tail)os->header_head=0;
if(!os->body_tail)os->body_head=0;
}
-
+ os->packets = 0; /* packets in current page, used for discontinuous */
return 1;
}
@@ -412,6 +413,7 @@
os->body_fill=0;
os->lacing_fill=0;
oggbyte_clear(&os->header_build);
+ os->packets=0;
os->holeflag=0;
os->spanflag=0;
More information about the commits
mailing list