Changeset 3144:f8cd1e36b390 in roaraudio for libroaross/libroaross.c


Ignore:
Timestamp:
01/15/10 13:09:40 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

open stream, fixed a lot things

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroaross/libroaross.c

    r3143 r3144  
    8484 struct roar_stream    stream; 
    8585 struct roar_vio_calls stream_vio; 
     86 int                   stream_dir; 
    8687 int                   stream_opened; 
    8788}; 
     
    157158 session->refc--; 
    158159 
     160 ROAR_DBG("_close_session(session=%p): session->refc=%i", session, session->refc); 
     161 
    159162 if ( session->refc == 0 ) { 
    160163  roar_disconnect(&(session->con)); 
     
    174177 session->refc++; // TODO: better warp this 
    175178 handle->type = HT_NONE; 
    176  roar_stream_new_empty(&(handle->stream)); 
     179 handle->stream_dir = ROAR_DIR_PLAY; 
     180 roar_stream_new(&(handle->stream), ROAR_RATE_DEFAULT, ROAR_CHANNELS_DEFAULT, ROAR_BITS_DEFAULT, ROAR_CODEC_DEFAULT); 
    177181 
    178182 return handle; 
     
    185189 handle->refc--; 
    186190 
     191 ROAR_DBG("_close_handle(handle=%p): handle->refc=%i", handle, handle->refc); 
     192 
    187193 if ( handle->refc == 0 ) { 
    188   _close_session(handle->session); 
    189  
    190194  if ( handle->stream_opened ) 
    191195   roar_vio_close(&(handle->stream_vio)); 
    192196 
     197  handle->session->refc--; 
     198 
     199  _close_session(handle->session); 
     200 
    193201  roar_mm_free(handle); 
    194202 } 
    195 } 
    196  
    197 static int _open_stream (struct handle * handle) { 
    198   return -1; 
    199203} 
    200204 
     
    261265  return -2; 
    262266 
    263  _os.write(1, "DOOF!\n", 6); 
    264  
    265267 if ( (session = _open_session(NULL, NULL)) == NULL ) { 
    266268  return -1; 
     
    280282 
    281283 return pointer->fh; 
     284} 
     285 
     286// ------------------------------------- 
     287// open function for streams: 
     288// ------------------------------------- 
     289 
     290static int _open_stream (struct handle * handle) { 
     291  // FIXME: this should be re-written much more cleanly: 
     292 
     293 if ( handle == NULL ) 
     294  return -1; 
     295 
     296 if ( roar_vio_simple_new_stream_obj(&(handle->stream_vio), 
     297                                     &(handle->session->con), &(handle->stream), 
     298                                     handle->stream.info.rate, 
     299                                     handle->stream.info.channels, 
     300                                     handle->stream.info.bits, 
     301                                     handle->stream.info.codec, 
     302                                     handle->stream_dir 
     303                                    ) == -1 ) 
     304  return -1; 
     305 
     306 handle->stream_opened++; 
     307 
     308 return 0; 
    282309} 
    283310 
Note: See TracChangeset for help on using the changeset viewer.