#include <AVStreams_i.h>
Inheritance diagram for TAO_StreamCtrl:
Public Member Functions | |
TAO_StreamCtrl (void) | |
Default Constructor. | |
virtual | ~TAO_StreamCtrl (void) |
virtual destructor. | |
virtual void | stop (const AVStreams::flowSpec &the_spec) |
virtual void | start (const AVStreams::flowSpec &the_spec) |
virtual void | destroy (const AVStreams::flowSpec &the_spec) |
virtual CORBA::Boolean | bind_devs (AVStreams::MMDevice_ptr a_party, AVStreams::MMDevice_ptr b_party, AVStreams::streamQoS &the_qos, const AVStreams::flowSpec &the_flows) |
virtual CORBA::Boolean | bind (AVStreams::StreamEndPoint_A_ptr a_party, AVStreams::StreamEndPoint_B_ptr b_party, AVStreams::streamQoS &the_qos, const AVStreams::flowSpec &the_flows) |
virtual void | unbind_dev (AVStreams::MMDevice_ptr dev, const AVStreams::flowSpec &the_spec) |
virtual void | unbind_party (AVStreams::StreamEndPoint_ptr the_ep, const AVStreams::flowSpec &the_spec) |
Unbind the_ep from the stream. Empty the_spec means apply to all flows. | |
virtual void | unbind (void) |
unbind the stream. Same effect as Basic_StreamCtrl::destroy () | |
virtual AVStreams::VDev_ptr | get_related_vdev (AVStreams::MMDevice_ptr adev, AVStreams::StreamEndPoint_out sep) |
virtual CORBA::Boolean | modify_QoS (AVStreams::streamQoS &new_qos, const AVStreams::flowSpec &the_spec) |
Protected Types | |
typedef ACE_Hash_Map_Manager< MMDevice_Map_Hash_Key, MMDevice_Map_Entry, ACE_Null_Mutex > | MMDevice_Map |
typedef ACE_Hash_Map_Iterator< MMDevice_Map_Hash_Key, MMDevice_Map_Entry, ACE_Null_Mutex > | MMDevice_Map_Iterator |
Protected Attributes | |
MMDevice_Map | mmdevice_a_map_ |
MMDevice_Map | mmdevice_b_map_ |
TAO_MCastConfigIf * | mcastconfigif_ |
AVStreams::MCastConfigIf_var | mcastconfigif_ptr_ |
AVStreams::StreamCtrl_var | streamctrl_ |
CORBA::ULong | source_id_ |
Classes | |
struct | MMDevice_Map_Entry |
Definition at line 194 of file AVStreams_i.h.
typedef ACE_Hash_Map_Manager<MMDevice_Map_Hash_Key,MMDevice_Map_Entry,ACE_Null_Mutex> TAO_StreamCtrl::MMDevice_Map [protected] |
Definition at line 272 of file AVStreams_i.h.
typedef ACE_Hash_Map_Iterator<MMDevice_Map_Hash_Key,MMDevice_Map_Entry,ACE_Null_Mutex> TAO_StreamCtrl::MMDevice_Map_Iterator [protected] |
Definition at line 273 of file AVStreams_i.h.
TAO_StreamCtrl::TAO_StreamCtrl | ( | void | ) |
Default Constructor.
Definition at line 407 of file AVStreams_i.cpp.
References CORBA::Exception::_tao_print_exception(), TAO_AV_RTCP::alloc_srcid(), ACE_OS::hostname(), ACE_OS::inet_addr(), source_id_, and streamctrl_.
00408 :mcastconfigif_ (0) 00409 { 00410 try 00411 { 00412 this->streamctrl_ = this->_this (); 00413 char buf [BUFSIZ]; 00414 int result = ACE_OS::hostname (buf, BUFSIZ); 00415 unsigned long ipaddr = 0; 00416 if (result == 0) 00417 ipaddr = ACE_OS::inet_addr (buf); 00418 this->source_id_ = TAO_AV_RTCP::alloc_srcid (ipaddr); 00419 } 00420 catch (const CORBA::Exception& ex) 00421 { 00422 ex._tao_print_exception ("TAO_StreamCtrl::TAO_StreamCtrl"); 00423 } 00424 }
TAO_StreamCtrl::~TAO_StreamCtrl | ( | void | ) | [virtual] |
virtual destructor.
Definition at line 426 of file AVStreams_i.cpp.
References mcastconfigif_.
00427 { 00428 delete this->mcastconfigif_; 00429 }
CORBA::Boolean TAO_StreamCtrl::bind | ( | AVStreams::StreamEndPoint_A_ptr | a_party, | |
AVStreams::StreamEndPoint_B_ptr | b_party, | |||
AVStreams::streamQoS & | the_qos, | |||
const AVStreams::flowSpec & | the_flows | |||
) | [virtual] |
Establish a connection between two streamendpoints. This can be used if the streamendpoints have been created independent of a MMDevice
Definition at line 882 of file AVStreams_i.cpp.
References CORBA::Exception::_tao_print_exception(), ACE_ASSERT, ACE_DEBUG, ACE_ERROR_RETURN, ACE_NEW_RETURN, ACE_Hash_Map_Iterator_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::advance(), FlowEndPoint_Map, TAO_Basic_StreamCtrl::get_flow_connection(), TAO_AV_QoS::get_flow_qos(), TAO_Pseudo_Var_T< T >::in(), ACE_Hash_Map_Entry< EXT_ID, INT_ID >::int_id_, CORBA::is_nil(), LM_DEBUG, LM_ERROR, ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::next(), AVStreams::QoS::QoSParams, AVStreams::QoS::QoSType, TAO_Basic_StreamCtrl::sep_a_, TAO_Basic_StreamCtrl::sep_b_, TAO_Basic_StreamCtrl::set_flow_connection(), CORBA::string_dup(), and TAO_debug_level.
Referenced by bind_devs().
00886 { 00887 this->sep_a_ = AVStreams::StreamEndPoint_A::_duplicate(sep_a); 00888 this->sep_b_ = AVStreams::StreamEndPoint_B::_duplicate(sep_b); 00889 00890 int result = 0; 00891 try 00892 { 00893 if (CORBA::is_nil (sep_a_.in() ) || 00894 CORBA::is_nil (sep_b_.in() )) 00895 ACE_ERROR_RETURN ((LM_ERROR, 00896 "(%P|%t) TAO_StreamCtrl::bind:" 00897 "a_party or b_party null!"), 00898 0); 00899 00900 // Define each other as their peers. 00901 CORBA::Any sep_any; 00902 sep_any <<= sep_b; 00903 sep_a_->define_property ("PeerAdapter", 00904 sep_any); 00905 sep_any <<= sep_a; 00906 sep_b_->define_property ("PeerAdapter", 00907 sep_any); 00908 // since its full profile we do the viable stream setup algorithm. 00909 // get the flows for the A streamendpoint. 00910 // the flows spec is empty and hence we do a exhaustive match. 00911 AVStreams::flowSpec a_flows, b_flows; 00912 CORBA::Any_var flows_any; 00913 flows_any = sep_a_->get_property_value ("Flows"); 00914 AVStreams::flowSpec *temp_flows; 00915 flows_any.in () >>= temp_flows; 00916 a_flows = *temp_flows; 00917 flows_any = sep_b_->get_property_value ("Flows"); 00918 flows_any.in () >>= temp_flows; 00919 b_flows = *temp_flows; 00920 u_int i; 00921 FlowEndPoint_Map *a_fep_map; 00922 FlowEndPoint_Map *b_fep_map; 00923 ACE_NEW_RETURN (a_fep_map, 00924 FlowEndPoint_Map, 00925 0); 00926 ACE_NEW_RETURN (b_fep_map, 00927 FlowEndPoint_Map, 00928 0); 00929 for (i=0;i<a_flows.length ();i++) 00930 { 00931 const char *flowname = a_flows[i]; 00932 // get the flowendpoint references. 00933 CORBA::Object_var fep_obj = 00934 sep_a_->get_fep (flowname); 00935 AVStreams::FlowEndPoint_var fep = 00936 AVStreams::FlowEndPoint::_narrow (fep_obj.in ()); 00937 ACE_CString fep_key (flowname); 00938 result = a_fep_map->bind (fep_key, fep); 00939 if (result == -1) 00940 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_StreamCtrl::bind failed for %s\n", flowname)); 00941 } 00942 // get the flowendpoints for streamendpoint_b 00943 for (i=0;i<b_flows.length ();i++) 00944 { 00945 const char *flowname = b_flows[i]; 00946 // get the flowendpoint references. 00947 CORBA::Object_var fep_obj = 00948 sep_b->get_fep (flowname); 00949 AVStreams::FlowEndPoint_var fep = 00950 AVStreams::FlowEndPoint::_narrow (fep_obj.in ()); 00951 ACE_CString fep_key (flowname); 00952 result = b_fep_map->bind (fep_key, fep); 00953 if (result == -1) 00954 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_StreamCtrl::bind failed for %s\n", flowname)); 00955 } 00956 FlowEndPoint_Map *map_a = 0, *map_b = 0; 00957 if (flow_spec.length () == 0) 00958 { 00959 map_a = a_fep_map; 00960 map_b = b_fep_map; 00961 } 00962 else 00963 { 00964 FlowEndPoint_Map *spec_fep_map_a, *spec_fep_map_b; 00965 ACE_NEW_RETURN (spec_fep_map_a, 00966 FlowEndPoint_Map, 00967 0); 00968 ACE_NEW_RETURN (spec_fep_map_b, 00969 FlowEndPoint_Map, 00970 0); 00971 for (i=0; i< flow_spec.length ();i++) 00972 { 00973 TAO_Forward_FlowSpec_Entry *entry = 0; 00974 ACE_NEW_RETURN (entry, 00975 TAO_Forward_FlowSpec_Entry, 00976 0); 00977 entry->parse (flow_spec[i]); 00978 ACE_CString fep_key (entry->flowname ()); 00979 AVStreams::FlowEndPoint_var fep; 00980 result = a_fep_map->find (fep_key, fep); 00981 if (result == -1) 00982 ACE_ERROR_RETURN ((LM_ERROR, "Fep not found on A side for flowname: %s\n", flow_spec[i].in ()), 0); 00983 00984 result = spec_fep_map_a->bind (fep_key, fep); 00985 if (result == -1) 00986 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "Bind failed for %s\n", flow_spec[i].in ())); 00987 00988 result = b_fep_map->find (fep_key, fep); 00989 if (result == -1) 00990 ACE_ERROR_RETURN ((LM_ERROR, "Fep not found on B side for flowname: %s\n", flow_spec[i].in ()), 0); 00991 00992 result = spec_fep_map_b->bind (fep_key, fep); 00993 if (result == -1) 00994 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "Bind failed for %s\n", flow_spec[i].in ())); 00995 } 00996 map_a = spec_fep_map_a; 00997 map_b = spec_fep_map_b; 00998 } 00999 01000 TAO_AV_QoS qos (stream_qos); 01001 // Now go thru the list of flow endpoint and match them. 01002 // uses the first match policy. 01003 FlowEndPoint_Map_Iterator a_feps_iterator (*map_a); 01004 FlowEndPoint_Map_Entry *a_feps_entry, *b_feps_entry; 01005 try 01006 { 01007 01008 for (;a_feps_iterator.next (a_feps_entry) != 0; 01009 a_feps_iterator.advance ()) 01010 { 01011 AVStreams::FlowEndPoint_var fep_a = a_feps_entry->int_id_; 01012 AVStreams::FlowEndPoint_var connected_to = 01013 fep_a->get_connected_fep (); 01014 01015 if (!CORBA::is_nil (connected_to.in ())) 01016 { 01017 // Skip this one, it is already connected... 01018 continue; 01019 } 01020 01021 FlowEndPoint_Map_Iterator b_feps_iterator (*map_b); 01022 for (;b_feps_iterator.next (b_feps_entry) != 0; 01023 b_feps_iterator.advance ()) 01024 { 01025 AVStreams::FlowEndPoint_var fep_b = b_feps_entry->int_id_; 01026 AVStreams::FlowConnection_var flow_connection; 01027 01028 AVStreams::FlowEndPoint_var connected_to = 01029 fep_b->get_connected_fep (); 01030 01031 if (!CORBA::is_nil (connected_to.in ())) 01032 { 01033 // Skip this one, it is already connected... 01034 continue; 01035 } 01036 01037 if (fep_a->is_fep_compatible (fep_b.in()) == 1) 01038 { 01039 // assume that flow names are same so that we 01040 // can use either of them. 01041 CORBA::Object_var flow_connection_obj; 01042 CORBA::Any_var flowname_any = 01043 fep_a->get_property_value ("FlowName"); 01044 const char *flowname = 0; 01045 flowname_any.in () >>= flowname; 01046 try 01047 { 01048 flow_connection_obj = 01049 this->get_flow_connection (flowname); 01050 flow_connection = 01051 AVStreams::FlowConnection::_narrow (flow_connection_obj.in ()); 01052 } 01053 catch (const CORBA::Exception&) 01054 { 01055 TAO_FlowConnection *flowConnection; 01056 ACE_NEW_RETURN (flowConnection, 01057 TAO_FlowConnection, 01058 0); 01059 flow_connection = flowConnection->_this (); 01060 this->set_flow_connection (flowname, 01061 flow_connection.in ()); 01062 } 01063 01064 // make sure that a_feps is flow_producer 01065 // and b_feps is flow_consumer 01066 // There should be a way to find which flow 01067 // endpoint is producer and which is 01068 // consumer. 01069 01070 AVStreams::FlowProducer_var producer; 01071 AVStreams::FlowConsumer_var consumer; 01072 01073 try 01074 { 01075 producer = 01076 AVStreams::FlowProducer::_narrow (fep_a.in()); 01077 consumer = 01078 AVStreams::FlowConsumer::_narrow (fep_b.in()); 01079 01080 // If the types don't match then try in 01081 // the opposite order 01082 if (CORBA::is_nil (producer.in ())) 01083 { 01084 producer = 01085 AVStreams::FlowProducer::_narrow (fep_b.in()); 01086 consumer = 01087 AVStreams::FlowConsumer::_narrow (fep_a.in()); 01088 } 01089 // At this point they should both be 01090 // non-nil 01091 // @@ raise an exception (which one?) if 01092 // this is not true... 01093 ACE_ASSERT (!CORBA::is_nil (producer.in ())); 01094 ACE_ASSERT (!CORBA::is_nil (consumer.in ())); 01095 } 01096 catch (const CORBA::Exception&) 01097 { 01098 //Yamuna : Recheck this 01099 throw;//_EX (producer_check); 01100 } 01101 CORBA::String_var fep_a_name, fep_b_name; 01102 flowname_any = fep_a->get_property_value ("FlowName"); 01103 const char *temp_name; 01104 flowname_any.in () >>= temp_name; 01105 fep_a_name = CORBA::string_dup (temp_name); 01106 flowname_any = fep_b->get_property_value ("FlowName"); 01107 flowname_any.in () >>= temp_name; 01108 fep_b_name = CORBA::string_dup (temp_name); 01109 AVStreams::QoS flow_qos; 01110 flow_qos.QoSType = fep_a_name; 01111 flow_qos.QoSParams.length (0); 01112 result = qos.get_flow_qos (fep_a_name.in (), flow_qos); 01113 if (result == -1) 01114 { 01115 flow_qos.QoSType = fep_b_name; 01116 result = qos.get_flow_qos (fep_b_name.in (), 01117 flow_qos); 01118 if (result == -1 && TAO_debug_level > 0) 01119 ACE_DEBUG ((LM_DEBUG, 01120 "No QoS Specified for this flow <%s>\n", flowname)); 01121 } 01122 flow_connection->connect (producer.in (), 01123 consumer.in (), 01124 flow_qos); 01125 } 01126 } 01127 } 01128 } 01129 catch (const CORBA::Exception& ex) 01130 { 01131 ex._tao_print_exception ("TAO_StreamCtrl::bind:flow_connect block"); 01132 return 0; 01133 } 01134 } 01135 catch (const CORBA::Exception&) 01136 { 01137 // error was thrown because one of the streamendpoints is light profile. 01138 // Now connect the streams together 01139 this->sep_a_->connect (this->sep_b_.in (), 01140 stream_qos, 01141 flow_spec); 01142 } 01143 return 1; 01144 }
CORBA::Boolean TAO_StreamCtrl::bind_devs | ( | AVStreams::MMDevice_ptr | a_party, | |
AVStreams::MMDevice_ptr | b_party, | |||
AVStreams::streamQoS & | the_qos, | |||
const AVStreams::flowSpec & | the_flows | |||
) | [virtual] |
Establish a stream between a_party and b_party, with qos the_qos, and for the flows in the_flows if the_flows is empty, bind all the flows Causes a connection to be established between the StreamEndpoints. Returns success/failure
Definition at line 547 of file AVStreams_i.cpp.
References CORBA::Exception::_tao_print_exception(), ACE_DEBUG, ACE_ERROR_RETURN, ACE_NEW_RETURN, bind(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find(), TAO_StreamCtrl::MMDevice_Map_Entry::flowspec_, CORBA::is_nil(), LM_DEBUG, LM_ERROR, mcastconfigif_, mcastconfigif_ptr_, mmdevice_a_map_, mmdevice_b_map_, TAO_StreamCtrl::MMDevice_Map_Entry::qos_, TAO_StreamCtrl::MMDevice_Map_Entry::sep_, TAO_Basic_StreamCtrl::sep_a_, TAO_Basic_StreamCtrl::sep_b_, TAO_MCastConfigIf::set_peer(), streamctrl_, TAO_debug_level, TAO_ORB_Core_instance(), TAO_StreamCtrl::MMDevice_Map_Entry::vdev_, TAO_Basic_StreamCtrl::vdev_a_, and TAO_Basic_StreamCtrl::vdev_b_.
Referenced by TAO_MMDevice::bind().
00551 { 00552 try 00553 { 00554 if (CORBA::is_nil (a_party) && CORBA::is_nil (b_party)) 00555 ACE_ERROR_RETURN ((LM_ERROR, "Both parties are nil\n"), 0); 00556 // Check to see if we have non-nil parties to bind! 00557 if (TAO_debug_level > 0) 00558 if (CORBA::is_nil (a_party) || 00559 CORBA::is_nil (b_party)) 00560 if (TAO_debug_level > 0) 00561 ACE_DEBUG ((LM_DEBUG, 00562 "(%P|%t) TAO_StreamCtrl::bind_devs: " 00563 "a_party or b_party is null" 00564 "Multicast mode\n")); 00565 00566 // Request a_party to create the endpoint and vdev 00567 CORBA::Boolean met_qos; 00568 CORBA::String_var named_vdev; 00569 00570 if (!CORBA::is_nil (a_party)) 00571 { 00572 MMDevice_Map_Hash_Key find_key (a_party); 00573 MMDevice_Map_Entry find_entry; 00574 int result = 00575 this->mmdevice_a_map_.find (find_key, find_entry); 00576 if (result == 0) 00577 { 00578 if (TAO_debug_level > 0) 00579 { 00580 // Already in the map. 00581 if (TAO_debug_level > 0) 00582 ACE_DEBUG ((LM_DEBUG, "mmdevice a_party is already bound\n")); 00583 } 00584 return 1; 00585 } 00586 else 00587 { 00588 this->sep_a_ = 00589 a_party-> create_A (this->streamctrl_.in (), 00590 this->vdev_a_.out (), 00591 the_qos, 00592 met_qos, 00593 named_vdev.inout (), 00594 the_flows); 00595 00596 if (TAO_debug_level > 0) 00597 ACE_DEBUG ((LM_DEBUG, "(%P|%t) TAO_StreamCtrl::create_A: succeeded\n")); 00598 // Define ourselves as the related_streamctrl property of the sep. 00599 CORBA::Any streamctrl_any; 00600 streamctrl_any <<= this->streamctrl_.in (); 00601 this->sep_a_->define_property ("Related_StreamCtrl", 00602 streamctrl_any); 00603 00604 CORBA::Any vdev_a_any; 00605 vdev_a_any <<= this->vdev_a_.in (); 00606 this->sep_a_->define_property ("Related_VDev", 00607 vdev_a_any); 00608 00609 CORBA::Any streamendpoint_a_any; 00610 streamendpoint_a_any <<= this->sep_a_.in (); 00611 this->vdev_a_->define_property ("Related_StreamEndpoint", 00612 streamendpoint_a_any); 00613 00614 00615 CORBA::Any mmdevice_a_any; 00616 mmdevice_a_any <<= a_party; 00617 this->vdev_a_->define_property ("Related_MMDevice", 00618 mmdevice_a_any); 00619 00620 // add the mmdevice, sep and vdev to the map. 00621 MMDevice_Map_Entry map_entry; 00622 MMDevice_Map_Hash_Key key (a_party); 00623 map_entry.sep_ = AVStreams::StreamEndPoint_A::_duplicate (this->sep_a_.in ()); 00624 map_entry.vdev_ = AVStreams::VDev::_duplicate (this->vdev_a_.in ()); 00625 map_entry.flowspec_ = the_flows; 00626 map_entry.qos_ = the_qos; 00627 result = 00628 this->mmdevice_a_map_.bind (key, map_entry); 00629 if (result < 0) 00630 if (TAO_debug_level > 0) 00631 ACE_DEBUG ((LM_DEBUG, "Error binding mmdevice entry in the a_map")); 00632 } 00633 } 00634 // Request b_party to create the endpoint and vdev 00635 if (!CORBA::is_nil (b_party)) 00636 { 00637 MMDevice_Map_Hash_Key find_key (b_party); 00638 MMDevice_Map_Entry find_entry; 00639 int result = 00640 this->mmdevice_b_map_.find (find_key, find_entry); 00641 if (result == 0) 00642 { 00643 // Already in the map. 00644 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "mmdevice b_party is already bound\n")); 00645 return 1; 00646 } 00647 else 00648 { 00649 this->sep_b_ = 00650 b_party-> create_B (this->streamctrl_.in (), 00651 this->vdev_b_.out (), 00652 the_qos, 00653 met_qos, 00654 named_vdev.inout (), 00655 the_flows); 00656 00657 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "(%P|%t) TAO_StreamCtrl::create_B: succeeded\n")); 00658 00659 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, 00660 "\n(%P|%t)stream_endpoint_b_ = %s", 00661 TAO_ORB_Core_instance ()->orb ()->object_to_string (this->sep_b_.in ()))); 00662 // Define ourselves as the related_streamctrl property of the sep. 00663 CORBA::Any streamctrl_any; 00664 streamctrl_any <<= this->streamctrl_.in (); 00665 this->sep_b_->define_property ("Related_StreamCtrl", 00666 streamctrl_any); 00667 00668 CORBA::Any vdev_b_any; 00669 vdev_b_any <<= this->vdev_b_.in (); 00670 this->sep_b_->define_property ("Related_VDev", 00671 vdev_b_any); 00672 00673 CORBA::Any streamendpoint_b_any; 00674 streamendpoint_b_any <<= this->sep_b_.in (); 00675 this->vdev_b_->define_property ("Related_StreamEndpoint", 00676 streamendpoint_b_any); 00677 00678 00679 CORBA::Any mmdevice_b_any; 00680 mmdevice_b_any <<= b_party; 00681 this->vdev_b_->define_property ("Related_MMDevice", 00682 mmdevice_b_any); 00683 // add the mmdevice, sep and vdev to the map. 00684 MMDevice_Map_Entry map_entry; 00685 MMDevice_Map_Hash_Key key (b_party); 00686 map_entry.sep_ = AVStreams::StreamEndPoint::_duplicate (this->sep_b_.in ()); 00687 map_entry.vdev_ = AVStreams::VDev::_duplicate(this->vdev_b_.in ()); 00688 map_entry.flowspec_ = the_flows; 00689 map_entry.qos_ = the_qos; 00690 int result = 00691 this->mmdevice_b_map_.bind (key, map_entry); 00692 if (result < 0) 00693 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "Error binding mmdevice entry in the b_map")); 00694 } 00695 } 00696 00697 // Tell the endpoints about each other. 00698 if ((!CORBA::is_nil (a_party)) && (!CORBA::is_nil (b_party))) 00699 { 00700 CORBA::Any sep_a_peer_any; 00701 CORBA::Any sep_b_peer_any; 00702 00703 sep_a_peer_any <<= this->sep_b_.in(); 00704 sep_b_peer_any <<= this->sep_a_.in(); 00705 this->sep_a_->define_property ("PeerAdapter", 00706 sep_a_peer_any); 00707 00708 this->sep_b_->define_property ("PeerAdapter", 00709 sep_b_peer_any); 00710 } 00711 00712 // In the full profile case there's no VDev. 00713 if (CORBA::is_nil (b_party) && (!CORBA::is_nil (this->vdev_a_.in ()))) 00714 { 00715 // Now set the source id for this A endpoint. 00716 // If the sep contains flow producers then set the source ids for those 00717 // instead. 00718 try 00719 { 00720 CORBA::Any_ptr flows_any = this->sep_a_->get_property_value ("Flows"); 00721 AVStreams::flowSpec_var flows; 00722 *flows_any >>= flows.out (); 00723 for (CORBA::ULong i=0; i< flows->length ();++i) 00724 { 00725 CORBA::Object_var fep_obj = 00726 this->sep_a_->get_fep (flows [i]); 00727 try 00728 { 00729 AVStreams::FlowProducer_var producer = 00730 AVStreams::FlowProducer::_narrow (fep_obj.in ()); 00731 producer->set_source_id (this->source_id_++); 00732 } 00733 catch (const CORBA::Exception& ex) 00734 { 00735 if (TAO_debug_level > 0) 00736 ACE_DEBUG ((LM_DEBUG, " %s ", static_cast<char const*>(flows[i]))); 00737 00738 ex._tao_print_exception ( 00739 "producer_check: not a producer"); 00740 00741 } 00742 } 00743 } 00744 catch (const CORBA::Exception&) 00745 { 00746 // Since the full profile failed try setting the source id 00747 // for the sep instead. 00748 // @@Naga: What do we do if in the light profile the sep has 00749 // many producers who do not have flow interfaces. Then 00750 // the streamctrl has to give an array of source ids to 00751 // the sep. 00752 this->sep_a_->set_source_id (this->source_id_++); 00753 } 00754 if (!this->mcastconfigif_) 00755 { 00756 ACE_NEW_RETURN (this->mcastconfigif_, 00757 TAO_MCastConfigIf, 00758 0); 00759 // @@: Deactivating the object thru poa means calling remove_ref after _this. 00760 this->mcastconfigif_ptr_ = this->mcastconfigif_->_this (); 00761 } 00762 // Multicast source being added. 00763 CORBA::Boolean result = this->vdev_a_->set_Mcast_peer (this->streamctrl_.in (), 00764 this->mcastconfigif_ptr_.in (), 00765 the_qos, 00766 the_flows); 00767 if (!result) 00768 ACE_ERROR_RETURN ((LM_ERROR, "set_Mcast_peer failed\n"), 0); 00769 } 00770 00771 if (CORBA::is_nil (a_party)) 00772 { 00773 if (!CORBA::is_nil (this->vdev_b_.in ())) 00774 { 00775 // Multicast sink being added. 00776 if (!this->mcastconfigif_) 00777 ACE_ERROR_RETURN ((LM_ERROR, "first add a source and then a sink\n"), 0); 00778 this->mcastconfigif_->set_peer (this->vdev_b_.in (), 00779 the_qos, 00780 the_flows); 00781 } 00782 00783 int connect_leaf_success = 0; 00784 try 00785 { 00786 // @@: define null interfaces for Atm so that they can be implemented once 00787 // ACE adds support for ATM multicast. 00788 connect_leaf_success = this->sep_a_->connect_leaf (this->sep_b_.in (), 00789 the_qos, 00790 the_flows); 00791 connect_leaf_success = 1; 00792 } 00793 catch (const AVStreams::notSupported&) 00794 { 00795 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "connect_leaf failed\n")); 00796 connect_leaf_success = 0; 00797 } 00798 catch (const CORBA::Exception& ex) 00799 { 00800 ex._tao_print_exception ( 00801 "TAO_StreamCtrl::bind_devs"); 00802 } 00803 if (!connect_leaf_success) 00804 { 00805 if (TAO_debug_level > 0) 00806 ACE_DEBUG ((LM_DEBUG,"TAO_StreamCtrl::bind_devs Multiconnect\n")); 00807 AVStreams::flowSpec connect_flows = the_flows; 00808 this->sep_a_->multiconnect (the_qos, connect_flows); 00809 this->sep_b_->multiconnect (the_qos, connect_flows); 00810 } 00811 } 00812 00813 if (!CORBA::is_nil (a_party) && !CORBA::is_nil (b_party)) 00814 { 00815 // Check to see if the MMDevice contains FDev objects 00816 // If it contains FDev objects, then we are using the 00817 // Full profile, and we want to call bind() instead 00818 // of connect() on the the streamctrl 00819 if( a_party->is_property_defined("Flows") && 00820 b_party->is_property_defined("Flows") ) 00821 { 00822 if (TAO_debug_level > 0) { 00823 //FUZZ: disable check_for_lack_ACE_OS 00824 ACE_DEBUG ((LM_DEBUG, "(%N,%l) Full profile, invoking bind()\n")); 00825 //FUZZ: enable check_for_lack_ACE_OS 00826 } 00827 00828 // It is full profile 00829 // we have feps in the sep then dont call connect 00830 // instead call bind on the streamctrl. 00831 this->bind (this->sep_a_.in (), 00832 this->sep_b_.in (), 00833 the_qos, 00834 the_flows); 00835 00836 00837 00838 } 00839 // This is the light profile, call connect() 00840 else if (!CORBA::is_nil (this->vdev_a_.in ()) && !CORBA::is_nil (this->vdev_b_.in ())) 00841 { 00842 if (TAO_debug_level > 0) { 00843 //FUZZ: disable check_for_lack_ACE_OS 00844 ACE_DEBUG ((LM_DEBUG, "(%N,%l) Light profile, invoking connect()\n")); 00845 //FUZZ: enable check_for_lack_ACE_OS 00846 } 00847 00848 // Tell the 2 VDev's about one another 00849 this->vdev_a_->set_peer (this->streamctrl_.in (), 00850 this->vdev_b_.in (), 00851 the_qos, 00852 the_flows); 00853 00854 this->vdev_b_->set_peer (this->streamctrl_.in (), 00855 this->vdev_a_.in (), 00856 the_qos, 00857 the_flows); 00858 00859 00860 // Now connect the streams together. This will 00861 // establish the connection 00862 CORBA::Boolean result = 00863 this->sep_a_->connect (this->sep_b_.in (), 00864 the_qos, 00865 the_flows); 00866 if (result == 0) 00867 ACE_ERROR_RETURN ((LM_ERROR, "sep_a->connect (sep_b) failed\n"), 0); 00868 } 00869 } 00870 } 00871 catch (const CORBA::Exception& ex) 00872 { 00873 ex._tao_print_exception ("TAO_StreamCtrl::bind_devs"); 00874 return 0; 00875 } 00876 return 1; 00877 }
void TAO_StreamCtrl::destroy | ( | const AVStreams::flowSpec & | the_spec | ) | [virtual] |
Tears down the stream. This will close the connection, and delete the streamendpoint and vdev associated with this stream Empty the_spec means apply operation to all flows
Reimplemented from TAO_Basic_StreamCtrl.
Definition at line 511 of file AVStreams_i.cpp.
References CORBA::Exception::_tao_print_exception(), ACE_DEBUG, ACE_Hash_Map_Iterator_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::advance(), TAO_AV_Core::deactivate_servant(), TAO_Basic_StreamCtrl::destroy(), LM_DEBUG, ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::next(), and TAO_debug_level.
00512 { 00513 try 00514 { 00515 TAO_Basic_StreamCtrl::destroy (flow_spec); 00516 if (this->flow_connection_map_.current_size () > 0) 00517 return; 00518 00519 MMDevice_Map_Iterator a_iterator (this->mmdevice_a_map_); 00520 MMDevice_Map::ENTRY *entry = 0; 00521 for (;a_iterator.next (entry)!= 0;a_iterator.advance ()) 00522 { 00523 entry->int_id_.sep_->destroy (flow_spec); 00524 } 00525 MMDevice_Map_Iterator b_iterator (this->mmdevice_b_map_); 00526 for (;b_iterator.next (entry)!= 0;b_iterator.advance ()) 00527 { 00528 entry->int_id_.sep_->destroy (flow_spec); 00529 } 00530 } 00531 catch (const CORBA::Exception& ex) 00532 { 00533 ex._tao_print_exception ("TAO_StreamCtrl::destroy"); 00534 return; 00535 } 00536 00537 int result = TAO_AV_Core::deactivate_servant (this); 00538 if (result < 0) 00539 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_StreamCtrl::destroy failed\n")); 00540 }
AVStreams::VDev_ptr TAO_StreamCtrl::get_related_vdev | ( | AVStreams::MMDevice_ptr | adev, | |
AVStreams::StreamEndPoint_out | sep | |||
) | [virtual] |
Definition at line 1189 of file AVStreams_i.cpp.
References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find(), mmdevice_a_map_, TAO_StreamCtrl::MMDevice_Map_Entry::sep_, and TAO_StreamCtrl::MMDevice_Map_Entry::vdev_.
01191 { 01192 MMDevice_Map_Hash_Key key (adev); 01193 MMDevice_Map_Entry entry; 01194 int result = -1; 01195 result = this->mmdevice_a_map_.find (key, entry); 01196 if (result < 0) 01197 { 01198 result = this->mmdevice_a_map_.find (key, entry); 01199 if (result < 0) 01200 return AVStreams::VDev::_nil (); 01201 } 01202 sep = AVStreams::StreamEndPoint::_duplicate (entry.sep_.in ()); 01203 return AVStreams::VDev::_duplicate (entry.vdev_.in ()); 01204 }
CORBA::Boolean TAO_StreamCtrl::modify_QoS | ( | AVStreams::streamQoS & | new_qos, | |
const AVStreams::flowSpec & | the_spec | |||
) | [virtual] |
Changes the QoS associated with the stream Empty the_spec means apply operation to all flows
Reimplemented from TAO_Basic_StreamCtrl.
Definition at line 1208 of file AVStreams_i.cpp.
References CORBA::Exception::_tao_print_exception(), ACE_DEBUG, LM_DEBUG, CORBA::string_dup(), and TAO_debug_level.
01210 { 01211 if (TAO_debug_level > 0) 01212 ACE_DEBUG ((LM_DEBUG, 01213 "TAO_StreamCtrl::modify_QoS\n")); 01214 01215 01216 if (this->mcastconfigif_ != 0) 01217 { 01218 // call modify_Qos on the root VDev which is the mcast configif. 01219 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "Cannot Modify the Qos for multipoint streams\n")); 01220 } 01221 else 01222 { 01223 try 01224 { 01225 AVStreams::flowSpec in_flowspec; 01226 AVStreams::flowSpec out_flowspec; 01227 01228 in_flowspec.length (0); 01229 out_flowspec.length (0); 01230 01231 int in_index = 0; 01232 int out_index = 0; 01233 01234 AVStreams::flowSpec flowspec; 01235 if (the_spec.length () == 0) 01236 { 01237 // Apply modify_qos to all the flows 01238 flowspec = this->flows_; 01239 MMDevice_Map_Iterator iterator (this->mmdevice_a_map_); 01240 MMDevice_Map::ENTRY *entry = 0; 01241 for (;iterator.next (entry) != 0;iterator.advance ()) 01242 { 01243 flowspec = entry->int_id_.flowspec_; 01244 } 01245 } 01246 else 01247 { 01248 flowspec = the_spec; 01249 } 01250 01251 if (TAO_debug_level > 0) 01252 ACE_DEBUG ((LM_DEBUG, 01253 "TAO_StreamCtrl::modify_QoS\n")); 01254 01255 01256 for (u_int i=0;i < flowspec.length ();i++) 01257 { 01258 TAO_Forward_FlowSpec_Entry entry; 01259 entry.parse (flowspec [i]); 01260 int direction = entry.direction (); 01261 if (direction == 0) 01262 { 01263 in_flowspec.length (in_index + 1); 01264 in_flowspec [in_index++] = CORBA::string_dup (entry.entry_to_string ()); 01265 } 01266 else 01267 { 01268 out_flowspec.length (out_index + 1); 01269 out_flowspec [out_index++] = CORBA::string_dup (entry.entry_to_string ()); 01270 } 01271 } 01272 01273 if (in_flowspec.length () != 0) 01274 { 01275 this->vdev_a_->modify_QoS (new_qos, in_flowspec); 01276 } 01277 01278 if (out_flowspec.length () != 0) 01279 { 01280 this->vdev_b_->modify_QoS (new_qos, out_flowspec); 01281 } 01282 } 01283 catch (const CORBA::Exception& ex) 01284 { 01285 ex._tao_print_exception ("TAO_StreamCtrl::modify_QoS"); 01286 return 0; 01287 } 01288 01289 } 01290 return 1; 01291 }
void TAO_StreamCtrl::start | ( | const AVStreams::flowSpec & | the_spec | ) | [virtual] |
Start the transfer of data in the stream. Empty the_spec means apply operation to all flows
Reimplemented from TAO_Basic_StreamCtrl.
Definition at line 472 of file AVStreams_i.cpp.
References CORBA::Exception::_tao_print_exception(), ACE_Hash_Map_Iterator_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::advance(), ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::next(), printf(), and TAO_Basic_StreamCtrl::start().
00473 { 00474 try 00475 { 00476 TAO_Basic_StreamCtrl::start (flow_spec); 00477 if (this->flow_connection_map_.current_size () > 0) 00478 return; 00479 00480 MMDevice_Map_Iterator a_iterator (this->mmdevice_a_map_); 00481 MMDevice_Map::ENTRY *entry = 0; 00482 for (;a_iterator.next (entry)!= 0;a_iterator.advance ()) 00483 { 00484 entry->int_id_.sep_->start (flow_spec); 00485 } 00486 MMDevice_Map_Iterator b_iterator (this->mmdevice_b_map_); 00487 for (;b_iterator.next (entry)!= 0;b_iterator.advance ()) 00488 { 00489 entry->int_id_.sep_->start (flow_spec); 00490 } 00491 } 00492 catch(AVStreams::noSuchFlow& ex) 00493 { 00494 throw; //ACS mod 2007-08 00495 } 00496 catch (const CORBA::Exception& ex) 00497 { 00498 ex._tao_print_exception ("TAO_StreamCtrl::start"); 00499 throw; //ACS mod 2007-08 00500 } 00501 catch(...) 00502 { 00503 printf ("TAO_StreamCtrl::start - unknow exception\n"); 00504 } 00505 }
void TAO_StreamCtrl::stop | ( | const AVStreams::flowSpec & | the_spec | ) | [virtual] |
Stop the transfer of data of the stream Empty the_spec means apply operation to all flows
Reimplemented from TAO_Basic_StreamCtrl.
Definition at line 435 of file AVStreams_i.cpp.
References CORBA::Exception::_tao_print_exception(), ACE_Hash_Map_Iterator_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::advance(), ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::next(), printf(), and TAO_Basic_StreamCtrl::stop().
00436 { 00437 try 00438 { 00439 TAO_Basic_StreamCtrl::stop (flow_spec); 00440 if (this->flow_connection_map_.current_size () > 0) 00441 return; 00442 MMDevice_Map_Iterator a_iterator (this->mmdevice_a_map_); 00443 MMDevice_Map::ENTRY *entry = 0; 00444 for (;a_iterator.next (entry)!= 0;a_iterator.advance ()) 00445 { 00446 entry->int_id_.sep_->stop (flow_spec); 00447 } 00448 MMDevice_Map_Iterator b_iterator (this->mmdevice_b_map_); 00449 for (;b_iterator.next (entry)!= 0;b_iterator.advance ()) 00450 { 00451 entry->int_id_.sep_->stop (flow_spec); 00452 } 00453 } 00454 catch(AVStreams::noSuchFlow& ex) 00455 { 00456 throw; //ACS mod 2007-08 00457 } 00458 catch (const CORBA::Exception& ex) 00459 { 00460 ex._tao_print_exception ("TAO_StreamCtrl::stop"); 00461 throw; //ACS mod 2007-08 00462 } 00463 catch(...) 00464 { 00465 printf ("TAO_StreamCtrl::stop - unknow exception\n"); 00466 } 00467 }
void TAO_StreamCtrl::unbind | ( | void | ) | [virtual] |
unbind the stream. Same effect as Basic_StreamCtrl::destroy ()
Definition at line 1147 of file AVStreams_i.cpp.
References CORBA::Exception::_tao_print_exception(), ACE_Hash_Map_Iterator_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::advance(), and ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::next().
01148 { 01149 try 01150 { 01151 if (this->flow_connection_map_.current_size () > 0) 01152 return; 01153 01154 AVStreams::flowSpec flow_spec; 01155 flow_spec.length(0); 01156 01157 MMDevice_Map_Iterator a_iterator (this->mmdevice_a_map_); 01158 MMDevice_Map::ENTRY *entry = 0; 01159 for (;a_iterator.next (entry)!= 0;a_iterator.advance ()) 01160 { 01161 entry->int_id_.sep_->destroy (flow_spec); 01162 } 01163 MMDevice_Map_Iterator b_iterator (this->mmdevice_b_map_); 01164 for (;b_iterator.next (entry)!= 0;b_iterator.advance ()) 01165 { 01166 entry->int_id_.sep_->destroy (flow_spec); 01167 } 01168 } 01169 catch (const CORBA::Exception& ex) 01170 { 01171 ex._tao_print_exception ("TAO_StreamCtrl::unbind"); 01172 return; 01173 } 01174 }
void TAO_StreamCtrl::unbind_dev | ( | AVStreams::MMDevice_ptr | dev, | |
const AVStreams::flowSpec & | the_spec | |||
) | [virtual] |
void TAO_StreamCtrl::unbind_party | ( | AVStreams::StreamEndPoint_ptr | the_ep, | |
const AVStreams::flowSpec & | the_spec | |||
) | [virtual] |
Unbind the_ep from the stream. Empty the_spec means apply to all flows.
Definition at line 1177 of file AVStreams_i.cpp.
TAO_MCastConfigIf* TAO_StreamCtrl::mcastconfigif_ [protected] |
AVStreams::MCastConfigIf_var TAO_StreamCtrl::mcastconfigif_ptr_ [protected] |
MMDevice_Map TAO_StreamCtrl::mmdevice_a_map_ [protected] |
MMDevice_Map TAO_StreamCtrl::mmdevice_b_map_ [protected] |
CORBA::ULong TAO_StreamCtrl::source_id_ [protected] |
AVStreams::StreamCtrl_var TAO_StreamCtrl::streamctrl_ [protected] |