Changeset 762:b0fafbce8cc5 in roaraudio for libroar
- Timestamp:
- 09/07/08 03:04:30 (16 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/file.c
r701 r762 157 157 158 158 ssize_t roar_file_play (struct roar_connection * con, char * file, int exec) { 159 struct roar_stream s; 160 161 return roar_file_play_full(con, file, exec, 0, &s); 162 } 163 164 ssize_t roar_file_play_full (struct roar_connection * con, char * file, int exec, int passfh, struct roar_stream * s) { 159 165 int codec = -1; 160 166 int in, out = -1; 161 struct roar_stream s;162 167 ssize_t r = 0; 163 168 int len; … … 171 176 return -1; 172 177 178 if ( exec && passfh ) 179 return -1; 180 173 181 if ( (in = open(file, O_RDONLY, 0644)) == -1 ) { 174 182 return -1; … … 188 196 189 197 if ( exec ) { 190 if ( roar_stream_new( &s, rate, channels, bits, codec) == -1 ) {191 close(in); 192 return -1; 193 } 194 195 if ( roar_stream_connect(con, &s, ROAR_DIR_PLAY) == -1 ) {196 close(in); 197 return -1; 198 } 199 200 if ( roar_stream_exec(con, &s) == -1 ) {198 if ( roar_stream_new(s, rate, channels, bits, codec) == -1 ) { 199 close(in); 200 return -1; 201 } 202 203 if ( roar_stream_connect(con, s, ROAR_DIR_PLAY) == -1 ) { 204 close(in); 205 return -1; 206 } 207 208 if ( roar_stream_exec(con, s) == -1 ) { 201 209 close(in); 202 210 return -1; … … 215 223 write(out, buf, len); 216 224 217 r = roar_file_send_raw(out, in); 218 219 close(out); 220 221 if ( exec ) { 222 con->fh = -1; 223 } 224 225 close(in); 225 if ( !passfh ) { 226 r = roar_file_send_raw(out, in); 227 228 close(out); 229 230 if ( exec ) { 231 con->fh = -1; 232 } 233 234 close(in); 235 } else { 236 if ( roar_stream_passfh(con, s, in) == -1 ) { 237 return -1; 238 } 239 close(out); 240 close(in); 241 return 0; 242 } 226 243 227 244 return r;
Note: See TracChangeset
for help on using the changeset viewer.