Changeset 5278:b3e0dd3f3141 in roaraudio for libroar


Ignore:
Timestamp:
11/21/11 00:42:20 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

last parts of merging _nonblock into _ctl and fixed sizeof(cmd) of _ctls

Location:
libroar
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • libroar/vio.c

    r5276 r5278  
    5656 memset((void*)calls, 0, sizeof(struct roar_vio_calls)); 
    5757 
    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  
    6458 calls->read     = roar_vio_basic_read; 
    6559 calls->write    = roar_vio_basic_write; 
     
    155149} 
    156150 
    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, (unsigned int)offset, whence); 
     151roar_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); 
    161155 
    162156 if ( vio == NULL ) { 
     
    210204} 
    211205 
    212 int     roar_vio_ctl     (struct roar_vio_calls * vio, int cmd, void * data) { 
     206int     roar_vio_ctl     (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 
    213207 int ret; 
    214208 
     
    394388} 
    395389 
    396 off_t   roar_vio_basic_lseek(struct roar_vio_calls * vio, off_t offset, int whence) { 
     390roar_off_t   roar_vio_basic_lseek(struct roar_vio_calls * vio, roar_off_t offset, int whence) { 
    397391#ifdef _CAN_OPERATE 
    398392 return lseek(roar_vio_get_fh(vio), offset, whence); 
     
    411405} 
    412406 
    413 int     roar_vio_basic_ctl     (struct roar_vio_calls * vio, int cmd, void * data) { 
     407int     roar_vio_basic_ctl     (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 
    414408#ifdef ROAR_HAVE_H_SYS_IOCTL 
    415409 struct roar_vio_sysio_ioctl * sysioctl; 
     
    715709} 
    716710 
    717 off_t   roar_vio_pass_lseek(struct roar_vio_calls * vio, off_t offset, int whence) { 
     711roar_off_t   roar_vio_pass_lseek(struct roar_vio_calls * vio, roar_off_t offset, int whence) { 
    718712 return roar_vio_lseek((struct roar_vio_calls *) vio->inst, offset, whence); 
    719713} 
     
    723717} 
    724718 
    725 int     roar_vio_pass_ctl     (struct roar_vio_calls * vio, int cmd, void * data) { 
     719int     roar_vio_pass_ctl     (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 
    726720 if (vio == NULL) { 
    727721  roar_err_set(ROAR_ERROR_FAULT); 
     
    841835 
    842836// 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) { 
     837roar_off_t   roar_vio_re_lseek(struct roar_vio_calls * vio, roar_off_t offset, int whence) { 
    844838 return roar_vio_lseek((struct roar_vio_calls *) vio->inst, offset, whence); 
    845839} 
  • libroar/vio_bio.c

    r4708 r5278  
    4646 calls->write    = roar_vio_bio_write; 
    4747 calls->lseek    = roar_vio_bio_lseek; 
    48  calls->nonblock = roar_vio_bio_nonblock; 
    4948 calls->sync     = roar_vio_bio_sync; 
    5049 calls->close    = roar_vio_bio_close; 
     
    8281} 
    8382 
    84 off_t   roar_vio_bio_lseek   (struct roar_vio_calls * vio, off_t offset, int whence) { 
     83roar_off_t   roar_vio_bio_lseek   (struct roar_vio_calls * vio, roar_off_t offset, int whence) { 
    8584 return -1; 
    8685} 
    8786 
    88 int     roar_vio_bio_nonblock(struct roar_vio_calls * vio, int state) { 
    89  return -1; 
    90 } 
    9187int     roar_vio_bio_sync    (struct roar_vio_calls * vio) { 
    9288 return -1; 
  • libroar/vio_buffer.c

    r5276 r5278  
    146146 struct roar_vio_buffer * self = vio->inst; 
    147147 struct roar_vio_calls  * backend; 
    148  off_t dst = 0; 
     148 roar_off_t dst = 0; 
    149149 
    150150 if ( self->use_re ) { 
     
    182182 
    183183 // 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 ) 
    185185  return -1; 
    186186 
     
    207207} 
    208208 
    209 off_t   roar_vio_buffer_lseek   (struct roar_vio_calls * vio, off_t offset, int whence) { 
     209roar_off_t   roar_vio_buffer_lseek   (struct roar_vio_calls * vio, roar_off_t offset, int whence) { 
    210210 struct roar_vio_buffer * self = vio->inst; 
    211211 size_t newoff; 
    212  off_t  ret; 
    213  off_t  invoff; 
     212 roar_off_t  ret; 
     213 roar_off_t  invoff; 
    214214 
    215215 // in-memory seeking is only supported for SEEK_CUR: 
     
    286286 } 
    287287 
    288  if (ret != (off_t)-1) 
     288 if (ret != (roar_off_t)-1) 
    289289  self->abspos = ret; 
    290290 
     
    292292} 
    293293 
    294 int     roar_vio_buffer_ctl     (struct roar_vio_calls * vio, int cmd, void * data) { 
     294int     roar_vio_buffer_ctl     (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 
    295295 struct roar_vio_buffer * self; 
    296296 
  • libroar/vio_buffer_store.c

    r5276 r5278  
    132132} 
    133133 
    134 off_t   roar_vio_buffer_store_lseek   (struct roar_vio_calls * vio, off_t offset, int whence) { 
     134roar_off_t   roar_vio_buffer_store_lseek   (struct roar_vio_calls * vio, roar_off_t offset, int whence) { 
    135135 // 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; 
    137137} 
    138138 
     
    141141} 
    142142 
    143 int     roar_vio_buffer_store_ctl     (struct roar_vio_calls * vio, int cmd, void * data) { 
     143int     roar_vio_buffer_store_ctl     (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 
    144144 if (vio == NULL || cmd == -1) 
    145145  return -1; 
  • libroar/vio_cmd.c

    r5276 r5278  
    251251 calls->read     = roar_vio_2popen_read; 
    252252 calls->write    = roar_vio_2popen_write; 
    253  calls->nonblock = roar_vio_2popen_nonblock; 
    254253 calls->sync     = roar_vio_2popen_sync; 
    255254 calls->ctl      = roar_vio_2popen_ctl; 
     
    536535} 
    537536 
    538 int     roar_vio_cmd_ctl     (struct roar_vio_calls * vio, int cmd, void * data) { 
     537int     roar_vio_cmd_ctl     (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 
    539538 struct roar_vio_cmd_state * state = (struct roar_vio_cmd_state *)vio->inst; 
    540539 char buf[1]; 
  • libroar/vio_jumbo.c

    r5276 r5278  
    120120} 
    121121 
    122 off_t   roar_vio_jumbo_lseek   (struct roar_vio_calls * vio, off_t offset, int whence) { 
     122roar_off_t   roar_vio_jumbo_lseek   (struct roar_vio_calls * vio, roar_off_t offset, int whence) { 
    123123 struct roar_vio_jumbo * self = vio->inst; 
    124124 
    125125 if ( roar_vio_jumbo_sync(vio) == -1 ) 
    126   return (off_t) -1; 
     126  return (roar_off_t) -1; 
    127127 
    128128 return roar_vio_lseek(self->backend, offset, whence); 
     
    148148} 
    149149 
    150 int     roar_vio_jumbo_ctl     (struct roar_vio_calls * vio, int cmd, void * data) { 
     150int     roar_vio_jumbo_ctl     (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 
    151151 struct roar_vio_jumbo * self = vio->inst; 
    152152 
  • libroar/vio_magic.c

    r4708 r5278  
    3636#include "libroar.h" 
    3737 
    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 
    4039 
    41 ssize_t roar_vio_magic_read    (struct roar_vio_calls * vio, void *buf, size_t count) { 
     40static int     roar_vio_magic_close   (struct roar_vio_calls * vio); 
     41 
     42static ssize_t roar_vio_magic_read    (struct roar_vio_calls * vio, void *buf, size_t count) { 
    4243 struct roar_vio_magic * self = (struct roar_vio_magic *)(vio->inst); 
    4344 struct roar_buffer    * inp; 
     
    7576} 
    7677 
    77 ssize_t roar_vio_magic_write   (struct roar_vio_calls * vio, void *buf, size_t count) { 
     78static ssize_t roar_vio_magic_write   (struct roar_vio_calls * vio, void *buf, size_t count) { 
    7879 struct roar_vio_magic * self = (struct roar_vio_magic *)(vio->inst); 
    7980 void * calls; 
     
    8889} 
    8990 
    90 off_t   roar_vio_magic_lseek   (struct roar_vio_calls * vio, off_t offset, int whence) { 
     91static roar_off_t   roar_vio_magic_lseek   (struct roar_vio_calls * vio, roar_off_t offset, int whence) { 
    9192 struct roar_vio_magic * self = (struct roar_vio_magic *)(vio->inst); 
    9293 void * calls; 
     
    101102} 
    102103 
    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) { 
     104static int     roar_vio_magic_sync    (struct roar_vio_calls * vio) { 
    117105 struct roar_vio_magic * self = (struct roar_vio_magic *)(vio->inst); 
    118106 void * calls; 
     
    127115} 
    128116 
     117int     roar_vio_open_magic    (struct roar_vio_calls * calls, struct roar_vio_calls * dst, int * codec); 
     118 
     119#endif 
     120 
    129121//ll 
  • libroar/vio_misc.c

    r5276 r5278  
    5454} 
    5555 
    56 static off_t   roar_vio_misc_lseek   (struct roar_vio_calls * vio, off_t offset, int whence) { 
     56static roar_off_t   roar_vio_misc_lseek   (struct roar_vio_calls * vio, roar_off_t offset, int whence) { 
    5757 (void)vio, (void)offset, (void)whence; 
    5858 return 0; 
     
    6464} 
    6565 
    66 static int     roar_vio_misc_ctl     (struct roar_vio_calls * vio, int cmd, void * data) { 
     66static int     roar_vio_misc_ctl     (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 
    6767 struct roar_vio_misc * self = vio->inst; 
    6868 
  • libroar/vio_pipe.c

    r5276 r5278  
    195195} 
    196196 
    197 int     roar_vio_pipe_ctl     (struct roar_vio_calls * vio, int cmd, void * data) { 
     197int     roar_vio_pipe_ctl     (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 
    198198 struct roar_vio_pipe * self; 
    199199 
  • libroar/vio_proto.c

    r5276 r5278  
    120120 calls->read     = roar_vio_proto_read; 
    121121 calls->write    = roar_vio_proto_write; 
    122 // calls->lseek    = roar_vio_proto_lseek; // TODO: this is currently not supported 
    123122 calls->sync     = roar_vio_proto_sync; 
    124123 calls->ctl      = roar_vio_proto_ctl; 
     
    229228} 
    230229 
    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  
    234230int     roar_vio_proto_sync    (struct roar_vio_calls * vio) { 
    235231 struct roar_vio_proto * self = vio->inst; 
     
    238234} 
    239235 
    240 int     roar_vio_proto_ctl     (struct roar_vio_calls * vio, int cmd, void * data) { 
     236int     roar_vio_proto_ctl     (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 
    241237 struct roar_vio_proto * self = vio->inst; 
    242238 
  • libroar/vio_rtp.c

    r5276 r5278  
    114114 calls->read               = roar_vio_rtp_read; 
    115115 calls->write              = roar_vio_rtp_write; 
    116 // calls->lseek              = roar_vio_rtp_lseek; 
    117116 calls->sync               = roar_vio_rtp_sync; 
    118117 calls->ctl                = roar_vio_rtp_ctl; 
     
    313312} 
    314313 
    315 off_t   roar_vio_rtp_lseek   (struct roar_vio_calls * vio, off_t offset, int whence); 
    316  
    317314int     roar_vio_rtp_sync    (struct roar_vio_calls * vio) { 
    318315 struct roar_rtp_inst * self = vio->inst; 
     
    323320} 
    324321 
    325 int     roar_vio_rtp_ctl     (struct roar_vio_calls * vio, int cmd, void * data) { 
     322int     roar_vio_rtp_ctl     (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 
    326323 struct roar_rtp_inst * self = vio->inst; 
    327324 struct roar_stream          * s    = NULL; 
  • libroar/vio_stack.c

    r5276 r5278  
    116116} 
    117117 
    118 int     roar_vio_stack_ctl     (struct roar_vio_calls * vio, int cmd, void * data) { 
     118int     roar_vio_stack_ctl     (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 
    119119 if (vio == NULL || cmd == -1) 
    120120  return -1; 
     
    170170} 
    171171 
    172 off_t   roar_vio_stack_lseek   (struct roar_vio_calls * vio, off_t offset, int whence) { 
     172roar_off_t   roar_vio_stack_lseek   (struct roar_vio_calls * vio, roar_off_t offset, int whence) { 
    173173 if ( vio == NULL ) 
    174174  return -1; 
  • libroar/vio_stdio.c

    r5270 r5278  
    131131} 
    132132 
    133 off_t   roar_vio_stdio_lseek   (struct roar_vio_calls * vio, off_t offset, int whence) { 
     133roar_off_t   roar_vio_stdio_lseek   (struct roar_vio_calls * vio, roar_off_t offset, int whence) { 
    134134#if defined(ROAR_HAVE_FSEEK) && defined(ROAR_HAVE_FTELL) 
    135135 if ( fseek((FILE*)(vio->inst), offset, whence) == -1 ) 
     
    138138 return ftell((FILE*)(vio->inst)); 
    139139#else 
    140  return (off_t)-1; 
     140 return (roar_off_t)-1; 
    141141#endif 
    142142} 
     
    146146} 
    147147 
    148 int     roar_vio_stdio_ctl     (struct roar_vio_calls * vio, int cmd, void * data) { 
     148int     roar_vio_stdio_ctl     (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 
    149149 
    150150 if ( vio == NULL || cmd == -1 ) 
  • libroar/vio_stream.c

    r5276 r5278  
    4444} 
    4545 
    46 static off_t   _vio_stream_lseek   (struct roar_vio_calls * vio, off_t offset, int whence) { 
     46static roar_off_t   _vio_stream_lseek   (struct roar_vio_calls * vio, roar_off_t offset, int whence) { 
    4747 return roar_vio_lseek(roar_get_connection_vio2(vio->inst), offset, whence); 
    4848} 
     
    5050 return roar_vio_sync(roar_get_connection_vio2(vio->inst)); 
    5151} 
    52 static int     _vio_stream_ctl     (struct roar_vio_calls * vio, int cmd, void * data) { 
     52static int     _vio_stream_ctl     (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 
    5353 if (vio == NULL) { 
    5454  roar_err_set(ROAR_ERROR_FAULT); 
  • libroar/vio_string.c

    r4708 r5278  
    6767 char    cur; 
    6868 char    buf[1024]; 
    69  off_t   offs; 
     69 roar_off_t   offs; 
    7070 char  * eol; 
    7171 
     
    7979 size -= 1; 
    8080 
    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 ) { 
    8282  // need to use the one byte at a time methode 
    8383  while ( have < size ) { 
  • libroar/vio_winsock.c

    r5276 r5278  
    4949} 
    5050 
    51 int     roar_vio_winsock_ctl     (struct roar_vio_calls * vio, int cmd, void * data) { 
     51int     roar_vio_winsock_ctl     (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 
    5252 int tmp; 
    5353 int s_r = 0, s_w = 0; 
  • libroar/vio_zlib.c

    r5276 r5278  
    429429} 
    430430 
    431 static off_t   roar_vio_zlib_lseek   (struct roar_vio_calls * vio, off_t offset, int whence) { 
     431static roar_off_t   roar_vio_zlib_lseek   (struct roar_vio_calls * vio, roar_off_t offset, int whence) { 
    432432 (void)vio, (void)offset, (void)whence; 
    433433 roar_err_set(ROAR_ERROR_NOSYS); 
    434  return (off_t)-1; 
     434 return (roar_off_t)-1; 
    435435} 
    436436 
     
    447447} 
    448448 
    449 static int     roar_vio_zlib_ctl     (struct roar_vio_calls * vio, int cmd, void * data) { 
     449static int     roar_vio_zlib_ctl     (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) { 
    450450 struct roar_vio_gzip * self; 
    451451 
Note: See TracChangeset for help on using the changeset viewer.