Changeset 3412:45514e2fd112 in roaraudio


Ignore:
Timestamp:
02/11/10 17:32:47 (10 years ago)
Author:
phi
Branch:
default
Message:

added basic pa_context_get_sink_info_by_name()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroarpulse/introspect.c

    r3411 r3412  
    4040 
    4141/** Get information about a sink by its name */ 
    42 pa_operation* pa_context_get_sink_info_by_name(pa_context *c, const char *name, pa_sink_info_cb_t cb, void *userdata); 
     42pa_operation* pa_context_get_sink_info_by_name(pa_context *c, const char *name, pa_sink_info_cb_t cb, void *userdata) { 
     43 struct roar_stream stream; 
     44 pa_sink_info painfo; 
     45 
     46 if ( c == NULL || cb == NULL ) 
     47  return roar_pa_op_new_done(); 
     48 
     49 memset(&painfo, 0, sizeof(painfo)); 
     50 
     51 if ( !!strcasecmp(name, ROAR_PA_DEFAULT_SINK) ) 
     52  return roar_pa_op_new_done(); 
     53 
     54 if ( roar_server_oinfo(roar_pa_context_get_con(c), &stream) == -1 ) 
     55  return roar_pa_op_new_done(); 
     56 
     57 if ( roar_pa_auinfo2sspec(&(painfo.sample_spec), &(stream.info)) == -1 ) 
     58  return roar_pa_op_new_done(); 
     59 
     60// pa_channel_map_init_auto(&(painfo.channel_map), stream.info.channels, PA_CHANNEL_MAP_DEFAULT); 
     61// pa_cvolume_init(&(painfo.volume)); 
     62 
     63 painfo.name                = ROAR_PA_DEFAULT_SINK; 
     64 painfo.index               = 0; 
     65 painfo.description         = "RoarAudio default mixer"; 
     66 painfo.owner_module        = PA_INVALID_INDEX; 
     67 painfo.mute                = 0; 
     68 painfo.monitor_source      = 0; 
     69 painfo.monitor_source_name = ROAR_PA_DEFAULT_SOURCE; 
     70 painfo.latency             = 0; 
     71 painfo.driver              = "Waveform Mixer Core"; 
     72// painfo.pa_sink_flags_t     = 0; 
     73 
     74 cb(c, &painfo, 1, userdata); 
     75 
     76 return roar_pa_op_new_done(); 
     77} 
    4378 
    4479/** Get information about a sink by its index */ 
     
    6398 pa_server_info painfo; 
    6499 
    65  if ( c == NULL ) 
     100 if ( c == NULL || cb == NULL ) 
    66101  return roar_pa_op_new_done(); 
    67102 
     
    86121 painfo.cookie             ^= (client.pid & 0xFF) | (client.uid & 0xFF) << 8 | (client.gid & 0xFF) << 16; 
    87122 
    88  if ( cb != NULL ) { 
    89   cb(c, &painfo, userdata); 
    90  } 
     123 cb(c, &painfo, userdata); 
    91124 
    92125 return roar_pa_op_new_done(); 
Note: See TracChangeset for help on using the changeset viewer.