Changeset 5056:b31e60545552 in roaraudio for roard/driver_ao.c


Ignore:
Timestamp:
06/02/11 23:13:11 (11 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

support auto reconf bits=32->16 in case not supported (See: #48)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roard/driver_ao.c

    r5012 r5056  
    3232 if ( _driver_ao_usage_counter++ == 0 ) 
    3333  ao_initialize(); 
     34 
     35#ifdef ROAR_HAVE_AO_APPEND_GLOBAL_OPTION 
     36 ao_append_global_option("client_name", "roard"); 
     37#endif 
    3438} 
    3539 
     
    4448 ao_sample_format     format; 
    4549 int driver; 
     50 int autoconfig = 0; 
    4651 
    4752 ROAR_WARN("The libao driver is obsolete, use another!"); 
     
    4954 if ( fh != -1 ) 
    5055  return -1; 
     56 
     57 if ( sstream != NULL ) { 
     58  autoconfig = streams_get_flag(ROAR_STREAM(sstream)->id, ROAR_FLAG_AUTOCONF); 
     59 } 
    5160 
    5261 driver_ao_init(); 
     
    94103   break; 
    95104  default: 
    96    ROAR_ERR("Can not open audio device via libao: codec not supported. You may want to try -oO codec=pcm"); 
    97    driver_ao_uninit(); 
    98    return -1; 
    99   break; 
     105    if ( autoconfig ) { 
     106     format.byte_format = AO_FMT_NATIVE; 
     107     info->codec = ROAR_CODEC_DEFAULT; 
     108    } else { 
     109     ROAR_ERR("Can not open audio device via libao: codec not supported. You may want to try -oO codec=pcm"); 
     110     driver_ao_uninit(); 
     111     return -1; 
     112    } 
     113   break; 
    100114 } 
    101115 
    102116 aodevice = ao_open_live(driver, &format, NULL /* no options */); 
     117 
     118 if ( aodevice == NULL && autoconfig ) { 
     119  format.byte_format = AO_FMT_NATIVE; 
     120  format.bits        = 16; 
     121  info->codec        = ROAR_CODEC_DEFAULT; 
     122  info->bits         = 16; 
     123  aodevice = ao_open_live(driver, &format, NULL /* no options */); 
     124 } 
    103125 
    104126 if ( aodevice == NULL ) { 
Note: See TracChangeset for help on using the changeset viewer.