Changeset 5358:f3d3dc789cd7 in roaraudio for libroarpulse


Ignore:
Timestamp:
12/15/11 18:52:47 (8 years ago)
Author:
phi
Branch:
default
Message:

fixed minor problems with pulse emulation

Location:
libroarpulse
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libroarpulse/context.c

    r5270 r5358  
    130130        pa_context_flags_t flags, 
    131131        const pa_spawn_api *api) { 
    132  
    133  if ( c == NULL ) 
     132 pa_context_flags_t flags_left = flags; 
     133 
     134 if ( c == NULL ) 
     135  return -1; 
     136 
     137 flags_left |= PA_CONTEXT_NOAUTOSPAWN; 
     138 flags_left -= PA_CONTEXT_NOAUTOSPAWN; 
     139#ifdef PA_CONTEXT_NOFAIL 
     140 flags_left |= PA_CONTEXT_NOFAIL; 
     141 flags_left -= PA_CONTEXT_NOFAIL; 
     142#endif 
     143#ifdef PA_CONTEXT_NOFLAGS 
     144 flags_left |= PA_CONTEXT_NOFLAGS; 
     145 flags_left -= PA_CONTEXT_NOFLAGS; 
     146#endif 
     147 
     148 if ( flags_left != 0 ) 
    134149  return -1; 
    135150 
     
    140155 } 
    141156 
     157 // flags may contain the following values: 
     158#if 0 
     159    PA_CONTEXT_NOFLAGS = 0x0000U, 
     160    /**< Flag to pass when no specific options are needed (used to avoid casting)  \since 0.9.19 */ 
     161    PA_CONTEXT_NOAUTOSPAWN = 0x0001U, 
     162    /**< Disabled autospawning of the PulseAudio daemon if required */ 
     163    PA_CONTEXT_NOFAIL = 0x0002U 
     164    /**< Don't fail if the daemon is not available when pa_context_connect() is called, instead enter PA_CONTEXT_CONNECTING state and wait for the daemon to appear.  \since 0.9.15 */ 
     165#endif 
     166 
    142167 // we do currently not support to spawn a daemon, so we ignore flags and api. 
    143168 
    144  server = roar_pa_find_server((char*)server); 
    145  
    146  if ( roar_simple_connect(&(c->con), (char*)server, 
     169 server = roar_pa_find_server(server); 
     170 
     171 if ( roar_simple_connect(&(c->con), server, 
    147172                          c->name != NULL ? c->name : "libroarpulse [pa_context_connect()]") == -1 ) { 
    148173  c->errnum = PA_ERR_CONNECTIONREFUSED; 
    149174  pa_context_set_state(c, PA_CONTEXT_FAILED); 
     175 
     176#ifdef PA_CONTEXT_NOFAIL 
     177  if ( flags & PA_CONTEXT_NOFAIL ) { 
     178   pa_context_set_state(c, PA_CONTEXT_CONNECTING); 
     179   return 0; 
     180  } 
     181#endif 
    150182  return -1; 
    151183 } 
  • libroarpulse/libroarpulse.c

    r4708 r5358  
    3939 
    4040#include <libroarpulse/libroarpulse.h> 
    41  
    42 int roar_codec_pulse2roar (int codec) { 
    43  return ROAR_CODEC_DEFAULT; 
    44 } 
    4541 
    4642int roar_pa_sspec2auinfo (struct roar_audio_info * info, const pa_sample_spec * ss) { 
     
    124120} 
    125121 
    126 char * roar_pa_find_server (char * server) { 
     122const char * roar_pa_find_server (const char * server) { 
    127123 struct roar_x11_connection * x11con; 
    128124 
Note: See TracChangeset for help on using the changeset viewer.