Changeset 4969:d0b8acb5121f in roaraudio for libroarsndio


Ignore:
Timestamp:
05/16/11 12:11:55 (13 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

Added support for OpenBSD sndio's new TCP connection syntax.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroarsndio/libroarsndio.c

    r4708 r4969  
    7171 } 
    7272 
    73  if ( (optsoffset = strstr(unitoffset, ".")) != NULL ) { 
     73 if ( (optsoffset = strstr(unitoffset, "/")) != NULL ) { 
     74  *optsoffset = 0; 
     75  return unitoffset; 
     76 } else if ( (optsoffset = strstr(unitoffset, ".")) != NULL ) { 
    7477  // TODO: add some code to strip the options of the end 
    7578  return name; 
     
    103106 struct sio_hdl * hdl = NULL; 
    104107 int is_midi = 0; 
     108 char * tmp; 
    105109 
    106110 if ( (hdl = roar_mm_malloc(sizeof(struct sio_hdl))) == NULL ) 
     
    108112 
    109113 memset(hdl, 0, sizeof(struct sio_hdl)); 
     114 hdl->device = NULL; 
    110115 
    111116 switch (mode) { 
     
    113118    hdl->dir = ROAR_DIR_PLAY; 
    114119   break; 
     120  case SIO_REC: 
     121    hdl->dir = ROAR_DIR_PLAY; 
     122   break; 
    115123  case MIO_OUT: 
    116124    is_midi = 1; 
     
    123131 
    124132  // unsupported: 
    125   case SIO_REC: 
    126133  case SIO_PLAY|SIO_REC: 
    127134  case MIO_OUT|MIO_IN: 
     
    141148 } 
    142149 
    143  name = sndio_to_roar_names((char*) name); 
    144  
    145  if ( roar_simple_connect(&(hdl->con), (char*) name, "libroarsndio") == -1 ) { 
     150 if ( name != NULL ) { 
     151  tmp = roar_mm_strdup(name); 
     152  name = sndio_to_roar_names(tmp); 
     153 
     154  if ( name != NULL ) 
     155   hdl->device = roar_mm_strdup(name); 
     156 
     157  roar_mm_free(tmp); 
     158 } 
     159 
     160 if ( roar_simple_connect(&(hdl->con), hdl->device, "libroarsndio") == -1 ) { 
     161  roar_mm_free(hdl->device); 
    146162  roar_mm_free(hdl); 
    147163  return NULL; 
     
    151167 
    152168 hdl->stream_opened = 0; 
    153  
    154  if ( name != NULL ) 
    155   hdl->device = strdup(name); 
    156169 
    157170 if ( is_midi ) { 
     
    179192 roar_disconnect(&(hdl->con)); 
    180193 
     194 if ( hdl->device != NULL ) 
     195  roar_mm_free(hdl->device); 
    181196 roar_mm_free(hdl); 
    182197} 
Note: See TracChangeset for help on using the changeset viewer.