Changeset 5289:ddb3677af4d0 in roaraudio


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

Files:
22 edited

Legend:

Unmodified
Added
Removed
  • include/libroar/cdrom.h

    r5241 r5289  
    5252 int fh; 
    5353 int stream; 
     54 int mixer; 
    5455 pid_t player; 
    5556 char device[ROAR_CDROM_MAX_DEVLEN]; 
     
    6364}; 
    6465 
    65 int roar_cdrom_open (struct roar_connection * con, struct roar_cdrom * cdrom, const char * device); 
     66int roar_cdrom_open (struct roar_connection * con, struct roar_cdrom * cdrom, const char * device, int mixer); 
    6667int roar_cdrom_close(struct roar_cdrom * cdrom); 
    6768int roar_cdrom_stop (struct roar_cdrom * cdrom); 
  • include/libroar/simple.h

    r5226 r5289  
    4242int roar_simple_connect2(struct roar_connection * con, const char * server, const char * name, int flags, uint_least32_t timeout); 
    4343 
    44 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) _LIBROAR_ATTR_DEPRECATED; 
     44int 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); 
    4545 
    46 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); 
    47  
    48 int roar_simple_new_stream_obj (struct roar_connection * con, struct roar_stream * s, int rate, int channels, int bits, int codec, int dir) _LIBROAR_ATTR_DEPRECATED; 
     46int 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) _LIBROAR_ATTR_DEPRECATED; 
    4947 
    5048int roar_simple_play_file(const char * file, const char * server, const char * name); 
  • include/libroar/vio.h

    r5278 r5289  
    8787int     roar_vio_open_socket_listen(struct roar_vio_calls * calls, int type, const char * host, int port) _LIBROAR_ATTR_USE_RESULT _LIBROAR_ATTR_NONNULL_ALL; 
    8888 
    89 int     roar_vio_simple_stream (struct roar_vio_calls * calls, int rate, int channels, int bits, int codec, 
    90                                                                const char * server, int dir, const char * name); 
     89int     roar_vio_simple_stream (struct roar_vio_calls * calls, 
     90                                uint32_t rate, uint32_t channels, uint32_t bits, uint32_t codec, 
     91                                const char * server, int dir, const char * name, int mixer); 
    9192 
    9293int     roar_vio_simple_new_stream_obj (struct roar_vio_calls * calls, 
    9394                                        struct roar_connection * con, 
    9495                                        struct roar_stream * s, 
    95                                         int rate, int channels, int bits, int codec, int dir); 
     96                                        uint32_t rate, uint32_t channels, uint32_t bits, uint32_t codec, 
     97                                        int dir, int mixer); 
    9698 
    9799// possible VIOs: 
  • 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; 
  • libroareio/driver_roar.c

    r5270 r5289  
    2727#include "driver.h" 
    2828 
    29 int roar_cdriver_roar(struct roar_vio_calls * calls, const char * name, const char * dev, struct roar_audio_info * info, int dir) { 
     29#define MIXER_ID -1 
     30 
     31int roar_cdriver_roar(struct roar_vio_calls * calls, 
     32                      const char * name, const char * dev, 
     33                      struct roar_audio_info * info, int dir) { 
    3034 (void)name; 
    31  return roar_vio_simple_stream(calls, info->rate, info->channels, info->bits, info->codec, dev, dir, "libroareio client"); 
     35 
     36 return roar_vio_simple_stream(calls, 
     37                               info->rate, info->channels, info->bits, info->codec, 
     38                               dev, dir, "libroareio client", MIXER_ID); 
    3239} 
    3340 
  • libroaresd/esdstream.c

    r5258 r5289  
    7272 } 
    7373 
    74  if ( roar_vio_simple_stream(&calls, rate, channels, bits, codec, host, dir, name) == -1 ) 
     74 if ( roar_vio_simple_stream(&calls, rate, channels, bits, codec, host, dir, name, -1) == -1 ) 
    7575  return -1; 
    7676 
  • libroaross/libroaross.c

    r5236 r5289  
    827827                                     handle->stream.info.bits, 
    828828                                     handle->stream.info.codec, 
    829                                      handle->stream_dir 
     829                                     handle->stream_dir, 
     830                                     -1 /* TODO: Find better way to select mixer ID. */ 
    830831                                    ) == -1 ) 
    831832  return -1; 
  • libroarpulse/stream.c

    r5270 r5289  
    329329                                     s->stream.info.rate, s->stream.info.channels, 
    330330                                     s->stream.info.bits, s->stream.info.codec, 
    331                                      s->stream.dir) == -1 ) { 
     331                                     s->stream.dir, -1 /* TODO: FIXME: set to requested mixer */ ) == -1 ) { 
    332332  pa_stream_set_state(s, PA_STREAM_FAILED); 
    333333  return -1; 
  • libroarrsound/libroarrsound.c

    r5238 r5289  
    341341 
    342342 if ( roar_vio_simple_new_stream_obj(&(self->vio), &(self->con), &(self->stream), 
    343                                      self->rsound.rate, self->rsound.channels, bits, codec, ROAR_DIR_PLAY) == -1 ) 
     343                                     self->rsound.rate, self->rsound.channels, bits, codec, ROAR_DIR_PLAY, -1) == -1 ) 
    344344  return -1; 
    345345 
  • libroarsndio/stream.c

    r4708 r5289  
    104104 
    105105 if ( roar_vio_simple_new_stream_obj(&(hdl->svio), &(hdl->con), &(hdl->stream), 
    106                                      _i(rate), _i(channels), _i(bits), _i(codec), hdl->dir) == -1 ) 
     106                                     _i(rate), _i(channels), _i(bits), _i(codec), hdl->dir, -1) == -1 ) 
    107107  return 0; 
    108108 
  • libroaryiff/audiocd.c

    r4708 r5289  
    5656 
    5757 if ( ! _g_roaryiff_cdrom.is_open ) { 
    58   if ( roar_cdrom_open(&rcon, _g_roaryiff_cdrom.cdrom, NULL) == -1 ) 
     58  if ( roar_cdrom_open(&rcon, _g_roaryiff_cdrom.cdrom, NULL, -1) == -1 ) 
    5959   return -1; 
    6060 } 
  • plugins/xmms/roar.c

    r5236 r5289  
    152152 
    153153 if ( roar_vio_simple_new_stream_obj(&(g_inst.vio), &(g_inst.con), &(g_inst.stream), 
    154                                      rate, nch, bits, codec, ROAR_DIR_PLAY) == -1 ) { 
     154                                     rate, nch, bits, codec, ROAR_DIR_PLAY, -1) == -1 ) { 
    155155  roar_disconnect(&(g_inst.con)); 
    156156  g_inst.state |= STATE_CONNECTED; 
  • roarclients/roarfilt.c

    r5180 r5289  
    244244 if ( roar_vio_simple_stream(&svio, 
    245245                             info.rate, info.channels, info.bits, info.codec, 
    246                              server, ROAR_DIR_FILTER, "roarfilt") == -1 ) { 
     246                             server, ROAR_DIR_FILTER, "roarfilt", -1) == -1 ) { 
    247247  fprintf(stderr, "Error: can not start playback\n"); 
    248248  return 1; 
  • roarclients/roarinterconnect.c

    r5238 r5289  
    322322       return 2; 
    323323    } 
    324     if ( roar_vio_simple_stream(&vio, rate, channels, bits, codec, remote, tmp, CLIENT_NAME) == -1 ) { 
     324    if ( roar_vio_simple_stream(&vio, rate, channels, bits, codec, remote, tmp, CLIENT_NAME, -1) == -1 ) { 
    325325     fprintf(stderr, "Error: can not open RoarAudio stream to %s: %s\n", remote, roar_error2str(roar_error)); 
    326326     return 2; 
  • roarclients/roarlight.c

    r4914 r5289  
    3535 
    3636 printf("  --server    SERVER    - Set server hostname\n" 
     37        "  --mixer     MIXERID   - ID of the light mixer to use\n" 
    3738        "  --help                - Show this help\n" 
    3839       ); 
     
    4647} 
    4748 
    48 int cmd_set (CONVAR, char * arg) { 
     49int cmd_set (CONVAR, char * arg, const int mixer) { 
    4950 char * next = arg; 
    5051 char * k, * v; 
     
    8081 if ( roar_vio_simple_new_stream_obj(&vio, con, NULL, 
    8182                                     ROAR_RATE_DEFAULT, ROAR_CHANNELS_DEFAULT, ROAR_BITS_DEFAULT, 
    82                                      ROAR_CODEC_ROARDMX, ROAR_DIR_LIGHT_IN) == -1 ) 
     83                                     ROAR_CODEC_ROARDMX, ROAR_DIR_LIGHT_IN, mixer) == -1 ) 
    8384  return -1; 
    8485 
     
    9495 
    9596int main (int argc, char * argv[]) { 
     97 struct roar_connection con; 
     98 int    mixer = -1; // -1 = Default 
    9699 char * server   = NULL; 
    97100 char * k; 
    98101 int    i; 
    99  struct roar_connection con; 
    100102 
    101103 for (i = 1; i < argc; i++) { 
     
    104106  if ( !strcmp(k, "--server") || !strcmp(k, "-s") ) { 
    105107   server = argv[++i]; 
     108  } else if ( !strcmp(k, "--mixer") ) { 
     109   mixer = atoi(argv[++i]); 
    106110  } else if ( !strcmp(k, "--codec") ) { 
    107111 
     
    142146  } else if ( !strcmp(k, "set") ) { 
    143147   i++; 
    144    if ( cmd_set(&con, argv[i]) == -1 ) { 
     148   if ( cmd_set(&con, argv[i], mixer) == -1 ) { 
    145149    fprintf(stderr, "Error: can not set channels\n"); 
    146150   } else { 
  • roarclients/roarphone.c

    r4883 r5289  
    168168 if ( (fh = roar_vio_simple_new_stream_obj(vio, &(g_cons.con), &(g_cons.stream), 
    169169                                           info->rate, info->channels, info->bits, info->codec, 
    170                                            ROAR_DIR_BIDIR 
     170                                           ROAR_DIR_BIDIR, -1 
    171171                                          )) == -1 ) 
    172172  return -1; 
  • roarclients/roarvumeter.c

    r5179 r5289  
    220220 } 
    221221 
    222  if ( roar_vio_simple_new_stream_obj(&stream, &con, &s, rate, channels, bits, codec, ROAR_DIR_MONITOR) == -1) { 
     222 if ( roar_vio_simple_new_stream_obj(&stream, &con, &s, rate, channels, bits, codec, ROAR_DIR_MONITOR, -1) == -1) { 
    223223  fprintf(stderr, "Error: can not start monetoring\n"); 
    224224  return 1; 
  • roard/driver_roar.c

    r5162 r5289  
    2626#include "roard.h" 
    2727 
     28#define MIXER_ID -1 
     29 
    2830int driver_roar_open_vio(struct roar_vio_calls * inst, char * device, struct roar_audio_info * info, int fh, struct roar_stream_server * sstream) { 
    2931 int dir = ROAR_DIR_PLAY; 
     
    4648 } 
    4749 
    48  if ( roar_vio_simple_stream(inst, info->rate, info->channels, info->bits, info->codec, device, dir, "roard") == -1 ) { 
     50 if ( roar_vio_simple_stream(inst, info->rate, info->channels, info->bits, info->codec, device, dir, "roard", MIXER_ID) == -1 ) { 
    4951  if ( streams_get_flag(ROAR_STREAM(sstream)->id, ROAR_FLAG_AUTOCONF) ) { 
    5052   if ( roar_profile2info(info, "default") == -1 ) 
    5153    return -1; 
    5254 
    53    if ( roar_vio_simple_stream(inst, info->rate, info->channels, info->bits, info->codec, device, dir, "roard") == -1 ) { 
     55   if ( roar_vio_simple_stream(inst, info->rate, info->channels, info->bits, info->codec, device, dir, "roard", MIXER_ID) == -1 ) { 
    5456    return -1; 
    5557   } 
  • roard/sources.c

    r5278 r5289  
    463463 
    464464 if ( roar_vio_simple_stream(&(ss->vio), s->info.rate, s->info.channels, s->info.bits, s->info.codec, 
    465                              device, ROAR_DIR_MONITOR, "roard") == -1 ) 
     465                             device, ROAR_DIR_MONITOR, "roard", -1) == -1 ) 
    466466  return -1; 
    467467 
Note: See TracChangeset for help on using the changeset viewer.