Changeset 2019:1a31346356fd in roaraudio for libroarsndio
- Timestamp:
- 06/19/09 17:28:43 (15 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- libroarsndio
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libroarsndio/libroarsndio.c
r1711 r2019 52 52 sio_initpar(&(hdl->para)); 53 53 54 hdl-> fh = -1;54 hdl->stream_opened = 0; 55 55 56 56 if ( name != NULL ) … … 64 64 return; 65 65 66 if ( hdl->fh == -1 ) 67 close(hdl->fh); 66 sio_stop(hdl); 68 67 69 68 roar_disconnect(&(hdl->con)); -
libroarsndio/stream.c
r1577 r2019 36 36 #define _i(x) (hdl->info.x) 37 37 int sio_start (struct sio_hdl * hdl) { 38 int fh; 39 38 40 if ( hdl == NULL ) 39 41 return 0; 40 42 41 if ( hdl-> fh != -1)43 if ( hdl->stream_opened ) 42 44 return 0; 43 45 44 if ( ( hdl->fh = roar_simple_new_stream_obj(&(hdl->con), &(hdl->stream), _i(rate), _i(channels), _i(bits), _i(codec), ROAR_DIR_PLAY)) == -1 )46 if ( (fh = roar_simple_new_stream_obj(&(hdl->con), &(hdl->stream), _i(rate), _i(channels), _i(bits), _i(codec), ROAR_DIR_PLAY)) == -1 ) 45 47 return 0; 48 49 if ( roar_vio_open_fh_socket(&(hdl->svio), fh) == -1 ) { 50 close(fh); 51 return 0; 52 } 53 54 hdl->stream_opened = 1; 46 55 47 56 return 1; … … 54 63 return 0; 55 64 56 if ( hdl->fh == -1)65 if ( !hdl->stream_opened ) 57 66 return 0; 58 67 59 close(hdl->fh);68 roar_vio_close(&(hdl->svio)); 60 69 61 hdl-> fh= -1;70 hdl->stream_opened = -1; 62 71 63 72 return 1; … … 70 79 return 0; 71 80 72 if ( hdl->fh == -1)81 if ( !hdl->stream_opened ) 73 82 return 0; 74 83 75 if ( (ret = r ead(hdl->fh, addr, nbytes)) < 0 )84 if ( (ret = roar_vio_read(&(hdl->svio), addr, nbytes)) < 0 ) 76 85 return 0; 77 86 … … 84 93 return 0; 85 94 86 if ( hdl->fh == -1)95 if ( !hdl->stream_opened ) 87 96 return 0; 88 97 89 if ( (ret = write(hdl->fh, addr, nbytes)) < 0 )98 if ( (ret = roar_vio_write(&(hdl->svio), addr, nbytes)) < 0 ) 90 99 return 0; 91 100
Note: See TracChangeset
for help on using the changeset viewer.