| 1 | # PySoy storage declarations |
|---|
| 2 | # |
|---|
| 3 | # Copyright (C) 2006,2007,2008 PySoy Group |
|---|
| 4 | # |
|---|
| 5 | # This program is free software; you can redistribute it and/or modify |
|---|
| 6 | # it under the terms of the GNU Affero General Public License as published |
|---|
| 7 | # by the Free Software Foundation, either version 3 of the License, or |
|---|
| 8 | # (at your option) any later version. |
|---|
| 9 | # |
|---|
| 10 | # This program is distributed in the hope that it will be useful, |
|---|
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | # GNU Affero General Public License for more details. |
|---|
| 14 | # |
|---|
| 15 | # You should have received a copy of the GNU Affero General Public License |
|---|
| 16 | # along with this program; if not, see http://www.gnu.org/licenses |
|---|
| 17 | # |
|---|
| 18 | # $Id$ |
|---|
| 19 | |
|---|
| 20 | cimport ogg |
|---|
| 21 | cimport py |
|---|
| 22 | cimport stdio |
|---|
| 23 | cimport soy._internals |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | cdef struct Stored : |
|---|
| 27 | int serialno |
|---|
| 28 | unsigned char namelen |
|---|
| 29 | char name[256] |
|---|
| 30 | void *object |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | cdef class Transport (soy._internals.Loopable) : |
|---|
| 34 | cdef Stored* _objs |
|---|
| 35 | cdef object _dict |
|---|
| 36 | cdef int _mobj |
|---|
| 37 | cdef int _nobj |
|---|
| 38 | cdef int _vers # <-9=error, -1=empty, 0=ogg, >0=soy |
|---|
| 39 | cdef int _mode # 0 = idle, 1 = load, 2 = save |
|---|
| 40 | # for Ogg |
|---|
| 41 | cdef int _oggLoop |
|---|
| 42 | cdef ogg.ogg_sync_state _sync |
|---|
| 43 | # |
|---|
| 44 | # General Functions |
|---|
| 45 | cdef int _initObjt ( self, int, object, object ) |
|---|
| 46 | cdef int _indexName ( self, char*, |
|---|
| 47 | unsigned char ) nogil |
|---|
| 48 | cdef int _indexSerial ( self, int ) nogil |
|---|
| 49 | # |
|---|
| 50 | # Transport-specific functions |
|---|
| 51 | cdef int _open ( self, object ) |
|---|
| 52 | cdef int _read ( self, char*, int ) nogil |
|---|
| 53 | cdef int _write ( self, char*, int ) nogil |
|---|
| 54 | cdef int _goto ( self, long ) nogil |
|---|
| 55 | cdef int _seek ( self, long ) nogil |
|---|
| 56 | cdef long _tell ( self ) nogil |
|---|
| 57 | cdef void _rewind ( self ) nogil |
|---|
| 58 | cdef void _close ( self ) nogil |
|---|
| 59 | # |
|---|
| 60 | # Soy functions |
|---|
| 61 | cdef void _soyHead ( self ) |
|---|
| 62 | cdef void _soyLoad ( self ) nogil |
|---|
| 63 | cdef void _soyRead ( self, char*, int ) nogil |
|---|
| 64 | # |
|---|
| 65 | # Ogg functions |
|---|
| 66 | cdef void _oggHead ( self ) |
|---|
| 67 | cdef void _oggLoad ( self ) nogil |
|---|
| 68 | cdef int _oggReadPage ( self, ogg.ogg_page* ) nogil |
|---|
| 69 | |
|---|
| 70 | |
|---|
| 71 | cdef class File (Transport) : |
|---|
| 72 | cdef void* _file |
|---|