Changeset 5148:73d76a74be61 in roaraudio
- Timestamp:
- 10/15/11 14:29:29 (13 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- libroar
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/basic.c
r5146 r5148 374 374 375 375 int roar_wait_msg (struct roar_connection * con, int16_t seq, int16_t seqmask) { 376 roar_err_set(ROAR_ERROR_NOSYS); 376 377 return -1; 377 378 } … … 381 382 382 383 if ( con == NULL ) { 384 roar_err_set(ROAR_ERROR_FAULT); 383 385 return -1; 384 386 } … … 436 438 437 439 int roar_debug_message_print (struct roar_message * mes) { 438 if ( mes == NULL ) 439 return -1; 440 roar_debug_warn_obsolete("roar_debug_message_print", NULL, NULL); 441 442 if ( mes == NULL ) { 443 roar_err_set(ROAR_ERROR_FAULT); 444 return -1; 445 } 440 446 441 447 ROAR_DBG("roar_debug_message_print(*): Command: %i", mes->cmd); … … 449 455 450 456 int roar_debug_audio_info_print (struct roar_audio_info * info) { 451 if ( info == NULL ) 452 return -1; 457 if ( info == NULL ) { 458 roar_err_set(ROAR_ERROR_FAULT); 459 return -1; 460 } 453 461 454 462 ROAR_DBG("roar_debug_audio_info_print(*): Rate : %i", info->rate); -
libroar/ctl.c
r5145 r5148 325 325 326 326 if ( m->data[0] != 0 ) { 327 ROAR_ERR("roar_ctl_m2f(*): version %i not supported!", (int)m->data[0]); 327 ROAR_DBG("roar_ctl_m2f(*): version %i not supported!", (int)m->data[0]); 328 roar_err_set(ROAR_ERROR_NSVERSION); 328 329 return -1; 329 330 } -
libroar/file.c
r5118 r5148 36 36 #include "libroar.h" 37 37 38 #define BUF SIZE819239 #define BUFMAX 6553638 #define BUFFERSIZE 8192 39 #define BUFMAX 65536 40 40 41 41 #ifdef ROAR_HAVE_IO_POSIX … … 97 97 #endif 98 98 int len; 99 char buf[BUF SIZE];99 char buf[BUFFERSIZE]; 100 100 #if defined(__linux__) && defined(ROAR_HAVE_IPV4) 101 101 int cork_new = 1, cork_old; … … 118 118 // TODO: try mmap here! 119 119 120 while ((len = read(in, buf, BUF SIZE)) > 0)120 while ((len = read(in, buf, BUFFERSIZE)) > 0) 121 121 r += write(out, buf, len); 122 122 … … 136 136 int mmap_flags = 0; 137 137 struct stat stat; 138 139 roar_debug_warn_obsolete("roar_file_map", NULL, NULL); 138 140 139 141 if ( mem == NULL || filename == NULL ) … … 183 185 184 186 int roar_file_unmap (size_t len, void * mem) { 187 roar_debug_warn_obsolete("roar_file_unmap", NULL, NULL); 188 185 189 #ifdef ROAR_HAVE_MMAP 186 190 return munmap(mem, len); … … 205 209 int seek; 206 210 int len; 207 char buf[BUF SIZE];211 char buf[BUFFERSIZE]; 208 212 int rate = ROAR_RATE_DEFAULT, channels = ROAR_CHANNELS_DEFAULT, bits = ROAR_BITS_DEFAULT; 209 213 struct roar_stream localstream[1]; … … 213 217 ROAR_DBG("roar_file_play_full(*) = ?"); 214 218 215 if ( !s)219 if ( s == NULL ) 216 220 s = localstream; 217 221 218 if ( !con ) 219 return -1; 220 221 if ( !file ) 222 return -1; 223 224 if ( exec && passfh ) 225 return -1; 222 if ( con == NULL ) { 223 roar_err_set(ROAR_ERROR_FAULT); 224 return -1; 225 } 226 227 if ( file == NULL ) { 228 roar_err_set(ROAR_ERROR_FAULT); 229 return -1; 230 } 231 232 if ( exec && passfh ) { 233 roar_err_set(ROAR_ERROR_INVAL); 234 return -1; 235 } 226 236 227 237 #ifdef ROAR_TARGET_WIN32 … … 230 240 if ( (in = open(file, O_RDONLY, 0644)) == -1 ) { 231 241 #endif 232 return -1; 233 } 234 235 if ((len = read(in, buf, BUFSIZE)) < 1) { 242 roar_err_from_errno(); 243 return -1; 244 } 245 246 if ((len = read(in, buf, BUFFERSIZE)) < 1) { 247 roar_err_from_errno(); 236 248 close(in); 237 249 return -1; … … 245 257 246 258 if ( codec == -1 ) { 247 ROAR_ ERR("roar_file_play_full(*): Unknown codec of file: %s", file);259 ROAR_WARN("roar_file_play_full(*): Unknown codec of file: %s", file); 248 260 close(in); 261 roar_err_set(ROAR_ERROR_BADMAGIC); 249 262 return -1; 250 263 } … … 256 269 if ( exec ) { 257 270 if ( roar_stream_new(s, rate, channels, bits, codec) == -1 ) { 258 ROAR_ ERR("roar_file_play_full(*): Can not create new stream. This is realy BAD!");271 ROAR_DBG("roar_file_play_full(*): Can not create new stream. This is realy BAD!"); 259 272 close(in); 260 273 return -1; … … 262 275 263 276 if ( roar_stream_connect2(con, s, ROAR_DIR_PLAY, -1) == -1 ) { 264 ROAR_ ERR("roar_file_play_full(*): Can not connect new stream to server.");277 ROAR_DBG("roar_file_play_full(*): Can not connect new stream to server."); 265 278 close(in); 266 279 return -1; … … 268 281 269 282 if ( roar_stream_exec(con, s) == -1 ) { 270 ROAR_ ERR("roar_file_play_full(*): Can not exec new stream on server.");283 ROAR_DBG("roar_file_play_full(*): Can not exec new stream on server."); 271 284 close(in); 272 285 return -1; … … 275 288 roar_libroar_nowarn(); 276 289 if ( (out = roar_get_connection_fh(con)) == -1 ) { 277 ROAR_ ERR("roar_file_play_full(*): Can not get socket of server connection for exec data transmition.");290 ROAR_DBG("roar_file_play_full(*): Can not get socket of server connection for exec data transmition."); 278 291 close(in); 279 292 roar_libroar_warn(); … … 311 324 close(out); 312 325 #else 313 while ((len = read(in, buf, BUF SIZE)) > 0)326 while ((len = read(in, buf, BUFFERSIZE)) > 0) 314 327 if ( send(out, buf, len, 0) != len ) 315 328 break; … … 336 349 return r; 337 350 #else 351 roar_err_set(ROAR_ERROR_NOSYS); 338 352 return -1; 339 353 #endif … … 350 364 #endif 351 365 366 roar_err_set(ROAR_ERROR_NODEV); 352 367 return NULL; 353 368 } -
libroar/simple.c
r5118 r5148 73 73 struct roar_connection con; 74 74 int ret; 75 int safe_error; 75 76 76 77 roar_debug_warn_sysio("roar_simple_stream_obj", NULL, NULL); … … 83 84 84 85 if ( roar_stream_new(s, rate, channels, bits, codec) == -1 ) { 86 safe_error = roar_error; 85 87 roar_disconnect(&con); 88 roar_err_set(safe_error); 86 89 return -1; 87 90 } 88 91 89 92 if ( roar_stream_connect2(&con, s, dir, -1) == -1 ) { 93 safe_error = roar_error; 90 94 roar_disconnect(&con); 95 roar_err_set(safe_error); 91 96 return -1; 92 97 } 93 98 94 99 if ( roar_stream_exec(&con, s) == -1 ) { 100 safe_error = roar_error; 95 101 roar_disconnect(&con); 102 roar_err_set(safe_error); 96 103 return -1; 97 104 } … … 99 106 roar_libroar_nowarn(); 100 107 if ( (ret = roar_get_connection_fh(&con)) == -1 ) { 108 safe_error = roar_error; 101 109 roar_libroar_warn(); 102 110 roar_disconnect(&con); 111 roar_err_set(safe_error); 103 112 return -1; 104 113 } -
libroar/socket.c
r5138 r5148 230 230 231 231 if ( (flags = fcntl(fh, F_GETFL, 0)) == -1 ) { 232 roar_err_from_errno(); 232 233 ROAR_ERR("roar_socket_nonblock(fh=%i, state=%i): Can not read flags: %s", fh, state, strerror(errno)); 233 234 ROAR_DBG("roar_socket_nonblock(fh=%i, state=%i) = -1", fh, state); … … 244 245 245 246 if ( fcntl(fh, F_SETFL, flags) == -1 ) { 247 roar_err_from_errno(); 246 248 ROAR_ERR("roar_socket_nonblock(fh=%i, state=%i): Can not set flags: %s", fh, state, strerror(errno)); 247 249 ROAR_DBG("roar_socket_nonblock(fh=%i, state=%i) = -1", fh, state); … … 269 271 270 272 if ( getsockname(fh, (struct sockaddr *)&socket_addr, &len) == -1 ) { 273 roar_err_from_errno(); 271 274 return -1; 272 275 } 273 276 274 277 if ( socket_addr.sin_family != AF_INET ) { 278 roar_err_set(ROAR_ERROR_TYPEMM); 275 279 return -1; 276 280 } … … 283 287 // if ( mode_func(fh, (struct sockaddr *)&socket_addr, sizeof(struct sockaddr_in)) == -1 ) { 284 288 if ( bind(n, (struct sockaddr *)&socket_addr, len) == -1 ) { 289 roar_err_from_errno(); 285 290 close(n); 286 291 return -1; -
libroar/stream.c
r5145 r5148 67 67 roar_stream_s2m(&ms, &m); 68 68 69 if ( roar_req (con, &m, NULL) != 0 )69 if ( roar_req3(con, &m, NULL) != 0 ) 70 70 return -1; 71 71
Note: See TracChangeset
for help on using the changeset viewer.