1 /*********************************************************************** 2 * AUTHOR: Marcus Overhagen 3 * FILE: MediaRoster.cpp 4 * DESCR: 5 ***********************************************************************/ 6 #include <MediaRoster.h> 7 #include <Locker.h> 8 #include <Message.h> 9 #include <Messenger.h> 10 #include <StopWatch.h> 11 #include <OS.h> 12 #include <String.h> 13 #include <TimeSource.h> 14 #undef DEBUG 15 #define DEBUG 3 16 #include "debug.h" 17 #include "PortPool.h" 18 #include "ServerInterface.h" 19 #include "DormantNodeManager.h" 20 #include "NotificationManager.h" 21 22 static BMessenger *ServerMessenger = 0; 23 static team_id team; 24 25 // the BMediaRoster destructor is private, 26 // but _DefaultDeleter is a friend class of 27 // the BMediaRoster an thus can delete it 28 class _DefaultDeleter 29 { 30 public: 31 void Delete() { delete BMediaRoster::_sDefault; } 32 }; 33 34 35 namespace MediaKitPrivate 36 { 37 38 class RosterSingleton 39 { 40 public: 41 RosterSingleton() 42 { 43 thread_info info; 44 get_thread_info(find_thread(NULL), &info); 45 team = info.team; 46 ServerMessenger = new BMessenger(NEW_MEDIA_SERVER_SIGNATURE); 47 } 48 ~RosterSingleton() 49 { 50 _DefaultDeleter deleter; 51 deleter.Delete(); // deletes BMediaRoster::_sDefault 52 delete ServerMessenger; 53 } 54 }; 55 56 RosterSingleton singleton; 57 58 59 status_t GetNode(node_type type, media_node * out_node, int32 * out_input_id = NULL, BString * out_input_name = NULL); 60 status_t SetNode(node_type type, const media_node *node, const dormant_node_info *info = NULL, const media_input *input = NULL); 61 62 status_t QueryServer(BMessage *query, BMessage *reply) 63 { 64 status_t status; 65 status = ServerMessenger->SendMessage(query,reply); 66 if (status != B_OK || reply->what != B_OK) { 67 TRACE("QueryServer failed! status = 0x%08lx\n",status); 68 TRACE("Query:\n"); 69 query->PrintToStream(); 70 TRACE("Reply:\n"); 71 reply->PrintToStream(); 72 } 73 return status; 74 } 75 76 status_t GetNode(node_type type, media_node * out_node, int32 * out_input_id, BString * out_input_name) 77 { 78 if (out_node == NULL) 79 return B_BAD_VALUE; 80 81 xfer_server_get_node msg; 82 xfer_server_get_node_reply reply; 83 port_id port; 84 status_t rv; 85 int32 code; 86 87 port = find_port("media_server port"); 88 if (port <= B_OK) 89 return B_ERROR; 90 91 msg.type = type; 92 msg.reply_port = _PortPool->GetPort(); 93 rv = write_port(port, SERVER_GET_NODE, &msg, sizeof(msg)); 94 if (rv != B_OK) { 95 _PortPool->PutPort(msg.reply_port); 96 return rv; 97 } 98 rv = read_port(msg.reply_port, &code, &reply, sizeof(reply)); 99 _PortPool->PutPort(msg.reply_port); 100 if (rv < B_OK) 101 return rv; 102 *out_node = reply.node; 103 if (out_input_id) 104 *out_input_id = reply.input_id; 105 if (out_input_name) 106 *out_input_name = reply.input_name; 107 return reply.result; 108 } 109 110 status_t SetNode(node_type type, const media_node *node, const dormant_node_info *info, const media_input *input) 111 { 112 xfer_server_set_node msg; 113 xfer_server_set_node_reply reply; 114 port_id port; 115 status_t rv; 116 int32 code; 117 118 port = find_port("media_server port"); 119 if (port <= B_OK) 120 return B_ERROR; 121 122 msg.type = type; 123 msg.use_node = node ? true : false; 124 if (node) 125 msg.node = *node; 126 msg.use_dni = info ? true : false; 127 if (info) 128 msg.dni = *info; 129 msg.use_input = input ? true : false; 130 if (input) 131 msg.input = *input; 132 msg.reply_port = _PortPool->GetPort(); 133 rv = write_port(port, SERVER_SET_NODE, &msg, sizeof(msg)); 134 if (rv != B_OK) { 135 _PortPool->PutPort(msg.reply_port); 136 return rv; 137 } 138 rv = read_port(msg.reply_port, &code, &reply, sizeof(reply)); 139 _PortPool->PutPort(msg.reply_port); 140 141 return (rv < B_OK) ? rv : reply.result; 142 } 143 144 }; 145 146 /************************************************************* 147 * public BMediaRoster 148 *************************************************************/ 149 150 status_t 151 BMediaRoster::GetVideoInput(media_node * out_node) 152 { 153 CALLED(); 154 return MediaKitPrivate::GetNode(VIDEO_INPUT, out_node); 155 } 156 157 158 status_t 159 BMediaRoster::GetAudioInput(media_node * out_node) 160 { 161 CALLED(); 162 return MediaKitPrivate::GetNode(AUDIO_INPUT, out_node); 163 } 164 165 166 status_t 167 BMediaRoster::GetVideoOutput(media_node * out_node) 168 { 169 CALLED(); 170 return MediaKitPrivate::GetNode(VIDEO_OUTPUT, out_node); 171 } 172 173 174 status_t 175 BMediaRoster::GetAudioMixer(media_node * out_node) 176 { 177 CALLED(); 178 return MediaKitPrivate::GetNode(AUDIO_MIXER, out_node); 179 } 180 181 182 status_t 183 BMediaRoster::GetAudioOutput(media_node * out_node) 184 { 185 CALLED(); 186 return MediaKitPrivate::GetNode(AUDIO_OUTPUT, out_node); 187 } 188 189 190 status_t 191 BMediaRoster::GetAudioOutput(media_node * out_node, 192 int32 * out_input_id, 193 BString * out_input_name) 194 { 195 CALLED(); 196 return MediaKitPrivate::GetNode(AUDIO_OUTPUT_EX, out_node, out_input_id, out_input_name); 197 } 198 199 200 status_t 201 BMediaRoster::GetTimeSource(media_node * out_node) 202 { 203 CALLED(); 204 return MediaKitPrivate::GetNode(TIME_SOURCE, out_node); 205 } 206 207 208 status_t 209 BMediaRoster::SetVideoInput(const media_node & producer) 210 { 211 CALLED(); 212 return MediaKitPrivate::SetNode(VIDEO_INPUT, &producer); 213 } 214 215 216 status_t 217 BMediaRoster::SetVideoInput(const dormant_node_info & producer) 218 { 219 CALLED(); 220 return MediaKitPrivate::SetNode(VIDEO_INPUT, NULL, &producer); 221 } 222 223 224 status_t 225 BMediaRoster::SetAudioInput(const media_node & producer) 226 { 227 CALLED(); 228 return MediaKitPrivate::SetNode(AUDIO_INPUT, &producer); 229 } 230 231 232 status_t 233 BMediaRoster::SetAudioInput(const dormant_node_info & producer) 234 { 235 CALLED(); 236 return MediaKitPrivate::SetNode(AUDIO_INPUT, NULL, &producer); 237 } 238 239 240 status_t 241 BMediaRoster::SetVideoOutput(const media_node & consumer) 242 { 243 CALLED(); 244 return MediaKitPrivate::SetNode(VIDEO_OUTPUT, &consumer); 245 } 246 247 248 status_t 249 BMediaRoster::SetVideoOutput(const dormant_node_info & consumer) 250 { 251 CALLED(); 252 return MediaKitPrivate::SetNode(VIDEO_OUTPUT, NULL, &consumer); 253 } 254 255 256 status_t 257 BMediaRoster::SetAudioOutput(const media_node & consumer) 258 { 259 CALLED(); 260 return MediaKitPrivate::SetNode(AUDIO_OUTPUT, &consumer); 261 } 262 263 264 status_t 265 BMediaRoster::SetAudioOutput(const media_input & input_to_output) 266 { 267 CALLED(); 268 return MediaKitPrivate::SetNode(AUDIO_OUTPUT, NULL, NULL, &input_to_output); 269 } 270 271 272 status_t 273 BMediaRoster::SetAudioOutput(const dormant_node_info & consumer) 274 { 275 CALLED(); 276 return MediaKitPrivate::SetNode(AUDIO_OUTPUT, NULL, &consumer); 277 } 278 279 280 status_t 281 BMediaRoster::GetNodeFor(media_node_id node, 282 media_node * clone) 283 { 284 UNIMPLEMENTED(); 285 return B_ERROR; 286 } 287 288 289 status_t 290 BMediaRoster::GetSystemTimeSource(media_node * clone) 291 { 292 CALLED(); 293 return MediaKitPrivate::GetNode(SYSTEM_TIME_SOURCE, clone); 294 } 295 296 297 status_t 298 BMediaRoster::ReleaseNode(const media_node & node) 299 { 300 UNIMPLEMENTED(); 301 return B_ERROR; 302 } 303 304 305 306 BTimeSource * 307 BMediaRoster::MakeTimeSourceFor(const media_node & for_node) 308 { 309 UNIMPLEMENTED(); 310 return 0; 311 } 312 313 314 status_t 315 BMediaRoster::Connect(const media_source & from, 316 const media_destination & to, 317 media_format * io_format, 318 media_output * out_output, 319 media_input * out_input) 320 { 321 return BMediaRoster::Connect(from, to, io_format, out_output, out_input, 0); 322 } 323 324 325 status_t 326 BMediaRoster::Connect(const media_source & from, 327 const media_destination & to, 328 media_format * io_format, 329 media_output * out_output, 330 media_input * out_input, 331 uint32 in_flags, 332 void * _reserved) 333 { 334 CALLED(); 335 if (io_format == NULL || out_output == NULL || out_input == NULL) 336 return B_BAD_VALUE; 337 if (from == media_source::null) 338 return B_MEDIA_BAD_SOURCE; 339 if (to == media_destination::null) 340 return B_MEDIA_BAD_DESTINATION; 341 342 xfer_producer_format_proposal msg1; 343 xfer_producer_format_proposal_reply reply1; 344 xfer_consumer_accept_format msg2; 345 xfer_consumer_accept_format_reply reply2; 346 xfer_producer_prepare_to_connect msg3; 347 xfer_producer_prepare_to_connect_reply reply3; 348 xfer_consumer_connected msg4; 349 xfer_consumer_connected_reply reply4; 350 xfer_producer_connect msg5; 351 xfer_producer_connect_reply reply5; 352 status_t rv; 353 port_id port; 354 int32 code; 355 356 port = _PortPool->GetPort(); 357 358 // BBufferProducer::FormatProposal 359 msg1.output = from; 360 msg1.format = *io_format; 361 msg1.reply_port = port; 362 rv = write_port(from.port, PRODUCER_FORMAT_PROPOSAL, &msg1, sizeof(msg1)); 363 if (rv != B_OK) 364 goto failed; 365 rv = read_port(port, &code, &reply1, sizeof(reply1)); 366 if (rv < B_OK) 367 goto failed; 368 if (reply1.result != B_OK) { 369 rv = reply1.result; 370 goto failed; 371 } 372 373 // BBufferConsumer::AcceptFormat 374 msg2.dest = to; 375 msg2.format = *io_format; 376 msg2.reply_port = port; 377 rv = write_port(to.port, CONSUMER_ACCEPT_FORMAT, &msg2, sizeof(msg2)); 378 if (rv != B_OK) 379 goto failed; 380 rv = read_port(port, &code, &reply2, sizeof(reply2)); 381 if (rv < B_OK) 382 goto failed; 383 if (reply2.result != B_OK) { 384 rv = reply2.result; 385 goto failed; 386 } 387 *io_format = reply2.format; 388 389 // BBufferProducer::PrepareToConnect 390 msg3.source = from; 391 msg3.destination = to; 392 msg3.format = *io_format; 393 msg3.reply_port = port; 394 rv = write_port(from.port, PRODUCER_PREPARE_TO_CONNECT, &msg3, sizeof(msg3)); 395 if (rv != B_OK) 396 goto failed; 397 rv = read_port(port, &code, &reply3, sizeof(reply3)); 398 if (rv < B_OK) 399 goto failed; 400 if (reply3.result != B_OK) { 401 rv = reply3.result; 402 goto failed; 403 } 404 *io_format = reply3.format; 405 //reply3.out_source; 406 //reply3.name; 407 408 // BBufferConsumer::Connected 409 msg4.producer = reply3.out_source; 410 msg4.where = to; 411 msg4.with_format = *io_format; 412 msg4.reply_port = port; 413 rv = write_port(to.port, CONSUMER_CONNECTED, &msg4, sizeof(msg4)); 414 if (rv != B_OK) 415 goto failed; 416 rv = read_port(port, &code, &reply4, sizeof(reply4)); 417 if (rv < B_OK) 418 goto failed; 419 if (reply4.result != B_OK) { 420 rv = reply4.result; 421 goto failed; 422 } 423 // reply4.input; 424 425 // BBufferProducer::Connect 426 msg5.error = B_OK; 427 msg5.source = reply3.out_source; 428 msg5.destination = to; 429 msg5.format = *io_format; 430 msg5.name[0] = 0; 431 msg5.reply_port = port; 432 433 rv = write_port(from.port, PRODUCER_CONNECT, &msg5, sizeof(msg5)); 434 if (rv != B_OK) 435 goto failed; 436 rv = read_port(port, &code, &reply5, sizeof(reply5)); 437 if (rv < B_OK) 438 goto failed; 439 440 // out_output->node = 441 out_output->source = reply3.out_source; 442 out_output->destination = to;//reply4.input; 443 out_output->format = *io_format; 444 strcpy(out_output->name,reply5.name); 445 446 // out_input->node 447 out_input->source = reply3.out_source; 448 out_input->destination = to;//reply4.input; 449 out_input->format = *io_format; 450 strcpy(out_input->name,reply3.name); 451 452 _PortPool->PutPort(port); 453 return B_OK; 454 455 failed: 456 _PortPool->PutPort(port); 457 return rv; 458 } 459 460 461 status_t 462 BMediaRoster::Disconnect(media_node_id source_node, 463 const media_source & source, 464 media_node_id destination_node, 465 const media_destination & destination) 466 { 467 UNIMPLEMENTED(); 468 return B_ERROR; 469 } 470 471 472 status_t 473 BMediaRoster::StartNode(const media_node & node, 474 bigtime_t at_performance_time) 475 { 476 CALLED(); 477 if (node.node == 0) 478 return B_MEDIA_BAD_NODE; 479 480 xfer_node_start msg; 481 msg.performance_time = at_performance_time; 482 483 return write_port(node.port, NODE_START, &msg, sizeof(msg)); 484 } 485 486 487 status_t 488 BMediaRoster::StopNode(const media_node & node, 489 bigtime_t at_performance_time, 490 bool immediate) 491 { 492 CALLED(); 493 if (node.node == 0) 494 return B_MEDIA_BAD_NODE; 495 496 xfer_node_stop msg; 497 msg.performance_time = at_performance_time; 498 msg.immediate = immediate; 499 500 return write_port(node.port, NODE_STOP, &msg, sizeof(msg)); 501 } 502 503 504 status_t 505 BMediaRoster::SeekNode(const media_node & node, 506 bigtime_t to_media_time, 507 bigtime_t at_performance_time) 508 { 509 CALLED(); 510 if (node.node == 0) 511 return B_MEDIA_BAD_NODE; 512 513 xfer_node_seek msg; 514 msg.media_time = to_media_time; 515 msg.performance_time = at_performance_time; 516 517 return write_port(node.port, NODE_SEEK, &msg, sizeof(msg)); 518 } 519 520 521 status_t 522 BMediaRoster::StartTimeSource(const media_node & node, 523 bigtime_t at_real_time) 524 { 525 CALLED(); 526 if (node.node == 0) 527 return B_MEDIA_BAD_NODE; 528 if ((node.kind & B_TIME_SOURCE) == 0) 529 return B_MEDIA_BAD_NODE; 530 531 BTimeSource::time_source_op_info msg; 532 msg.op = BTimeSource::B_TIMESOURCE_START; 533 msg.real_time = at_real_time; 534 535 return write_port(node.port, TIMESOURCE_OP, &msg, sizeof(msg)); 536 } 537 538 539 status_t 540 BMediaRoster::StopTimeSource(const media_node & node, 541 bigtime_t at_real_time, 542 bool immediate) 543 { 544 CALLED(); 545 if (node.node == 0) 546 return B_MEDIA_BAD_NODE; 547 if ((node.kind & B_TIME_SOURCE) == 0) 548 return B_MEDIA_BAD_NODE; 549 550 BTimeSource::time_source_op_info msg; 551 msg.op = immediate ? BTimeSource::B_TIMESOURCE_STOP_IMMEDIATELY : BTimeSource::B_TIMESOURCE_STOP; 552 msg.real_time = at_real_time; 553 554 return write_port(node.port, TIMESOURCE_OP, &msg, sizeof(msg)); 555 } 556 557 558 status_t 559 BMediaRoster::SeekTimeSource(const media_node & node, 560 bigtime_t to_performance_time, 561 bigtime_t at_real_time) 562 { 563 CALLED(); 564 if (node.node == 0) 565 return B_MEDIA_BAD_NODE; 566 if ((node.kind & B_TIME_SOURCE) == 0) 567 return B_MEDIA_BAD_NODE; 568 569 BTimeSource::time_source_op_info msg; 570 msg.op = BTimeSource::B_TIMESOURCE_SEEK; 571 msg.real_time = at_real_time; 572 msg.performance_time = to_performance_time; 573 574 return write_port(node.port, TIMESOURCE_OP, &msg, sizeof(msg)); 575 } 576 577 578 status_t 579 BMediaRoster::SyncToNode(const media_node & node, 580 bigtime_t at_time, 581 bigtime_t timeout) 582 { 583 UNIMPLEMENTED(); 584 return B_ERROR; 585 } 586 587 588 status_t 589 BMediaRoster::SetRunModeNode(const media_node & node, 590 BMediaNode::run_mode mode) 591 { 592 CALLED(); 593 if (node.node == 0) 594 return B_MEDIA_BAD_NODE; 595 596 xfer_node_set_run_mode msg; 597 msg.mode = mode; 598 599 return write_port(node.port, NODE_SET_RUN_MODE, &msg, sizeof(msg)); 600 } 601 602 603 status_t 604 BMediaRoster::PrerollNode(const media_node & node) 605 { 606 CALLED(); 607 if (node.node == 0) 608 return B_MEDIA_BAD_NODE; 609 610 char dummy; 611 return write_port(node.port, NODE_PREROLL, &dummy, sizeof(dummy)); 612 } 613 614 615 status_t 616 BMediaRoster::RollNode(const media_node & node, 617 bigtime_t startPerformance, 618 bigtime_t stopPerformance, 619 bigtime_t atMediaTime) 620 { 621 UNIMPLEMENTED(); 622 return B_ERROR; 623 } 624 625 626 status_t 627 BMediaRoster::SetProducerRunModeDelay(const media_node & node, 628 bigtime_t delay, 629 BMediaNode::run_mode mode) 630 { 631 UNIMPLEMENTED(); 632 return B_ERROR; 633 } 634 635 636 status_t 637 BMediaRoster::SetProducerRate(const media_node & producer, 638 int32 numer, 639 int32 denom) 640 { 641 CALLED(); 642 if (producer.node == 0) 643 return B_MEDIA_BAD_NODE; 644 if ((producer.kind & B_BUFFER_PRODUCER) == 0) 645 return B_MEDIA_BAD_NODE; 646 647 xfer_producer_set_play_rate msg; 648 xfer_producer_set_play_rate_reply reply; 649 status_t rv; 650 int32 code; 651 652 msg.numer = numer; 653 msg.denom = denom; 654 msg.reply_port = _PortPool->GetPort(); 655 rv = write_port(producer.node, PRODUCER_SET_PLAY_RATE, &msg, sizeof(msg)); 656 if (rv != B_OK) { 657 _PortPool->PutPort(msg.reply_port); 658 return rv; 659 } 660 rv = read_port(msg.reply_port, &code, &reply, sizeof(reply)); 661 _PortPool->PutPort(msg.reply_port); 662 return (rv < B_OK) ? rv : reply.result; 663 } 664 665 666 667 /* Nodes will have available inputs/outputs as long as they are capable */ 668 /* of accepting more connections. The node may create an additional */ 669 /* output or input as the currently available is taken into usage. */ 670 status_t 671 BMediaRoster::GetLiveNodeInfo(const media_node & node, 672 live_node_info * out_live_info) 673 { 674 UNIMPLEMENTED(); 675 return B_ERROR; 676 } 677 678 679 status_t 680 BMediaRoster::GetLiveNodes(live_node_info * out_live_nodes, 681 int32 * io_total_count, 682 const media_format * has_input, 683 const media_format * has_output, 684 const char * name, 685 uint64 node_kinds) 686 { 687 UNIMPLEMENTED(); 688 return B_ERROR; 689 } 690 691 692 status_t 693 BMediaRoster::GetFreeInputsFor(const media_node & node, 694 media_input * out_free_inputs, 695 int32 buf_num_inputs, 696 int32 * out_total_count, 697 media_type filter_type) 698 { 699 UNIMPLEMENTED(); 700 return B_ERROR; 701 } 702 703 704 status_t 705 BMediaRoster::GetConnectedInputsFor(const media_node & node, 706 media_input * out_active_inputs, 707 int32 buf_num_inputs, 708 int32 * out_total_count) 709 { 710 UNIMPLEMENTED(); 711 return B_ERROR; 712 } 713 714 715 status_t 716 BMediaRoster::GetAllInputsFor(const media_node & node, 717 media_input * out_inputs, 718 int32 buf_num_inputs, 719 int32 * out_total_count) 720 { 721 CALLED(); 722 if (node.node == 0 || (node.kind & B_BUFFER_CONSUMER) == 0) 723 return B_MEDIA_BAD_NODE; 724 if (out_inputs == NULL || out_total_count == NULL) 725 return B_BAD_VALUE; 726 727 status_t rv; 728 status_t rv2; 729 port_id port; 730 int32 code; 731 int32 cookie; 732 733 port = _PortPool->GetPort(); 734 *out_total_count = 0; 735 cookie = 0; 736 rv = B_OK; 737 for (int32 i = 0; i < buf_num_inputs; i++) { 738 xfer_consumer_get_next_input msg; 739 xfer_consumer_get_next_input_reply reply; 740 msg.cookie = cookie; 741 msg.reply_port = port; 742 rv = write_port(node.port, CONSUMER_GET_NEXT_INPUT, &msg, sizeof(msg)); 743 if (rv != B_OK) 744 break; 745 rv = read_port(msg.reply_port, &code, &reply, sizeof(reply)); 746 if (rv < B_OK || reply.result != B_OK) 747 break; 748 *out_total_count += 1; 749 out_inputs[i] = reply.input; 750 cookie = reply.cookie; 751 } 752 _PortPool->PutPort(port); 753 754 xfer_consumer_dispose_input_cookie msg2; 755 msg2.cookie = cookie; 756 rv2 = write_port(node.port, CONSUMER_DISPOSE_INPUT_COOKIE, &msg2, sizeof(msg2)); 757 758 return (rv < B_OK) ? rv : rv2; 759 } 760 761 762 status_t 763 BMediaRoster::GetFreeOutputsFor(const media_node & node, 764 media_output * out_free_outputs, 765 int32 buf_num_outputs, 766 int32 * out_total_count, 767 media_type filter_type) 768 { 769 UNIMPLEMENTED(); 770 return B_ERROR; 771 } 772 773 774 status_t 775 BMediaRoster::GetConnectedOutputsFor(const media_node & node, 776 media_output * out_active_outputs, 777 int32 buf_num_outputs, 778 int32 * out_total_count) 779 { 780 UNIMPLEMENTED(); 781 return B_ERROR; 782 } 783 784 785 status_t 786 BMediaRoster::GetAllOutputsFor(const media_node & node, 787 media_output * out_outputs, 788 int32 buf_num_outputs, 789 int32 * out_total_count) 790 { 791 CALLED(); 792 if (node.node == 0 || (node.kind & B_BUFFER_PRODUCER) == 0) 793 return B_MEDIA_BAD_NODE; 794 if (out_outputs == NULL || out_total_count == NULL) 795 return B_BAD_VALUE; 796 797 status_t rv; 798 status_t rv2; 799 port_id port; 800 int32 code; 801 int32 cookie; 802 803 port = _PortPool->GetPort(); 804 *out_total_count = 0; 805 cookie = 0; 806 rv = B_OK; 807 for (int32 i = 0; i < buf_num_outputs; i++) { 808 xfer_producer_get_next_output msg; 809 xfer_producer_get_next_output_reply reply; 810 msg.cookie = cookie; 811 msg.reply_port = port; 812 rv = write_port(node.port, PRODUCER_GET_NEXT_OUTPUT, &msg, sizeof(msg)); 813 if (rv != B_OK) 814 break; 815 rv = read_port(msg.reply_port, &code, &reply, sizeof(reply)); 816 if (rv < B_OK || reply.result != B_OK) 817 break; 818 *out_total_count += 1; 819 out_outputs[i] = reply.output; 820 cookie = reply.cookie; 821 } 822 _PortPool->PutPort(port); 823 824 xfer_producer_dispose_output_cookie msg2; 825 msg2.cookie = cookie; 826 rv2 = write_port(node.port, PRODUCER_DISPOSE_OUTPUT_COOKIE, &msg2, sizeof(msg2)); 827 828 return (rv < B_OK) ? rv : rv2; 829 } 830 831 832 status_t 833 BMediaRoster::StartWatching(const BMessenger & where) 834 { 835 CALLED(); 836 if (!where.IsValid()) { 837 TRACE("BMediaRoster::StartWatching: messenger invalid!\n"); 838 return B_BAD_VALUE; 839 } 840 return _NotificationManager->Register(where, media_node::null, 841 BPrivate::media::NotificationManager::notification_basic); 842 } 843 844 845 status_t 846 BMediaRoster::StartWatching(const BMessenger & where, 847 int32 notificationType) 848 { 849 CALLED(); 850 if (!where.IsValid()) { 851 TRACE("BMediaRoster::StartWatching: messenger invalid!\n"); 852 return B_BAD_VALUE; 853 } 854 if (!BPrivate::media::NotificationManager::IsValidNotificationType(notificationType)) { 855 TRACE("BMediaRoster::StartWatching: notificationType invalid!\n"); 856 return B_BAD_VALUE; 857 } 858 return _NotificationManager->Register(where, media_node::null, 859 BPrivate::media::NotificationManager::NotificationType2Mask(notificationType)); 860 } 861 862 863 status_t 864 BMediaRoster::StartWatching(const BMessenger & where, 865 const media_node & node, 866 int32 notificationType) 867 { 868 CALLED(); 869 if (!where.IsValid()) { 870 TRACE("BMediaRoster::StartWatching: messenger invalid!\n"); 871 return B_BAD_VALUE; 872 } 873 if (node.node == 0) { 874 TRACE("BMediaRoster::StartWatching: node invalid!\n"); 875 return B_MEDIA_BAD_NODE; 876 } 877 if (!BPrivate::media::NotificationManager::IsValidNotificationType(notificationType)) { 878 TRACE("BMediaRoster::StartWatching: notificationType invalid!\n"); 879 return B_BAD_VALUE; 880 } 881 return _NotificationManager->Register(where, node, 882 BPrivate::media::NotificationManager::NotificationType2Mask(notificationType)); 883 } 884 885 886 status_t 887 BMediaRoster::StopWatching(const BMessenger & where) 888 { 889 CALLED(); 890 // messenger may already be invalid, so we don't check this 891 return _NotificationManager->Unregister(where, media_node::null, 892 BPrivate::media::NotificationManager::notification_basic); 893 } 894 895 896 status_t 897 BMediaRoster::StopWatching(const BMessenger & where, 898 int32 notificationType) 899 { 900 CALLED(); 901 // messenger may already be invalid, so we don't check this 902 if (!BPrivate::media::NotificationManager::IsValidNotificationType(notificationType)) { 903 TRACE("BMediaRoster::StopWatching: notificationType invalid!\n"); 904 return B_BAD_VALUE; 905 } 906 return _NotificationManager->Unregister(where, media_node::null, 907 BPrivate::media::NotificationManager::NotificationType2Mask(notificationType)); 908 } 909 910 911 status_t 912 BMediaRoster::StopWatching(const BMessenger & where, 913 const media_node & node, 914 int32 notificationType) 915 { 916 CALLED(); 917 // messenger may already be invalid, so we don't check this 918 if (node.node == 0) { 919 TRACE("BMediaRoster::StopWatching: node invalid!\n"); 920 return B_MEDIA_BAD_NODE; 921 } 922 if (!BPrivate::media::NotificationManager::IsValidNotificationType(notificationType)) { 923 TRACE("BMediaRoster::StopWatching: notificationType invalid!\n"); 924 return B_BAD_VALUE; 925 } 926 return _NotificationManager->Unregister(where, node, 927 BPrivate::media::NotificationManager::NotificationType2Mask(notificationType)); 928 } 929 930 931 status_t 932 BMediaRoster::RegisterNode(BMediaNode * node) 933 { 934 CALLED(); 935 if (node == NULL) 936 return B_BAD_VALUE; 937 938 xfer_node_registered msg; 939 msg.node_id = 1; 940 941 return node->HandleMessage(NODE_REGISTERED,&msg,sizeof(msg)); 942 } 943 944 945 status_t 946 BMediaRoster::UnregisterNode(BMediaNode * node) 947 { 948 UNIMPLEMENTED(); 949 return B_ERROR; 950 } 951 952 953 // thread safe for multiple calls to Roster() 954 /* static */ BMediaRoster * 955 BMediaRoster::Roster(status_t* out_error) 956 { 957 CALLED(); 958 static BLocker locker("BMediaRoster::Roster locker"); 959 locker.Lock(); 960 if (_sDefault == NULL) { 961 _sDefault = new BMediaRoster(); 962 if (out_error != NULL) 963 *out_error = B_OK; 964 } else { 965 if (out_error != NULL) 966 *out_error = B_OK; 967 } 968 locker.Unlock(); 969 return _sDefault; 970 } 971 972 973 // won't create it if there isn't one 974 // not thread safe if you call Roster() at the same time 975 /* static */ BMediaRoster * 976 BMediaRoster::CurrentRoster() 977 { 978 CALLED(); 979 return _sDefault; 980 } 981 982 983 status_t 984 BMediaRoster::SetTimeSourceFor(media_node_id node, 985 media_node_id time_source) 986 { 987 UNIMPLEMENTED(); 988 return B_ERROR; 989 } 990 991 992 status_t 993 BMediaRoster::GetParameterWebFor(const media_node & node, 994 BParameterWeb ** out_web) 995 { 996 UNIMPLEMENTED(); 997 return B_ERROR; 998 } 999 1000 1001 status_t 1002 BMediaRoster::StartControlPanel(const media_node & node, 1003 BMessenger * out_messenger) 1004 { 1005 UNIMPLEMENTED(); 1006 return B_ERROR; 1007 } 1008 1009 1010 status_t 1011 BMediaRoster::GetDormantNodes(dormant_node_info * out_info, 1012 int32 * io_count, 1013 const media_format * has_input /* = NULL */, 1014 const media_format * has_output /* = NULL */, 1015 const char * name /* = NULL */, 1016 uint64 require_kinds /* = NULL */, 1017 uint64 deny_kinds /* = NULL */) 1018 { 1019 CALLED(); 1020 if (out_info == NULL) 1021 return B_BAD_VALUE; 1022 if (io_count == NULL) 1023 return B_BAD_VALUE; 1024 if (*io_count <= 0) 1025 return B_BAD_VALUE; 1026 1027 xfer_server_get_dormant_nodes msg; 1028 port_id port; 1029 status_t rv; 1030 1031 port = find_port("media_server port"); 1032 if (port <= B_OK) 1033 return B_ERROR; 1034 1035 msg.maxcount = *io_count; 1036 msg.has_input = (bool) has_input; 1037 if (has_input) 1038 msg.inputformat = *has_input; // XXX we should not make a flat copy of media_format 1039 msg.has_output = (bool) has_output; 1040 if (has_output) 1041 msg.outputformat = *has_output;; // XXX we should not make a flat copy of media_format 1042 msg.has_name = (bool) name; 1043 if (name) { 1044 int len = min_c(strlen(name),sizeof(msg.name) - 1); 1045 memcpy(msg.name,name,len); 1046 msg.name[len] = 0; 1047 } 1048 msg.require_kinds = require_kinds; 1049 msg.deny_kinds = deny_kinds; 1050 msg.reply_port = _PortPool->GetPort(); 1051 1052 rv = write_port(port, SERVER_GET_DORMANT_NODES, &msg, sizeof(msg)); 1053 if (rv != B_OK) { 1054 _PortPool->PutPort(msg.reply_port); 1055 return rv; 1056 } 1057 1058 xfer_server_get_dormant_nodes_reply reply; 1059 int32 code; 1060 1061 rv = read_port(msg.reply_port, &code, &reply, sizeof(reply)); 1062 if (rv < B_OK) { 1063 _PortPool->PutPort(msg.reply_port); 1064 return rv; 1065 } 1066 1067 *io_count = reply.count; 1068 1069 if (*io_count > 0) { 1070 rv = read_port(msg.reply_port, &code, out_info, *io_count * sizeof(dormant_node_info)); 1071 if (rv < B_OK) 1072 reply.result = rv; 1073 } 1074 _PortPool->PutPort(msg.reply_port); 1075 1076 return reply.result; 1077 } 1078 1079 1080 status_t 1081 BMediaRoster::InstantiateDormantNode(const dormant_node_info & in_info, 1082 media_node * out_node, 1083 uint32 flags /* currently B_FLAVOR_IS_GLOBAL or B_FLAVOR_IS_LOCAL */ ) 1084 { 1085 CALLED(); 1086 if ((flags & (B_FLAVOR_IS_GLOBAL | B_FLAVOR_IS_LOCAL)) == 0) { 1087 printf("Error: BMediaRoster::InstantiateDormantNode called without flags\n"); 1088 return B_BAD_VALUE; 1089 } 1090 if (out_node == 0) 1091 return B_BAD_VALUE; 1092 1093 // XXX we should not trust the values passed in by the user, 1094 // XXX and ask the server to determine where to insta 1095 1096 1097 // XXX SOMETHING IS VERY WRONG HERE 1098 // if ((in_info.flavor_flags & B_FLAVOR_IS_GLOBAL) == 0 && (flags & B_FLAVOR_IS_LOCAL)) { 1099 if (flags & B_FLAVOR_IS_LOCAL) { 1100 return InstantiateDormantNode(in_info,out_node); 1101 } 1102 1103 // XXX SOMETHING IS VERY WRONG HERE 1104 // if ((in_info.flavor_flags & B_FLAVOR_IS_GLOBAL) || (flags & B_FLAVOR_IS_GLOBAL)) { 1105 if (flags & B_FLAVOR_IS_GLOBAL) { 1106 // forward this request into the media_addon_server, 1107 // which in turn will call InstantiateDormantNode() 1108 // to create it there localy 1109 xfer_addonserver_instantiate_dormant_node msg; 1110 xfer_addonserver_instantiate_dormant_node_reply reply; 1111 port_id port; 1112 status_t rv; 1113 int32 code; 1114 port = find_port("media_addon_server port"); 1115 if (port <= B_OK) 1116 return B_ERROR; 1117 msg.info = in_info; 1118 msg.reply_port = _PortPool->GetPort(); 1119 rv = write_port(port, ADDONSERVER_INSTANTIATE_DORMANT_NODE, &msg, sizeof(msg)); 1120 if (rv != B_OK) { 1121 _PortPool->PutPort(msg.reply_port); 1122 return rv; 1123 } 1124 rv = read_port(msg.reply_port, &code, &reply, sizeof(reply)); 1125 _PortPool->PutPort(msg.reply_port); 1126 if (rv < B_OK) 1127 return rv; 1128 *out_node = reply.node; 1129 return reply.result; 1130 } 1131 1132 // XXX SOMETHING IS VERY WRONG HERE 1133 // printf("Error: BMediaRoster::InstantiateDormantNode in_info.flavor_flags = %#08lx, flags = %#08lx\n", in_info.flavor_flags, flags); 1134 1135 return B_ERROR; 1136 } 1137 1138 1139 status_t 1140 BMediaRoster::InstantiateDormantNode(const dormant_node_info & in_info, 1141 media_node * out_node) 1142 { 1143 CALLED(); 1144 1145 // to instantiate a dormant node in the current address space, we need to 1146 // either load the add-on from file and create a new BMediaAddOn class, or 1147 // reuse the cached BMediaAddOn from a previous call 1148 // call BMediaAddOn::InstantiateNodeFor() 1149 // and cache the BMediaAddOn after that for later reuse. 1150 // BeOS R5 does not seem to delete it when the application quits 1151 // if B_FLAVOR_IS_GLOBAL, we need to use the BMediaAddOn object that 1152 // resides in the media_addon_server 1153 1154 // RegisterNode() is called automatically for nodes instantiated from add-ons 1155 1156 //XXX TEST! 1157 BMediaAddOn *addon; 1158 BMediaNode *node; 1159 BMessage config; 1160 status_t out_error; 1161 addon = _DormantNodeManager->GetAddon(in_info.addon); 1162 if (!addon) { 1163 printf("BMediaRoster::InstantiateDormantNode: GetAddon failed\n"); 1164 return B_ERROR; 1165 } 1166 flavor_info temp; 1167 temp.internal_id = in_info.flavor_id; 1168 node = addon->InstantiateNodeFor(&temp, &config, &out_error); 1169 if (!node) { 1170 printf("BMediaRoster::InstantiateDormantNode: InstantiateNodeFor failed\n"); 1171 _DormantNodeManager->PutAddon(in_info.addon); 1172 return B_ERROR; 1173 } 1174 *out_node = node->Node(); 1175 return B_OK; 1176 } 1177 1178 1179 status_t 1180 BMediaRoster::GetDormantNodeFor(const media_node & node, 1181 dormant_node_info * out_info) 1182 { 1183 UNIMPLEMENTED(); 1184 1185 return B_ERROR; 1186 } 1187 1188 1189 status_t 1190 BMediaRoster::GetDormantFlavorInfoFor(const dormant_node_info & in_dormant, 1191 dormant_flavor_info * out_flavor) 1192 { 1193 CALLED(); 1194 1195 xfer_server_get_dormant_flavor_info msg; 1196 xfer_server_get_dormant_flavor_info_reply *reply; 1197 port_id port; 1198 status_t rv; 1199 int32 code; 1200 1201 port = find_port("media_server port"); 1202 if (port <= B_OK) 1203 return B_ERROR; 1204 1205 reply = (xfer_server_get_dormant_flavor_info_reply *) malloc(16000); 1206 if (reply == 0) 1207 return B_ERROR; 1208 1209 msg.addon = in_dormant.addon; 1210 msg.flavor_id = in_dormant.flavor_id; 1211 msg.reply_port = _PortPool->GetPort(); 1212 rv = write_port(port, SERVER_GET_DORMANT_FLAVOR_INFO, &msg, sizeof(msg)); 1213 if (rv != B_OK) { 1214 free(reply); 1215 _PortPool->PutPort(msg.reply_port); 1216 return rv; 1217 } 1218 rv = read_port(msg.reply_port, &code, reply, 16000); 1219 _PortPool->PutPort(msg.reply_port); 1220 1221 if (rv < B_OK) { 1222 free(reply); 1223 return rv; 1224 } 1225 1226 if (reply->result == B_OK) 1227 rv = out_flavor->Unflatten(reply->dfi_type, &reply->dfi, reply->dfi_size); 1228 else 1229 rv = reply->result; 1230 1231 free(reply); 1232 return rv; 1233 } 1234 1235 1236 status_t 1237 BMediaRoster::GetLatencyFor(const media_node & producer, 1238 bigtime_t * out_latency) 1239 { 1240 UNIMPLEMENTED(); 1241 *out_latency = 0; 1242 return B_ERROR; 1243 } 1244 1245 1246 status_t 1247 BMediaRoster::GetInitialLatencyFor(const media_node & producer, 1248 bigtime_t * out_latency, 1249 uint32 * out_flags) 1250 { 1251 UNIMPLEMENTED(); 1252 *out_latency = 0; 1253 *out_flags = 0; 1254 return B_ERROR; 1255 } 1256 1257 1258 status_t 1259 BMediaRoster::GetStartLatencyFor(const media_node & time_source, 1260 bigtime_t * out_latency) 1261 { 1262 UNIMPLEMENTED(); 1263 *out_latency = 0; 1264 return B_ERROR; 1265 } 1266 1267 1268 status_t 1269 BMediaRoster::GetFileFormatsFor(const media_node & file_interface, 1270 media_file_format * out_formats, 1271 int32 * io_num_infos) 1272 { 1273 UNIMPLEMENTED(); 1274 return B_ERROR; 1275 } 1276 1277 1278 status_t 1279 BMediaRoster::SetRefFor(const media_node & file_interface, 1280 const entry_ref & file, 1281 bool create_and_truncate, 1282 bigtime_t * out_length) /* if create is false */ 1283 { 1284 UNIMPLEMENTED(); 1285 return B_ERROR; 1286 } 1287 1288 1289 status_t 1290 BMediaRoster::GetRefFor(const media_node & node, 1291 entry_ref * out_file, 1292 BMimeType * mime_type) 1293 { 1294 UNIMPLEMENTED(); 1295 return B_ERROR; 1296 } 1297 1298 1299 status_t 1300 BMediaRoster::SniffRefFor(const media_node & file_interface, 1301 const entry_ref & file, 1302 BMimeType * mime_type, 1303 float * out_capability) 1304 { 1305 UNIMPLEMENTED(); 1306 return B_ERROR; 1307 } 1308 1309 1310 /* This is the generic "here's a file, now can someone please play it" interface */ 1311 status_t 1312 BMediaRoster::SniffRef(const entry_ref & file, 1313 uint64 require_node_kinds, /* if you need an EntityInterface or BufferConsumer or something */ 1314 dormant_node_info * out_node, 1315 BMimeType * mime_type) 1316 { 1317 UNIMPLEMENTED(); 1318 return B_ERROR; 1319 } 1320 1321 1322 status_t 1323 BMediaRoster::GetDormantNodeForType(const BMimeType & type, 1324 uint64 require_node_kinds, 1325 dormant_node_info * out_node) 1326 { 1327 UNIMPLEMENTED(); 1328 return B_ERROR; 1329 } 1330 1331 1332 status_t 1333 BMediaRoster::GetReadFileFormatsFor(const dormant_node_info & in_node, 1334 media_file_format * out_read_formats, 1335 int32 in_read_count, 1336 int32 * out_read_count) 1337 { 1338 UNIMPLEMENTED(); 1339 return B_ERROR; 1340 } 1341 1342 1343 status_t 1344 BMediaRoster::GetWriteFileFormatsFor(const dormant_node_info & in_node, 1345 media_file_format * out_write_formats, 1346 int32 in_write_count, 1347 int32 * out_write_count) 1348 { 1349 UNIMPLEMENTED(); 1350 return B_ERROR; 1351 } 1352 1353 1354 status_t 1355 BMediaRoster::GetFormatFor(const media_output & output, 1356 media_format * io_format, 1357 uint32 flags) 1358 { 1359 UNIMPLEMENTED(); 1360 return B_ERROR; 1361 } 1362 1363 1364 status_t 1365 BMediaRoster::GetFormatFor(const media_input & input, 1366 media_format * io_format, 1367 uint32 flags) 1368 { 1369 UNIMPLEMENTED(); 1370 return B_ERROR; 1371 } 1372 1373 1374 status_t 1375 BMediaRoster::GetFormatFor(const media_node & node, 1376 media_format * io_format, 1377 float quality) 1378 { 1379 UNIMPLEMENTED(); 1380 return B_ERROR; 1381 } 1382 1383 1384 ssize_t 1385 BMediaRoster::GetNodeAttributesFor(const media_node & node, 1386 media_node_attribute * outArray, 1387 size_t inMaxCount) 1388 { 1389 UNIMPLEMENTED(); 1390 return B_ERROR; 1391 } 1392 1393 1394 media_node_id 1395 BMediaRoster::NodeIDFor(port_id source_or_destination_port) 1396 { 1397 UNIMPLEMENTED(); 1398 return B_ERROR; 1399 } 1400 1401 1402 status_t 1403 BMediaRoster::GetInstancesFor(media_addon_id addon, 1404 int32 flavor, 1405 media_node_id * out_id, 1406 int32 * io_count) 1407 { 1408 UNIMPLEMENTED(); 1409 return B_ERROR; 1410 } 1411 1412 1413 1414 status_t 1415 BMediaRoster::SetRealtimeFlags(uint32 in_enabled) 1416 { 1417 UNIMPLEMENTED(); 1418 return B_ERROR; 1419 } 1420 1421 1422 status_t 1423 BMediaRoster::GetRealtimeFlags(uint32 * out_enabled) 1424 { 1425 UNIMPLEMENTED(); 1426 return B_ERROR; 1427 } 1428 1429 1430 ssize_t 1431 BMediaRoster::AudioBufferSizeFor(int32 channel_count, 1432 uint32 sample_format, 1433 float frame_rate, 1434 bus_type bus_kind) 1435 { 1436 UNIMPLEMENTED(); 1437 return 4096; 1438 } 1439 1440 1441 /* Use MediaFlags to inquire about specific features of the Media Kit. */ 1442 /* Returns < 0 for "not present", positive size for output data size. */ 1443 /* 0 means that the capability is present, but no data about it. */ 1444 /* static */ ssize_t 1445 BMediaRoster::MediaFlags(media_flags cap, 1446 void * buf, 1447 size_t maxSize) 1448 { 1449 UNIMPLEMENTED(); 1450 return 0; 1451 } 1452 1453 1454 1455 /* BLooper overrides */ 1456 /* virtual */ void 1457 BMediaRoster::MessageReceived(BMessage * message) 1458 { 1459 UNIMPLEMENTED(); 1460 } 1461 1462 /* virtual */ bool 1463 BMediaRoster::QuitRequested() 1464 { 1465 UNIMPLEMENTED(); 1466 return true; 1467 } 1468 1469 /* virtual */ BHandler * 1470 BMediaRoster::ResolveSpecifier(BMessage *msg, 1471 int32 index, 1472 BMessage *specifier, 1473 int32 form, 1474 const char *property) 1475 { 1476 UNIMPLEMENTED(); 1477 return 0; 1478 } 1479 1480 1481 /* virtual */ status_t 1482 BMediaRoster::GetSupportedSuites(BMessage *data) 1483 { 1484 UNIMPLEMENTED(); 1485 return B_ERROR; 1486 } 1487 1488 1489 BMediaRoster::~BMediaRoster() 1490 { 1491 CALLED(); 1492 BMessage msg(MEDIA_SERVER_UNREGISTER_APP); 1493 BMessage reply; 1494 msg.AddInt32("team",team); 1495 ServerMessenger->SendMessage(&msg,&reply); 1496 } 1497 1498 1499 /************************************************************* 1500 * private BMediaRoster 1501 *************************************************************/ 1502 1503 // deprecated call 1504 status_t 1505 BMediaRoster::SetOutputBuffersFor(const media_source & output, 1506 BBufferGroup * group, 1507 bool will_reclaim ) 1508 { 1509 UNIMPLEMENTED(); 1510 return B_ERROR; 1511 } 1512 1513 1514 /* FBC stuffing (Mmmh, Stuffing!) */ 1515 status_t BMediaRoster::_Reserved_MediaRoster_0(void *) { return B_ERROR; } 1516 status_t BMediaRoster::_Reserved_MediaRoster_1(void *) { return B_ERROR; } 1517 status_t BMediaRoster::_Reserved_MediaRoster_2(void *) { return B_ERROR; } 1518 status_t BMediaRoster::_Reserved_MediaRoster_3(void *) { return B_ERROR; } 1519 status_t BMediaRoster::_Reserved_MediaRoster_4(void *) { return B_ERROR; } 1520 status_t BMediaRoster::_Reserved_MediaRoster_5(void *) { return B_ERROR; } 1521 status_t BMediaRoster::_Reserved_MediaRoster_6(void *) { return B_ERROR; } 1522 status_t BMediaRoster::_Reserved_MediaRoster_7(void *) { return B_ERROR; } 1523 1524 1525 BMediaRoster::BMediaRoster() : 1526 BLooper("BMediaRoster looper",B_NORMAL_PRIORITY,B_LOOPER_PORT_DEFAULT_CAPACITY) 1527 { 1528 CALLED(); 1529 BMessage msg(MEDIA_SERVER_REGISTER_APP); 1530 BMessage reply; 1531 msg.AddInt32("team",team); 1532 ServerMessenger->SendMessage(&msg,&reply); 1533 } 1534 1535 /* static */ status_t 1536 BMediaRoster::ParseCommand(BMessage & reply) 1537 { 1538 UNIMPLEMENTED(); 1539 return B_ERROR; 1540 } 1541 1542 1543 1544 status_t 1545 BMediaRoster::GetDefaultInfo(media_node_id for_default, 1546 BMessage & out_config) 1547 { 1548 UNIMPLEMENTED(); 1549 return B_ERROR; 1550 } 1551 1552 1553 1554 status_t 1555 BMediaRoster::SetRunningDefault(media_node_id for_default, 1556 const media_node & node) 1557 { 1558 UNIMPLEMENTED(); 1559 return B_ERROR; 1560 } 1561 1562 1563 /************************************************************* 1564 * static BMediaRoster variables 1565 *************************************************************/ 1566 1567 bool BMediaRoster::_isMediaServer; 1568 port_id BMediaRoster::_mReplyPort; 1569 int32 BMediaRoster::_mReplyPortRes; 1570 int32 BMediaRoster::_mReplyPortUnavailCount; 1571 BMediaRoster * BMediaRoster::_sDefault = NULL; 1572 1573