Changeset 5289:ddb3677af4d0 in roaraudio for libroar


Ignore:
Timestamp:
11/22/11 14:47:44 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

use support to set mixer ID up at least one API layer

Location:
libroar
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • libroar/cdrom.c

    r5241 r5289  
    109109} 
    110110 
    111 int roar_cdrom_open (struct roar_connection * con, struct roar_cdrom * cdrom, const char * device) { 
     111int roar_cdrom_open (struct roar_connection * con, struct roar_cdrom * cdrom, const char * device, int mixer) { 
    112112#ifdef ROAR_HAVE_CDROM 
    113113 int flags; 
     
    127127 
    128128 cdrom->con        = con; // we do not care here if it is set or not as we can operate in local only mode 
     129 cdrom->mixer      = mixer; 
    129130 
    130131 cdrom->stream     = -1; 
     
    229230 if ( cdrom->play_local ) { 
    230231 
    231   if ( roar_vio_simple_new_stream_obj(&vio, cdrom->con, stream, ROAR_CDROM_STREAMINFO, ROAR_DIR_PLAY) == -1 ) { 
     232  if ( roar_vio_simple_new_stream_obj(&vio, cdrom->con, stream, ROAR_CDROM_STREAMINFO, ROAR_DIR_PLAY, cdrom->mixer) == -1 ) { 
    232233   return -1; 
    233234  } 
  • libroar/simple.c

    r5238 r5289  
    3636#include "libroar.h" 
    3737 
     38static int roar_simple_stream_obj  (struct roar_stream * s, uint32_t rate, uint32_t channels, uint32_t bits, uint32_t codec, const char * server, int dir, const char * name, int mixer) _LIBROAR_ATTR_DEPRECATED; 
     39 
    3840int roar_simple_connect (struct roar_connection * con, const char * server, const char * name) { 
    3941 return roar_simple_connect2(con, server, name, 0, 0); 
     
    6264} 
    6365 
    64 int roar_simple_stream_obj  (struct roar_stream * s, int rate, int channels, int bits, int codec, const char * server, int dir, const char * name) { 
     66static int roar_simple_stream_obj  (struct roar_stream * s, uint32_t rate, uint32_t channels, uint32_t bits, uint32_t codec, const char * server, int dir, const char * name, int mixer) { 
    6567 struct roar_connection con; 
    6668 int ret; 
     
    8284 } 
    8385 
    84  if ( roar_stream_connect(&con, s, dir, -1) == -1 ) { 
     86 if ( roar_stream_connect(&con, s, dir, mixer) == -1 ) { 
    8587  safe_error = roar_error; 
    8688  roar_disconnect(&con); 
     
    115117} 
    116118 
    117 int roar_simple_new_stream_attachexeced_obj (struct roar_connection * con, struct roar_stream * s, int rate, int channels, int bits, int codec, int dir) { 
     119int roar_simple_new_stream_attachexeced_obj (struct roar_connection * con, struct roar_stream * s, uint32_t rate, uint32_t channels, uint32_t bits, uint32_t codec, int dir, int mixer) { 
    118120 int fh; 
    119121 
    120122 if ( (fh = roar_simple_stream_obj(s, rate, channels, bits, codec, NULL /* server, we hope this is ok here... */, 
    121                                    dir, "libroar temp stream")) == -1 ) 
     123                                   dir, "libroar temp stream", mixer)) == -1 ) 
    122124  return -1; 
    123125 
     
    134136} 
    135137 
    136 int roar_simple_new_stream_obj (struct roar_connection * con, struct roar_stream * s, int rate, int channels, int bits, int codec, int dir) { 
     138int roar_simple_new_stream_obj (struct roar_connection * con, struct roar_stream * s, uint32_t rate, uint32_t channels, uint32_t bits, uint32_t codec, int dir, int mixer) { 
    137139 struct roar_libroar_config * config = roar_libroar_get_config(); 
    138140 char file[80] = {0}; 
     
    171173 if ( config != NULL ) { 
    172174  if ( config->workaround.workarounds & ROAR_LIBROAR_CONFIG_WAS_USE_EXECED ) { 
    173    return roar_simple_new_stream_attachexeced_obj(con, s, rate, channels, bits, codec, dir); 
     175   return roar_simple_new_stream_attachexeced_obj(con, s, rate, channels, bits, codec, dir, mixer); 
    174176  } 
    175177 } 
     
    254256 } 
    255257 
    256  if ( roar_stream_connect(con, s, dir, -1) == -1 ) { 
     258 if ( roar_stream_connect(con, s, dir, mixer) == -1 ) { 
    257259  return -1; 
    258260 } 
     
    281283     return -1; 
    282284 
    283     return roar_simple_new_stream_attachexeced_obj(con, s, rate, channels, bits, codec, dir); 
     285    return roar_simple_new_stream_attachexeced_obj(con, s, rate, channels, bits, codec, dir, mixer); 
    284286   } 
    285287 
     
    310312      return -1; 
    311313 
    312      return roar_simple_new_stream_attachexeced_obj(con, s, rate, channels, bits, codec, dir); 
     314     return roar_simple_new_stream_attachexeced_obj(con, s, rate, channels, bits, codec, dir, mixer); 
    313315    } else { // seems like we have a positive reply. So we retry the listen socket: 
    314316     FD_ZERO(&fds); 
     
    323325        return -1; 
    324326 
    325        return roar_simple_new_stream_attachexeced_obj(con, s, rate, channels, bits, codec, dir); 
     327       return roar_simple_new_stream_attachexeced_obj(con, s, rate, channels, bits, codec, dir, mixer); 
    326328      } 
    327329     } 
  • libroar/vio_stream.c

    r5278 r5289  
    9494} 
    9595 
    96 int     roar_vio_simple_stream (struct roar_vio_calls * calls, int rate, int channels, int bits, int codec, 
    97                                                                const char * server, int dir, const char * name) { 
     96int     roar_vio_simple_stream (struct roar_vio_calls * calls, 
     97                                uint32_t rate, uint32_t channels, uint32_t bits, uint32_t codec, 
     98                                const char * server, int dir, const char * name, int mixer) { 
    9899 struct roar_connection * con = NULL; 
    99100 struct roar_stream       stream; 
     
    121122 } 
    122123 
    123  if ( roar_stream_connect(con, &stream, dir, -1) == -1 ) { 
     124 if ( roar_stream_connect(con, &stream, dir, mixer) == -1 ) { 
    124125  err = roar_error; 
    125126  roar_disconnect(con); 
     
    159160                                        struct roar_connection * con, 
    160161                                        struct roar_stream * s, 
    161                                         int rate, int channels, int bits, int codec, int dir) { 
     162                                        uint32_t rate, uint32_t channels, uint32_t bits, uint32_t codec, 
     163                                        int dir, int mixer) { 
    162164 struct roar_stream stream; 
    163165 int fh; 
     
    174176 
    175177 roar_libroar_nowarn(); 
    176  if ( (fh = roar_simple_new_stream_obj(con, s, rate, channels, bits, codec, dir)) == -1 ) { 
     178 if ( (fh = roar_simple_new_stream_obj(con, s, rate, channels, bits, codec, dir, mixer)) == -1 ) { 
    177179  roar_libroar_warn(); 
    178180  ROAR_DBG("roar_vio_simple_new_stream_obj(*) = -1"); 
  • libroar/vs.c

    r5270 r5289  
    338338 ret = roar_vio_simple_new_stream_obj(&(vss->vio), vss->con, &(vss->stream), 
    339339                                      info->rate, info->channels, info->bits, info->codec, 
    340                                       dir 
     340                                      dir, vss->mixerid 
    341341                                     ); 
    342342 
     
    351351 } 
    352352 
    353  if ( roar_stream_get_info(vss->con, &(vss->stream), &sinfo) != -1 ) { 
    354   // TODO: fix this: 
    355   // as we currently do not support to select mixer we just check if we hit the 
    356   // right one. 
    357   if ( vss->mixerid != -1 && vss->mixerid != sinfo.mixer ) { 
    358    _seterr(ROAR_ERROR_INVAL); // TODO: should we maybe use a diffrent value? 
    359    roar_vio_close(vss->vio_ptr); 
    360    return -1; 
    361   } 
    362  
    363   vss->mixerid = sinfo.mixer; 
     353 if ( vss->mixerid != -1 ) { 
     354  if ( roar_stream_get_info(vss->con, &(vss->stream), &sinfo) != -1 ) { 
     355   vss->mixerid = sinfo.mixer; 
     356  } 
     357 } 
     358 
     359 if ( vss->mixerid != -1 ) 
    364360  _roar_vs_find_first_prim(vss); 
    365  } 
    366361 
    367362 vss->flags |= FLAG_STREAM; 
Note: See TracChangeset for help on using the changeset viewer.