pyogg-1.3+repack.orig/0000755000175000017500000000000011022740041013725 5ustar morphmorphpyogg-1.3+repack.orig/include/0000755000175000017500000000000007717116257015376 5ustar morphmorphpyogg-1.3+repack.orig/include/pyogg/0000755000175000017500000000000007717116257016523 5ustar morphmorphpyogg-1.3+repack.orig/include/pyogg/pyogg.h0000644000175000017500000000124207550140631020004 0ustar morphmorph#ifndef __PYOGG_H__ #define __PYOGG_H__ #include #include /* The struct to hold everything we pass from the _ogg module * to its submodules. */ typedef struct { int version_major; int version_minor; PyTypeObject *OggPacket_Type; PyTypeObject *OggStreamState_Type; PyObject *Py_OggError; PyObject *(*ogg_packet_from_packet)(ogg_packet *op); int (*arg_to_int64)(PyObject *longobj, ogg_int64_t *val); } ogg_module_info; /* Function to convert Long Python objects into an ogg_int64 value. Returns 0 on failure (a Python error will be set) */ int arg_to_int64(PyObject *longobj, ogg_int64_t *val); #endif // __PYOGG_H__ pyogg-1.3+repack.orig/pysrc/0000755000175000017500000000000007717116257015113 5ustar morphmorphpyogg-1.3+repack.orig/pysrc/__init__.py0000644000175000017500000000006007550140631017204 0ustar morphmorphfrom _ogg import * __all__ = ['_ogg', 'vorbis'] pyogg-1.3+repack.orig/src/0000755000175000017500000000000007717116257014542 5ustar morphmorphpyogg-1.3+repack.orig/src/_oggmodule.c0000644000175000017500000000320407612372416017021 0ustar morphmorph#include #include "general.h" #include "_oggmodule.h" #include "pyoggstreamstate.h" #include "pyoggsyncstate.h" #include "pyoggpacket.h" #include "pyoggpackbuff.h" #include "pyoggpage.h" static PyMethodDef Ogg_methods[] = { {"OggStreamState", py_ogg_stream_state_new, METH_VARARGS, py_ogg_stream_state_doc}, {"OggPackBuff", py_oggpack_buffer_new, METH_VARARGS, py_oggpack_buffer_doc}, {"OggSyncState", py_ogg_sync_state_new, METH_VARARGS, py_ogg_sync_state_doc}, {NULL, NULL} }; static char docstring[] = ""; static ogg_module_info mi = { VERSION_MINOR, VERSION_MAJOR, &py_ogg_packet_type, &py_ogg_stream_state_type, NULL, /* Will be Py_OggError */ py_ogg_packet_from_packet, arg_to_int64, }; void init_ogg(void) { PyObject *module, *dict, *Py_module_info; py_oggpack_buffer_type.ob_type = &PyType_Type; py_ogg_packet_type.ob_type = &PyType_Type; py_ogg_page_type.ob_type = &PyType_Type; py_ogg_stream_state_type.ob_type = &PyType_Type; py_ogg_sync_state_type.ob_type = &PyType_Type; module = Py_InitModule("_ogg", Ogg_methods); dict = PyModule_GetDict(module); Py_OggError = PyErr_NewException("ogg.OggError", NULL, NULL); PyDict_SetItemString(dict, "OggError", Py_OggError); mi.Py_OggError = Py_OggError; Py_module_info = PyCObject_FromVoidPtr(&mi, NULL); PyDict_SetItemString(dict, "_moduleinfo", Py_module_info); PyDict_SetItemString(dict, "__doc__", PyString_FromString(docstring)); PyDict_SetItemString(dict, "__version__", PyString_FromString("1.2")); if (PyErr_Occurred()) PyErr_SetString(PyExc_ImportError, "_ogg: init failed"); } pyogg-1.3+repack.orig/src/_oggmodule.h0000644000175000017500000000040607550140631017020 0ustar morphmorph#ifndef __OGGMODULE_H__ #define __OGGMODULE_H__ #include PyObject *Py_OggError; /* Object docstrings */ extern char py_ogg_stream_state_doc[]; extern char py_oggpack_buffer_doc[]; extern char py_ogg_sync_state_doc[]; #endif /* __OGGMODULE_H__ */ pyogg-1.3+repack.orig/src/general.c0000644000175000017500000000107707550140631016314 0ustar morphmorph#include "general.h" #include #include /* * general.c * * functions which are needed by both the ogg and vorbis modules */ /* Simple function to turn an object into an ogg_int64_t. Returns 0 on * an error. Does not DECREF the argument */ int arg_to_int64(PyObject *longobj, ogg_int64_t *val) { if(PyLong_Check(longobj)) *val = PyLong_AsLongLong(longobj); else if (PyInt_Check(longobj)) *val = PyInt_AsLong(longobj); else { PyErr_SetString(PyExc_TypeError, "Argument must be int or long"); return 0; } return 1; } pyogg-1.3+repack.orig/src/general.h0000644000175000017500000000050407550140631016313 0ustar morphmorph#ifndef __GENERAL_H__ #define __GENERAL_H__ #include #include #define MSG_SIZE 256 #define KEY_SIZE 1024 #define PY_UNICODE (PY_VERSION_HEX >= 0x01060000) #define FDEF(x) static PyObject *py_##x(PyObject *self, PyObject *args); \ static char py_##x##_doc[] = #endif /* __GENERAL_H__ */ pyogg-1.3+repack.orig/src/pyoggpackbuff.c0000644000175000017500000001357707550140631017536 0ustar morphmorph#include "pyoggpackbuff.h" #include "general.h" #include "_oggmodule.h" /************************************************************ OggPackBuffer Object ************************************************************/ char py_oggpack_buffer_doc[] = ""; static void py_oggpack_buffer_dealloc(PyObject *); static PyObject* py_oggpack_buffer_getattr(PyObject *, char *); static PyObject *py_oggpack_repr(PyObject *self); FDEF(oggpack_reset) ""; FDEF(oggpack_writeclear) ""; FDEF(oggpack_look) ""; FDEF(oggpack_look1) ""; FDEF(oggpack_bytes) ""; FDEF(oggpack_bits) ""; FDEF(oggpack_read) "Return the value of n bits"; FDEF(oggpack_read1) ""; FDEF(oggpack_adv) "Advance the read location by n bits"; FDEF(oggpack_adv1) ""; FDEF(oggpack_write) "Write bits to the buffer.\n\n\ The first parameterf is an integer from which the bits will be extracted.\n\ The second parameter is the number of bits to write (defaults to 32)"; PyTypeObject py_oggpack_buffer_type = { PyObject_HEAD_INIT(NULL) 0, "Oggpack_Buffer", sizeof(py_oggpack_buffer), 0, /* Standard Methods */ /* (destructor) */ py_oggpack_buffer_dealloc, /* (printfunc) */ 0, /* (getattrfunc) */ py_oggpack_buffer_getattr, /* (setattrfunc) */ 0, /* (cmpfunc) */ 0, /* (reprfunc) */ py_oggpack_repr, /* Type Categories */ 0, /* as number */ 0, /* as sequence */ 0, /* as mapping */ 0, /* hash */ 0, /* binary */ 0, /* repr */ 0, /* getattro */ 0, /* setattro */ 0, /* as buffer */ 0, /* tp_flags */ py_oggpack_buffer_doc }; static PyMethodDef py_oggpack_buffer_methods[] = { {"reset", py_oggpack_reset, METH_VARARGS, py_oggpack_reset_doc}, {"writeclear", py_oggpack_writeclear, METH_VARARGS, py_oggpack_writeclear_doc}, {"look", py_oggpack_look, METH_VARARGS, py_oggpack_look_doc}, {"look1", py_oggpack_look1, METH_VARARGS, py_oggpack_look1_doc}, {"bytes", py_oggpack_bytes, METH_VARARGS, py_oggpack_bytes_doc}, {"bits", py_oggpack_bits, METH_VARARGS, py_oggpack_bits_doc}, {"read", py_oggpack_read, METH_VARARGS, py_oggpack_read_doc}, {"read1", py_oggpack_read1, METH_VARARGS, py_oggpack_read1_doc}, {"write", py_oggpack_write, METH_VARARGS, py_oggpack_write_doc}, {"adv", py_oggpack_adv, METH_VARARGS, py_oggpack_adv_doc}, {"adv1", py_oggpack_adv1, METH_VARARGS, py_oggpack_adv1_doc}, {NULL, NULL} }; static void py_oggpack_buffer_dealloc(PyObject *self) { PyMem_DEL(self); } static PyObject* py_oggpack_buffer_getattr(PyObject *self, char *name) { return Py_FindMethod(py_oggpack_buffer_methods, self, name); } PyObject * py_oggpack_buffer_new(PyObject *self, PyObject *args) { py_oggpack_buffer *ret; if (!PyArg_ParseTuple(args, "")) return NULL; ret = (py_oggpack_buffer *) PyObject_NEW(py_oggpack_buffer, &py_oggpack_buffer_type); if (ret == NULL) return NULL; oggpack_writeinit(&ret->ob); return (PyObject *)ret; } static PyObject * py_oggpack_reset(PyObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, "")) return NULL; oggpack_reset(PY_OGGPACK_BUFF(self)); Py_INCREF(Py_None); return Py_None; } static PyObject * py_oggpack_writeclear(PyObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, "")) return NULL; oggpack_writeclear(PY_OGGPACK_BUFF(self)); Py_INCREF(Py_None); return Py_None; } static PyObject * py_oggpack_look(PyObject *self, PyObject *args) { int bits = 32; long ret; if (!PyArg_ParseTuple(args, "l", &bits)) return NULL; if (bits > 32) { PyErr_SetString(PyExc_ValueError, "Cannot look at more than 32 bits"); return NULL; } ret = oggpack_look(PY_OGGPACK_BUFF(self), bits); return PyLong_FromLong(ret); } static PyObject * py_oggpack_look1(PyObject *self, PyObject *args) { long ret; if (!PyArg_ParseTuple(args, "")) return NULL; ret = oggpack_look1(PY_OGGPACK_BUFF(self)); return PyLong_FromLong(ret); } static PyObject * py_oggpack_bytes(PyObject *self, PyObject *args) { long ret; if (!PyArg_ParseTuple(args, "")) return NULL; ret = oggpack_bytes(PY_OGGPACK_BUFF(self)); return PyLong_FromLong(ret); } static PyObject * py_oggpack_bits(PyObject *self, PyObject *args) { long ret; if (!PyArg_ParseTuple(args, "")) return NULL; ret = oggpack_bits(PY_OGGPACK_BUFF(self)); return PyLong_FromLong(ret); } static PyObject * py_oggpack_write(PyObject *self, PyObject *args) { long val; int bits = 32; if (!PyArg_ParseTuple(args, "l|l", &val, &bits)) return NULL; if (bits > 32) { PyErr_SetString(PyExc_ValueError, "Cannot write more than 32 bits"); return NULL; } oggpack_write(PY_OGGPACK_BUFF(self), val, bits); Py_INCREF(Py_None); return Py_None; } static PyObject * py_oggpack_read(PyObject *self, PyObject *args) { int bits = 32; long ret; if (!PyArg_ParseTuple(args, "|i", &bits)) return NULL; if (bits > 32) { PyErr_SetString(PyExc_ValueError, "Cannot read more than 32 bits"); return NULL; } ret = oggpack_read(PY_OGGPACK_BUFF(self), bits); return PyInt_FromLong(ret); } static PyObject * py_oggpack_read1(PyObject *self, PyObject *args) { long ret; if (!PyArg_ParseTuple(args, "")) return NULL; ret = oggpack_read1(PY_OGGPACK_BUFF(self)); return PyInt_FromLong(ret); } static PyObject * py_oggpack_adv(PyObject *self, PyObject *args) { int bits; if (!PyArg_ParseTuple(args, "i", &bits)) return NULL; oggpack_adv(PY_OGGPACK_BUFF(self), bits); Py_INCREF(Py_None); return Py_None; } static PyObject * py_oggpack_adv1(PyObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, "")) return NULL; oggpack_adv1(PY_OGGPACK_BUFF(self)); Py_INCREF(Py_None); return Py_None; } static PyObject * py_oggpack_repr(PyObject *self) { oggpack_buffer *ob = PY_OGGPACK_BUFF(self); char buf[256]; sprintf(buf, "", ob->endbyte, ob->endbit, self); return PyString_FromString(buf); } pyogg-1.3+repack.orig/src/pyoggpackbuff.h0000644000175000017500000000052607550140631017531 0ustar morphmorph#ifndef PYOGGPACKBUFF_H #define PYOGGPACKBUFF_H #include #include typedef struct { PyObject_HEAD oggpack_buffer ob; } py_oggpack_buffer; #define PY_OGGPACK_BUFF(x) (&(((py_oggpack_buffer *) (x))->ob)) extern PyTypeObject py_oggpack_buffer_type; PyObject *py_oggpack_buffer_new(PyObject *, PyObject *); #endif pyogg-1.3+repack.orig/src/pyoggpacket.c0000644000175000017500000000443307550140631017213 0ustar morphmorph#include #include "pyoggpacket.h" /************************************************************ OggPacket Object ************************************************************/ char py_ogg_packet_doc[] = ""; static void py_ogg_packet_dealloc(PyObject *); static PyObject* py_ogg_packet_getattr(PyObject *, char *); static int py_ogg_packet_setattr(PyObject *, char *, PyObject *); static PyObject *py_ogg_packet_repr(PyObject *self); PyTypeObject py_ogg_packet_type = { PyObject_HEAD_INIT(NULL) 0, "OggPacket", sizeof(py_ogg_packet), 0, /* Standard Methods */ /* (destructor) */ py_ogg_packet_dealloc, /* (printfunc) */ 0, /* (getattrfunc) */ py_ogg_packet_getattr, /* (setattrfunc) */ py_ogg_packet_setattr, /* (cmpfunc) */ 0, /* (reprfunc) */ py_ogg_packet_repr, /* Type Categories */ 0, /* as number */ 0, /* as sequence */ 0, /* as mapping */ 0, /* hash */ 0, /* binary */ 0, /* repr */ 0, /* getattro */ 0, /* setattro */ 0, /* as buffer */ 0, /* tp_flags */ py_ogg_packet_doc }; static PyMethodDef py_ogg_packet_methods[] = { {NULL, NULL} }; PyObject * py_ogg_packet_from_packet(ogg_packet *op) { py_ogg_packet *ret = (py_ogg_packet *) PyObject_NEW(py_ogg_packet, &py_ogg_packet_type); if (ret == NULL) return NULL; ret->op = *op; return (PyObject *)ret; } static void py_ogg_packet_dealloc(PyObject *self) { PyMem_DEL(self); } static PyObject* py_ogg_packet_getattr(PyObject *self, char *name) { if (strcmp(name, "granulepos") == 0) return PyLong_FromLongLong(PY_OGG_PACKET(self)->granulepos); return Py_FindMethod(py_ogg_packet_methods, self, name); } static int py_ogg_packet_setattr(PyObject *self, char *name, PyObject *value) { ogg_int64_t v; if (strcmp(name, "granulepos") == 0) { if (!arg_to_int64(value, &v)) return -1; PY_OGG_PACKET(self)->granulepos = v; return 0; } return -1; } static PyObject * py_ogg_packet_repr(PyObject *self) { ogg_packet *op = PY_OGG_PACKET(self); char buf[256]; char *bos = op->b_o_s ? "BOS " : ""; char *eos = op->e_o_s ? "EOS " : ""; sprintf(buf, "", bos, eos, op->packetno, op->granulepos, op->bytes, self); return PyString_FromString(buf); } pyogg-1.3+repack.orig/src/pyoggpacket.h0000644000175000017500000000051607550140631017216 0ustar morphmorph#ifndef PYOGGPACKET_H #define PYOGGPACKET_H #include #include typedef struct { PyObject_HEAD ogg_packet op; } py_ogg_packet; extern PyTypeObject py_ogg_packet_type; #define PY_OGG_PACKET(x) (&(((py_ogg_packet *) (x))->op)) PyObject *py_ogg_packet_from_packet(ogg_packet *); #endif /* PYOGGPACKET_H */ pyogg-1.3+repack.orig/src/pyoggpage.c0000644000175000017500000001335007550140631016656 0ustar morphmorph#include "general.h" #include "_oggmodule.h" #include "pyoggpage.h" /***************************************************************** OggPage Object *****************************************************************/ char py_ogg_page_doc[] = ""; static void py_ogg_page_dealloc(PyObject *); static PyObject* py_ogg_page_getattr(PyObject *, char *); static int py_ogg_page_setattr(PyObject *self, char *name, PyObject *value); static PyObject *py_ogg_page_repr(PyObject *self); FDEF(ogg_page_writeout) "Write the page to a given file object. Returns the number of bytes written."; FDEF(ogg_page_eos) "Tell whether this page is the end of a stream."; FDEF(ogg_page_version) "Return the stream version"; FDEF(ogg_page_serialno) "Return the serial number of the page"; FDEF(ogg_page_pageno) "Return the page number of the page"; FDEF(ogg_page_continued) "Return whether this page contains data continued from the previous page."; FDEF(ogg_page_bos) "Return whether this page is the beginning of a logical bistream."; FDEF(ogg_page_granulepos) "Return the granular position of the data contained in this page."; PyTypeObject py_ogg_page_type = { PyObject_HEAD_INIT(NULL) 0, "OggPage", sizeof(py_ogg_page), 0, /* Standard Methods */ /* (destructor) */ py_ogg_page_dealloc, /* (printfunc) */ 0, /* (getattrfunc) */ py_ogg_page_getattr, /* (setattrfunc) */ py_ogg_page_setattr, /* (cmpfunc) */ 0, /* (reprfunc) */ py_ogg_page_repr, /* Type Categories */ 0, /* as number */ 0, /* as sequence */ 0, /* as mapping */ 0, /* hash */ 0, /* binary */ 0, /* repr */ 0, /* getattro */ 0, /* setattro */ 0, /* as buffer */ 0, /* tp_flags */ py_ogg_page_doc }; static PyMethodDef py_ogg_page_methods[] = { {"writeout", py_ogg_page_writeout, METH_VARARGS, py_ogg_page_writeout_doc}, {"eos", py_ogg_page_eos, METH_VARARGS, py_ogg_page_eos_doc}, {"version", py_ogg_page_version, METH_VARARGS, py_ogg_page_version_doc}, {"serialno", py_ogg_page_serialno, METH_VARARGS, py_ogg_page_serialno_doc}, {"pageno", py_ogg_page_pageno, METH_VARARGS, py_ogg_page_pageno_doc}, {"continued", py_ogg_page_continued, METH_VARARGS, py_ogg_page_continued_doc}, {"bos", py_ogg_page_bos, METH_VARARGS, py_ogg_page_bos_doc}, {"granulepos", py_ogg_page_granulepos, METH_VARARGS, py_ogg_page_granulepos_doc}, {NULL, NULL} }; static void py_ogg_page_dealloc(PyObject *self) { PyMem_DEL(self); } static PyObject* py_ogg_page_getattr(PyObject *self, char *name) { return Py_FindMethod(py_ogg_page_methods, self, name); } PyObject * py_ogg_page_from_page(ogg_page *op) { py_ogg_page *pyop = (py_ogg_page *) PyObject_NEW(py_ogg_page, &py_ogg_page_type); if (pyop == NULL) return NULL; // FIX: won't this leak memory? how does the page's pointed-to // memory get freed? pyop->op = *op; return (PyObject *) pyop; } /* Take in a Python file object and write the given page to that file. */ static PyObject * py_ogg_page_writeout(PyObject *self, PyObject *args) { FILE *fp; int bytes; PyObject *pyfile; py_ogg_page *op_self = (py_ogg_page *) self; if (!PyArg_ParseTuple(args, "O!", &PyFile_Type, &pyfile)) return NULL; fp = PyFile_AsFile(pyfile); bytes = fwrite(op_self->op.header,1,op_self->op.header_len, fp); bytes += fwrite(op_self->op.body,1,op_self->op.body_len, fp); return PyInt_FromLong(bytes); } static PyObject* py_ogg_page_eos(PyObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, "")) return NULL; return PyInt_FromLong(ogg_page_eos(PY_OGG_PAGE(self))); } static PyObject * py_ogg_page_version(PyObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, "")) return NULL; return PyInt_FromLong(ogg_page_version(PY_OGG_PAGE(self))); } static PyObject * py_ogg_page_serialno(PyObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, "")) return NULL; return PyInt_FromLong(ogg_page_serialno(PY_OGG_PAGE(self))); } static PyObject * py_ogg_page_pageno(PyObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, "")) return NULL; return PyLong_FromLong(ogg_page_pageno(PY_OGG_PAGE(self))); } static PyObject * py_ogg_page_continued(PyObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, "")) return NULL; return PyInt_FromLong(ogg_page_continued(PY_OGG_PAGE(self))); } static PyObject * py_ogg_page_bos(PyObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, "")) return NULL; return PyInt_FromLong(ogg_page_bos(PY_OGG_PAGE(self))); } static PyObject * py_ogg_page_granulepos(PyObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, "")) return NULL; return PyLong_FromLong(ogg_page_granulepos(PY_OGG_PAGE(self))); } static int py_ogg_page_setattr(PyObject *self, char *name, PyObject *value) { // XXX: somehow the set and get forms should be unified, perhaps to // make them both attribute accesses? if (strcmp(name, "pageno") == 0) { // FIX: also handle PyLong? if (PyInt_Check(value)) { long v = PyInt_AsLong(value); char *pb = PY_OGG_PAGE(self)->header; // XXX: ugh, libogg should do this instead int i; for (i=18; i<22; i++) { pb[i] = v & 0xff; v >>= 8; } return 0; } else return -1; } return -1; } static PyObject * py_ogg_page_repr(PyObject *self) { ogg_page *op = PY_OGG_PAGE(self); char buf[256]; char *cont = ogg_page_continued(op) ? "CONT " : ""; char *bos = ogg_page_bos(op) ? "BOS " : ""; char *eos = ogg_page_eos(op) ? "EOS " : ""; sprintf(buf, "", cont, bos, eos, ogg_page_pageno(op), ogg_page_granulepos(op), ogg_page_serialno(op), op->header_len, op->body_len, self); return PyString_FromString(buf); } pyogg-1.3+repack.orig/src/pyoggpage.h0000644000175000017500000000045007550140631016660 0ustar morphmorph#ifndef PYOGGPAGE_H #define PYOGGPAGE_H #include #include typedef struct { PyObject_HEAD ogg_page op; } py_ogg_page; #define PY_OGG_PAGE(x) (&(((py_ogg_page *) (x))->op)) extern PyTypeObject py_ogg_page_type; PyObject *py_ogg_page_from_page(ogg_page *og); #endif pyogg-1.3+repack.orig/src/pyoggstreamstate.c0000644000175000017500000001404507550140631020300 0ustar morphmorph#include "_oggmodule.h" #include "pyoggstreamstate.h" #include "pyoggpacket.h" #include "pyoggpage.h" #include "general.h" /***************************************************************** OggStreamState Object *****************************************************************/ char py_ogg_stream_state_doc[] = ""; static void py_ogg_stream_state_dealloc(PyObject *); static PyObject* py_ogg_stream_state_getattr(PyObject *, char *); static PyObject *py_ogg_stream_repr(PyObject *self); FDEF(ogg_stream_packetin) "Add a packet to the stream."; FDEF(ogg_stream_clear) "Clear the contents of the stream state."; FDEF(ogg_stream_flush) "Produce an ogg page suitable for writing to output."; FDEF(ogg_stream_eos) "Return whether the end of the stream is reached."; FDEF(ogg_stream_pageout) "Extract and return an OggPage."; FDEF(ogg_stream_reset) "Reset the stream state"; FDEF(ogg_stream_pagein) "Write a page to the stream"; FDEF(ogg_stream_packetout) "Extract a packet from the stream"; PyTypeObject py_ogg_stream_state_type = { PyObject_HEAD_INIT(NULL) 0, "OggStreamState", sizeof(py_ogg_stream_state), 0, /* Standard Methods */ /* (destructor) */ py_ogg_stream_state_dealloc, /* (printfunc) */ 0, /* (getattrfunc) */ py_ogg_stream_state_getattr, /* (setattrfunc) */ 0, /* (cmpfunc) */ 0, /* (reprfunc) */ py_ogg_stream_repr, /* Type Categories */ 0, /* as number */ 0, /* as sequence */ 0, /* as mapping */ 0, /* hash */ 0, /* binary */ 0, /* repr */ 0, /* getattro */ 0, /* setattro */ 0, /* as buffer */ 0, /* tp_flags */ py_ogg_stream_state_doc }; static PyMethodDef py_ogg_stream_state_methods[] = { {"clear", py_ogg_stream_clear, METH_VARARGS, py_ogg_stream_clear_doc}, {"flush", py_ogg_stream_flush, METH_VARARGS, py_ogg_stream_flush_doc}, {"eos", py_ogg_stream_eos, METH_VARARGS, py_ogg_stream_eos_doc}, {"packetin", py_ogg_stream_packetin, METH_VARARGS, py_ogg_stream_packetin_doc}, {"pageout", py_ogg_stream_pageout, METH_VARARGS, py_ogg_stream_pageout_doc}, {"pagein", py_ogg_stream_pagein, METH_VARARGS, py_ogg_stream_pagein_doc}, {"packetout", py_ogg_stream_packetout, METH_VARARGS, py_ogg_stream_packetout_doc}, {"reset", py_ogg_stream_reset, METH_VARARGS, py_ogg_stream_reset_doc}, {NULL, NULL} }; static void py_ogg_stream_state_dealloc(PyObject *self) { ogg_stream_clear(PY_OGG_STREAM(self)); PyMem_DEL(self); } static PyObject* py_ogg_stream_state_getattr(PyObject *self, char *name) { return Py_FindMethod(py_ogg_stream_state_methods, self, name); } PyObject * py_ogg_stream_state_from_serialno(int serialno) { py_ogg_stream_state *ret = PyObject_NEW(py_ogg_stream_state, &py_ogg_stream_state_type); if (ret == NULL) return NULL; ogg_stream_init(&ret->os, serialno); return (PyObject *) ret; } PyObject * py_ogg_stream_state_new(PyObject *self, PyObject *args) { int serialno; if (!PyArg_ParseTuple(args, "i", &serialno)) return NULL; return py_ogg_stream_state_from_serialno(serialno); } static PyObject * py_ogg_stream_clear(PyObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, "")) return NULL; ogg_stream_clear(PY_OGG_STREAM(self)); Py_INCREF(Py_None); return Py_None; } static PyObject * py_ogg_stream_packetin(PyObject *self, PyObject *args) { py_ogg_packet *packetobj; if (!PyArg_ParseTuple(args, "O!", &py_ogg_packet_type, (PyObject *) &packetobj)) return NULL; if (ogg_stream_packetin(PY_OGG_STREAM(self), &packetobj->op)) { /* currently this can't happen */ PyErr_SetString(Py_OggError, "error in ogg_stream_packetin"); return NULL; } Py_INCREF(Py_None); return Py_None; } static PyObject * py_ogg_stream_flush(PyObject *self, PyObject *args) { ogg_page op; int res; if (!PyArg_ParseTuple(args, "")) return NULL; res = ogg_stream_flush(PY_OGG_STREAM(self), &op); if (res == 0) { Py_INCREF(Py_None); return Py_None; } return py_ogg_page_from_page(&op); } /* TODO: You can't keep a page between calls to flush or pageout!! */ static PyObject * py_ogg_stream_pageout(PyObject *self, PyObject *args) { ogg_page op; int res; if (!PyArg_ParseTuple(args, "")) return NULL; res = ogg_stream_pageout(PY_OGG_STREAM(self), &op); if (res == 0) { Py_INCREF(Py_None); return Py_None; } return py_ogg_page_from_page(&op); } static PyObject* py_ogg_stream_eos(PyObject *self, PyObject *args) { int eos = ogg_stream_eos(PY_OGG_STREAM(self)); if (!PyArg_ParseTuple(args, "")) return NULL; return PyInt_FromLong(eos); } static PyObject * py_ogg_stream_reset(PyObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, "")) return NULL; if (ogg_stream_reset(PY_OGG_STREAM(self))) { PyErr_SetString(Py_OggError, "Error resetting stream"); return NULL; } else { Py_INCREF(Py_None); return Py_None; } } static PyObject * py_ogg_stream_pagein(PyObject *self, PyObject *args) { py_ogg_page *pageobj; if (!PyArg_ParseTuple(args, "O!", &py_ogg_page_type, (PyObject *) &pageobj)) return NULL; if (ogg_stream_pagein(PY_OGG_STREAM(self), &pageobj->op)) { PyErr_SetString(Py_OggError, "error in ogg_stream_pagein (bad page?)"); return NULL; } Py_INCREF(Py_None); return Py_None; } static PyObject * py_ogg_stream_packetout(PyObject *self, PyObject *args) { ogg_packet op; int res; if (!PyArg_ParseTuple(args, "")) return NULL; res = ogg_stream_packetout(PY_OGG_STREAM(self), &op); if (res == 0) { Py_INCREF(Py_None); return Py_None; } else if (res == -1) { PyErr_SetString(Py_OggError, "lost sync"); return NULL; } return py_ogg_packet_from_packet(&op); } static PyObject * py_ogg_stream_repr(PyObject *self) { ogg_stream_state *os = PY_OGG_STREAM(self); char buf[256]; char *bos = os->b_o_s ? "BOS " : ""; char *eos = os->e_o_s ? "EOS " : ""; sprintf(buf, "", bos, eos, os->pageno, os->packetno, os->granulepos, os->serialno, self); return PyString_FromString(buf); } pyogg-1.3+repack.orig/src/pyoggstreamstate.h0000644000175000017500000000062707550140631020306 0ustar morphmorph#ifndef PYOGGSTREAMSTATE_H #define PYOGGSTREAMSTATE_H #include #include typedef struct { PyObject_HEAD ogg_stream_state os; } py_ogg_stream_state; extern PyTypeObject py_ogg_stream_state_type; #define PY_OGG_STREAM(x) (&(((py_ogg_stream_state *) (x))->os)) PyObject *py_ogg_stream_state_from_serialno(int); PyObject *py_ogg_stream_state_new(PyObject *, PyObject *); #endif pyogg-1.3+repack.orig/src/pyoggsyncstate.c0000644000175000017500000001022607550140631017756 0ustar morphmorph#include "pyoggsyncstate.h" #include "pyoggpage.h" #include "general.h" #include "_oggmodule.h" /***************************************************************** OggSyncState Object *****************************************************************/ char py_ogg_sync_state_doc[] = ""; static void py_ogg_sync_state_dealloc(PyObject *); static PyObject* py_ogg_sync_state_getattr(PyObject *, char *); FDEF(ogg_sync_clear) "Clear the contents of this object."; FDEF(ogg_sync_reset) ""; #if 0 FDEF(ogg_sync_wrote) "Tell how many bytes were written to the buffer."; #endif FDEF(ogg_sync_bytesin) "Append bytes to the sync state buffer."; FDEF(ogg_sync_pageseek) "Synchronize with the given OggPage."; PyTypeObject py_ogg_sync_state_type = { PyObject_HEAD_INIT(NULL) 0, "OggSyncState", sizeof(py_ogg_sync_state), 0, /* Standard Methods */ /* (destructor) */ py_ogg_sync_state_dealloc, /* (printfunc) */ 0, /* (getattrfunc) */ py_ogg_sync_state_getattr, /* (setattrfunc) */ 0, /* (cmpfunc) */ 0, /* (reprfunc) */ 0, /* Type Categories */ 0, /* as number */ 0, /* as sequence */ 0, /* as mapping */ 0, /* hash */ 0, /* binary */ 0, /* repr */ 0, /* getattro */ 0, /* setattro */ 0, /* as buffer */ 0, /* tp_flags */ py_ogg_sync_state_doc }; /* TODO: Remove reset functions? Not useful in Python? */ static PyMethodDef py_ogg_sync_state_methods[] = { {"reset", py_ogg_sync_reset, METH_VARARGS, py_ogg_sync_reset_doc}, {"clear", py_ogg_sync_clear, METH_VARARGS, py_ogg_sync_clear_doc}, #if 0 {"wrote", py_ogg_sync_wrote, METH_VARARGS, py_ogg_sync_wrote_doc}, #endif {"bytesin", py_ogg_sync_bytesin, METH_VARARGS, py_ogg_sync_bytesin_doc}, {"pageseek", py_ogg_sync_pageseek, METH_VARARGS, py_ogg_sync_pageseek_doc}, {NULL, NULL} }; PyObject * py_ogg_sync_state_new(PyObject *self, PyObject *args) { py_ogg_sync_state *ret; if (!PyArg_ParseTuple(args, "")) return NULL; ret = PyObject_NEW(py_ogg_sync_state, &py_ogg_sync_state_type); if (ret == NULL) return NULL; ogg_sync_init(PY_OGG_SYNC_STATE(ret)); return (PyObject *) ret; } static void py_ogg_sync_state_dealloc(PyObject *self) { ogg_sync_clear(PY_OGG_SYNC_STATE(self)); PyMem_DEL(self); } static PyObject* py_ogg_sync_state_getattr(PyObject *self, char *name) { return Py_FindMethod(py_ogg_sync_state_methods, self, name); } static PyObject * py_ogg_sync_reset(PyObject *self, PyObject *args) { int ret; if (!PyArg_ParseTuple(args, "")) return NULL; ret = ogg_sync_reset(PY_OGG_SYNC_STATE(self)); Py_INCREF(Py_None); return Py_None; } static PyObject * py_ogg_sync_clear(PyObject *self, PyObject *args) { int ret; if (!PyArg_ParseTuple(args, "")) return NULL; ret = ogg_sync_clear(PY_OGG_SYNC_STATE(self)); Py_INCREF(Py_None); return Py_None; } #if 0 static PyObject * py_ogg_sync_wrote(PyObject *self, PyObject *args) { long bytes; int ret; if (!PyArg_ParseTuple(args, "l", &bytes)) return NULL; ret = ogg_sync_wrote(PY_OGG_SYNC_STATE(self), bytes); if (ret == -1) { PyErr_SetString(Py_OggError, "Overflow of ogg_sync_state buffer."); return NULL; } Py_INCREF(Py_None); return Py_None; } #endif static PyObject * py_ogg_sync_bytesin(PyObject *self, PyObject *args) { char *bytes; int byte_count; char *ogg_buffer; int ret; if (!PyArg_ParseTuple(args, "s#", &bytes, &byte_count)) return NULL; // TODO: ogg_sync_buffer should be modified to fail gracefully when // out of memory ogg_buffer = ogg_sync_buffer(PY_OGG_SYNC_STATE(self), byte_count); memcpy(ogg_buffer, bytes, byte_count); ret = ogg_sync_wrote(PY_OGG_SYNC_STATE(self), byte_count); if (ret == -1) { PyErr_SetString(Py_OggError, "internal error: wrote too much!"); return NULL; } Py_INCREF(Py_None); return Py_None; } static PyObject * py_ogg_sync_pageseek(PyObject *self, PyObject *args) { py_ogg_page page; int skipped; if (!PyArg_ParseTuple(args, "")) return NULL; skipped = ogg_sync_pageseek(PY_OGG_SYNC_STATE(self), &page.op); if (skipped > 0) return Py_BuildValue("iO", skipped, py_ogg_page_from_page(&page.op)); else return Py_BuildValue("iO", skipped, Py_None); } pyogg-1.3+repack.orig/src/pyoggsyncstate.h0000644000175000017500000000053207550140631017762 0ustar morphmorph#ifndef PYOGGSYNCSTATE_H #define PYOGGSYNCSTATE_H #include #include typedef struct { PyObject_HEAD ogg_sync_state os; } py_ogg_sync_state; #define PY_OGG_SYNC_STATE(x) (&(((py_ogg_sync_state *) (x))->os)) extern PyTypeObject py_ogg_sync_state_type; PyObject *py_ogg_sync_state_new(PyObject *, PyObject *); #endif pyogg-1.3+repack.orig/test/0000755000175000017500000000000007717116257014732 5ustar morphmorphpyogg-1.3+repack.orig/test/oggtail.py0000644000175000017500000001006207550140631016715 0ustar morphmorph#!/usr/bin/env python # $Id: oggtail.py,v 1.1 2001/05/02 01:49:11 andrew Exp $ # Send to stdout an ogg stream composed of the last PERCENT percent of # file OGGFILE. # # example: oggtail.py --percent=PERCENT OGGFILE # # (PERCENT is rounded down to the nearest page. Cutting at the # nearest packet would be more complicated.) # First version by Mike Coleman , April 2001 # TODO: This still doesn't work quite right. 'ogg123' complains with # a warning if we pipe oggtail's output directly into it, so probably # there's a minor error in the stream formatting somewhere. import getopt import ogg import sys _debug = 0 def usage(): sys.exit("usage: oggtail.py [--debug] --percent=PERCENT OGGFILE") def debug(s): if _debug: sys.stderr.write(s) sys.stderr.write('\n') def copy_packets(from_, to_, outstream=None, count=None, start_pageno=0, start_granulepos=0): """ Copy 'count' packets from file 'from_' to file 'to_'. If 'count' is None, copy the rest of 'from_'. Use 'start_granulepos' as the initial granulepos tag for pages. Bytes will be skipped in 'from_' to sync, as needed, and copying will stop if a chain boundary is encountered. """ # XXX: warn on desync, except at beginning? copied = 0 written = 0 pageno = start_pageno granule_offset = None instream = None # get it? insync? get it? i'm so funny you can't stand it! insync = ogg.OggSyncState() while count == None or copied < count: b = from_.read(65536) # size doesn't really matter if not b: break insync.bytesin(b) skipped = 1 while skipped != 0: skipped, page = insync.pageseek() if skipped > 0: if instream and page.serialno() != serialno: # we hit a chain boundary break if not instream: serialno = page.serialno() instream = ogg.OggStreamState(serialno) outstream = ogg.OggStreamState(serialno) page.pageno = pageno debug('*** %s' % page.pageno()) pageno = pageno + 1 instream.pagein(page) while count == None or copied < count: p = instream.packetout() if not p: break if p.granulepos != -1: if granule_offset == None: granule_offset = p.granulepos p.granulepos = p.granulepos - granule_offset debug('copied %s' % p) outstream.packetin(p) copied = copied + 1 while 1: pg = outstream.pageout() if not pg: break debug('writing %s' % pg) # FIX: should check success of write written = written + pg.writeout(to_) elif skipped < 0: print 'skipped', -skipped, 'bytes' pg = outstream.flush() if pg: written = written + pg.writeout(to_) return (written, pageno - start_pageno, outstream) opts, pargs = getopt.getopt(sys.argv[1:], '', ['debug', 'percent=']) print sys.argv, opts, pargs if len(opts) < 1 or len(pargs) != 1: usage() for o, a in opts: print o, a if o == '--percent': try: percent = float(a) except ValueError: usage() elif o == '--debug': _debug = 1 else: usage() if not 0.0 <= percent <= 100.0: usage() file = pargs[0] f = open(file, 'rb') f.seek(0, 2) f_size = f.tell() f.seek(0) # first copy the three header packets n, p, os = copy_packets(f, sys.stdout, None, 3) debug('copied header: %d bytes, %d pages' % (n, p)) debug(str(os)) # then seek to percent and copy out the rest f.seek(int((100.0 - percent) / 100.0 * f_size)) n, p, os = copy_packets(f, sys.stdout, os) debug('copied tail: %d bytes, %d pages' % (n, p)) debug(str(os)) pyogg-1.3+repack.orig/test/testogg.py0000644000175000017500000000003007550140631016735 0ustar morphmorphimport ogg print "Yay" pyogg-1.3+repack.orig/AUTHORS0000644000175000017500000000011107550140631015000 0ustar morphmorphAndrew Chatham Mike Coleman pyogg-1.3+repack.orig/COPYING0000644000175000017500000006131407550140631014777 0ustar morphmorph GNU LIBRARY GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights. Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library. Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license. The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such. Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better. However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library. Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one. GNU LIBRARY GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA. Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! pyogg-1.3+repack.orig/ChangeLog0000644000175000017500000001642307612372747015535 0ustar morphmorph2003-1-18 Andrew H. Chatham * Applied a patch from Nicodemus to get this to build on windows. 2002-9-24 Andrew H. Chatham * setup.py: fixed regular expression 2002-07-23 Andrew H. Chatham * Bumped version to 1.0 to match libogg 2002-07-23 Andrew H. Chatham * pyoggpackbuff.c: Removed *_huff functions (no longer in API). 2002-05-21 Andrew H. Chatham * _oggmodule.c: Include another header 2002-02-17 Andrew H. Chatham * _oggmodule.c, pyoggsyncstate.c, pyoggstreamstate.c, pyoggpage.c, pyoggpacket.c, pyoggpackbuff.c: Set the ob_types in the init method instead of statically, as MSVC complains. 2002-01-27 Andrew H. Chatham * config_unix.py: Pass dir flags better * pyoggpackbuff.c (py_oggpack_reset), (py_oggpack_writeclear): Return None from functions * bump version to 0.5 2001-09-02 Andrew H. Chatham * setup.py: bumped version number to 0.4 2001-08-30 Andrew H. Chatham * include/pyogg/pyogg.h, src/_oggmodule.c: Pass a copy of the implementation of arg_to_int64 so it can be shared by the Vorbis module. 2001-05-14 Andrew Chatham * setup.py : Bumped to version 0.3 * src/general.c (arg_to_64): Changed to arg_to_int64. Removed DECREF and changed calling convention and return value. Also moved to so it can be shared with vorbis-python * src/general.h: Fixed preprocessor warnings * src/pyoggpacket.c (py_ogg_packet_setattr): Changed to arg_to_int64 2001-05-01 Mike Coleman * test/oggtail.py: new script to show off some of ogg module * src/pyogg*.c: methods with no args now check that they're called this way * src/pyogg*.c: add repr functions * src/pyogg*.c: add type checking for PyTypeObject function table * src/pyoggpacket.c: add get/set granulepos attribute * src/pyoggpage.c: add set pageno attribute * src/pyoggstreamstate.c: implement pagein, packetout methods * src/pyoggsyncstate.c: implement bytesin, pageseek methods, comment out unneeded wrote method * src/pyogg*state.c: fix free of bogus pointer in dealloc 3-27-2001 Andrew H. Chatham * src/_oggmodule.c: Added OggSyncState * src/pyoggpage.c: Added _continued, _bos, _granulepos * src/pyoggstreamstate.c: Added _clear * src/pyoggsyncstate.c: Added _pageseek, _clear and constructor 3-17-2001 Andrew H. Chatham * src/_oggmodule.c: Remove dependency on Vorbis * src/pyoggpackbuff.c: More PackBuff methods * src/pyoggsyncstate.c: Simple SyncState methods. * src/pyoggpack.c: Removed * src/_oggmodule.c: Added ability to create OggPackBuff object 1-17-2001 Andrew H. Chatham * src/audiofilemodule.c src/audioread.c src/audioread.h src/pyvorbiscodec.c src/pyvorbiscodec.h src/pyvorbisfile.c src/pyvorbisfile.h src/pyvorbisinfo.c src/pyvorbisinfo.h src/vorbismodule.c src/vorbismodule.h src/wavread.c src/wavread.h: Removed * config_unix.py : Added setup.py : Take advantage of config_unix.py and only build ogg module * include/pyogg.h: Added * src/_oggmodule.c (init_ogg): Changed to use new pyogg.h 11-29-2000 Andrew H. Chatham * test/ogg123.py: Added support for linuxaudiodev. Factored parts of Player class into a superclass and made separate AOPlayer and LADPlayer subclasses. * test/short.py: added 11-28-2000 Andrew H. Chatham * src/_oggmodule.c (init_ogg): Stuff PyOgg_Error into a Py_CObject. * src/vorbismodule.c (initvorbis): Get PyOgg_Error back out to inherit from. * test/ogg123.py: Change to use new module arrangement. 11-28-2000 Andrew H. Chatham * setup.py: Changed leftover MySQLdb reference. Went back to having a separate _oggmodule and vorismodule. * oggmodule.[ch]: Moved to _oggmodule.[ch] * general.[ch]: Created to house any functions needed by more than one module. Currentnly houses arg_to_64. * src/pyvorbisinfo.c: Changed reference to mappingmethod struct in initializer to a pointer. Removed unused variables (mostly casts of *self) (py_comment_subscript): Added unicode support (py_comment_assign): Added unicode support (get_caps_key): Changed to (make_caps_key). Now takes size argument. (py_comment_as_dict): Fixed case of NULL vendor variable. 11-28-2000 Andrew H. Chatham * src/vorbis*.[ch]: Moved to src/pyvorbis*.[ch] 11-28-2000 Andrew H. Chatham * src/vorbiscodec.[ch]: * src/vorbisfile.[ch]: * src/vorbisinfo.[ch]: Moved type definitions into .c files, declarations into .h files. Removed src/objects/*. 11-28-2000 Andrew H. Chatham * src/oggmodule.h: Removed docstrings and type variables. Moved to separate C files. * src/vorbiscodec.c: (py_codec_new) (py_codec_dealloc) Added. Docstrings added. * src/vorbisfile.c: Docstrings added. * src/vorbisinfo.c: Docstrings added. (py_ov_info_getattr): Removed attributes which are no longer in Vorbis header file. 10-28-2000 Andrew H. Chatham * src/vorbis/vorbisinfo.c: (py_comment_keys), (py_comment_items), (py_comment_values), (py_comment_as_dict): Fixed reference leaks. 10-28-2000 Andrew H. Chatham * src/vorbis/vorbisinfo.[ch]: Added * src/vorbis/vorbisinfo.c: Made the VorbisComment object and added all it's member functions so that it will behave similarly to a Python dictionary. 10-28-2000 Andrew H. Chatham * src/vorbis/vorbisfile.h: Changed all definitions to use FDEF macro. * src/vorbis/vorbisfile.c: Added VorbisComment object. 10-27-2000 Andrew H. Chatham * Refactored into pyvorbismodule.c and pyvorbisfile.c 10-27-2000 Andrew H. Chatham * README: Added first text. * src/vorbis/vorbismodule.c (py_ov_raw_total) (py_ov_pcm_total) (py_ov_raw_tell) (py_ov_pcm_tell): Changed PyLong_FromLong to PyLong_FromLongLong * src/vorbis/vorbismodule.c (arg_to_64): Added. * src/vorbis/vorbismodule.c (py_ov_pcm_seek) (py_ov_pcm_seek_page): Added call to (arg_to_64) * src/vorbis/vorbismodule.c (py_ov_comment): Took ! out of call to get_caps_key and changed initial size of list to 0. 10-26-2000 Andrew H. Chatham * src/vorbis/vorbismodule.c (py_ov_comment) (get_caps_key): Added (untested) support for unicode strings and made all keys uppercase. * src/vorbis/vorbismodule.c (py_ov_info): Added error handling for when ov_info fails. * src/vorbis/vorbismodule.c (py_info_dealloc): Don't free the vorbis_info*. It doesn't belong to us. * test/ogg123.py: Separated things out in an aborted attempt to support socket arguments. The wrapper's not up to that yet. 10-26-2000 Andrew H. Chatham * src/vorbis/vorbismodule.h: Added docstrings for all functions, however inaccurate they may be. * src/vorbis/vorbismodule.c (py_ov_read): Changed default value for length from 1000 to 4096. 10-25-2000 Andrew H. Chatham * Created. pyogg-1.3+repack.orig/MANIFEST0000644000175000017500000000110707717116257015103 0ustar morphmorphAUTHORS COPYING ChangeLog MANIFEST MANIFEST.in NEWS README config_unix.py prebuild.sh setup.cfg setup.py ./setup.py debian/README.Debian debian/changelog debian/control debian/copyright debian/python-pyogg.docs debian/python-pyogg.examples debian/rules include/pyogg/pyogg.h pysrc/__init__.py src/_oggmodule.c src/_oggmodule.h src/general.c src/general.h src/pyoggpackbuff.c src/pyoggpackbuff.h src/pyoggpacket.c src/pyoggpacket.h src/pyoggpage.c src/pyoggpage.h src/pyoggstreamstate.c src/pyoggstreamstate.h src/pyoggsyncstate.c src/pyoggsyncstate.h test/oggtail.py test/testogg.py pyogg-1.3+repack.orig/MANIFEST.in0000644000175000017500000000036507717116122015504 0ustar morphmorphinclude ChangeLog README COPYING AUTHORS NEWS setup.py config_unix.py prebuild.sh MANIFEST MANIFEST.in recursive-include src/ *.c *.h *.py recursive-include test/ *.py recursive-include include/ *.h recursive-include debian/ * prune debian/CVS pyogg-1.3+repack.orig/NEWS0000644000175000017500000000055507550140631014443 0ustar morphmorph0.2 - 1/18/2001 * Added configure scripts * Separated into separate pyogg and pyvorbis packages 0.1.0 - 12/05/2000 * Support for encoding. * Added audiofile module 0.0.4 - 11/28/2000 * Proper unicode support in the VorbisComment object * Made the vorbis module a submodule of ogg (could be changed in the future if I have too much trouble later). pyogg-1.3+repack.orig/README0000644000175000017500000000243507550140631014623 0ustar morphmorphpyogg - a Python wrapper for the Ogg libraries Ogg/Vorbis is available at http://www.xiph.org There's not a whole lot you can do with this module by itself. You'll probably also want the ogg.vorbis module, which can be found wherever you got this. You can now write Python programs to encode and decode Ogg Vorbis files (encoding is quite a bit more involved). The module is self-documenting, though I need to update quite a bit of it. And if anyone is wondering why I have things separated into a main module "ogg" and a submodule "ogg.vorbis", vorbis is the audio subset of the ogg bitstream. In the future there will likely be a video part of the ogg bistream, and nothing in the ogg modulue really has to know about anything specific in the vorbis module. To build, you need the distutils package, availible from http://www.python.org/sigs/distutils-sig/download.html (it comes with Python 2.0). Run "python setup.py build" to build and then as root run "python setup.py install". You may need to run the config_unix.py script, passing it a --prefix value if you've installed your ogg stuff someplace weird. Alternately, you can just create a file called "Setup" and put in values for ogg_include_dir, ogg_lib_dir, and ogg_libs. The file format for Setup is: key = value with one pair per line. pyogg-1.3+repack.orig/config_unix.py0000755000175000017500000000471607550140631016634 0ustar morphmorph#!/usr/bin/env python import string import os import sys def msg_checking(msg): print "Checking", msg, "...", def execute(cmd, display = 0): if display: print cmd return os.system(cmd) def run_test(input, flags = ''): try: f = open('_temp.c', 'w') f.write(input) f.close() compile_cmd = '%s -o _temp _temp.c %s' % (os.environ.get('CC', 'cc'), flags) if not execute(compile_cmd): execute('./_temp') finally: execute('rm -f _temp.c _temp') ogg_test_program = ''' #include #include #include #include int main () { system("touch conf.oggtest"); return 0; } ''' def find_ogg(ogg_prefix = '/usr/local', enable_oggtest = 1): """A rough translation of ogg.m4""" ogg_cflags = [] ogg_libs = [] ogg_include_dir = ogg_prefix + '/include' ogg_lib_dir = ogg_prefix + '/lib' ogg_libs = 'ogg' msg_checking('for Ogg') if enable_oggtest: execute('rm -f conf.oggtest', 0) try: run_test(ogg_test_program, flags="-I" + ogg_include_dir) if not os.path.isfile('conf.oggtest'): raise RuntimeError, "Did not produce output" execute('rm conf.oggtest', 0) except: print "test program failed" return None print "success" return {'ogg_libs' : ogg_libs, 'ogg_lib_dir' : ogg_lib_dir, 'ogg_include_dir' : ogg_include_dir} def write_data(data): f = open('Setup', 'w') for item in data.items(): f.write('%s = %s\n' % item) f.close() print "Wrote Setup file" def print_help(): print '''%s --prefix Give the prefix in which ogg was installed.''' % sys.argv[0] sys.exit(0) def parse_args(): data = {} argv = sys.argv for pos in range(len(argv)): if argv[pos] == '--help': print_help() if argv[pos] == '--prefix': pos = pos + 1 if len(argv) == pos: print "Prefix needs an argument" sys.exit(1) data['prefix'] = argv[pos] return data def main(): args = parse_args() prefix = args.get('prefix', '/usr/local') data = find_ogg(ogg_prefix = prefix) if not data: print "Config failure" sys.exit(1) write_data(data) if __name__ == '__main__': main() pyogg-1.3+repack.orig/prebuild.sh0000644000175000017500000000030707550140631016101 0ustar morphmorph#!/bin/sh # This is just a simple script to be run before any automatic # binary distribution building (like bdist or bdist_rpm). You # probably don't have to worry about it. python config_unix.py pyogg-1.3+repack.orig/setup.cfg0000644000175000017500000000006507550140631015561 0ustar morphmorph[bdist_rpm] requires=libogg build_script=prebuild.sh pyogg-1.3+repack.orig/setup.py0000755000175000017500000000420607717116251015464 0ustar morphmorph#!/usr/bin/env python """Setup script for the Ogg module distribution.""" import os import re import sys import string from distutils.core import setup from distutils.extension import Extension VERSION_MAJOR = 1 VERSION_MINOR = 3 pyogg_version = str(VERSION_MAJOR) + "." + str(VERSION_MINOR) def get_setup(): data = {} r = re.compile(r'(\S+)\s*?=\s*(.+)') if not os.path.isfile('Setup'): print "No 'Setup' file. Perhaps you need to run the configure script." sys.exit(1) f = open('Setup', 'r') for line in f.readlines(): m = r.search(line) if not m: print "Error in setup file:", line sys.exit(1) key = m.group(1) val = m.group(2) data[key] = val return data data = get_setup() ogg_include_dir = data['ogg_include_dir'] ogg_lib_dir = data['ogg_lib_dir'] ogg_libs = string.split(data['ogg_libs']) _oggmodule = Extension(name='_ogg', sources=['src/_oggmodule.c', 'src/pyoggpacket.c', 'src/pyoggstreamstate.c', 'src/pyoggpage.c', 'src/pyoggpackbuff.c', 'src/pyoggsyncstate.c', 'src/general.c'], define_macros = [('VERSION_MAJOR', VERSION_MAJOR), ('VERSION_MINOR', VERSION_MINOR), ('VERSION', '"%s"' % pyogg_version)], include_dirs=[ogg_include_dir, 'include'], library_dirs=[ogg_lib_dir], libraries=ogg_libs) setup ( name = "pyogg", version = pyogg_version, description = "A wrapper for the Ogg libraries.", author = "Andrew Chatham", author_email = "andrew.chatham@duke.edu", url = "http://dulug.duke.edu/~andrew/pyogg", headers = ['include/pyogg/pyogg.h'], packages = ['ogg'], package_dir = {'ogg' : 'pysrc'}, ext_package = 'ogg', ext_modules = [_oggmodule]) pyogg-1.3+repack.orig/PKG-INFO0000644000175000017500000000037507717116257015055 0ustar morphmorphMetadata-Version: 1.0 Name: pyogg Version: 1.3 Summary: A wrapper for the Ogg libraries. Home-page: http://dulug.duke.edu/~andrew/pyogg Author: Andrew Chatham Author-email: andrew.chatham@duke.edu License: UNKNOWN Description: UNKNOWN Platform: UNKNOWN