Changeset 5296:b7fd2c45243e in roaraudio
- Timestamp:
- 11/25/11 02:27:12 (12 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
ChangeLog
r5295 r5296 1 1 v. 1.0beta0 - ? 2 * Updated API (SONAME change) (Closes: #184, #185, #128, #135, #134, #133, #129 )2 * Updated API (SONAME change) (Closes: #184, #185, #128, #135, #134, #133, #129, #188) 3 3 * Do not set errno to zero in ogg_vorbis codec filter (Closes: #191) 4 4 * Updated data types for struct roar_audio_info (Closes: #189) -
doc/man3/roar_disconnect.3
r5032 r5296 1 1 .\" roar_simple_play.3: 2 2 3 .TH "roar_ disconnect" "3" "May 2011" "RoarAudio" "System Manager's Manual: RoarAudio"3 .TH "roar_connectionref" "3" "May 2011" "RoarAudio" "System Manager's Manual: RoarAudio" 4 4 5 5 .SH NAME 6 roar_ disconnect \- disconnect from RoarAudio's sound server6 roar_connectionref, roar_connectionunref \- change reference counter for RoarAudio connections 7 7 8 8 .SH SYNOPSIS … … 10 10 #include <roaraudio.h> 11 11 12 int roar_disconnect(struct roar_connection * con); 12 int roar_connectionref(struct roar_connection * con); 13 14 int roar_connectionunref(struct roar_connection * con); 15 16 #define roar_disconnect(x) roar_connectionunref((x)) 13 17 14 18 .SH "DESCRIPTION" 15 Closes es connection previously opend via \fBBroar_simple_connect\fR(3) or \fBBroar_simple_connect2\fR(3). 16 19 Those functions change the reference counter for connection objects 20 previously opend via \fBroar_connect\fR(3), \fBroar_connect_fh\fR(3) or \fBroar_simple_connect\fR(3). 21 If the reference counter hints zero the connection is closed and the object is destroyed. 22 .PP 23 The \fBroar_disconnect\fR(3) macro is provided to be source compatible (recompile needed) 24 with RoarAudio 0.4 or older. 17 25 18 26 .SH "PARAMETERS" 19 27 .TP 20 28 \fBcon\fR 21 The connection to be closed.29 The connection to be altered. 22 30 23 31 .SH "RETURN VALUE" -
doc/symlinks.src
r5083 r5296 29 29 roar_vs_latency 3 roar_vs_position 3 30 30 roar_vs_latency2 3 roar_vs_position 3 31 roar_connectionref 3 roar_disconnect 3 32 roar_connectionunref 3 roar_disconnect 3 -
include/libroar/basic.h
r5270 r5296 47 47 #endif 48 48 49 #define ROAR_CON_FLAGS_NONE 0x00 50 #define ROAR_CON_FLAGS_FH 0x01 /* obsoleted */ 51 #define ROAR_CON_FLAGS_VIO 0x02 /* mandatory */ 52 #define ROAR_CON_FLAGS_ISCLIENT 0x04 53 #define ROAR_CON_FLAGS_SUPPORT_V2 0x08 /* mandatory if con.version == 2 */ 54 #define ROAR_CON_FLAGS_SUPPORT_EF 0x10 /* Both peers support error frames */ 49 #define ROAR_CON_FLAGS_NONE 0x00000000UL 50 #define ROAR_CON_FLAGS_FH 0x00000001UL /* obsoleted */ 51 #define ROAR_CON_FLAGS_VIO 0x00000002UL /* mandatory */ 52 #define ROAR_CON_FLAGS_ISCLIENT 0x00000004UL 53 #define ROAR_CON_FLAGS_SUPPORT_V2 0x00000008UL /* mandatory if con.version == 2 */ 54 #define ROAR_CON_FLAGS_SUPPORT_EF 0x00000010UL /* Both peers support error frames */ 55 #define ROAR_CON_FLAGS_FREESELF 0x00000020UL /* Free the connection object */ 55 56 56 57 struct roar_message { … … 67 68 }; 68 69 70 struct roar_stds; // "caps.h" will be included later. 71 69 72 struct roar_connection { 70 73 size_t refc; 71 74 uint32_t flags; 72 75 int version; 73 struct roar_vio_calls viocon; 76 struct roar_vio_calls * viocon; 77 struct roar_vio_calls viocon_store; 74 78 struct roar_error_frame errorframe; 75 79 void * cb_userdata; 76 80 void (*cb)(struct roar_connection * con, struct roar_message * mes, void * data, void * userdata); 81 struct roar_stds * server_stds; 82 char * server_name; 77 83 }; 78 84 … … 84 90 int roar_get_connection_fh (struct roar_connection * con); 85 91 struct roar_vio_calls * roar_get_connection_vio2 (struct roar_connection * con); 86 int roar_disconnect (struct roar_connection * con); 92 const char * roar_get_connection_server(struct roar_connection * con); 93 int roar_connectionref(struct roar_connection * con); 94 int roar_connectionunref(struct roar_connection * con); 95 #define roar_disconnect(x) roar_connectionunref((x)) 87 96 88 97 int roar_set_connection_callback(struct roar_connection * con, -
libroar/basic.c
r5267 r5296 262 262 int roar_connect (struct roar_connection * con, const char * server, int flags, uint_least32_t timeout) { 263 263 int fh; 264 int err; 264 265 265 266 if ( con == NULL ) { … … 274 275 return -1; 275 276 276 return roar_connect_fh(con, fh); 277 if ( roar_connect_fh(con, fh) == -1 ) { 278 err = roar_error; 279 #ifdef ROAR_TARGET_WIN32 280 closesocket(fh); 281 #else 282 close(fh); 283 #endif 284 roar_error = err; 285 return -1; 286 } 287 288 if ( server != NULL ) { 289 con->server_name = roar_mm_strdup(server); 290 } 291 292 return 0; 277 293 } 278 294 … … 289 305 290 306 memset(con, 0, sizeof(struct roar_connection)); 291 con->refc = 0;307 con->refc = 1; 292 308 con->flags = ROAR_CON_FLAGS_NONE; 293 309 con->version = 0; 294 310 con->cb_userdata = NULL; 295 311 con->cb = NULL; 312 con->server_stds = NULL; 313 con->server_name = NULL; 296 314 297 315 roar_err_init(&(con->errorframe)); 298 316 299 if ( roar_vio_open_fh_socket(&(con->viocon), fh) != -1 ) { 317 con->viocon = &(con->viocon_store); 318 319 if ( roar_vio_open_fh_socket(con->viocon, fh) != -1 ) { 300 320 con->flags |= ROAR_CON_FLAGS_VIO; 301 321 } … … 317 337 ROAR_DBG("roar_get_connection_fh(con=%p) = ?", con); 318 338 319 if ( roar_vio_ctl( &(con->viocon), ROAR_VIO_CTL_GET_FH, &fh) == -1 )339 if ( roar_vio_ctl(con->viocon, ROAR_VIO_CTL_GET_FH, &fh) == -1 ) 320 340 return -1; 321 341 … … 330 350 331 351 if ( con->flags & ROAR_CON_FLAGS_VIO ) 332 return &(con->viocon);352 return con->viocon; 333 353 334 354 // TODO: try to open the VIO. … … 337 357 } 338 358 339 int roar_disconnect (struct roar_connection * con) { 359 const char * roar_get_connection_server(struct roar_connection * con) { 360 if ( con == NULL ) { 361 roar_err_set(ROAR_ERROR_FAULT); 362 return NULL; 363 } 364 365 return con->server_name; 366 } 367 368 int roar_connectionref(struct roar_connection * con) { 369 if ( con == NULL ) { 370 roar_err_set(ROAR_ERROR_FAULT); 371 return -1; 372 } 373 374 con->refc++; 375 376 return 0; 377 } 378 379 int roar_connectionunref(struct roar_connection * con) { 340 380 struct roar_vio_calls * vio; 341 381 struct roar_message m; 382 383 if ( con == NULL ) { 384 roar_err_set(ROAR_ERROR_FAULT); 385 return -1; 386 } 387 388 con->refc--; 389 390 if ( con->refc ) 391 return 0; 342 392 343 393 memset(&m, 0, sizeof(m)); … … 354 404 } 355 405 356 roar_connect_fh(con, -2); 357 358 roar_err_set(ROAR_ERROR_NONE); 406 if ( con->server_stds != NULL ) { 407 roar_stds_free(con->server_stds); 408 con->server_stds = NULL; 409 } 410 411 if ( con->server_name != NULL ) { 412 roar_mm_free(con->server_name); 413 con->server_name = NULL; 414 } 415 416 if ( con->flags & ROAR_CON_FLAGS_FREESELF ) { 417 roar_mm_free(con); 418 } else { 419 roar_connect_fh(con, -2); 420 } 359 421 360 422 return 0; -
libroar/simple.c
r5289 r5296 120 120 int fh; 121 121 122 if ( (fh = roar_simple_stream_obj(s, rate, channels, bits, codec, NULL /* server, we hope this is ok here... */,122 if ( (fh = roar_simple_stream_obj(s, rate, channels, bits, codec, roar_get_connection_server(con), 123 123 dir, "libroar temp stream", mixer)) == -1 ) 124 124 return -1;
Note: See TracChangeset
for help on using the changeset viewer.