[xiph-commits] r7252 - in branches/ogg2-arc: include/ogg2 src
arc at dactyl.lonelymoon.com
arc
Wed Jul 21 16:22:56 PDT 2004
Author: arc
Date: Wed Jul 21 16:22:56 2004
New Revision: 7252
Modified:
branches/ogg2-arc/include/ogg2/ogg.h
branches/ogg2-arc/src/stream.c
Log:
Turned OGG_DISCONT into a flag, changed the conditionals to treat it as
such to make it easier to add additional modes in the future, if extra
modes are ever needed.
Have not yet grokked much of the decoding side of stream.c. Added a
conditional for discont mode on line 490, but much of the coding style
confuses me, such as why adv is tested twice, seperatly, without
(apparently) any possibility of modification between the two
conditionals on lines 504 and 527.
Need to either consult with Monty or spend more hours grokking..
Modified: branches/ogg2-arc/include/ogg2/ogg.h
===================================================================
--- branches/ogg2-arc/include/ogg2/ogg.h 2004-07-21 21:51:11 UTC (rev 7251)
+++ branches/ogg2-arc/include/ogg2/ogg.h 2004-07-21 23:22:54 UTC (rev 7252)
@@ -137,9 +137,8 @@
extern int ogg_packet_release(ogg_packet *op);
extern int ogg_page_release(ogg_page *og);
-/* Ogg BITSTREAM PRIMITIVES: return codes ***************************/
+/* Ogg BITSTREAM PRIMITIVES: mode flags *****************************/
-#define OGG_CONT 0
#define OGG_DISCONT 1
/* Ogg BITSTREAM PRIMITIVES: return codes ***************************/
Modified: branches/ogg2-arc/src/stream.c
===================================================================
--- branches/ogg2-arc/src/stream.c 2004-07-21 21:51:11 UTC (rev 7251)
+++ branches/ogg2-arc/src/stream.c 2004-07-21 23:22:54 UTC (rev 7252)
@@ -32,8 +32,11 @@
}
int ogg_stream_setmode(ogg_stream_state *os, int mode){
+ /* I don't know what extra modes may be needed, but we might as well
+ provide support for them in the API. */
+
/* (Dis)cont mode must be known and set before Page 1 is processed */
- if(mode==0||mode==1){
+ if(mode&1){
if(os->pageno==0||(os->pageno==1&&os->packets==0)){
os->mode=mode;
return OGG_SUCCESS;
@@ -143,7 +146,7 @@
oggbyte_init(&os->header_build,0,os->bufferpool);
/* for discontinuous mode */
- if(os->mode&&!os->packets)os->granulepos=op->granulepos;
+ if(os->mode&1&&!os->packets)os->granulepos=op->granulepos;
os->packets++;
/* concat packet data */
@@ -166,7 +169,7 @@
granulepos et al and then finish packet lacing */
os->body_fill+=remainder;
- if(!os->mode)os->granulepos=op->granulepos;
+ if(!(os->mode&1))os->granulepos=op->granulepos;
os->packetno++; /* for the sake of completeness */
if(op->e_o_s)os->e_o_s=1;
oggbyte_set1(&os->header_build,remainder,27+os->lacing_fill++);
@@ -484,10 +487,17 @@
op->e_o_s=os->e_o_s;
else
op->e_o_s=0;
- if( (os->body_fill&FINFLAG) && !(os->body_fill_next&FINFLAG) )
- op->granulepos=os->granulepos;
- else
- op->granulepos=-1;
+ if(os->mode&1){
+ /* Discontinuous Mode */
+ printf("Not yet..\n");
+
+ }else{
+ /* Continuous Mode */
+ if( (os->body_fill&FINFLAG) && !(os->body_fill_next&FINFLAG) )
+ op->granulepos=os->granulepos;
+ else
+ op->granulepos=-1;
+ }
op->packetno=os->packetno;
}
More information about the commits
mailing list