Changeset 1660:99bfd21f00ef in roaraudio
- Timestamp:
- 05/08/09 16:56:40 (15 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
include/libroar/basic.h
r1320 r1660 55 55 56 56 struct roar_connection { 57 int fh;57 int __fh; 58 58 }; 59 59 … … 63 63 int roar_connect (struct roar_connection * con, char * server); 64 64 int roar_connect_fh (struct roar_connection * con, int fh); 65 int roar_get_connection_fh (struct roar_connection * con); 65 66 int roar_disconnect (struct roar_connection * con); 66 67 -
libroar/basic.c
r1475 r1660 187 187 memset(con, 0, sizeof(struct roar_connection)); 188 188 189 con-> fh = fh;189 con->__fh = fh; 190 190 191 191 roar_errno = ROAR_ERROR_NONE; 192 192 return 0; 193 } 194 195 int roar_get_connection_fh (struct roar_connection * con) { 196 return con->__fh; 193 197 } 194 198 … … 204 208 205 209 #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); 210 214 211 215 roar_errno = ROAR_ERROR_NONE; … … 256 260 struct roar_vio_calls vio; 257 261 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 ) 259 263 return -1; 260 264 … … 298 302 struct roar_vio_calls vio; 299 303 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 ) 301 305 return -1; 302 306 … … 385 389 struct roar_vio_calls vio; 386 390 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 ) 388 392 return -1; 389 393 -
libroar/file.c
r1474 r1660 203 203 struct roar_stream localstream[1]; 204 204 205 // FIXME: check error cases 206 205 207 if ( !s ) 206 208 s = localstream; … … 255 257 } 256 258 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); 260 265 } else { 261 266 if ( !(passfh && seek) ) { -
libroar/simple.c
r1476 r1660 65 65 int roar_simple_stream_obj (struct roar_stream * s, int rate, int channels, int bits, int codec, char * server, int dir, char * name) { 66 66 struct roar_connection con; 67 int ret; 67 68 68 69 if ( roar_simple_connect(&con, server, name) == -1 ) { … … 87 88 } 88 89 90 if ( (ret = roar_get_connection_fh(&con)) == -1 ) { 91 roar_disconnect(&con); 92 return -1; 93 } 94 89 95 if ( dir == ROAR_DIR_PLAY ) { 90 ROAR_SHUTDOWN( con.fh, SHUT_RD);96 ROAR_SHUTDOWN(ret, SHUT_RD); 91 97 } 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; 96 102 } 97 103 … … 146 152 147 153 #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 ) { 149 155 return -1; 150 156 } … … 339 345 struct roar_connection con; 340 346 341 con.fh = fh; 347 if ( roar_connect_fh(&con, fh) == -1 ) 348 return -1; 342 349 343 350 return roar_get_standby(&con); -
libroar/stream.c
r1475 r1660 203 203 int roar_stream_passfh (struct roar_connection * con, struct roar_stream * s, int fh) { 204 204 struct roar_message m; 205 int confh; 205 206 206 207 m.cmd = ROAR_CMD_PASSFH; … … 210 211 211 212 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; 212 216 213 217 if ( roar_send_message(con, &m, NULL) == -1 ) { … … 218 222 ROAR_DBG("roar_stream_passfh(*): msg send"); 219 223 220 if ( roar_socket_send_fh(con ->fh, fh, NULL, 0) == -1 )224 if ( roar_socket_send_fh(confh, fh, NULL, 0) == -1 ) 221 225 return -1; 222 226 -
libroaresd/esdbasic.c
r705 r1660 45 45 int esd_open_sound( const char *host ) { 46 46 struct roar_connection con; 47 int fh; 47 48 48 49 if ( roar_simple_connect(&con, (char*) host, NULL) == -1 ) { … … 51 52 } 52 53 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; 54 60 } 55 61 … … 79 85 m.datalen = 0; 80 86 81 con.fh = esd;87 roar_connect_fh(&con, esd); 82 88 83 89 gettimeofday(&try, NULL); -
libroaresd/esdctl.c
r705 r1660 54 54 struct roar_connection con; 55 55 56 con.fh = esd;56 roar_connect_fh(&con, esd); 57 57 58 58 return roar_set_standby(&con, ROAR_STANDBY_ACTIVE); … … 62 62 struct roar_connection con; 63 63 64 con.fh = esd;64 roar_connect_fh(&con, esd); 65 65 66 66 return roar_set_standby(&con, ROAR_STANDBY_INACTIVE); … … 148 148 r->version = 0; // seems to be static 149 149 150 con.fh = esd;150 roar_connect_fh(&con, esd); 151 151 m.cmd = ROAR_CMD_SERVER_OINFO; 152 152 m.datalen = 0; … … 201 201 esd_player_info_t * new_player, * cur = NULL; // = NULL to avoid gcc warning 202 202 203 con->fh = esd;203 roar_connect_fh(con, esd); 204 204 205 205 r = malloc(sizeof(esd_info_t)); … … 334 334 struct roar_mixer_settings mixer; 335 335 336 con.fh = esd;336 roar_connect_fh(&con, esd); 337 337 338 338 mixer.mixer[0] = left_scale == 256 ? 65535 : left_scale * 256; -
libroaryiff/audiocd.c
r819 r1660 42 42 return -1; 43 43 44 r con.fh = con->fd;44 roar_connect_fh(&rcon, con->fd); 45 45 46 46 if ( ! _g_roaryiff_cdrom.is_open ) { … … 58 58 return -1; 59 59 60 r con.fh = con->fd;60 roar_connect_fh(&rcon, con->fd); 61 61 62 62 if ( _g_roaryiff_cdrom.is_playing ) { -
libroaryiff/connection.c
r787 r1660 52 52 } 53 53 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 } 55 59 56 60 return ycon; -
libroaryiff/ctl.c
r788 r1660 31 31 return; 32 32 33 r con.fh = con->fd;33 roar_connect_fh(&rcon, con->fd); 34 34 35 35 roar_exit(&rcon); -
libroaryiff/events.c
r799 r1660 34 34 return -1; 35 35 36 r con.fh = con->fd;36 roar_connect_fh(&rcon, con->fd); 37 37 38 38 if ( con->prev_generated_yid != YIDNULL ) { -
libroaryiff/playback.c
r794 r1660 39 39 return YIDNULL; 40 40 41 r con.fh = con->fd;41 roar_connect_fh(&rcon, con->fd); 42 42 43 43 // hm,... find out how to do this. … … 62 62 return; 63 63 64 r con.fh = con->fd;64 roar_connect_fh(&rcon, con->fd); 65 65 66 66 roar_kick(&rcon, ROAR_OT_STREAM, ROARYIFF_YID2ROAR(yid));
Note: See TracChangeset
for help on using the changeset viewer.