Changeset 4883:c56aedd9d0cb in roaraudio for libroar


Ignore:
Timestamp:
04/26/11 21:39:10 (13 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

Added functions to access symbolic names for audio info parameters (Closes: #51)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/stream.c

    r4796 r4883  
    964964} 
    965965 
     966int32_t roar_str2rate(const char * rate) { 
     967 struct roar_audio_info info; 
     968 int ret; 
     969 
     970 if ( roar_profile2info(&info, rate) != -1 ) { 
     971  return info.rate; 
     972 } 
     973 
     974 ret = atoi(rate); 
     975 
     976 if ( ret == 0 && rate[0] != '0' ) { 
     977  return -1; 
     978 } 
     979 
     980 return ret; 
     981} 
     982 
     983int32_t roar_str2bits(const char * bits) { 
     984 struct roar_audio_info info; 
     985 int ret; 
     986 
     987 if ( roar_profile2info(&info, bits) != -1 ) { 
     988  return info.bits; 
     989 } 
     990 
     991 ret = atoi(bits); 
     992 
     993 if ( ret == 0 && bits[0] != '0' ) { 
     994  return -1; 
     995 } 
     996 
     997 return ret; 
     998} 
     999 
     1000int32_t roar_str2channels(const char * channels) { 
     1001 struct roar_audio_info info; 
     1002 int ret; 
     1003 
     1004 if ( !strcasecmp(channels, "mono") ) { 
     1005  return 1; 
     1006 } else if ( !strcasecmp(channels, "stereo") ) { 
     1007  return 2; 
     1008 } 
     1009 
     1010 if ( roar_profile2info(&info, channels) != -1 ) { 
     1011  return info.channels; 
     1012 } 
     1013 
     1014 ret = atoi(channels); 
     1015 
     1016 if ( ret == 0 && channels[0] != '0' ) { 
     1017  return -1; 
     1018 } 
     1019 
     1020 return ret; 
     1021} 
     1022 
     1023 
    9661024const char * roar_streamstate2str(int streamstate) { 
    9671025 switch (streamstate) { 
Note: See TracChangeset for help on using the changeset viewer.