Changeset 5278:b3e0dd3f3141 in roaraudio for libroar
- Timestamp:
- 11/21/11 00:42:20 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- libroar
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/vio.c
r5276 r5278 56 56 memset((void*)calls, 0, sizeof(struct roar_vio_calls)); 57 57 58 /*59 calls->read = (ssize_t (*)(int fd, void *buf, size_t count, void * inst))read;60 calls->write = (ssize_t (*)(int fd, void *buf, size_t count, void * inst))write;61 calls->lseek = (off_t (*)(int fildes, off_t offset, int whence, void * inst))lseek;62 */63 64 58 calls->read = roar_vio_basic_read; 65 59 calls->write = roar_vio_basic_write; … … 155 149 } 156 150 157 off_t roar_vio_lseek(struct roar_vio_calls * vio,off_t offset, int whence) {158 off_t ret;159 160 ROAR_DBG("roar_vio_lseek(vio=%p, offset=% u, whence=%i) = ?", vio, (unsignedint)offset, whence);151 roar_off_t roar_vio_lseek(struct roar_vio_calls * vio, roar_off_t offset, int whence) { 152 roar_off_t ret; 153 154 ROAR_DBG("roar_vio_lseek(vio=%p, offset=%li, whence=%i) = ?", vio, (long int)offset, whence); 161 155 162 156 if ( vio == NULL ) { … … 210 204 } 211 205 212 int roar_vio_ctl (struct roar_vio_calls * vio, int cmd, void * data) {206 int roar_vio_ctl (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 213 207 int ret; 214 208 … … 394 388 } 395 389 396 off_t roar_vio_basic_lseek(struct roar_vio_calls * vio,off_t offset, int whence) {390 roar_off_t roar_vio_basic_lseek(struct roar_vio_calls * vio, roar_off_t offset, int whence) { 397 391 #ifdef _CAN_OPERATE 398 392 return lseek(roar_vio_get_fh(vio), offset, whence); … … 411 405 } 412 406 413 int roar_vio_basic_ctl (struct roar_vio_calls * vio, int cmd, void * data) {407 int roar_vio_basic_ctl (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 414 408 #ifdef ROAR_HAVE_H_SYS_IOCTL 415 409 struct roar_vio_sysio_ioctl * sysioctl; … … 715 709 } 716 710 717 off_t roar_vio_pass_lseek(struct roar_vio_calls * vio,off_t offset, int whence) {711 roar_off_t roar_vio_pass_lseek(struct roar_vio_calls * vio, roar_off_t offset, int whence) { 718 712 return roar_vio_lseek((struct roar_vio_calls *) vio->inst, offset, whence); 719 713 } … … 723 717 } 724 718 725 int roar_vio_pass_ctl (struct roar_vio_calls * vio, int cmd, void * data) {719 int roar_vio_pass_ctl (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 726 720 if (vio == NULL) { 727 721 roar_err_set(ROAR_ERROR_FAULT); … … 841 835 842 836 // TODO: we should do a some more intelgent thing here. 843 off_t roar_vio_re_lseek(struct roar_vio_calls * vio,off_t offset, int whence) {837 roar_off_t roar_vio_re_lseek(struct roar_vio_calls * vio, roar_off_t offset, int whence) { 844 838 return roar_vio_lseek((struct roar_vio_calls *) vio->inst, offset, whence); 845 839 } -
libroar/vio_bio.c
r4708 r5278 46 46 calls->write = roar_vio_bio_write; 47 47 calls->lseek = roar_vio_bio_lseek; 48 calls->nonblock = roar_vio_bio_nonblock;49 48 calls->sync = roar_vio_bio_sync; 50 49 calls->close = roar_vio_bio_close; … … 82 81 } 83 82 84 off_t roar_vio_bio_lseek (struct roar_vio_calls * vio,off_t offset, int whence) {83 roar_off_t roar_vio_bio_lseek (struct roar_vio_calls * vio, roar_off_t offset, int whence) { 85 84 return -1; 86 85 } 87 86 88 int roar_vio_bio_nonblock(struct roar_vio_calls * vio, int state) {89 return -1;90 }91 87 int roar_vio_bio_sync (struct roar_vio_calls * vio) { 92 88 return -1; -
libroar/vio_buffer.c
r5276 r5278 146 146 struct roar_vio_buffer * self = vio->inst; 147 147 struct roar_vio_calls * backend; 148 off_t dst = 0;148 roar_off_t dst = 0; 149 149 150 150 if ( self->use_re ) { … … 182 182 183 183 // do the seek: 184 if ( roar_vio_lseek(backend, dst, SEEK_CUR) == ( off_t)-1 )184 if ( roar_vio_lseek(backend, dst, SEEK_CUR) == (roar_off_t)-1 ) 185 185 return -1; 186 186 … … 207 207 } 208 208 209 off_t roar_vio_buffer_lseek (struct roar_vio_calls * vio,off_t offset, int whence) {209 roar_off_t roar_vio_buffer_lseek (struct roar_vio_calls * vio, roar_off_t offset, int whence) { 210 210 struct roar_vio_buffer * self = vio->inst; 211 211 size_t newoff; 212 off_t ret;213 off_t invoff;212 roar_off_t ret; 213 roar_off_t invoff; 214 214 215 215 // in-memory seeking is only supported for SEEK_CUR: … … 286 286 } 287 287 288 if (ret != ( off_t)-1)288 if (ret != (roar_off_t)-1) 289 289 self->abspos = ret; 290 290 … … 292 292 } 293 293 294 int roar_vio_buffer_ctl (struct roar_vio_calls * vio, int cmd, void * data) {294 int roar_vio_buffer_ctl (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 295 295 struct roar_vio_buffer * self; 296 296 -
libroar/vio_buffer_store.c
r5276 r5278 132 132 } 133 133 134 off_t roar_vio_buffer_store_lseek (struct roar_vio_calls * vio,off_t offset, int whence) {134 roar_off_t roar_vio_buffer_store_lseek (struct roar_vio_calls * vio, roar_off_t offset, int whence) { 135 135 // TODO: implement support to seek forward as wide as the buffer allows us to seek. 136 return ( off_t)-1;136 return (roar_off_t)-1; 137 137 } 138 138 … … 141 141 } 142 142 143 int roar_vio_buffer_store_ctl (struct roar_vio_calls * vio, int cmd, void * data) {143 int roar_vio_buffer_store_ctl (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 144 144 if (vio == NULL || cmd == -1) 145 145 return -1; -
libroar/vio_cmd.c
r5276 r5278 251 251 calls->read = roar_vio_2popen_read; 252 252 calls->write = roar_vio_2popen_write; 253 calls->nonblock = roar_vio_2popen_nonblock;254 253 calls->sync = roar_vio_2popen_sync; 255 254 calls->ctl = roar_vio_2popen_ctl; … … 536 535 } 537 536 538 int roar_vio_cmd_ctl (struct roar_vio_calls * vio, int cmd, void * data) {537 int roar_vio_cmd_ctl (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 539 538 struct roar_vio_cmd_state * state = (struct roar_vio_cmd_state *)vio->inst; 540 539 char buf[1]; -
libroar/vio_jumbo.c
r5276 r5278 120 120 } 121 121 122 off_t roar_vio_jumbo_lseek (struct roar_vio_calls * vio,off_t offset, int whence) {122 roar_off_t roar_vio_jumbo_lseek (struct roar_vio_calls * vio, roar_off_t offset, int whence) { 123 123 struct roar_vio_jumbo * self = vio->inst; 124 124 125 125 if ( roar_vio_jumbo_sync(vio) == -1 ) 126 return ( off_t) -1;126 return (roar_off_t) -1; 127 127 128 128 return roar_vio_lseek(self->backend, offset, whence); … … 148 148 } 149 149 150 int roar_vio_jumbo_ctl (struct roar_vio_calls * vio, int cmd, void * data) {150 int roar_vio_jumbo_ctl (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 151 151 struct roar_vio_jumbo * self = vio->inst; 152 152 -
libroar/vio_magic.c
r4708 r5278 36 36 #include "libroar.h" 37 37 38 int roar_vio_open_magic (struct roar_vio_calls * calls, struct roar_vio_calls * dst, int * codec); 39 int roar_vio_magic_close (struct roar_vio_calls * vio); 38 #if 0 40 39 41 ssize_t roar_vio_magic_read (struct roar_vio_calls * vio, void *buf, size_t count) { 40 static int roar_vio_magic_close (struct roar_vio_calls * vio); 41 42 static ssize_t roar_vio_magic_read (struct roar_vio_calls * vio, void *buf, size_t count) { 42 43 struct roar_vio_magic * self = (struct roar_vio_magic *)(vio->inst); 43 44 struct roar_buffer * inp; … … 75 76 } 76 77 77 s size_t roar_vio_magic_write (struct roar_vio_calls * vio, void *buf, size_t count) {78 static ssize_t roar_vio_magic_write (struct roar_vio_calls * vio, void *buf, size_t count) { 78 79 struct roar_vio_magic * self = (struct roar_vio_magic *)(vio->inst); 79 80 void * calls; … … 88 89 } 89 90 90 off_t roar_vio_magic_lseek (struct roar_vio_calls * vio,off_t offset, int whence) {91 static roar_off_t roar_vio_magic_lseek (struct roar_vio_calls * vio, roar_off_t offset, int whence) { 91 92 struct roar_vio_magic * self = (struct roar_vio_magic *)(vio->inst); 92 93 void * calls; … … 101 102 } 102 103 103 int roar_vio_magic_nonblock(struct roar_vio_calls * vio, int state) { 104 struct roar_vio_magic * self = (struct roar_vio_magic *)(vio->inst); 105 void * calls; 106 107 if (self == NULL) 108 return -1; 109 110 if ( roar_stack_get_cur(&(self->vios), &calls) == -1 ) 111 return -1; 112 113 return roar_vio_nonblock((struct roar_vio_calls*)calls, state); 114 } 115 116 int roar_vio_magic_sync (struct roar_vio_calls * vio) { 104 static int roar_vio_magic_sync (struct roar_vio_calls * vio) { 117 105 struct roar_vio_magic * self = (struct roar_vio_magic *)(vio->inst); 118 106 void * calls; … … 127 115 } 128 116 117 int roar_vio_open_magic (struct roar_vio_calls * calls, struct roar_vio_calls * dst, int * codec); 118 119 #endif 120 129 121 //ll -
libroar/vio_misc.c
r5276 r5278 54 54 } 55 55 56 static off_t roar_vio_misc_lseek (struct roar_vio_calls * vio,off_t offset, int whence) {56 static roar_off_t roar_vio_misc_lseek (struct roar_vio_calls * vio, roar_off_t offset, int whence) { 57 57 (void)vio, (void)offset, (void)whence; 58 58 return 0; … … 64 64 } 65 65 66 static int roar_vio_misc_ctl (struct roar_vio_calls * vio, int cmd, void * data) {66 static int roar_vio_misc_ctl (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 67 67 struct roar_vio_misc * self = vio->inst; 68 68 -
libroar/vio_pipe.c
r5276 r5278 195 195 } 196 196 197 int roar_vio_pipe_ctl (struct roar_vio_calls * vio, int cmd, void * data) {197 int roar_vio_pipe_ctl (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 198 198 struct roar_vio_pipe * self; 199 199 -
libroar/vio_proto.c
r5276 r5278 120 120 calls->read = roar_vio_proto_read; 121 121 calls->write = roar_vio_proto_write; 122 // calls->lseek = roar_vio_proto_lseek; // TODO: this is currently not supported123 122 calls->sync = roar_vio_proto_sync; 124 123 calls->ctl = roar_vio_proto_ctl; … … 229 228 } 230 229 231 // TODO: this is currently not implemented as this is hard to implement with buffers:232 off_t roar_vio_proto_lseek (struct roar_vio_calls * vio, off_t offset, int whence);233 234 230 int roar_vio_proto_sync (struct roar_vio_calls * vio) { 235 231 struct roar_vio_proto * self = vio->inst; … … 238 234 } 239 235 240 int roar_vio_proto_ctl (struct roar_vio_calls * vio, int cmd, void * data) {236 int roar_vio_proto_ctl (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 241 237 struct roar_vio_proto * self = vio->inst; 242 238 -
libroar/vio_rtp.c
r5276 r5278 114 114 calls->read = roar_vio_rtp_read; 115 115 calls->write = roar_vio_rtp_write; 116 // calls->lseek = roar_vio_rtp_lseek;117 116 calls->sync = roar_vio_rtp_sync; 118 117 calls->ctl = roar_vio_rtp_ctl; … … 313 312 } 314 313 315 off_t roar_vio_rtp_lseek (struct roar_vio_calls * vio, off_t offset, int whence);316 317 314 int roar_vio_rtp_sync (struct roar_vio_calls * vio) { 318 315 struct roar_rtp_inst * self = vio->inst; … … 323 320 } 324 321 325 int roar_vio_rtp_ctl (struct roar_vio_calls * vio, int cmd, void * data) {322 int roar_vio_rtp_ctl (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 326 323 struct roar_rtp_inst * self = vio->inst; 327 324 struct roar_stream * s = NULL; -
libroar/vio_stack.c
r5276 r5278 116 116 } 117 117 118 int roar_vio_stack_ctl (struct roar_vio_calls * vio, int cmd, void * data) {118 int roar_vio_stack_ctl (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 119 119 if (vio == NULL || cmd == -1) 120 120 return -1; … … 170 170 } 171 171 172 off_t roar_vio_stack_lseek (struct roar_vio_calls * vio,off_t offset, int whence) {172 roar_off_t roar_vio_stack_lseek (struct roar_vio_calls * vio, roar_off_t offset, int whence) { 173 173 if ( vio == NULL ) 174 174 return -1; -
libroar/vio_stdio.c
r5270 r5278 131 131 } 132 132 133 off_t roar_vio_stdio_lseek (struct roar_vio_calls * vio,off_t offset, int whence) {133 roar_off_t roar_vio_stdio_lseek (struct roar_vio_calls * vio, roar_off_t offset, int whence) { 134 134 #if defined(ROAR_HAVE_FSEEK) && defined(ROAR_HAVE_FTELL) 135 135 if ( fseek((FILE*)(vio->inst), offset, whence) == -1 ) … … 138 138 return ftell((FILE*)(vio->inst)); 139 139 #else 140 return ( off_t)-1;140 return (roar_off_t)-1; 141 141 #endif 142 142 } … … 146 146 } 147 147 148 int roar_vio_stdio_ctl (struct roar_vio_calls * vio, int cmd, void * data) {148 int roar_vio_stdio_ctl (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 149 149 150 150 if ( vio == NULL || cmd == -1 ) -
libroar/vio_stream.c
r5276 r5278 44 44 } 45 45 46 static off_t _vio_stream_lseek (struct roar_vio_calls * vio,off_t offset, int whence) {46 static roar_off_t _vio_stream_lseek (struct roar_vio_calls * vio, roar_off_t offset, int whence) { 47 47 return roar_vio_lseek(roar_get_connection_vio2(vio->inst), offset, whence); 48 48 } … … 50 50 return roar_vio_sync(roar_get_connection_vio2(vio->inst)); 51 51 } 52 static int _vio_stream_ctl (struct roar_vio_calls * vio, int cmd, void * data) {52 static int _vio_stream_ctl (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 53 53 if (vio == NULL) { 54 54 roar_err_set(ROAR_ERROR_FAULT); -
libroar/vio_string.c
r4708 r5278 67 67 char cur; 68 68 char buf[1024]; 69 off_t offs;69 roar_off_t offs; 70 70 char * eol; 71 71 … … 79 79 size -= 1; 80 80 81 if ( (offs = roar_vio_lseek(vio, 0, SEEK_CUR)) == ( off_t)-1 ) {81 if ( (offs = roar_vio_lseek(vio, 0, SEEK_CUR)) == (roar_off_t)-1 ) { 82 82 // need to use the one byte at a time methode 83 83 while ( have < size ) { -
libroar/vio_winsock.c
r5276 r5278 49 49 } 50 50 51 int roar_vio_winsock_ctl (struct roar_vio_calls * vio, int cmd, void * data) {51 int roar_vio_winsock_ctl (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 52 52 int tmp; 53 53 int s_r = 0, s_w = 0; -
libroar/vio_zlib.c
r5276 r5278 429 429 } 430 430 431 static off_t roar_vio_zlib_lseek (struct roar_vio_calls * vio,off_t offset, int whence) {431 static roar_off_t roar_vio_zlib_lseek (struct roar_vio_calls * vio, roar_off_t offset, int whence) { 432 432 (void)vio, (void)offset, (void)whence; 433 433 roar_err_set(ROAR_ERROR_NOSYS); 434 return ( off_t)-1;434 return (roar_off_t)-1; 435 435 } 436 436 … … 447 447 } 448 448 449 static int roar_vio_zlib_ctl (struct roar_vio_calls * vio, int cmd, void * data) {449 static int roar_vio_zlib_ctl (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 450 450 struct roar_vio_gzip * self; 451 451
Note: See TracChangeset
for help on using the changeset viewer.