Changeset 5226:3cb3cab29e5e in roaraudio for libroaresd/esdstream.c
- Timestamp:
- 11/12/11 13:20:14 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroaresd/esdstream.c
r4978 r5226 50 50 /* open a socket for playing, monitoring, or recording as a stream */ 51 51 /* the *_fallback functions try to open /dev/dsp if there's no EsounD */ 52 int esd_play_stream( esd_format_t format, int rate, 53 const char *host, const char *name) {52 53 static int libroaresd_stream(esd_format_t format, int rate, const char *host, const char *name, int dir) { 54 54 int channels; 55 55 int bits; 56 56 int codec = ROAR_CODEC_DEFAULT; 57 struct roar_stream s; 57 58 58 59 if ( (format & ESD_BITS16) ) { … … 69 70 } 70 71 71 return roar_simple_stream(rate, channels, bits, codec, (char*)host, ROAR_DIR_PLAY, (char*) name); 72 return roar_simple_stream_obj(&s, rate, channels, bits, codec, (char*)host, dir, (char*)name); 73 } 74 75 int esd_play_stream( esd_format_t format, int rate, 76 const char *host, const char *name ) { 77 return libroaresd_stream(format, rate, host, name, ROAR_DIR_PLAY); 72 78 } 73 79 … … 87 93 int esd_monitor_stream( esd_format_t format, int rate, 88 94 const char *host, const char *name ) { 89 int channels; 90 int bits; 91 int codec = ROAR_CODEC_DEFAULT; 92 93 ROAR_DBG("esd_monitor_stream(format=%x, rate=%i, host='%s', name='%s') = ?", format, rate, host, name); 94 95 if ( (format & ESD_BITS16) ) { 96 bits = 16; 97 } else { 98 bits = 8; 99 codec = CODEC_DEF_8BIT; 100 } 101 102 if ( (format & ESD_MONO) ) { 103 channels = 1; 104 } else { 105 channels = 2; 106 } 107 108 return roar_simple_stream(rate, channels, bits, codec, (char*)host, ROAR_DIR_MONITOR, (char*)name); 95 return libroaresd_stream(format, rate, host, name, ROAR_DIR_MONITOR); 109 96 } 110 97 /* int esd_monitor_stream_fallback( esd_format_t format, int rate ); */ 111 98 int esd_record_stream( esd_format_t format, int rate, 112 99 const char *host, const char *name ) { 113 int channels; 114 int bits; 115 int codec = ROAR_CODEC_DEFAULT; 116 117 ROAR_DBG("esd_record_stream(format=%x, rate=%i, host='%s', name='%s') = ?", format, rate, host, name); 118 119 if ( (format & ESD_BITS16) ) { 120 bits = 16; 121 } else { 122 bits = 8; 123 codec = CODEC_DEF_8BIT; 124 } 125 126 if ( (format & ESD_MONO) ) { 127 channels = 1; 128 } else { 129 channels = 2; 130 } 131 132 return roar_simple_stream(rate, channels, bits, codec, (char*)host, ROAR_DIR_RECORD, (char*)name); 100 return libroaresd_stream(format, rate, host, name, ROAR_DIR_RECORD); 133 101 } 134 102 int esd_record_stream_fallback( esd_format_t format, int rate, … … 144 112 int esd_filter_stream( esd_format_t format, int rate, 145 113 const char *host, const char *name ) { 146 int channels; 147 int bits; 148 int codec = ROAR_CODEC_DEFAULT; 149 150 if ( (format & ESD_BITS16) ) { 151 bits = 16; 152 } else { 153 bits = 8; 154 codec = CODEC_DEF_8BIT; 155 } 156 157 if ( (format & ESD_MONO) ) { 158 channels = 1; 159 } else { 160 channels = 2; 161 } 162 163 return roar_simple_stream(rate, channels, bits, codec, (char*)host, ROAR_DIR_FILTER, (char*)name); 114 return libroaresd_stream(format, rate, host, name, ROAR_DIR_FILTER); 164 115 } 165 116
Note: See TracChangeset
for help on using the changeset viewer.