Changeset 4577:e9b3b3b521dd in roaraudio


Ignore:
Timestamp:
11/02/10 21:31:36 (13 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

Announce standards via OpenSLP (Closes: #5)

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r4576 r4577  
    11v. 0.4beta2 - ? 
    2  
     2        * Announce standards via OpenSLP (Closes: #5) 
    33 
    44v. 0.4beta1 - Mon Nov 01 2010 16:14 CET 
  • roard/caps.c

    r4510 r4577  
    5555}; 
    5656 
     57char * stds_string (void) { 
     58 size_t len = g_caps_stds.stds_len * 14; 
     59 char * ret = roar_mm_malloc(len); 
     60 size_t off = 0; 
     61 size_t i; 
     62 int snpret; 
     63 uint32_t cap; 
     64 int version; 
     65 
     66 if ( ret == NULL ) 
     67  return NULL; 
     68 
     69 for (i = 0; i < g_caps_stds.stds_len; i++) { 
     70  cap = g_caps_stds.stds[i]; 
     71  version = ROAR_STD_VERSION(cap); 
     72  if ( version == 0 ) { 
     73   snpret = snprintf(ret+off, len-off, "%i-%i,", ROAR_STD_VENDOR(cap), ROAR_STD_STD(cap)); 
     74  } else { 
     75   snpret = snprintf(ret+off, len-off, "%i-%i-%i,", ROAR_STD_VENDOR(cap), ROAR_STD_STD(cap), version); 
     76  } 
     77  if ( snpret > 0 ) { 
     78   off += snpret; 
     79  } else { 
     80   roar_mm_free(ret); 
     81   return NULL; 
     82  } 
     83 } 
     84 
     85 ret[off-1] = 0; 
     86 
     87 return ret; 
     88} 
     89 
    5790//ll 
  • roard/include/caps.h

    r4505 r4577  
    3131struct roar_stds g_caps_stds; 
    3232 
     33char * stds_string (void); 
     34 
    3335#endif 
    3436 
  • roard/roard.c

    r4482 r4577  
    13251325 char * location; 
    13261326 char * description; 
     1327 char * standards; 
    13271328 
    13281329 if ( sockname != NULL ) 
     
    13521353  } 
    13531354 
     1355  standards = stds_string(); 
     1356 
     1357  if ( standards == NULL ) { 
     1358   if ( (standards = roar_mm_malloc(1)) == NULL ) { 
     1359    SLPClose(hslp); 
     1360    return -1; 
     1361   } 
     1362   standards[0] = 0; 
     1363  } 
     1364 
    13541365  snprintf(attr, sizeof(attr), "(wave-rate=%i),(wave-channels=%i),(wave-bits=%i)," 
    13551366#ifndef ROAR_WITHOUT_DCOMP_LIGHT 
    13561367                               "(light-channels=%i)," 
    13571368#endif 
     1369                               "(standards=%s)," 
    13581370                               "(location=%s),(description=%s)", 
    13591371           g_sa->rate, g_sa->channels, g_sa->bits, 
     
    13611373           g_light_state.channels, 
    13621374#endif 
     1375           standards, 
    13631376           location, description 
    13641377          ); 
     1378 
     1379  roar_mm_free(standards); 
    13651380 
    13661381  /* Register a service with SLP */ 
Note: See TracChangeset for help on using the changeset viewer.