[xiph-commits] r7238 - in branches/ogg2-arc: include/ogg2 src

arc at dactyl.lonelymoon.com arc
Wed Jul 21 12:01:19 PDT 2004


Author: arc
Date: Wed Jul 21 12:01:19 2004
New Revision: 7238

Modified:
branches/ogg2-arc/include/ogg2/ogg.h
branches/ogg2-arc/src/stream.c
Log:
More work on discontinuous stream support.  I believe I've fixed the
problem from yesterday's commit, it's now honoring packet/stream
abstraction (as MikeS called it).  I have not fully tested to see if
it's handling CONT packets properly, but I believe it is.

There is now a ogg_stream_setmode function instead of adding a mode
argument to ogg_stream_create.  This was done because it doesn't change
the API for continuous codecs and because it allows the mode to be
changed after pageno 0 has been read, which is required for decoding.

I have not added decoding support for discontinuous streams yet.



Modified: branches/ogg2-arc/include/ogg2/ogg.h
===================================================================
--- branches/ogg2-arc/include/ogg2/ogg.h	2004-07-21 19:00:28 UTC (rev 7237)
+++ branches/ogg2-arc/include/ogg2/ogg.h	2004-07-21 19:01:18 UTC (rev 7238)
@@ -118,11 +118,12 @@

/* Ogg BITSTREAM PRIMITIVES: general ***************************/

-extern ogg_stream_state *ogg_stream_create(int serialno, int mode);
+extern ogg_stream_state *ogg_stream_create(int serialno);
extern int      ogg_stream_destroy(ogg_stream_state *os);
extern int      ogg_stream_reset(ogg_stream_state *os);
extern int      ogg_stream_reset_serialno(ogg_stream_state *os,int serialno);
extern int      ogg_stream_eos(ogg_stream_state *os);
+extern int	ogg_stream_setmode(ogg_stream_state *os, int mode);

extern int      ogg_page_version(ogg_page *og);
extern int      ogg_page_continued(ogg_page *og);
@@ -138,6 +139,11 @@

/* Ogg BITSTREAM PRIMITIVES: return codes ***************************/

+#define	OGG_CONT	0
+#define	OGG_DISCONT	1
+
+/* Ogg BITSTREAM PRIMITIVES: return codes ***************************/
+
#define  OGG_SUCCESS   0

#define  OGG_HOLE     -10
@@ -146,8 +152,8 @@
#define  OGG_ESERIAL  -13
#define  OGG_EINVAL   -14
#define  OGG_EEOS     -15
+#define  OGG_EMODE    -16

-
#ifdef __cplusplus
}
#endif

Modified: branches/ogg2-arc/src/stream.c
===================================================================
--- branches/ogg2-arc/src/stream.c	2004-07-21 19:00:28 UTC (rev 7237)
+++ branches/ogg2-arc/src/stream.c	2004-07-21 19:01:18 UTC (rev 7238)
@@ -23,15 +23,26 @@

/* A complete description of Ogg framing exists in docs/framing.html */

-ogg_stream_state *ogg_stream_create(int serialno, int mode){
+ogg_stream_state *ogg_stream_create(int serialno){
ogg_stream_state *os=_ogg_calloc(1,sizeof(*os));
os->watermark=4096;
os->serialno=serialno;
-  os->mode=mode;
os->bufferpool=ogg_buffer_create();
return os;
}

+int ogg_stream_setmode(ogg_stream_state *os, int mode){
+  /* (Dis)cont mode must be known and set before Page 1 is processed */
+  if(mode==0||mode==1){
+    if(os->pageno==0||(os->pageno==1&&os->packets==0)){
+      os->mode=mode;
+      return OGG_SUCCESS;
+    }
+    else printf("Error, pageno==%d, packets==%d\n", os->pageno, os->packets);
+  }
+  return OGG_EMODE;
+}
+
int ogg_stream_setfill(ogg_stream_state *os,int watermark){
if(os){
if(watermark>65535)watermark=65535;



More information about the commits mailing list