Changeset 5149:b7345c9daac1 in roaraudio


Ignore:
Timestamp:
10/15/11 15:24:11 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added support to list standards the client lib supports (not yet complet)

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • include/libroar/caps.h

    r4708 r5149  
    5252}; 
    5353 
     54const struct roar_stds * libroar_libstds(void); 
     55 
    5456int roar_caps_to_msg(struct roar_message * mes,  struct roar_caps    * caps, void ** data); 
    5557int roar_caps_from_msg(struct roar_caps  * caps, struct roar_message * mes,  void  * data); 
  • libroar/caps.c

    r4944 r5149  
    3636#include "libroar.h" 
    3737 
     38const struct roar_stds * libroar_libstds(void) { 
     39 static const uint32_t std[] = { 
     40  ROAR_STD_MAKE(ROAR_STDV_ROARAUDIO, 0, 0)  // ra-msg-v0 
     41 }; 
     42 static const struct roar_stds stds = {.stds_len = sizeof(std)/sizeof(*std), .stds = (uint32_t*)std}; 
     43 return &stds; 
     44} 
     45 
    3846int roar_caps_to_msg(struct roar_message * mes,  struct roar_caps    * caps, void ** data) { 
    3947 char * datap; 
     
    116124  flags = 0; 
    117125 
    118  if ( con == NULL ) 
    119   return -1; 
     126 if ( con == NULL ) { 
     127  roar_err_set(ROAR_ERROR_FAULT); 
     128  return -1; 
     129 } 
    120130 
    121131 if ( out != NULL ) 
     
    211221 struct roar_stds * ret; 
    212222 
    213  if ( len == 0 ) 
     223 if ( len == 0 ) { 
     224  roar_err_set(ROAR_ERROR_INVAL); 
    214225  return NULL; 
     226 } 
    215227 
    216228 ret = roar_mm_malloc(sizeof(struct roar_stds)); 
     
    235247 
    236248int roar_stds_free(struct roar_stds * stds) { 
    237  if ( stds == NULL ) 
    238   return -1; 
     249 if ( stds == NULL ) { 
     250  roar_err_set(ROAR_ERROR_FAULT); 
     251  return -1; 
     252 } 
    239253 
    240254 if ( stds->stds != NULL ) 
     
    260274 int i; 
    261275 
     276 if ( vendor == NULL ) { 
     277  roar_err_set(ROAR_ERROR_FAULT); 
     278  return -1; 
     279 } 
     280 
    262281 for (i = 0; _libroar_std_vendors[i].name != NULL; i++) 
    263282  if ( !strcasecmp(_libroar_std_vendors[i].name, vendor) ) 
    264283   return _libroar_std_vendors[i].vendor; 
    265284 
     285 roar_err_set(ROAR_ERROR_NOENT); 
    266286 return -1; 
    267287} 
     
    274294   return _libroar_std_vendors[i].name; 
    275295 
     296 roar_err_set(ROAR_ERROR_NOENT); 
    276297 return NULL; 
    277298} 
  • roarclients/roarctl.c

    r5144 r5149  
    6666        "  --verbose   -v          - Show verbose output\n" 
    6767        "  --list-aiprofiles       - Show audio info profiles and exit\n" 
     68        "  --list-libstandards     - Gets list of library (libroar) supported standards\n" 
    6869        "  --enum-servers          - Show a list of possible servers\n" 
    6970       ); 
     
    128129        "\n" 
    129130        "  serverstandards         - Gets list of server supported standards\n" 
     131        "  libstandards            - Gets list of library (libroar) supported standards\n" 
    130132        "\n" 
    131133        "  listclients             - Gets Information about clients\n" 
     
    295297} 
    296298 
    297 void server_standards (struct roar_connection * con) { 
    298  struct roar_stds * stds; 
     299static void print_stds (const struct roar_stds * stds) { 
    299300 size_t i; 
    300301 int vendor, standard, version; 
    301302 char numbuf[2][8]; 
    302303 const char * vendor_name; 
    303  
    304  if ( roar_caps_stds(con, &stds, NULL, -1) == -1 ) { 
    305   fprintf(stderr, "Error: can not get server standards\n"); 
    306   return; 
    307  } 
    308304 
    309305 for (i = 0; i < stds->stds_len; i++) { 
     
    327323  printf("Server standard       : %s-%i%s\n", vendor_name, standard, numbuf[1]); 
    328324 } 
     325} 
     326 
     327void server_standards (struct roar_connection * con) { 
     328 struct roar_stds * stds; 
     329 
     330 if ( roar_caps_stds(con, &stds, NULL, -1) == -1 ) { 
     331  fprintf(stderr, "Error: can not get server standards\n"); 
     332  return; 
     333 } 
     334 
     335 print_stds(stds); 
     336 
     337 roar_stds_free(stds); 
     338} 
     339 
     340void lib_standards (void) { 
     341 print_stds(libroar_libstds()); 
    329342} 
    330343 
     
    10831096   list_aiprofiles(); 
    10841097   return 0; 
     1098  } else if ( strcmp(k, "--list-libstandards") == 0 ) { 
     1099   lib_standards(); 
     1100   return 0; 
    10851101  } else if ( strcmp(k, "--enum-servers") == 0 ) { 
    10861102   enum_servers(); 
     
    11861202  } else if ( !strcmp(k, "serverstandards") ) { 
    11871203   server_standards(&con); 
     1204  } else if ( !strcmp(k, "libstandards") ) { 
     1205   lib_standards(); 
    11881206  } else if ( !strcmp(k, "listclients") ) { 
    11891207   list_clients(&con); 
Note: See TracChangeset for help on using the changeset viewer.