Changeset 2019:1a31346356fd in roaraudio for libroarsndio


Ignore:
Timestamp:
06/19/09 17:28:43 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

got libraorsndio work with nearly full VIO support for streams

Location:
libroarsndio
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libroarsndio/libroarsndio.c

    r1711 r2019  
    5252 sio_initpar(&(hdl->para)); 
    5353 
    54  hdl->fh = -1; 
     54 hdl->stream_opened = 0; 
    5555 
    5656 if ( name != NULL ) 
     
    6464  return; 
    6565 
    66  if ( hdl->fh == -1 ) 
    67   close(hdl->fh); 
     66 sio_stop(hdl); 
    6867 
    6968 roar_disconnect(&(hdl->con)); 
  • libroarsndio/stream.c

    r1577 r2019  
    3636#define _i(x) (hdl->info.x) 
    3737int    sio_start  (struct sio_hdl * hdl) { 
     38 int fh; 
     39 
    3840 if ( hdl == NULL ) 
    3941  return 0; 
    4042 
    41  if ( hdl->fh != -1 ) 
     43 if ( hdl->stream_opened ) 
    4244  return 0; 
    4345 
    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 ) 
    4547  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; 
    4655 
    4756 return 1; 
     
    5463  return 0; 
    5564 
    56  if ( hdl->fh == -1 ) 
     65 if ( !hdl->stream_opened ) 
    5766  return 0; 
    5867 
    59  close(hdl->fh); 
     68 roar_vio_close(&(hdl->svio)); 
    6069 
    61  hdl->fh = -1; 
     70 hdl->stream_opened = -1; 
    6271 
    6372 return 1; 
     
    7079  return 0; 
    7180 
    72  if ( hdl->fh == -1 ) 
     81 if ( !hdl->stream_opened ) 
    7382  return 0; 
    7483 
    75  if ( (ret = read(hdl->fh, addr, nbytes)) < 0 ) 
     84 if ( (ret = roar_vio_read(&(hdl->svio), addr, nbytes)) < 0 ) 
    7685  return 0; 
    7786 
     
    8493  return 0; 
    8594 
    86  if ( hdl->fh == -1 ) 
     95 if ( !hdl->stream_opened ) 
    8796  return 0; 
    8897 
    89  if ( (ret = write(hdl->fh, addr, nbytes)) < 0 ) 
     98 if ( (ret = roar_vio_write(&(hdl->svio), addr, nbytes)) < 0 ) 
    9099  return 0; 
    91100 
Note: See TracChangeset for help on using the changeset viewer.