Changeset 1991:92666322b25e in roaraudio


Ignore:
Timestamp:
06/13/09 03:58:04 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added stream options channel and universe to roard

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roard/roard.c

    r1926 r1991  
    169169 int32_t blocks = -1, blocksize = -1; 
    170170 int dir = ROAR_DIR_OUTPUT; 
     171 int error = 0; 
     172 // DMX: 
     173 int32_t channel  = -1; 
     174 int32_t universe = -1; 
     175 uint16_t tu16; 
    171176 
    172177 ROAR_DBG("add_output(drv='%s', dev='%s', opts='%s') = ?", drv, dev, opts); 
     
    223228   if ( (codec = roar_str2codec(v)) == -1 ) { 
    224229    ROAR_ERR("add_output(*): unknown codec '%s'", v); 
    225     streams_delete(stream); 
    226     if ( prim ) alive = 0; 
    227 #ifdef ROAR_DRIVER_CODEC 
    228     if ( to_free != NULL ) 
    229      free(to_free); 
    230 #endif 
    231     return -1; 
     230    error++; 
    232231   } 
    233232  } else if ( strcmp(k, "blocks") == 0 ) { 
     
    246245   } else { 
    247246    ROAR_ERR("add_output(*): unknown subsystem '%s'", k); 
    248     streams_delete(stream); 
    249     if ( prim ) alive = 0; 
    250 #ifdef ROAR_DRIVER_CODEC 
    251     if ( to_free != NULL ) 
    252      free(to_free); 
    253 #endif 
    254     return -1;  
    255    } 
     247    error++; 
     248   } 
     249  // DMX: 
     250  } else if ( strcmp(k, "channel") == 0 ) { 
     251   channel  = atoi(v); 
     252   if ( channel < 0 || channel > 65535 ) { 
     253    ROAR_ERR("add_output(*): Invalide channel (not within 0..65535): %i", channel); 
     254    channel = -1; 
     255    error++; 
     256   } 
     257  } else if ( strcmp(k, "universe") == 0 ) { 
     258   universe = atoi(v); 
     259   if ( universe < 0 || universe > 255 ) { 
     260    ROAR_ERR("add_output(*): Invalide universe (not within 0..255): %i", universe); 
     261    universe = -1; 
     262    error++; 
     263   } 
     264 
     265 
    256266  } else if ( strcmp(k, "meta") == 0 ) { 
    257267   streams_set_flag(stream, ROAR_FLAG_META); 
     
    267277  } else { 
    268278   ROAR_ERR("add_output(*): unknown option '%s'", k); 
     279   error++; 
     280  } 
     281 
     282  if ( error ) { 
    269283   streams_delete(stream); 
    270284   if ( prim ) alive = 0; 
     
    312326 if ( blocksize != -1 ) 
    313327  roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_DBLKSIZE, &blocksize); 
     328 
     329 // TODO: we shoudld *really* check for errors here... 
     330 if ( channel != -1 ) { 
     331  tu16 = channel; 
     332  roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_DMXSCHAN, &tu16); 
     333 } 
     334 if ( universe != -1 ) { 
     335  tu16 = universe; 
     336  roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_DMXUNIV, &tu16); 
     337 } 
    314338 
    315339 ROAR_DBG("add_output(*): ss->driver_id=%i", ss->driver_id); 
Note: See TracChangeset for help on using the changeset viewer.