[xiph-commits] r9025 - trunk/py-ogg2/src
arc at motherfish-iii.xiph.org
arc at motherfish-iii.xiph.org
Thu Mar 3 06:05:46 PST 2005
Author: arc
Date: 2005-03-03 06:05:43 -0800 (Thu, 03 Mar 2005)
New Revision: 9025
Modified:
trunk/py-ogg2/src/module.c
trunk/py-ogg2/src/packbuff.c
trunk/py-ogg2/src/packbuff.h
trunk/py-ogg2/src/packet.c
trunk/py-ogg2/src/packet.h
trunk/py-ogg2/src/page.c
trunk/py-ogg2/src/page.h
trunk/py-ogg2/src/stream.c
trunk/py-ogg2/src/stream.h
trunk/py-ogg2/src/sync.c
trunk/py-ogg2/src/sync.h
Log:
This should make py-ogg2 compatable with the current /branches/ogg2-arc
Modified: trunk/py-ogg2/src/module.c
===================================================================
--- trunk/py-ogg2/src/module.c 2005-03-03 12:56:20 UTC (rev 9024)
+++ trunk/py-ogg2/src/module.c 2005-03-03 14:05:43 UTC (rev 9025)
@@ -57,8 +57,6 @@
PyModule_AddStringConstant(module, "__doc__", docstring);
PyModule_AddStringConstant(module, "__version__", "2.0-pre_20040721");
- PyModule_AddIntConstant(module, "Ogg_Discont", OGG_DISCONT);
-
if (PyErr_Occurred())
PyErr_SetString(PyExc_ImportError, "ogg2: init failed");
}
Modified: trunk/py-ogg2/src/packbuff.c
===================================================================
--- trunk/py-ogg2/src/packbuff.c 2005-03-03 12:56:20 UTC (rev 9024)
+++ trunk/py-ogg2/src/packbuff.c 2005-03-03 14:05:43 UTC (rev 9025)
@@ -99,19 +99,19 @@
&PyOggPackBuffer_Type);
if (ret == NULL) return NULL;
ret->msb_flag = 0;
- PyOggPackBuffer_AsOggPackBuffer(ret) = PyMem_Malloc(oggpack_buffersize());
+ PyOggPackBuffer_AsOggPackBuffer(ret) = PyMem_Malloc(ogg2pack_buffersize());
if ( packetobj ) {
ret->write_flag = 0;
ret->packetobj = packetobj; /* Must keep packet around for now! */
Py_INCREF(((PyOggPackBufferObject *) ret)->packetobj);
- oggpack_readinit(PyOggPackBuffer_AsOggPackBuffer(ret),
+ ogg2pack_readinit(PyOggPackBuffer_AsOggPackBuffer(ret),
PyOggPacket_AsOggPacket(packetobj)->packet);
return (PyObject *)ret;
}
ret->write_flag = 1;
- oggpack_writeinit(PyOggPackBuffer_AsOggPackBuffer(ret),
- ogg_buffer_create());
+ ogg2pack_writeinit(PyOggPackBuffer_AsOggPackBuffer(ret),
+ ogg2_buffer_create());
return (PyObject *)ret;
}
@@ -131,19 +131,19 @@
&PyOggPackBuffer_Type);
if (ret == NULL) return NULL;
ret->msb_flag = 1;
- PyOggPackBuffer_AsOggPackBuffer(ret) = PyMem_Malloc(oggpack_buffersize());
+ PyOggPackBuffer_AsOggPackBuffer(ret) = PyMem_Malloc(ogg2pack_buffersize());
if ( packetobj ) {
ret->write_flag = 0;
ret->packetobj = packetobj; /* Must keep packet around for now! */
Py_INCREF(((PyOggPackBufferObject *) ret)->packetobj);
- oggpack_readinit(PyOggPackBuffer_AsOggPackBuffer(ret),
+ ogg2pack_readinit(PyOggPackBuffer_AsOggPackBuffer(ret),
PyOggPacket_AsOggPacket(packetobj)->packet);
return (PyObject *)ret;
}
ret->write_flag = 1;
- oggpack_writeinit(PyOggPackBuffer_AsOggPackBuffer(ret),
- ogg_buffer_create());
+ ogg2pack_writeinit(PyOggPackBuffer_AsOggPackBuffer(ret),
+ ogg2_buffer_create());
return (PyObject *)ret;
}
@@ -154,9 +154,9 @@
if ( ((PyOggPackBufferObject *) self)->write_flag ) {
if ( ((PyOggPackBufferObject *) self)->write_flag == 1 ) {
if ( ((PyOggPackBufferObject *) self)->msb_flag )
- oggpackB_writeclear(PyOggPackBuffer_AsOggPackBuffer(self));
+ ogg2packB_writeclear(PyOggPackBuffer_AsOggPackBuffer(self));
else
- oggpack_writeclear(PyOggPackBuffer_AsOggPackBuffer(self));
+ ogg2pack_writeclear(PyOggPackBuffer_AsOggPackBuffer(self));
}
}
else /* Release the packet being read */
@@ -189,9 +189,9 @@
return NULL;
if ( ((PyOggPackBufferObject *) self)->msb_flag )
- ret = oggpackB_bytes(PyOggPackBuffer_AsOggPackBuffer(self));
+ ret = ogg2packB_bytes(PyOggPackBuffer_AsOggPackBuffer(self));
else
- ret = oggpack_bytes(PyOggPackBuffer_AsOggPackBuffer(self));
+ ret = ogg2pack_bytes(PyOggPackBuffer_AsOggPackBuffer(self));
return PyLong_FromLong(ret);
}
@@ -204,9 +204,9 @@
return NULL;
if ( ((PyOggPackBufferObject *) self)->msb_flag )
- ret = oggpackB_bits(PyOggPackBuffer_AsOggPackBuffer(self));
+ ret = ogg2packB_bits(PyOggPackBuffer_AsOggPackBuffer(self));
else
- ret = oggpack_bits(PyOggPackBuffer_AsOggPackBuffer(self));
+ ret = ogg2pack_bits(PyOggPackBuffer_AsOggPackBuffer(self));
return PyLong_FromLong(ret);
}
@@ -218,9 +218,9 @@
return NULL;
if ( ((PyOggPackBufferObject *) self)->msb_flag )
- oggpackB_writeclear(PyOggPackBuffer_AsOggPackBuffer(self));
+ ogg2packB_writeclear(PyOggPackBuffer_AsOggPackBuffer(self));
else
- oggpack_writeclear(PyOggPackBuffer_AsOggPackBuffer(self));
+ ogg2pack_writeclear(PyOggPackBuffer_AsOggPackBuffer(self));
Py_INCREF(Py_None);
return Py_None;
}
@@ -237,9 +237,9 @@
if ( bits == 1 ) {
if ( ((PyOggPackBufferObject *) self)->msb_flag )
- ret = oggpackB_look1(PyOggPackBuffer_AsOggPackBuffer(self));
+ ret = ogg2packB_look1(PyOggPackBuffer_AsOggPackBuffer(self));
else
- ret = oggpack_look1(PyOggPackBuffer_AsOggPackBuffer(self));
+ ret = ogg2pack_look1(PyOggPackBuffer_AsOggPackBuffer(self));
return PyLong_FromLong(ret);
}
@@ -249,9 +249,9 @@
}
if ( ((PyOggPackBufferObject *) self)->msb_flag )
- ret = oggpackB_look(PyOggPackBuffer_AsOggPackBuffer(self), bits, &num);
+ ret = ogg2packB_look(PyOggPackBuffer_AsOggPackBuffer(self), bits, &num);
else
- ret = oggpack_look(PyOggPackBuffer_AsOggPackBuffer(self), bits, &num);
+ ret = ogg2pack_look(PyOggPackBuffer_AsOggPackBuffer(self), bits, &num);
if ( ret == 0 )
return PyLong_FromLong(num);
Py_INCREF(Py_None);
@@ -271,9 +271,9 @@
if ( bits == 1 ) {
if ( ((PyOggPackBufferObject *) self)->msb_flag )
- ret = oggpackB_read1(PyOggPackBuffer_AsOggPackBuffer(self));
+ ret = ogg2packB_read1(PyOggPackBuffer_AsOggPackBuffer(self));
else
- ret = oggpack_read1(PyOggPackBuffer_AsOggPackBuffer(self));
+ ret = ogg2pack_read1(PyOggPackBuffer_AsOggPackBuffer(self));
return PyInt_FromLong(ret);
}
@@ -284,9 +284,9 @@
if ( ((PyOggPackBufferObject *) self)->msb_flag )
- ret = oggpackB_read(PyOggPackBuffer_AsOggPackBuffer(self), bits, &num);
+ ret = ogg2packB_read(PyOggPackBuffer_AsOggPackBuffer(self), bits, &num);
else
- ret = oggpack_read(PyOggPackBuffer_AsOggPackBuffer(self), bits, &num);
+ ret = ogg2pack_read(PyOggPackBuffer_AsOggPackBuffer(self), bits, &num);
if ( ret == 0 )
return PyInt_FromLong(num);
Py_INCREF(Py_None);
@@ -304,14 +304,14 @@
if ( bits == 1 )
if ( ((PyOggPackBufferObject *) self)->msb_flag )
- oggpackB_adv1(PyOggPackBuffer_AsOggPackBuffer(self));
+ ogg2packB_adv1(PyOggPackBuffer_AsOggPackBuffer(self));
else
- oggpack_adv1(PyOggPackBuffer_AsOggPackBuffer(self));
+ ogg2pack_adv1(PyOggPackBuffer_AsOggPackBuffer(self));
else
if ( ((PyOggPackBufferObject *) self)->msb_flag )
- oggpackB_adv(PyOggPackBuffer_AsOggPackBuffer(self), bits);
+ ogg2packB_adv(PyOggPackBuffer_AsOggPackBuffer(self), bits);
else
- oggpack_adv(PyOggPackBuffer_AsOggPackBuffer(self), bits);
+ ogg2pack_adv(PyOggPackBuffer_AsOggPackBuffer(self), bits);
Py_INCREF(Py_None);
return Py_None;
@@ -333,9 +333,9 @@
}
if ( ((PyOggPackBufferObject *) self)->msb_flag )
- oggpackB_write(PyOggPackBuffer_AsOggPackBuffer(self), val, bits);
+ ogg2packB_write(PyOggPackBuffer_AsOggPackBuffer(self), val, bits);
else
- oggpack_write(PyOggPackBuffer_AsOggPackBuffer(self), val, bits);
+ ogg2pack_write(PyOggPackBuffer_AsOggPackBuffer(self), val, bits);
Py_INCREF(Py_None);
return Py_None;
@@ -345,7 +345,7 @@
static PyObject *
PyOggPackBuffer_Packetout(PyObject *self, PyObject *args)
{
- ogg_packet *op;
+ ogg2_packet *op;
PyOggPacketObject *packetobj;
if (!PyArg_ParseTuple(args, ""))
@@ -355,15 +355,16 @@
op = packetobj->packet;
if ( ((PyOggPackBufferObject *) self)->msb_flag ) {
- op->packet = oggpackB_writebuffer(PyOggPackBuffer_AsOggPackBuffer(self));
- op->bytes = oggpackB_bytes(PyOggPackBuffer_AsOggPackBuffer(self));
+ op->packet = ogg2packB_writebuffer(PyOggPackBuffer_AsOggPackBuffer(self));
+ op->bytes = ogg2packB_bytes(PyOggPackBuffer_AsOggPackBuffer(self));
} else {
- op->packet = oggpackB_writebuffer(PyOggPackBuffer_AsOggPackBuffer(self));
- op->bytes = oggpackB_bytes(PyOggPackBuffer_AsOggPackBuffer(self));
+ op->packet = ogg2packB_writebuffer(PyOggPackBuffer_AsOggPackBuffer(self));
+ op->bytes = ogg2packB_bytes(PyOggPackBuffer_AsOggPackBuffer(self));
}
op->b_o_s = 0;
op->e_o_s = 0;
- op->granulepos = 0;
+ op->top_granule = 0;
+ op->end_granule = 0;
op->packetno = 0;
((PyOggPackBufferObject *) self)->write_flag = 2;
@@ -374,7 +375,7 @@
static PyObject *
PyOggPackBuffer_Repr(PyObject *self)
{
- oggpack_buffer *ob = PyOggPackBuffer_AsOggPackBuffer(self);
+ ogg2pack_buffer *ob = PyOggPackBuffer_AsOggPackBuffer(self);
char buf[256];
if ( ((PyOggPackBufferObject *) self)->write_flag == 2 ) {
Modified: trunk/py-ogg2/src/packbuff.h
===================================================================
--- trunk/py-ogg2/src/packbuff.h 2005-03-03 12:56:20 UTC (rev 9024)
+++ trunk/py-ogg2/src/packbuff.h 2005-03-03 14:05:43 UTC (rev 9025)
@@ -7,7 +7,7 @@
PyObject_HEAD
int msb_flag; /* 0 = LSb (standard), 1 = MSb */
int write_flag; /* 0 = read, 1 = write, 2 = dead write */
- oggpack_buffer *buffer;
+ ogg2pack_buffer *buffer;
PyOggPacketObject *packetobj; /* temporary workaround */
} PyOggPackBufferObject;
Modified: trunk/py-ogg2/src/packet.c
===================================================================
--- trunk/py-ogg2/src/packet.c 2005-03-03 12:56:20 UTC (rev 9024)
+++ trunk/py-ogg2/src/packet.c 2005-03-03 14:05:43 UTC (rev 9025)
@@ -59,7 +59,8 @@
static PyMethodDef PyOggPacket_methods[] = {
{"bos", NULL},
{"eos", NULL},
- {"granulepos", NULL},
+ {"top_granule", NULL},
+ {"end_granule", NULL},
{"packetno", NULL},
{NULL, NULL}
};
@@ -67,7 +68,7 @@
PyOggPacketObject *
PyOggPacket_Alloc()
{
- ogg_packet *packet;
+ ogg2_packet *packet;
PyOggPacketObject *ret;
ret = (PyOggPacketObject *) PyObject_NEW(PyOggPacketObject,
@@ -77,12 +78,12 @@
ret->valid_flag = 1;
- ret->packet = PyMem_New(ogg_packet, 1);
+ ret->packet = PyMem_New(ogg2_packet, 1);
if (ret->packet == NULL) {
PyObject_Del(ret);
return NULL;
}
- memset(ret->packet, 0, sizeof(ogg_packet));
+ memset(ret->packet, 0, sizeof(ogg2_packet));
return ret;
}
@@ -90,7 +91,7 @@
static void
PyOggPacket_Dealloc(PyObject *self)
{
- ogg_packet_release(PyOggPacket_AsOggPacket(self));
+ ogg2_packet_release(PyOggPacket_AsOggPacket(self));
PyMem_Del(PyOggPacket_AsOggPacket(self));
PyObject_DEL(self);
}
@@ -118,8 +119,10 @@
return PyLong_FromLong(PyOggPacket_AsOggPacket(self)->b_o_s);
if (strcmp(name, "eos") == 0)
return PyLong_FromLong(PyOggPacket_AsOggPacket(self)->e_o_s);
- if (strcmp(name, "granulepos") == 0)
- return PyLong_FromLongLong(PyOggPacket_AsOggPacket(self)->granulepos);
+ if (strcmp(name, "top_granule") == 0)
+ return PyLong_FromLongLong(PyOggPacket_AsOggPacket(self)->top_granule);
+ if (strcmp(name, "end_granule") == 0)
+ return PyLong_FromLongLong(PyOggPacket_AsOggPacket(self)->end_granule);
if (strcmp(name, "packetno") == 0)
return PyLong_FromLongLong(PyOggPacket_AsOggPacket(self)->packetno);
return Py_FindMethod(PyOggPacket_methods, self, name);
@@ -146,13 +149,20 @@
PyOggPacket_AsOggPacket(self)->e_o_s = v;
return 0;
}
- if (strcmp(name, "granulepos") == 0) {
+ if (strcmp(name, "top_granule") == 0) {
ogg_int64_t v;
if (!arg_to_int64(value, &v))
return -1;
- PyOggPacket_AsOggPacket(self)->granulepos = v;
+ PyOggPacket_AsOggPacket(self)->top_granule = v;
return 0;
}
+ if (strcmp(name, "end_granule") == 0) {
+ ogg_int64_t v;
+ if (!arg_to_int64(value, &v))
+ return -1;
+ PyOggPacket_AsOggPacket(self)->end_granule = v;
+ return 0;
+ }
if (strcmp(name, "packetno") == 0) {
ogg_int64_t v;
if (!arg_to_int64(value, &v))
@@ -178,10 +188,11 @@
bos = PyOggPacket_AsOggPacket(self)->b_o_s ? "BOS, " : "";
eos = PyOggPacket_AsOggPacket(self)->e_o_s ? "EOS, " : "";
- sprintf(buf, "<OggPacket, %s%spacketno = %lld, granulepos = %lld,"
- " length = %ld at %p (%p)>", bos, eos,
+ sprintf(buf, "<OggPacket, %s%spacketno = %lld, topgranule = %lld,"
+ " endgranule = %lld, length = %ld at %p (%p)>", bos, eos,
PyOggPacket_AsOggPacket(self)->packetno,
- PyOggPacket_AsOggPacket(self)->granulepos,
+ PyOggPacket_AsOggPacket(self)->top_granule,
+ PyOggPacket_AsOggPacket(self)->end_granule,
PyOggPacket_AsOggPacket(self)->bytes, self,
PyOggPacket_AsOggPacket(self)->packet);
return PyString_FromString(buf);
Modified: trunk/py-ogg2/src/packet.h
===================================================================
--- trunk/py-ogg2/src/packet.h 2005-03-03 12:56:20 UTC (rev 9024)
+++ trunk/py-ogg2/src/packet.h 2005-03-03 14:05:43 UTC (rev 9025)
@@ -6,7 +6,7 @@
typedef struct {
PyObject_HEAD
int valid_flag;
- ogg_packet *packet;
+ ogg2_packet *packet;
} PyOggPacketObject;
extern PyTypeObject PyOggPacket_Type;
Modified: trunk/py-ogg2/src/page.c
===================================================================
--- trunk/py-ogg2/src/page.c 2005-03-03 12:56:20 UTC (rev 9024)
+++ trunk/py-ogg2/src/page.c 2005-03-03 14:05:43 UTC (rev 9025)
@@ -71,7 +71,7 @@
PyOggPageObject *
PyOggPage_Alloc() {
- ogg_page *page;
+ ogg2_page *page;
PyOggPageObject *ret;
ret = (PyOggPageObject *) PyObject_NEW(PyOggPageObject, &PyOggPage_Type);
@@ -79,7 +79,7 @@
return NULL;
ret->valid_flag = 1;
- page = PyMem_New(ogg_page, 1);
+ page = PyMem_New(ogg2_page, 1);
if (page == NULL) {
PyObject_Del(ret);
return NULL;
@@ -92,7 +92,7 @@
static void
PyOggPage_Dealloc(PyObject *self) {
- ogg_page_release(PyOggPage_AsOggPage(self));
+ ogg2_page_release(PyOggPage_AsOggPage(self));
PyMem_Del(PyOggPage_AsOggPage(self));
PyObject_Del(self);
}
@@ -112,7 +112,7 @@
static PyObject*
PyOggPage_Getattr(PyObject *self, char *name) {
- ogg_page *page;
+ ogg2_page *page;
if (((PyOggPageObject *) self)->valid_flag == 0) {
PyErr_SetString(PyOggPage_Error, "this page is no longer usable.");
@@ -122,21 +122,21 @@
page = PyOggPage_AsOggPage(self);
if (strcmp(name, "bos") == 0)
- return Py_TrueFalse(ogg_page_bos(page));
+ return Py_TrueFalse(ogg2_page_bos(page));
if (strcmp(name, "continued") == 0)
- return Py_TrueFalse(ogg_page_continued(page));
+ return Py_TrueFalse(ogg2_page_continued(page));
if (strcmp(name, "eos") == 0)
- return Py_TrueFalse(ogg_page_eos(page));
+ return Py_TrueFalse(ogg2_page_eos(page));
if (strcmp(name, "granulepos") == 0)
- return PyLong_FromLongLong(ogg_page_granulepos(page));
+ return PyLong_FromLongLong(ogg2_page_granulepos(page));
if (strcmp(name, "packets") == 0)
- return PyInt_FromLong(ogg_page_packets(page));
+ return PyInt_FromLong(ogg2_page_packets(page));
if (strcmp(name, "pageno") == 0)
- return PyInt_FromLong(ogg_page_pageno(page));
+ return PyInt_FromLong(ogg2_page_pageno(page));
if (strcmp(name, "serialno") == 0)
- return PyInt_FromLong(ogg_page_serialno(page));
+ return PyInt_FromLong(ogg2_page_serialno(page));
if (strcmp(name, "version") == 0)
- return PyInt_FromLong(ogg_page_version(page));
+ return PyInt_FromLong(ogg2_page_version(page));
return Py_FindMethod(PyOggPage_methods, self, name);
}
@@ -153,7 +153,7 @@
PyErr_SetString(PyExc_ValueError, "value must be type INT");
return -1;
}
- ogg_page_set_bos(PyOggPage_AsOggPage(self), v);
+ ogg2_page_set_bos(PyOggPage_AsOggPage(self), v);
return 0;
}
if (strcmp(name, "continued") == 0) {
@@ -162,7 +162,7 @@
PyErr_SetString(PyExc_ValueError, "value must be type INT");
return -1;
}
- ogg_page_set_continued(PyOggPage_AsOggPage(self), v);
+ ogg2_page_set_continued(PyOggPage_AsOggPage(self), v);
return 0;
}
if (strcmp(name, "eos") == 0) {
@@ -171,7 +171,7 @@
PyErr_SetString(PyExc_ValueError, "value must be type INT");
return -1;
}
- ogg_page_set_eos(PyOggPage_AsOggPage(self), v);
+ ogg2_page_set_eos(PyOggPage_AsOggPage(self), v);
return 0;
}
if (strcmp(name, "granulepos") == 0) {
@@ -180,7 +180,7 @@
PyErr_SetString(PyExc_ValueError, "value must be type INT");
return -1;
}
- ogg_page_set_granulepos(PyOggPage_AsOggPage(self), v);
+ ogg2_page_set_granulepos(PyOggPage_AsOggPage(self), v);
return 0;
}
if (strcmp(name, "pageno") == 0) {
@@ -189,7 +189,7 @@
PyErr_SetString(PyExc_ValueError, "value must be type INT");
return -1;
}
- ogg_page_set_pageno(PyOggPage_AsOggPage(self), v);
+ ogg2_page_set_pageno(PyOggPage_AsOggPage(self), v);
return 0;
}
if (strcmp(name, "serialno") == 0) {
@@ -198,7 +198,7 @@
PyErr_SetString(PyExc_ValueError, "value must be type INT");
return -1;
}
- ogg_page_set_serialno(PyOggPage_AsOggPage(self), v);
+ ogg2_page_set_serialno(PyOggPage_AsOggPage(self), v);
return 0;
}
if (strcmp(name, "version") == 0) {
@@ -226,17 +226,17 @@
return PyString_FromString(buf);
}
- bos = ogg_page_bos(PyOggPage_AsOggPage(self)) ? "BOS, " : "";
- eos = ogg_page_eos(PyOggPage_AsOggPage(self)) ? "EOS, " : "";
- cont = ogg_page_continued(PyOggPage_AsOggPage(self)) ? "CONT, " : "";
+ bos = ogg2_page_bos(PyOggPage_AsOggPage(self)) ? "BOS, " : "";
+ eos = ogg2_page_eos(PyOggPage_AsOggPage(self)) ? "EOS, " : "";
+ cont = ogg2_page_continued(PyOggPage_AsOggPage(self)) ? "CONT, " : "";
sprintf(buf, "<OggPage, %s%s%spageno = %ld, granulepos = %lld,"
" packets = %d, serialno = %d, version = %d,"
" head length = %ld, body length = %ld, at %p (%p)>",
- cont, bos, eos, ogg_page_pageno(PyOggPage_AsOggPage(self)),
- ogg_page_granulepos(PyOggPage_AsOggPage(self)),
- ogg_page_packets(PyOggPage_AsOggPage(self)),
- ogg_page_serialno(PyOggPage_AsOggPage(self)),
- ogg_page_version(PyOggPage_AsOggPage(self)),
+ cont, bos, eos, ogg2_page_pageno(PyOggPage_AsOggPage(self)),
+ ogg2_page_granulepos(PyOggPage_AsOggPage(self)),
+ ogg2_page_packets(PyOggPage_AsOggPage(self)),
+ ogg2_page_serialno(PyOggPage_AsOggPage(self)),
+ ogg2_page_version(PyOggPage_AsOggPage(self)),
PyOggPage_AsOggPage(self)->header_len,
PyOggPage_AsOggPage(self)->body_len,
self, PyOggPage_AsOggPage(self));
Modified: trunk/py-ogg2/src/page.h
===================================================================
--- trunk/py-ogg2/src/page.h 2005-03-03 12:56:20 UTC (rev 9024)
+++ trunk/py-ogg2/src/page.h 2005-03-03 14:05:43 UTC (rev 9025)
@@ -6,7 +6,7 @@
typedef struct {
PyObject_HEAD
int valid_flag;
- ogg_page *page;
+ ogg2_page *page;
} PyOggPageObject;
#define PyOggPage_AsOggPage(x) ( ((PyOggPageObject *) (x))->page )
Modified: trunk/py-ogg2/src/stream.c
===================================================================
--- trunk/py-ogg2/src/stream.c 2005-03-03 12:56:20 UTC (rev 9024)
+++ trunk/py-ogg2/src/stream.c 2005-03-03 14:05:43 UTC (rev 9025)
@@ -23,7 +23,7 @@
FDEF(PyOggStreamState_Packetpeek) "Extract a packet from the stream";
FDEF(PyOggStreamState_Reset) "Reset the stream state";
FDEF(PyOggStreamState_Eos) "Return whether the end of the stream is reached.";
-FDEF(PyOggStreamState_Setmode) "Set stream mode for (dis)continuous.";
+FDEF(PyOggStreamState_Setdiscont) "Set discontinuous stream mode.";
PyTypeObject PyOggStreamState_Type = {
PyObject_HEAD_INIT(NULL)
@@ -71,15 +71,15 @@
METH_VARARGS, PyOggStreamState_Reset_Doc},
{"eos", PyOggStreamState_Eos,
METH_VARARGS, PyOggStreamState_Eos_Doc},
- {"setmode", PyOggStreamState_Setmode,
- METH_VARARGS, PyOggStreamState_Setmode_Doc},
+ {"setdiscont", PyOggStreamState_Setdiscont,
+ METH_VARARGS, PyOggStreamState_Setdiscont_Doc},
{NULL, NULL}
};
static void
PyOggStreamState_Dealloc(PyObject *self)
{
- ogg_stream_destroy(PyOggStreamState_AsOggStreamState(self));
+ ogg2_stream_destroy(PyOggStreamState_AsOggStreamState(self));
PyObject_DEL(self);
}
@@ -97,7 +97,7 @@
if (ret == NULL)
return NULL;
- ret->stream = ogg_stream_create(serialno);
+ ret->stream = ogg2_stream_create(serialno);
if (ret->stream == NULL) {
PyObject_DEL(ret);
return NULL;
@@ -130,18 +130,18 @@
return NULL;
}
- ret = ogg_stream_packetin(PyOggStreamState_AsOggStreamState(self),
- PyOggPacket_AsOggPacket(packet));
- if (ret == OGG_SUCCESS) {
+ ret = ogg2_stream_packetin(PyOggStreamState_AsOggStreamState(self),
+ PyOggPacket_AsOggPacket(packet));
+ if (ret == OGG2_SUCCESS) {
Py_INCREF(Py_None);
packet->valid_flag = 0;
return Py_None;
}
- if (ret == OGG_EEOS) {
+ if (ret == OGG2_EEOS) {
PyErr_SetString(PyOgg_Error, "EOS has been set on this stream");
return NULL;
}
- PyErr_SetString(PyOgg_Error, "error in ogg_stream_packetin");
+ PyErr_SetString(PyOgg_Error, "error in ogg2_stream_packetin");
return NULL;
}
@@ -160,8 +160,8 @@
PyErr_SetString(PyOgg_Error, "Out of Memory.");
return NULL;
}
- ret = ogg_stream_pageout(PyOggStreamState_AsOggStreamState(self),
- PyOggPage_AsOggPage(pageobj));
+ ret = ogg2_stream_pageout(PyOggStreamState_AsOggStreamState(self),
+ PyOggPage_AsOggPage(pageobj));
if ( ret == 1 ) return (PyObject *) pageobj;
Py_DECREF(pageobj);
Py_INCREF(Py_None);
@@ -183,8 +183,8 @@
PyErr_SetString(PyOgg_Error, "Out of Memory.");
return NULL;
}
- ret = ogg_stream_flush(PyOggStreamState_AsOggStreamState(self),
- PyOggPage_AsOggPage(pageobj));
+ ret = ogg2_stream_flush(PyOggStreamState_AsOggStreamState(self),
+ PyOggPage_AsOggPage(pageobj));
if ( ret == 1 ) return (PyObject *) pageobj;
Py_DECREF(pageobj);
Py_INCREF(Py_None);
@@ -207,22 +207,22 @@
return NULL;
}
- ret = ogg_stream_pagein(PyOggStreamState_AsOggStreamState(self),
- PyOggPage_AsOggPage(page));
- if (ret == OGG_SUCCESS) {
+ ret = ogg2_stream_pagein(PyOggStreamState_AsOggStreamState(self),
+ PyOggPage_AsOggPage(page));
+ if (ret == OGG2_SUCCESS) {
Py_INCREF(Py_None);
page->valid_flag = 0;
return Py_None;
}
- if (ret == OGG_ESERIAL) {
+ if (ret == OGG2_ESERIAL) {
PyErr_SetString(PyOgg_Error, "Page serial does not match stream.");
return NULL;
}
- if (ret == OGG_EVERSION) {
+ if (ret == OGG2_EVERSION) {
PyErr_SetString(PyOgg_Error, "Unknown Ogg page version.");
return NULL;
}
- PyErr_SetString(PyOgg_Error, "Unknown return from ogg_stream_pagein.");
+ PyErr_SetString(PyOgg_Error, "Unknown return from ogg2_stream_pagein.");
return NULL;
}
@@ -242,8 +242,8 @@
return NULL;
}
- ret = ogg_stream_packetout(PyOggStreamState_AsOggStreamState(self),
- PyOggPacket_AsOggPacket(packetobj));
+ ret = ogg2_stream_packetout(PyOggStreamState_AsOggStreamState(self),
+ PyOggPacket_AsOggPacket(packetobj));
if (ret == 1) return (PyObject *) packetobj;
Py_DECREF(packetobj);
@@ -251,15 +251,15 @@
Py_INCREF(Py_None);
return Py_None;
}
- if (ret == OGG_HOLE ) {
+ if (ret == OGG2_HOLE ) {
PyErr_SetString(PyOgg_Error, "Hole in data, stream is desynced.");
return NULL;
}
- if (ret == OGG_SPAN) {
+ if (ret == OGG2_SPAN) {
PyErr_SetString(PyOgg_Error, "Stream spans ??.");
return NULL;
}
- PyErr_SetString(PyOgg_Error, "Unknown return from ogg_stream_packetout.");
+ PyErr_SetString(PyOgg_Error, "Unknown return from ogg2_stream_packetout.");
return NULL;
}
@@ -268,9 +268,9 @@
PyOggStreamState_Packetpeek(PyObject *self, PyObject *args)
{
int ret;
- ogg_packet *packet;
+ ogg2_packet *packet;
- ret = ogg_stream_packetout(PyOggStreamState_AsOggStreamState(self), packet);
+ ret = ogg2_stream_packetout(PyOggStreamState_AsOggStreamState(self), packet);
if (ret == 1) {
Py_INCREF(Py_True);
return Py_True;
@@ -279,15 +279,15 @@
Py_INCREF(Py_False);
return Py_False;
}
- if (ret == OGG_HOLE ) {
+ if (ret == OGG2_HOLE ) {
PyErr_SetString(PyOgg_Error, "Hole in data, stream is desynced.");
return NULL;
}
- if (ret == OGG_SPAN) {
+ if (ret == OGG2_SPAN) {
PyErr_SetString(PyOgg_Error, "Stream spans ??.");
return NULL;
}
- PyErr_SetString(PyOgg_Error, "Unknown return from ogg_stream_packetout.");
+ PyErr_SetString(PyOgg_Error, "Unknown return from ogg2_stream_packetout.");
return NULL;
}
@@ -302,11 +302,12 @@
return NULL;
if ( serialno == -1 )
- ret = ogg_stream_reset(PyOggStreamState_AsOggStreamState(self));
+ ret = ogg2_stream_reset(PyOggStreamState_AsOggStreamState(self));
else
- ret = ogg_stream_reset_serialno(PyOggStreamState_AsOggStreamState(self),serialno);
+ ret = ogg2_stream_reset_serialno(PyOggStreamState_AsOggStreamState(self),
+ serialno);
- if ( ret == OGG_SUCCESS ) {
+ if ( ret == OGG2_SUCCESS ) {
Py_INCREF(Py_None);
return Py_None;
} else {
@@ -324,7 +325,7 @@
if (!PyArg_ParseTuple(args, ""))
return NULL;
- eos = ogg_stream_eos(PyOggStreamState_AsOggStreamState(self));
+ eos = ogg2_stream_eos(PyOggStreamState_AsOggStreamState(self));
if ( eos == 0 ) {
Py_INCREF(Py_False);
return Py_False;
@@ -334,25 +335,24 @@
}
static PyObject*
-PyOggStreamState_Setmode(PyObject *self, PyObject *args)
+PyOggStreamState_Setdiscont(PyObject *self, PyObject *args)
{
- int mode;
int ret;
- if (!PyArg_ParseTuple(args, "i", &mode))
+ if (!PyArg_ParseTuple(args, ""))
return NULL;
- ret = ogg_stream_setmode(PyOggStreamState_AsOggStreamState(self), mode);
+ ret = ogg2_stream_setdiscont(PyOggStreamState_AsOggStreamState(self));
- if ( ret == OGG_SUCCESS ) {
+ if ( ret == OGG2_SUCCESS ) {
Py_INCREF(Py_None);
return Py_None;
}
- if ( ret == OGG_EMODE ) {
- PyErr_SetString(PyOgg_Error, "Cannot set this stream mode at this time.");
+ if ( ret == OGG2_EINVAL ) {
+ PyErr_SetString(PyOgg_Error, "Cannot change to discontinuous mode at this time.");
return NULL;
}
- PyErr_SetString(PyOgg_Error, "Unknown error while setting stream mode");
+ PyErr_SetString(PyOgg_Error, "Unknown error while changing to discontinuous stream mode");
return NULL;
}
Modified: trunk/py-ogg2/src/stream.h
===================================================================
--- trunk/py-ogg2/src/stream.h 2005-03-03 12:56:20 UTC (rev 9024)
+++ trunk/py-ogg2/src/stream.h 2005-03-03 14:05:43 UTC (rev 9025)
@@ -5,7 +5,7 @@
typedef struct {
PyObject_HEAD
- ogg_stream_state *stream;
+ ogg2_stream_state *stream;
} PyOggStreamStateObject;
extern PyTypeObject PyOggStreamState_Type;
Modified: trunk/py-ogg2/src/sync.c
===================================================================
--- trunk/py-ogg2/src/sync.c 2005-03-03 12:56:20 UTC (rev 9024)
+++ trunk/py-ogg2/src/sync.c 2005-03-03 14:05:43 UTC (rev 9025)
@@ -18,7 +18,7 @@
FDEF(PyOggSyncState_Reset) "Reset the PyOggSyncState object.";
FDEF(PyOggSyncState_Write) "Append bytes from a string.";
FDEF(PyOggSyncState_Input) "Append bytes from a file.";
-FDEF(PyOggSyncState_Pageout) "Add an Ogg page to the syn.";
+FDEF(PyOggSyncState_Pageout) "Add an Ogg page to the sync";
PyTypeObject PyOggSyncState_Type = {
PyObject_HEAD_INIT(NULL)
@@ -79,7 +79,7 @@
if (ret == NULL)
return NULL;
- ret->sync = ogg_sync_create();
+ ret->sync = ogg2_sync_create();
return (PyObject *) ret;
}
@@ -87,7 +87,7 @@
static void
PyOggSyncState_Dealloc(PyObject *self)
{
- ogg_sync_destroy(PyOggSyncState_AsOggSyncState(self));
+ ogg2_sync_destroy(PyOggSyncState_AsOggSyncState(self));
PyObject_DEL(self);
}
@@ -115,15 +115,15 @@
return NULL;
}
- ret = ogg_sync_pagein(PyOggSyncState_AsOggSyncState(self),
- PyOggPage_AsOggPage(page));
+ ret = ogg2_sync_pagein(PyOggSyncState_AsOggSyncState(self),
+ PyOggPage_AsOggPage(page));
- if (ret == OGG_SUCCESS) {
+ if (ret == OGG2_SUCCESS) {
Py_INCREF(Py_None);
page->valid_flag = 0;
return Py_None;
}
- PyErr_SetString(PyOgg_Error, "Unknown return from ogg_sync_pagein.");
+ PyErr_SetString(PyOgg_Error, "Unknown return from ogg2_sync_pagein.");
return NULL;
}
@@ -134,15 +134,15 @@
int ret;
int ask_bytes;
int got_bytes;
- unsigned char *ogg_buffer;
+ unsigned char *oggbuffer;
char *pybuffer;
PyObject *pybufferobj;
if (!PyArg_ParseTuple(args, "i", &ask_bytes))
return NULL;
- got_bytes = ogg_sync_bufferout(PyOggSyncState_AsOggSyncState(self),
- &ogg_buffer);
+ got_bytes = ogg2_sync_bufferout(PyOggSyncState_AsOggSyncState(self),
+ &oggbuffer);
if ( got_bytes < ask_bytes ) ask_bytes = got_bytes;
@@ -150,13 +150,13 @@
PyObject_AsWriteBuffer(pybufferobj, (void **) &pybuffer, &got_bytes);
if ( got_bytes < ask_bytes ) ask_bytes = got_bytes;
if ( got_bytes == 0 ) return pybufferobj; /* If 0, return it now */
- memcpy(pybuffer, ogg_buffer, ask_bytes);
+ memcpy(pybuffer, oggbuffer, ask_bytes);
- ret = ogg_sync_read(PyOggSyncState_AsOggSyncState(self), ask_bytes);
- if (ret == OGG_SUCCESS) return pybufferobj;
+ ret = ogg2_sync_read(PyOggSyncState_AsOggSyncState(self), ask_bytes);
+ if (ret == OGG2_SUCCESS) return pybufferobj;
Py_DECREF(pybufferobj);
- PyErr_SetString(PyOgg_Error, "Unknown return from ogg_sync_read.");
+ PyErr_SetString(PyOgg_Error, "Unknown return from ogg2_sync_read.");
return NULL;
}
@@ -166,7 +166,7 @@
int ret;
int ask_bytes = -1;
int got_bytes;
- unsigned char *ogg_buffer;
+ unsigned char *oggbuffer;
FILE *fp;
PyObject *pyfile;
@@ -174,19 +174,19 @@
return NULL;
if ( ask_bytes < 0 ) ask_bytes = 4096;
- fp = PyFile_AsFile(pyfile);
+ fp = PyFile_AsFile(pyfile);
- got_bytes = ogg_sync_bufferout(PyOggSyncState_AsOggSyncState(self),
- &ogg_buffer);
+ got_bytes = ogg2_sync_bufferout(PyOggSyncState_AsOggSyncState(self),
+ &oggbuffer);
if ( got_bytes == 0 ) return PyInt_FromLong(0);
if ( got_bytes < ask_bytes ) ask_bytes = got_bytes;
- fwrite(ogg_buffer, 1, ask_bytes, fp);
+ fwrite(oggbuffer, 1, ask_bytes, fp);
- ret = ogg_sync_read(PyOggSyncState_AsOggSyncState(self), ask_bytes);
- if (ret == OGG_SUCCESS) return PyInt_FromLong(ask_bytes);
+ ret = ogg2_sync_read(PyOggSyncState_AsOggSyncState(self), ask_bytes);
+ if (ret == OGG2_SUCCESS) return PyInt_FromLong(ask_bytes);
- PyErr_SetString(PyOgg_Error, "Unknown return from ogg_sync_read.");
+ PyErr_SetString(PyOgg_Error, "Unknown return from ogg2_sync_read.");
return NULL;
}
@@ -199,12 +199,12 @@
if (!PyArg_ParseTuple(args, ""))
return NULL;
- ret = ogg_sync_reset(PyOggSyncState_AsOggSyncState(self));
- if (ret == OGG_SUCCESS) {
+ ret = ogg2_sync_reset(PyOggSyncState_AsOggSyncState(self));
+ if (ret == OGG2_SUCCESS) {
Py_INCREF(Py_None);
return Py_None;
}
- PyErr_SetString(PyOgg_Error, "Unknown error from ogg_sync_reset.");
+ PyErr_SetString(PyOgg_Error, "Unknown error from ogg2_sync_reset.");
return NULL;
}
@@ -215,20 +215,20 @@
int ret;
char *bytes;
int byte_count;
- char *ogg_buffer;
+ char *oggbuffer;
if (!PyArg_ParseTuple(args, "s#", &bytes, &byte_count))
return NULL;
- ogg_buffer = ogg_sync_bufferin(PyOggSyncState_AsOggSyncState(self),
+ oggbuffer = ogg2_sync_bufferin(PyOggSyncState_AsOggSyncState(self),
byte_count);
- memcpy(ogg_buffer, bytes, byte_count);
- ret = ogg_sync_wrote(PyOggSyncState_AsOggSyncState(self), byte_count);
- if (ret == OGG_SUCCESS) {
+ memcpy(oggbuffer, bytes, byte_count);
+ ret = ogg2_sync_wrote(PyOggSyncState_AsOggSyncState(self), byte_count);
+ if (ret == OGG2_SUCCESS) {
Py_INCREF(Py_None);
return Py_None;
}
- PyErr_SetString(PyOgg_Error, "Unknown error from ogg_sync_wrote.");
+ PyErr_SetString(PyOgg_Error, "Unknown error from ogg2_sync_wrote.");
return NULL;
}
@@ -238,7 +238,7 @@
{
int ret;
int bytes = 4096;
- char *ogg_buffer;
+ char *oggbuffer;
PyObject *pyfile;
FILE *fp;
@@ -247,15 +247,15 @@
fp = PyFile_AsFile(pyfile);
- ogg_buffer = ogg_sync_bufferin(PyOggSyncState_AsOggSyncState(self),
+ oggbuffer = ogg2_sync_bufferin(PyOggSyncState_AsOggSyncState(self),
bytes);
- bytes = fread(ogg_buffer, 1, bytes, fp);
- ret = ogg_sync_wrote(PyOggSyncState_AsOggSyncState(self),
- bytes);
- if ( ret == OGG_SUCCESS ) {
+ bytes = fread(oggbuffer, 1, bytes, fp);
+ ret = ogg2_sync_wrote(PyOggSyncState_AsOggSyncState(self), bytes);
+
+ if ( ret == OGG2_SUCCESS ) {
return PyLong_FromLong(bytes);
}
- PyErr_SetString(PyOgg_Error, "Unknown error from ogg_sync_wrote.");
+ PyErr_SetString(PyOgg_Error, "Unknown error from ogg2_sync_wrote.");
return NULL;
}
@@ -274,8 +274,8 @@
PyErr_SetString(PyOgg_Error, "Out of Memory.");
return NULL;
}
- ret = ogg_sync_pageout(PyOggSyncState_AsOggSyncState(self),
- PyOggPage_AsOggPage(pageobj));
+ ret = ogg2_sync_pageout(PyOggSyncState_AsOggSyncState(self),
+ PyOggPage_AsOggPage(pageobj));
if ( ret == 1 ) return (PyObject *) pageobj;
Py_DECREF(pageobj);
@@ -283,10 +283,10 @@
Py_INCREF(Py_None);
return Py_None;
}
- if (ret == OGG_HOLE ) {
+ if (ret == OGG2_HOLE ) {
PyErr_SetString(PyOgg_Error, "Hole in data, stream is desynced.");
return NULL;
}
- PyErr_SetString(PyOgg_Error, "Unknown error from ogg_sync_pageout.");
+ PyErr_SetString(PyOgg_Error, "Unknown error from ogg2_sync_pageout.");
return NULL;
}
Modified: trunk/py-ogg2/src/sync.h
===================================================================
--- trunk/py-ogg2/src/sync.h 2005-03-03 12:56:20 UTC (rev 9024)
+++ trunk/py-ogg2/src/sync.h 2005-03-03 14:05:43 UTC (rev 9025)
@@ -5,7 +5,7 @@
typedef struct {
PyObject_HEAD
- ogg_sync_state *sync;
+ ogg2_sync_state *sync;
} PyOggSyncStateObject;
#define PyOggSyncState_AsOggSyncState(x) (((PyOggSyncStateObject *) (x))->sync)
More information about the commits
mailing list