[0] | 1 | //basic.c: |
---|
| 2 | |
---|
[690] | 3 | /* |
---|
| 4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008 |
---|
| 5 | * |
---|
| 6 | * This file is part of libroar a part of RoarAudio, |
---|
| 7 | * a cross-platform sound system for both, home and professional use. |
---|
| 8 | * See README for details. |
---|
| 9 | * |
---|
| 10 | * This file is free software; you can redistribute it and/or modify |
---|
| 11 | * it under the terms of the GNU General Public License version 3 |
---|
| 12 | * as published by the Free Software Foundation. |
---|
| 13 | * |
---|
| 14 | * libroar is distributed in the hope that it will be useful, |
---|
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 17 | * GNU General Public License for more details. |
---|
| 18 | * |
---|
| 19 | * You should have received a copy of the GNU General Public License |
---|
| 20 | * along with this software; see the file COPYING. If not, write to |
---|
| 21 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
| 22 | * |
---|
| 23 | * NOTE for everyone want's to change something and send patches: |
---|
| 24 | * read README and HACKING! There a addition information on |
---|
| 25 | * the license of this document you need to read before you send |
---|
| 26 | * any patches. |
---|
| 27 | * |
---|
| 28 | * NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc |
---|
| 29 | * or libpulse*: |
---|
| 30 | * The libs libroaresd, libroararts and libroarpulse link this lib |
---|
| 31 | * and are therefore GPL. Because of this it may be illigal to use |
---|
| 32 | * them with any software that uses libesd, libartsc or libpulse*. |
---|
| 33 | */ |
---|
| 34 | |
---|
[0] | 35 | #include "libroar.h" |
---|
| 36 | |
---|
| 37 | int roar_connect_raw (char * server) { |
---|
| 38 | char user_sock[80]; |
---|
| 39 | char * roar_server; |
---|
[701] | 40 | int i = 0; |
---|
[0] | 41 | int port = 0; |
---|
| 42 | int fh = -1; |
---|
[501] | 43 | int is_decnet = 0; |
---|
[516] | 44 | char * obj = NULL; |
---|
[1475] | 45 | #if !defined(ROAR_TARGET_WIN32) && !defined(ROAR_TARGET_MICROCONTROLLER) |
---|
[1026] | 46 | struct passwd * pwd; |
---|
[1393] | 47 | #endif |
---|
[828] | 48 | #ifdef ROAR_HAVE_LIBDNET |
---|
| 49 | struct stat decnet_stat; |
---|
| 50 | #endif |
---|
[0] | 51 | |
---|
[807] | 52 | roar_errno = ROAR_ERROR_UNKNOWN; |
---|
| 53 | |
---|
[61] | 54 | if ( server == NULL && (roar_server = getenv("ROAR_SERVER")) != NULL ) |
---|
[0] | 55 | server = roar_server; |
---|
| 56 | |
---|
[1436] | 57 | #if !defined(ROAR_TARGET_WIN32) && !defined(ROAR_TARGET_MICROCONTROLLER) |
---|
[448] | 58 | if ( server == NULL && (i = readlink("/etc/roarserver", user_sock, 79)) != -1 ) { |
---|
| 59 | user_sock[i] = 0; |
---|
| 60 | server = user_sock; |
---|
| 61 | } |
---|
[1093] | 62 | #endif |
---|
[448] | 63 | |
---|
[61] | 64 | if ( server == NULL || *server == 0 ) { |
---|
[0] | 65 | /* connect via defaults */ |
---|
| 66 | |
---|
[1764] | 67 | #ifdef ROAR_HAVE_UNIX |
---|
[1436] | 68 | #ifndef ROAR_TARGET_MICROCONTROLLER |
---|
[1026] | 69 | roar_server = getenv("HOME"); |
---|
[1435] | 70 | #else |
---|
| 71 | roar_server = NULL; |
---|
| 72 | #endif |
---|
[1026] | 73 | |
---|
| 74 | if ( roar_server == NULL ) { |
---|
[1436] | 75 | #if !defined(ROAR_TARGET_WIN32) && !defined(ROAR_TARGET_MICROCONTROLLER) |
---|
[1026] | 76 | if ( (pwd = getpwuid(getuid())) == NULL ) { |
---|
| 77 | roar_server = "/NX-HOME-DIR"; |
---|
| 78 | } else { |
---|
| 79 | roar_server = pwd->pw_dir; |
---|
| 80 | } |
---|
[1078] | 81 | #else |
---|
| 82 | roar_server = "/WIN32-SUCKS"; |
---|
| 83 | #endif |
---|
[1026] | 84 | } |
---|
| 85 | |
---|
| 86 | snprintf(user_sock, 79, "%s/%s", roar_server, ROAR_DEFAULT_SOCK_USER); |
---|
[0] | 87 | |
---|
| 88 | if ( (fh = roar_socket_connect(user_sock, 0)) != -1 ) |
---|
| 89 | return fh; |
---|
| 90 | |
---|
[237] | 91 | if ( (fh = roar_socket_connect(ROAR_DEFAULT_SOCK_GLOBAL, 0)) != -1 ) |
---|
| 92 | return fh; |
---|
[1764] | 93 | #endif |
---|
[237] | 94 | |
---|
[0] | 95 | if ( (fh = roar_socket_connect(ROAR_DEFAULT_HOST, ROAR_DEFAULT_PORT)) != -1 ) |
---|
| 96 | return fh; |
---|
| 97 | |
---|
[828] | 98 | #ifdef ROAR_HAVE_LIBDNET |
---|
| 99 | if ( stat(ROAR_PROC_NET_DECNET, &decnet_stat) == 0 ) { |
---|
| 100 | if ( roar_socket_get_local_nodename() ) { |
---|
| 101 | snprintf(user_sock, 79, "%s::%s", roar_socket_get_local_nodename(), ROAR_DEFAULT_OBJECT); |
---|
[2010] | 102 | if ( (fh = roar_socket_connect(user_sock, ROAR_DEFAULT_NUM)) != -1 ) |
---|
| 103 | return fh; |
---|
[828] | 104 | } |
---|
[522] | 105 | } |
---|
[828] | 106 | #endif |
---|
[2007] | 107 | |
---|
| 108 | #ifdef ROAR_HAVE_LIBSLP |
---|
[2014] | 109 | if ( (server = roar_slp_find_roard(0)) != NULL ) |
---|
| 110 | if ( (fh = roar_connect_raw(server)) != -1 ) |
---|
| 111 | return fh; |
---|
| 112 | |
---|
| 113 | /* in case we can not connect to the server given this may be a cache problem, |
---|
| 114 | we do a new lookup with the cache disabled in this case */ |
---|
| 115 | ROAR_WARN("roar_connect_raw(*): Can not connect to SLP located server, disabling cache"); |
---|
| 116 | if ( (server = roar_slp_find_roard(1)) != NULL ) |
---|
| 117 | if ( (fh = roar_connect_raw(server)) != -1 ) |
---|
| 118 | return fh; |
---|
[2007] | 119 | #endif |
---|
[522] | 120 | |
---|
[2014] | 121 | return -1; |
---|
| 122 | |
---|
[0] | 123 | } else { |
---|
| 124 | /* connect via (char*)server */ |
---|
[501] | 125 | // find a port: |
---|
| 126 | if ( *server != '/' ) { // don't test AF_UNIX sockets for ports |
---|
| 127 | for (i = 0; server[i] != 0; i++) { |
---|
| 128 | if ( server[i] == ':' ) { |
---|
| 129 | if ( server[i+1] == ':' ) { // DECnet, leave unchanged |
---|
| 130 | is_decnet = 1; |
---|
[516] | 131 | obj = &server[i+2]; |
---|
[501] | 132 | break; |
---|
| 133 | } |
---|
| 134 | |
---|
| 135 | port = atoi(server+i+1); |
---|
| 136 | server[i] = 0; |
---|
| 137 | break; |
---|
| 138 | } |
---|
[0] | 139 | } |
---|
| 140 | } |
---|
| 141 | |
---|
[521] | 142 | if ( is_decnet ) { |
---|
| 143 | *user_sock = 0; |
---|
| 144 | if ( *server == ':' ) { |
---|
| 145 | if ( roar_socket_get_local_nodename() ) |
---|
[1066] | 146 | strncat(user_sock, roar_socket_get_local_nodename(), 6); |
---|
[521] | 147 | } |
---|
| 148 | |
---|
[1066] | 149 | strncat(user_sock, server, 79); |
---|
[516] | 150 | server = user_sock; |
---|
[521] | 151 | if ( *obj == 0 ) { |
---|
[1066] | 152 | #ifdef DN_MAXOBJL |
---|
| 153 | strncat(user_sock, ROAR_DEFAULT_OBJECT, DN_MAXOBJL+2); |
---|
| 154 | #else |
---|
| 155 | ROAR_ERR("roar_connect_raw(*): size of DECnet object unknown."); |
---|
| 156 | #endif |
---|
[521] | 157 | } |
---|
[516] | 158 | } |
---|
| 159 | |
---|
[501] | 160 | if ( port || is_decnet ) { |
---|
[0] | 161 | fh = roar_socket_connect(server, port); |
---|
| 162 | // restore the original string |
---|
| 163 | server[i] = ':'; |
---|
| 164 | } else { |
---|
| 165 | fh = roar_socket_connect(server, ROAR_DEFAULT_PORT); |
---|
| 166 | } |
---|
| 167 | } |
---|
| 168 | |
---|
[807] | 169 | if ( fh == -1 ) |
---|
| 170 | roar_errno = ROAR_ERROR_CONNREFUSED; |
---|
| 171 | |
---|
[0] | 172 | ROAR_DBG("roar_connect_raw(*) = %i", fh); |
---|
| 173 | |
---|
| 174 | return fh; |
---|
| 175 | } |
---|
| 176 | |
---|
| 177 | int roar_connect (struct roar_connection * con, char * server) { |
---|
[1315] | 178 | int fh; |
---|
| 179 | |
---|
| 180 | if ( con == NULL ) { |
---|
| 181 | roar_errno = ROAR_ERROR_INVAL; |
---|
| 182 | return -1; |
---|
| 183 | } |
---|
| 184 | |
---|
[807] | 185 | roar_errno = ROAR_ERROR_UNKNOWN; |
---|
[1315] | 186 | fh = roar_connect_raw(server); |
---|
[0] | 187 | |
---|
[1315] | 188 | if ( fh == -1 ) |
---|
[0] | 189 | return -1; |
---|
| 190 | |
---|
[1315] | 191 | return roar_connect_fh(con, fh); |
---|
| 192 | } |
---|
| 193 | |
---|
| 194 | int roar_connect_fh (struct roar_connection * con, int fh) { |
---|
| 195 | |
---|
| 196 | if ( con == NULL || fh == -1 ) { |
---|
| 197 | roar_errno = ROAR_ERROR_INVAL; |
---|
| 198 | return -1; |
---|
| 199 | } |
---|
| 200 | |
---|
| 201 | // specal hack to set an ilegal value used internaly in libroar: |
---|
| 202 | if ( fh == -2 ) |
---|
| 203 | fh = -1; |
---|
| 204 | |
---|
| 205 | memset(con, 0, sizeof(struct roar_connection)); |
---|
| 206 | |
---|
[1660] | 207 | con->__fh = fh; |
---|
[1315] | 208 | |
---|
[807] | 209 | roar_errno = ROAR_ERROR_NONE; |
---|
[0] | 210 | return 0; |
---|
| 211 | } |
---|
| 212 | |
---|
[1660] | 213 | int roar_get_connection_fh (struct roar_connection * con) { |
---|
[2043] | 214 | if ( con == NULL ) |
---|
| 215 | return -1; |
---|
| 216 | |
---|
[1660] | 217 | return con->__fh; |
---|
| 218 | } |
---|
| 219 | |
---|
[2043] | 220 | int roar_get_connection_vio (struct roar_connection * con, struct roar_vio_calls * vio) { |
---|
| 221 | if ( con == NULL || vio == NULL ) |
---|
| 222 | return -1; |
---|
| 223 | |
---|
| 224 | return roar_vio_open_fh_socket(vio, roar_get_connection_fh(con)); |
---|
| 225 | } |
---|
| 226 | |
---|
[0] | 227 | int roar_disconnect (struct roar_connection * con) { |
---|
| 228 | struct roar_message m; |
---|
| 229 | |
---|
| 230 | m.datalen = 0; |
---|
| 231 | m.stream = 0; |
---|
[133] | 232 | m.pos = 0; |
---|
[0] | 233 | m.cmd = ROAR_CMD_QUIT; |
---|
| 234 | |
---|
| 235 | roar_req(con, &m, NULL); |
---|
| 236 | |
---|
[1475] | 237 | #ifdef ROAR_HAVE_IO_POSIX |
---|
[1660] | 238 | close(roar_get_connection_fh(con)); |
---|
[1475] | 239 | #endif |
---|
[0] | 240 | |
---|
[1660] | 241 | roar_connect_fh(con, -2); |
---|
[0] | 242 | |
---|
[807] | 243 | roar_errno = ROAR_ERROR_NONE; |
---|
| 244 | |
---|
[0] | 245 | return 0; |
---|
| 246 | } |
---|
| 247 | |
---|
| 248 | int roar_identify (struct roar_connection * con, char * name) { |
---|
| 249 | struct roar_message mes; |
---|
| 250 | pid_t pid; |
---|
| 251 | int max_len; |
---|
| 252 | |
---|
[807] | 253 | roar_errno = ROAR_ERROR_UNKNOWN; |
---|
| 254 | |
---|
[0] | 255 | ROAR_DBG("roar_identify(*): try to identify myself..."); |
---|
| 256 | |
---|
| 257 | mes.cmd = ROAR_CMD_IDENTIFY; |
---|
| 258 | mes.stream = 0; |
---|
| 259 | mes.pos = 0; |
---|
| 260 | |
---|
| 261 | ROAR_DBG("roar_identify(*): name=%p", name); |
---|
| 262 | |
---|
| 263 | if ( name == NULL ) |
---|
| 264 | name = "libroar client"; |
---|
| 265 | |
---|
| 266 | ROAR_DBG("roar_identify(*): name=%p", name); |
---|
| 267 | |
---|
| 268 | max_len = strlen(name); |
---|
| 269 | ROAR_DBG("roar_identify(*): strlen(name) = %i", max_len); |
---|
| 270 | |
---|
| 271 | if ( max_len > (LIBROAR_BUFFER_MSGDATA - 5) ) |
---|
| 272 | max_len = LIBROAR_BUFFER_MSGDATA - 5; |
---|
| 273 | |
---|
| 274 | mes.datalen = 5 + max_len; |
---|
| 275 | mes.data[0] = 1; |
---|
| 276 | |
---|
| 277 | pid = getpid(); |
---|
| 278 | *(uint32_t*)(mes.data+1) = ROAR_HOST2NET32(pid); |
---|
| 279 | ROAR_DBG("roar_identify(*): pid = %i", pid); |
---|
| 280 | |
---|
| 281 | strncpy(mes.data+5, name, max_len); |
---|
| 282 | |
---|
| 283 | return roar_req(con, &mes, NULL); |
---|
| 284 | } |
---|
| 285 | |
---|
[8] | 286 | #define _ROAR_MESS_BUF_LEN (1 /* version */ + 1 /* cmd */ + 2 /* stream */ + 4 /* pos */ + 2 /* datalen */) |
---|
[0] | 287 | int roar_send_message (struct roar_connection * con, struct roar_message * mes, char * data) { |
---|
[1319] | 288 | struct roar_vio_calls vio; |
---|
| 289 | |
---|
[1660] | 290 | if ( roar_vio_open_fh_socket(&vio, roar_get_connection_fh(con)) == -1 ) |
---|
[1319] | 291 | return -1; |
---|
| 292 | |
---|
| 293 | return roar_vsend_message(&vio, mes, data); |
---|
| 294 | } |
---|
| 295 | |
---|
| 296 | int roar_vsend_message(struct roar_vio_calls * vio, struct roar_message * mes, char * data) { |
---|
[0] | 297 | char buf[_ROAR_MESS_BUF_LEN]; |
---|
| 298 | |
---|
[807] | 299 | roar_errno = ROAR_ERROR_UNKNOWN; |
---|
| 300 | |
---|
[0] | 301 | ROAR_DBG("roar_send_message(*): try to send an request..."); |
---|
| 302 | |
---|
[8] | 303 | buf[0] = _ROAR_MESSAGE_VERSION; |
---|
| 304 | buf[1] = (unsigned char) mes->cmd; |
---|
| 305 | *(uint16_t*)(buf+2) = ROAR_HOST2NET16(mes->stream); |
---|
| 306 | *(uint32_t*)(buf+4) = ROAR_HOST2NET32(mes->pos); |
---|
| 307 | *(uint16_t*)(buf+8) = ROAR_HOST2NET16(mes->datalen); |
---|
[0] | 308 | |
---|
[1319] | 309 | if ( roar_vio_write(vio, buf, _ROAR_MESS_BUF_LEN) != _ROAR_MESS_BUF_LEN ) { |
---|
[807] | 310 | roar_errno = ROAR_ERROR_PIPE; |
---|
[0] | 311 | return -1; |
---|
[807] | 312 | } |
---|
[0] | 313 | |
---|
[807] | 314 | if ( mes->datalen != 0 ) { |
---|
[1319] | 315 | if ( roar_vio_write(vio, data == NULL ? mes->data : data, mes->datalen) != mes->datalen ) { |
---|
[807] | 316 | roar_errno = ROAR_ERROR_PIPE; |
---|
[0] | 317 | return -1; |
---|
[807] | 318 | } |
---|
| 319 | } |
---|
| 320 | |
---|
| 321 | roar_errno = ROAR_ERROR_NONE; |
---|
[0] | 322 | |
---|
| 323 | ROAR_DBG("roar_send_message(*) = 0"); |
---|
| 324 | return 0; |
---|
| 325 | } |
---|
| 326 | |
---|
| 327 | int roar_recv_message (struct roar_connection * con, struct roar_message * mes, char ** data) { |
---|
[1319] | 328 | struct roar_vio_calls vio; |
---|
| 329 | |
---|
[1660] | 330 | if ( roar_vio_open_fh_socket(&vio, roar_get_connection_fh(con)) == -1 ) |
---|
[1319] | 331 | return -1; |
---|
| 332 | |
---|
| 333 | return roar_vrecv_message(&vio, mes, data); |
---|
| 334 | } |
---|
| 335 | |
---|
| 336 | int roar_vrecv_message(struct roar_vio_calls * vio, struct roar_message * mes, char ** data) { |
---|
[0] | 337 | char buf[_ROAR_MESS_BUF_LEN]; |
---|
| 338 | |
---|
[807] | 339 | roar_errno = ROAR_ERROR_UNKNOWN; |
---|
| 340 | |
---|
[0] | 341 | ROAR_DBG("roar_recv_message(*): try to get a response form the server..."); |
---|
| 342 | |
---|
| 343 | if ( data ) |
---|
| 344 | *data = NULL; |
---|
| 345 | |
---|
[1319] | 346 | if ( roar_vio_read(vio, buf, _ROAR_MESS_BUF_LEN) != _ROAR_MESS_BUF_LEN ) { |
---|
[807] | 347 | roar_errno = ROAR_ERROR_PROTO; |
---|
[0] | 348 | return -1; |
---|
[807] | 349 | } |
---|
[0] | 350 | |
---|
| 351 | ROAR_DBG("roar_recv_message(*): Got a header"); |
---|
| 352 | |
---|
[807] | 353 | if ( buf[0] != _ROAR_MESSAGE_VERSION ) { |
---|
| 354 | roar_errno = ROAR_ERROR_PROTO; |
---|
[8] | 355 | return -1; |
---|
[807] | 356 | } |
---|
[8] | 357 | |
---|
| 358 | mes->cmd = (unsigned char)buf[1]; |
---|
| 359 | mes->stream = ROAR_NET2HOST16(*(uint16_t*)(buf+2)); |
---|
| 360 | mes->pos = ROAR_NET2HOST32(*(uint32_t*)(buf+4)); |
---|
| 361 | mes->datalen = ROAR_NET2HOST16(*(uint16_t*)(buf+8)); |
---|
[0] | 362 | |
---|
| 363 | ROAR_DBG("roar_recv_message(*): command=%i(%s)", mes->cmd, |
---|
| 364 | mes->cmd == ROAR_CMD_OK ? "OK" : (mes->cmd == ROAR_CMD_ERROR ? "ERROR" : "UNKNOWN")); |
---|
| 365 | |
---|
[104] | 366 | if ( mes->datalen == 0 ) { |
---|
| 367 | ROAR_DBG("roar_recv_message(*): no data in this pkg"); |
---|
| 368 | ROAR_DBG("roar_recv_message(*) = 0"); |
---|
[807] | 369 | roar_errno = ROAR_ERROR_NONE; |
---|
[104] | 370 | return 0; |
---|
| 371 | } |
---|
| 372 | |
---|
[0] | 373 | if ( mes->datalen <= LIBROAR_BUFFER_MSGDATA ) { |
---|
[1319] | 374 | if ( roar_vio_read(vio, mes->data, mes->datalen) == mes->datalen ) { |
---|
[0] | 375 | ROAR_DBG("roar_recv_message(*): Got data!"); |
---|
| 376 | ROAR_DBG("roar_recv_message(*) = 0"); |
---|
[807] | 377 | roar_errno = ROAR_ERROR_NONE; |
---|
[0] | 378 | return 0; |
---|
| 379 | } |
---|
[807] | 380 | |
---|
| 381 | roar_errno = ROAR_ERROR_PIPE; |
---|
[0] | 382 | return -1; |
---|
| 383 | } else { |
---|
[807] | 384 | if ( data == NULL ) { |
---|
| 385 | roar_errno = ROAR_ERROR_MSGSIZE; |
---|
[0] | 386 | return -1; |
---|
[807] | 387 | } |
---|
[0] | 388 | |
---|
[807] | 389 | if ( (*data = malloc(mes->datalen)) == NULL ) { |
---|
| 390 | roar_errno = ROAR_ERROR_NOMEM; |
---|
[0] | 391 | return -1; |
---|
[807] | 392 | } |
---|
[0] | 393 | |
---|
[807] | 394 | if ( mes->datalen == 0 ) { |
---|
| 395 | roar_errno = ROAR_ERROR_NONE; |
---|
[0] | 396 | return 0; |
---|
[807] | 397 | } |
---|
[0] | 398 | |
---|
[1319] | 399 | if ( roar_vio_read(vio, *data, mes->datalen) == mes->datalen ) { |
---|
[0] | 400 | ROAR_DBG("roar_recv_message(*): Got data!"); |
---|
| 401 | ROAR_DBG("roar_recv_message(*) = 0"); |
---|
[807] | 402 | roar_errno = ROAR_ERROR_NONE; |
---|
[0] | 403 | return 0; |
---|
| 404 | } |
---|
[807] | 405 | |
---|
| 406 | roar_errno = ROAR_ERROR_PIPE; |
---|
[0] | 407 | return -1; |
---|
| 408 | } |
---|
| 409 | |
---|
[807] | 410 | // what happened here? |
---|
[0] | 411 | return -1; |
---|
| 412 | } |
---|
| 413 | |
---|
| 414 | int roar_req (struct roar_connection * con, struct roar_message * mes, char ** data) { |
---|
[1319] | 415 | struct roar_vio_calls vio; |
---|
| 416 | |
---|
[1660] | 417 | if ( roar_vio_open_fh_socket(&vio, roar_get_connection_fh(con)) == -1 ) |
---|
[1319] | 418 | return -1; |
---|
| 419 | |
---|
| 420 | return roar_vreq(&vio, mes, data); |
---|
| 421 | } |
---|
| 422 | |
---|
| 423 | int roar_vreq (struct roar_vio_calls * vio, struct roar_message * mes, char ** data) { |
---|
| 424 | if ( roar_vsend_message(vio, mes, data ? *data : NULL) != 0 ) |
---|
[0] | 425 | return -1; |
---|
| 426 | |
---|
| 427 | if ( data ) |
---|
| 428 | free(*data); |
---|
| 429 | |
---|
[2053] | 430 | roar_vio_sync(vio); // we need to do this becasue of ssl/compressed links |
---|
| 431 | |
---|
[1319] | 432 | return roar_vrecv_message(vio, mes, data); |
---|
[0] | 433 | } |
---|
| 434 | |
---|
| 435 | int roar_debug_message_print (struct roar_message * mes) { |
---|
| 436 | if ( mes == NULL ) |
---|
| 437 | return -1; |
---|
| 438 | |
---|
| 439 | ROAR_DBG("roar_debug_message_print(*): Command: %i", mes->cmd); |
---|
| 440 | ROAR_DBG("roar_debug_message_print(*): Stream : %u", mes->stream); |
---|
| 441 | ROAR_DBG("roar_debug_message_print(*): Pos : %u", mes->pos); |
---|
| 442 | ROAR_DBG("roar_debug_message_print(*): Datalen: %i", mes->datalen); |
---|
| 443 | |
---|
| 444 | ROAR_DBG("roar_debug_message_print(*) = 0"); |
---|
| 445 | return 0; |
---|
| 446 | } |
---|
| 447 | |
---|
| 448 | int roar_debug_audio_info_print (struct roar_audio_info * info) { |
---|
| 449 | if ( info == NULL ) |
---|
| 450 | return -1; |
---|
| 451 | |
---|
| 452 | ROAR_DBG("roar_debug_audio_info_print(*): Rate : %i", info->rate); |
---|
| 453 | ROAR_DBG("roar_debug_audio_info_print(*): Channels: %i", info->channels); |
---|
| 454 | ROAR_DBG("roar_debug_audio_info_print(*): Bits : %i", info->bits); |
---|
| 455 | ROAR_DBG("roar_debug_audio_info_print(*): Codec : %i", info->codec); |
---|
| 456 | |
---|
| 457 | ROAR_DBG("roar_debug_audio_info_print(*) = 0"); |
---|
| 458 | return 0; |
---|
| 459 | } |
---|
| 460 | |
---|
| 461 | //ll |
---|