Changeset 1660:99bfd21f00ef in roaraudio


Ignore:
Timestamp:
05/08/09 16:56:40 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

changed name of fh in con struct to fh, this should all apps requiring the private member to fail to build, added function to get fh, change code to use them both everythere

Files:
12 edited

Legend:

Unmodified
Added
Removed
  • include/libroar/basic.h

    r1320 r1660  
    5555 
    5656struct roar_connection { 
    57  int fh; 
     57 int __fh; 
    5858}; 
    5959 
     
    6363int roar_connect    (struct roar_connection * con, char * server); 
    6464int roar_connect_fh (struct roar_connection * con, int fh); 
     65int roar_get_connection_fh (struct roar_connection * con); 
    6566int roar_disconnect (struct roar_connection * con); 
    6667 
  • libroar/basic.c

    r1475 r1660  
    187187 memset(con, 0, sizeof(struct roar_connection)); 
    188188 
    189  con->fh = fh; 
     189 con->__fh = fh; 
    190190 
    191191 roar_errno = ROAR_ERROR_NONE; 
    192192 return 0; 
     193} 
     194 
     195int roar_get_connection_fh (struct roar_connection * con) { 
     196 return con->__fh; 
    193197} 
    194198 
     
    204208 
    205209#ifdef ROAR_HAVE_IO_POSIX 
    206  close(con->fh); 
    207 #endif 
    208  
    209  con->fh = -1; 
     210 close(roar_get_connection_fh(con)); 
     211#endif 
     212 
     213 roar_connect_fh(con, -2); 
    210214 
    211215 roar_errno = ROAR_ERROR_NONE; 
     
    256260 struct roar_vio_calls vio; 
    257261 
    258  if ( roar_vio_open_fh_socket(&vio, con->fh) == -1 ) 
     262 if ( roar_vio_open_fh_socket(&vio, roar_get_connection_fh(con)) == -1 ) 
    259263  return -1; 
    260264 
     
    298302 struct roar_vio_calls vio; 
    299303 
    300  if ( roar_vio_open_fh_socket(&vio, con->fh) == -1 ) 
     304 if ( roar_vio_open_fh_socket(&vio, roar_get_connection_fh(con)) == -1 ) 
    301305  return -1; 
    302306 
     
    385389 struct roar_vio_calls vio; 
    386390 
    387  if ( roar_vio_open_fh_socket(&vio, con->fh) == -1 ) 
     391 if ( roar_vio_open_fh_socket(&vio, roar_get_connection_fh(con)) == -1 ) 
    388392  return -1; 
    389393 
  • libroar/file.c

    r1474 r1660  
    203203 struct roar_stream localstream[1]; 
    204204 
     205 // FIXME: check error cases 
     206 
    205207 if ( !s ) 
    206208  s = localstream; 
     
    255257  } 
    256258 
    257   ROAR_SHUTDOWN(con->fh, SHUT_RD); 
    258  
    259   out = con->fh; 
     259  if ( (out = roar_get_connection_fh(con)) == -1 ) { 
     260   close(in); 
     261   return -1; 
     262  } 
     263 
     264  ROAR_SHUTDOWN(out, SHUT_RD); 
    260265 } else { 
    261266  if ( !(passfh && seek) ) { 
  • libroar/simple.c

    r1476 r1660  
    6565int roar_simple_stream_obj  (struct roar_stream * s, int rate, int channels, int bits, int codec, char * server, int dir, char * name) { 
    6666 struct roar_connection con; 
     67 int ret; 
    6768 
    6869 if ( roar_simple_connect(&con, server, name) == -1 ) { 
     
    8788 } 
    8889 
     90 if ( (ret = roar_get_connection_fh(&con)) == -1 ) { 
     91  roar_disconnect(&con); 
     92  return -1; 
     93 } 
     94 
    8995 if ( dir == ROAR_DIR_PLAY ) { 
    90   ROAR_SHUTDOWN(con.fh, SHUT_RD); 
     96  ROAR_SHUTDOWN(ret, SHUT_RD); 
    9197 } else if ( dir == ROAR_DIR_MONITOR || dir == ROAR_DIR_RECORD ) { 
    92   ROAR_SHUTDOWN(con.fh, SHUT_WR); 
    93  } 
    94  
    95  return con.fh; 
     98  ROAR_SHUTDOWN(ret, SHUT_WR); 
     99 } 
     100 
     101 return ret; 
    96102} 
    97103 
     
    146152 
    147153#ifdef ROAR_HAVE_BSDSOCKETS 
    148  if ( getsockname(con->fh, (struct sockaddr *)&socket_addr, &len) == -1 ) { 
     154 if ( getsockname(roar_get_connection_fh(con), (struct sockaddr *)&socket_addr, &len) == -1 ) { 
    149155  return -1; 
    150156 } 
     
    339345 struct roar_connection con; 
    340346 
    341  con.fh = fh; 
     347 if ( roar_connect_fh(&con, fh) == -1 ) 
     348  return -1; 
    342349 
    343350 return roar_get_standby(&con); 
  • libroar/stream.c

    r1475 r1660  
    203203int roar_stream_passfh  (struct roar_connection * con, struct roar_stream * s, int fh) { 
    204204 struct roar_message m; 
     205 int confh; 
    205206 
    206207 m.cmd     = ROAR_CMD_PASSFH; 
     
    210211 
    211212 ROAR_DBG("roar_stream_passfh(con={.fh=%i,...}, s={.id=%i,...}, fh=%i) = ?", con->fh, s->id, fh); 
     213 
     214 if ( (confh = roar_get_connection_fh(con)) == -1 ) 
     215  return -1; 
    212216 
    213217 if ( roar_send_message(con, &m, NULL) == -1 ) { 
     
    218222 ROAR_DBG("roar_stream_passfh(*): msg send"); 
    219223 
    220  if ( roar_socket_send_fh(con->fh, fh, NULL, 0) == -1 ) 
     224 if ( roar_socket_send_fh(confh, fh, NULL, 0) == -1 ) 
    221225  return -1; 
    222226 
  • libroaresd/esdbasic.c

    r705 r1660  
    4545int esd_open_sound( const char *host ) { 
    4646 struct roar_connection con; 
     47 int fh; 
    4748 
    4849 if ( roar_simple_connect(&con, (char*) host, NULL) == -1 ) { 
     
    5152 } 
    5253 
    53  return con.fh; 
     54 if ( (fh = roar_get_connection_fh(&con)) == -1 ) { 
     55  roar_disconnect(&con); 
     56  return -1; 
     57 } 
     58 
     59 return fh; 
    5460} 
    5561 
     
    7985 m.datalen = 0; 
    8086 
    81  con.fh = esd; 
     87 roar_connect_fh(&con, esd); 
    8288 
    8389 gettimeofday(&try, NULL); 
  • libroaresd/esdctl.c

    r705 r1660  
    5454 struct roar_connection con; 
    5555 
    56  con.fh = esd; 
     56 roar_connect_fh(&con, esd); 
    5757 
    5858 return roar_set_standby(&con, ROAR_STANDBY_ACTIVE); 
     
    6262 struct roar_connection con; 
    6363 
    64  con.fh = esd; 
     64 roar_connect_fh(&con, esd); 
    6565 
    6666 return roar_set_standby(&con, ROAR_STANDBY_INACTIVE); 
     
    148148 r->version = 0; // seems to be static 
    149149 
    150  con.fh    = esd; 
     150 roar_connect_fh(&con, esd); 
    151151 m.cmd     = ROAR_CMD_SERVER_OINFO; 
    152152 m.datalen = 0; 
     
    201201 esd_player_info_t * new_player, * cur = NULL; // = NULL to avoid gcc warning 
    202202 
    203  con->fh = esd; 
     203 roar_connect_fh(con, esd); 
    204204 
    205205 r = malloc(sizeof(esd_info_t)); 
     
    334334 struct roar_mixer_settings mixer; 
    335335 
    336  con.fh = esd; 
     336 roar_connect_fh(&con, esd); 
    337337 
    338338 mixer.mixer[0] = left_scale  == 256 ? 65535 : left_scale  * 256; 
  • libroaryiff/audiocd.c

    r819 r1660  
    4242  return -1; 
    4343 
    44  rcon.fh = con->fd; 
     44 roar_connect_fh(&rcon, con->fd); 
    4545 
    4646 if ( ! _g_roaryiff_cdrom.is_open ) { 
     
    5858  return -1; 
    5959 
    60  rcon.fh = con->fd; 
     60 roar_connect_fh(&rcon, con->fd); 
    6161 
    6262 if ( _g_roaryiff_cdrom.is_playing ) { 
  • libroaryiff/connection.c

    r787 r1660  
    5252 } 
    5353 
    54  ycon->fd = con.fh; 
     54 if ( (ycon->fd = roar_get_connection_fh(&con)) == -1 ) { 
     55  roar_disconnect(&con); 
     56  free(ycon); 
     57  return NULL; 
     58 } 
    5559 
    5660 return ycon; 
  • libroaryiff/ctl.c

    r788 r1660  
    3131  return; 
    3232 
    33  rcon.fh = con->fd; 
     33 roar_connect_fh(&rcon, con->fd); 
    3434 
    3535 roar_exit(&rcon); 
  • libroaryiff/events.c

    r799 r1660  
    3434  return -1; 
    3535 
    36  rcon.fh = con->fd; 
     36 roar_connect_fh(&rcon, con->fd); 
    3737 
    3838 if ( con->prev_generated_yid != YIDNULL ) { 
  • libroaryiff/playback.c

    r794 r1660  
    3939  return YIDNULL; 
    4040 
    41  rcon.fh = con->fd; 
     41 roar_connect_fh(&rcon, con->fd); 
    4242 
    4343 // hm,... find out how to do this. 
     
    6262  return; 
    6363 
    64  rcon.fh = con->fd; 
     64 roar_connect_fh(&rcon, con->fd); 
    6565 
    6666 roar_kick(&rcon, ROAR_OT_STREAM, ROARYIFF_YID2ROAR(yid)); 
Note: See TracChangeset for help on using the changeset viewer.