Classes | Public Member Functions | Protected Types | Protected Attributes

TAO_StreamCtrl Class Reference

Implementation the A/V StreamCtrl class. this class is used to control the stream. It should be subclassed by applications that want to provide more control features. More...

#include <AVStreams_i.h>

Inheritance diagram for TAO_StreamCtrl:
Inheritance graph
[legend]
Collaboration diagram for TAO_StreamCtrl:
Collaboration graph
[legend]

List of all members.

Classes

struct  MMDevice_Map_Entry

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_MCastConfigIfmcastconfigif_
AVStreams::MCastConfigIf_var mcastconfigif_ptr_
AVStreams::StreamCtrl_var streamctrl_
CORBA::ULong source_id_

Detailed Description

Implementation the A/V StreamCtrl class. this class is used to control the stream. It should be subclassed by applications that want to provide more control features.

Definition at line 194 of file AVStreams_i.h.


Member Typedef Documentation

Definition at line 272 of file AVStreams_i.h.

Definition at line 273 of file AVStreams_i.h.


Constructor & Destructor Documentation

TAO_StreamCtrl::TAO_StreamCtrl ( void   ) 

Default Constructor.

Definition at line 407 of file AVStreams_i.cpp.

  :mcastconfigif_ (0)
{
  try
    {
      this->streamctrl_ = this->_this ();
      char buf [BUFSIZ];
      int result = ACE_OS::hostname (buf, BUFSIZ);
      unsigned long ipaddr = 0;
      if (result == 0)
        ipaddr = ACE_OS::inet_addr (buf);
      this->source_id_ = TAO_AV_RTCP::alloc_srcid (ipaddr);
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("TAO_StreamCtrl::TAO_StreamCtrl");
    }
}

TAO_StreamCtrl::~TAO_StreamCtrl ( void   )  [virtual]

virtual destructor.

Definition at line 426 of file AVStreams_i.cpp.

{
  delete this->mcastconfigif_;
}


Member Function Documentation

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.

{
  this->sep_a_ = AVStreams::StreamEndPoint_A::_duplicate(sep_a);
  this->sep_b_ = AVStreams::StreamEndPoint_B::_duplicate(sep_b);

  int result = 0;
  try
    {
      if (CORBA::is_nil (sep_a_.in() ) ||
          CORBA::is_nil (sep_b_.in() ))
        ACE_ERROR_RETURN ((LM_ERROR,
                           "(%P|%t) TAO_StreamCtrl::bind:"
                           "a_party or b_party null!"),
                          0);

      // Define each other as their peers.
      CORBA::Any sep_any;
      sep_any <<= sep_b;
      sep_a_->define_property ("PeerAdapter",
                              sep_any);
      sep_any <<= sep_a;
      sep_b_->define_property ("PeerAdapter",
                              sep_any);
      // since its full profile we do the viable stream setup algorithm.
      // get the flows for the A streamendpoint.
      // the flows spec is empty and hence we do a exhaustive match.
      AVStreams::flowSpec a_flows, b_flows;
      CORBA::Any_var flows_any;
      flows_any = sep_a_->get_property_value ("Flows");
      AVStreams::flowSpec *temp_flows = 0;
      flows_any.in () >>= temp_flows;
      a_flows = *temp_flows;
      flows_any = sep_b_->get_property_value ("Flows");
      flows_any.in () >>= temp_flows;
      b_flows = *temp_flows;
      u_int i;
      FlowEndPoint_Map *a_fep_map;
      FlowEndPoint_Map *b_fep_map;
      ACE_NEW_RETURN (a_fep_map,
                      FlowEndPoint_Map,
                      0);
      ACE_NEW_RETURN (b_fep_map,
                      FlowEndPoint_Map,
                      0);
      for (i=0;i<a_flows.length ();i++)
        {
          const char *flowname = a_flows[i];
          // get the flowendpoint references.
          CORBA::Object_var fep_obj =
            sep_a_->get_fep (flowname);
          AVStreams::FlowEndPoint_var fep =
            AVStreams::FlowEndPoint::_narrow (fep_obj.in ());
          ACE_CString fep_key (flowname);
          result = a_fep_map->bind (fep_key, fep);
          if (result == -1)
            if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_StreamCtrl::bind failed for %s\n", flowname));
        }
      // get the flowendpoints for streamendpoint_b
      for (i=0;i<b_flows.length ();i++)
        {
          const char *flowname = b_flows[i];
          // get the flowendpoint references.
          CORBA::Object_var fep_obj =
            sep_b->get_fep (flowname);
          AVStreams::FlowEndPoint_var fep =
            AVStreams::FlowEndPoint::_narrow (fep_obj.in ());
          ACE_CString fep_key (flowname);
          result = b_fep_map->bind (fep_key, fep);
          if (result == -1)
            if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_StreamCtrl::bind failed for %s\n", flowname));
        }
      FlowEndPoint_Map *map_a = 0, *map_b = 0;
      if (flow_spec.length () == 0)
        {
          map_a = a_fep_map;
          map_b = b_fep_map;
        }
      else
        {
          FlowEndPoint_Map *spec_fep_map_a, *spec_fep_map_b;
          ACE_NEW_RETURN (spec_fep_map_a,
                          FlowEndPoint_Map,
                          0);
          ACE_NEW_RETURN (spec_fep_map_b,
                          FlowEndPoint_Map,
                          0);
          for (i=0; i< flow_spec.length ();i++)
            {
              TAO_Forward_FlowSpec_Entry *entry = 0;
              ACE_NEW_RETURN (entry,
                              TAO_Forward_FlowSpec_Entry,
                              0);
              entry->parse (flow_spec[i]);
              ACE_CString fep_key (entry->flowname ());
              AVStreams::FlowEndPoint_var fep;
              result = a_fep_map->find (fep_key, fep);
              if (result == -1)
                ACE_ERROR_RETURN ((LM_ERROR, "Fep not found on A side for flowname: %s\n", flow_spec[i].in ()), 0);

              result = spec_fep_map_a->bind (fep_key, fep);
              if (result == -1)
                if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "Bind failed for %s\n", flow_spec[i].in ()));

              result = b_fep_map->find (fep_key, fep);
              if (result == -1)
                ACE_ERROR_RETURN ((LM_ERROR, "Fep not found on B side for flowname: %s\n", flow_spec[i].in ()), 0);

              result = spec_fep_map_b->bind (fep_key, fep);
              if (result == -1)
                if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "Bind failed for %s\n", flow_spec[i].in ()));
            }
          map_a = spec_fep_map_a;
          map_b = spec_fep_map_b;
        }

      TAO_AV_QoS qos (stream_qos);
      // Now go thru the list of flow endpoint and match them.
      // uses the first match policy.
      FlowEndPoint_Map_Iterator a_feps_iterator (*map_a);
      FlowEndPoint_Map_Entry *a_feps_entry, *b_feps_entry;
      try
        {

          for (;a_feps_iterator.next (a_feps_entry) != 0;
               a_feps_iterator.advance ())
            {
              AVStreams::FlowEndPoint_var fep_a = a_feps_entry->int_id_;
              AVStreams::FlowEndPoint_var connected_to =
                fep_a->get_connected_fep ();

              if (!CORBA::is_nil (connected_to.in ()))
                {
                  // Skip this one, it is already connected...
                  continue;
                }

              FlowEndPoint_Map_Iterator b_feps_iterator (*map_b);
              for (;b_feps_iterator.next (b_feps_entry) != 0;
                   b_feps_iterator.advance ())
                {
                  AVStreams::FlowEndPoint_var fep_b = b_feps_entry->int_id_;
                  AVStreams::FlowConnection_var flow_connection;

                  AVStreams::FlowEndPoint_var connected_to =
                    fep_b->get_connected_fep ();

                  if (!CORBA::is_nil (connected_to.in ()))
                    {
                      // Skip this one, it is already connected...
                      continue;
                    }

                  if (fep_a->is_fep_compatible (fep_b.in()) == 1)
                    {
                      // assume that flow names are same so that we
                      // can use either of them.
                      CORBA::Object_var flow_connection_obj;
                      CORBA::Any_var flowname_any =
                        fep_a->get_property_value ("FlowName");
                      const char *flowname = 0;
                      flowname_any.in () >>= flowname;
                      try
                        {
                          flow_connection_obj =
                            this->get_flow_connection (flowname);
                          flow_connection =
                            AVStreams::FlowConnection::_narrow (flow_connection_obj.in ());
                        }
                      catch (const CORBA::Exception&)
                        {
                          TAO_FlowConnection *flowConnection;
                          ACE_NEW_RETURN (flowConnection,
                                          TAO_FlowConnection,
                                          0);
                          flow_connection = flowConnection->_this ();
                          this->set_flow_connection (flowname,
                                                     flow_connection.in ());
                        }

                      // make sure that a_feps is flow_producer
                      // and b_feps is flow_consumer
                      // There should be a way to find which flow
                      // endpoint is producer and which is
                      // consumer.

                      AVStreams::FlowProducer_var producer;
                      AVStreams::FlowConsumer_var consumer;

                      try
                        {
                          producer =
                            AVStreams::FlowProducer::_narrow (fep_a.in());
                          consumer =
                            AVStreams::FlowConsumer::_narrow (fep_b.in());

                          // If the types don't match then try in
                          // the opposite order
                          if (CORBA::is_nil (producer.in ()))
                            {
                              producer =
                                AVStreams::FlowProducer::_narrow (fep_b.in());
                              consumer =
                                AVStreams::FlowConsumer::_narrow (fep_a.in());
                            }
                          // At this point they should both be
                          // non-nil
                          // @@ raise an exception (which one?) if
                          // this is not true...
                          ACE_ASSERT (!CORBA::is_nil (producer.in ()));
                          ACE_ASSERT (!CORBA::is_nil (consumer.in ()));
                        }
                      catch (const CORBA::Exception&)
                        {
                          //Yamuna : Recheck this
                          throw;//_EX (producer_check);
                        }
                      CORBA::String_var fep_a_name, fep_b_name;
                      flowname_any = fep_a->get_property_value ("FlowName");
                      const char *temp_name = 0;
                      flowname_any.in () >>= temp_name;
                      fep_a_name = CORBA::string_dup (temp_name);
                      flowname_any = fep_b->get_property_value ("FlowName");
                      flowname_any.in () >>= temp_name;
                      fep_b_name = CORBA::string_dup (temp_name);
                      AVStreams::QoS flow_qos;
                      flow_qos.QoSType = fep_a_name;
                      flow_qos.QoSParams.length (0);
                      result = qos.get_flow_qos (fep_a_name.in (), flow_qos);
                      if (result == -1)
                        {
                          flow_qos.QoSType = fep_b_name;
                          result = qos.get_flow_qos (fep_b_name.in (),
                                                     flow_qos);
                          if (result == -1 && TAO_debug_level > 0)
                            ACE_DEBUG ((LM_DEBUG,
                                        "No QoS Specified for this flow <%s>\n", flowname));
                        }
                      flow_connection->connect (producer.in (),
                                                consumer.in (),
                                                flow_qos);
                    }
                }
            }
        }
      catch (const CORBA::Exception& ex)
        {
          ex._tao_print_exception ("TAO_StreamCtrl::bind:flow_connect block");
          return 0;
        }
    }
  catch (const CORBA::Exception&)
    {
      // error was thrown because one of the streamendpoints is light profile.
      // Now connect the streams together
      this->sep_a_->connect (this->sep_b_.in (),
                             stream_qos,
                             flow_spec);
    }
  return 1;
}

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.

{
  try
    {
      if (CORBA::is_nil (a_party) && CORBA::is_nil (b_party))
        ACE_ERROR_RETURN ((LM_ERROR, "Both parties are nil\n"), 0);
      // Check to see if we have non-nil parties to bind!
      if (TAO_debug_level > 0)
        if (CORBA::is_nil (a_party) ||
            CORBA::is_nil (b_party))
          if (TAO_debug_level > 0)
            ACE_DEBUG ((LM_DEBUG,
                        "(%P|%t) TAO_StreamCtrl::bind_devs: "
                        "a_party or b_party is null"
                        "Multicast mode\n"));

      // Request a_party to create the endpoint and vdev
      CORBA::Boolean met_qos;
      CORBA::String_var named_vdev;

      if (!CORBA::is_nil (a_party))
        {
          MMDevice_Map_Hash_Key find_key (a_party);
          MMDevice_Map_Entry find_entry;
          int result =
            this->mmdevice_a_map_.find (find_key, find_entry);
          if (result == 0)
            {
              if (TAO_debug_level > 0)
                {
                  // Already in the map.
                  if (TAO_debug_level > 0)
                    ACE_DEBUG ((LM_DEBUG, "mmdevice a_party is already bound\n"));
                }
              return 1;
            }
          else
            {
              this->sep_a_ =
                a_party-> create_A (this->streamctrl_.in (),
                                    this->vdev_a_.out (),
                                    the_qos,
                                    met_qos,
                                    named_vdev.inout (),
                                    the_flows);

              if (TAO_debug_level > 0)
                ACE_DEBUG ((LM_DEBUG, "(%P|%t) TAO_StreamCtrl::create_A: succeeded\n"));
              // Define ourselves as the related_streamctrl property of the sep.
              CORBA::Any streamctrl_any;
              streamctrl_any <<= this->streamctrl_.in ();
              this->sep_a_->define_property ("Related_StreamCtrl",
                                             streamctrl_any);

              CORBA::Any vdev_a_any;
              vdev_a_any <<= this->vdev_a_.in ();
              this->sep_a_->define_property ("Related_VDev",
                                             vdev_a_any);

              CORBA::Any streamendpoint_a_any;
              streamendpoint_a_any <<= this->sep_a_.in ();
              this->vdev_a_->define_property ("Related_StreamEndpoint",
                                              streamendpoint_a_any);


              CORBA::Any mmdevice_a_any;
              mmdevice_a_any <<= a_party;
              this->vdev_a_->define_property ("Related_MMDevice",
                                              mmdevice_a_any);

              // add the mmdevice, sep and vdev to the map.
              MMDevice_Map_Entry map_entry;
              MMDevice_Map_Hash_Key key (a_party);
              map_entry.sep_ = AVStreams::StreamEndPoint_A::_duplicate (this->sep_a_.in ());
              map_entry.vdev_ = AVStreams::VDev::_duplicate (this->vdev_a_.in ());
              map_entry.flowspec_ = the_flows;
              map_entry.qos_ = the_qos;
              result =
                this->mmdevice_a_map_.bind (key, map_entry);
              if (result < 0)
                if (TAO_debug_level > 0)
                  ACE_DEBUG ((LM_DEBUG, "Error binding mmdevice entry in the a_map"));
            }
        }
      // Request b_party to create the endpoint and vdev
      if (!CORBA::is_nil (b_party))
        {
          MMDevice_Map_Hash_Key find_key (b_party);
          MMDevice_Map_Entry find_entry;
          int result =
            this->mmdevice_b_map_.find (find_key, find_entry);
          if (result == 0)
            {
              // Already in the map.
              if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "mmdevice b_party is already bound\n"));
              return 1;
            }
          else
            {
              this->sep_b_ =
                b_party-> create_B (this->streamctrl_.in (),
                                    this->vdev_b_.out (),
                                    the_qos,
                                    met_qos,
                                    named_vdev.inout (),
                                    the_flows);

              if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "(%P|%t) TAO_StreamCtrl::create_B: succeeded\n"));

              if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,
                          "\n(%P|%t)stream_endpoint_b_ = %s",
                          TAO_ORB_Core_instance ()->orb ()->object_to_string (this->sep_b_.in ())));
              // Define ourselves as the related_streamctrl property of the sep.
              CORBA::Any streamctrl_any;
              streamctrl_any <<= this->streamctrl_.in ();
              this->sep_b_->define_property ("Related_StreamCtrl",
                                             streamctrl_any);

              CORBA::Any vdev_b_any;
              vdev_b_any <<= this->vdev_b_.in ();
              this->sep_b_->define_property ("Related_VDev",
                                             vdev_b_any);

              CORBA::Any streamendpoint_b_any;
              streamendpoint_b_any <<= this->sep_b_.in ();
              this->vdev_b_->define_property ("Related_StreamEndpoint",
                                              streamendpoint_b_any);


              CORBA::Any mmdevice_b_any;
              mmdevice_b_any <<= b_party;
              this->vdev_b_->define_property ("Related_MMDevice",
                                              mmdevice_b_any);
              // add the mmdevice, sep and vdev to the map.
              MMDevice_Map_Entry map_entry;
              MMDevice_Map_Hash_Key key (b_party);
              map_entry.sep_ = AVStreams::StreamEndPoint::_duplicate (this->sep_b_.in ());
              map_entry.vdev_ = AVStreams::VDev::_duplicate(this->vdev_b_.in ());
              map_entry.flowspec_ = the_flows;
              map_entry.qos_ = the_qos;
              int result =
                this->mmdevice_b_map_.bind (key, map_entry);
              if (result < 0)
                if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "Error binding mmdevice entry in the b_map"));
            }
        }

      // Tell the endpoints about each other.
      if ((!CORBA::is_nil (a_party)) && (!CORBA::is_nil (b_party)))
        {
          CORBA::Any sep_a_peer_any;
          CORBA::Any sep_b_peer_any;

          sep_a_peer_any <<= this->sep_b_.in();
          sep_b_peer_any <<= this->sep_a_.in();
          this->sep_a_->define_property ("PeerAdapter",
                                          sep_a_peer_any);

          this->sep_b_->define_property ("PeerAdapter",
                                         sep_b_peer_any);
        }

      // In the full profile case there's no VDev.
      if (CORBA::is_nil (b_party) && (!CORBA::is_nil (this->vdev_a_.in ())))
        {
          // Now set the source id for this A endpoint.
          // If the sep contains flow producers then set the source ids for those
          // instead.
          try
            {
              CORBA::Any_ptr flows_any = this->sep_a_->get_property_value ("Flows");
              AVStreams::flowSpec_var flows;
              *flows_any >>= flows.out ();
              for (CORBA::ULong i=0; i< flows->length ();++i)
                {
                  CORBA::Object_var fep_obj =
                    this->sep_a_->get_fep (flows [i]);
                  try
                    {
                      AVStreams::FlowProducer_var producer =
                        AVStreams::FlowProducer::_narrow (fep_obj.in ());
                      producer->set_source_id (this->source_id_++);
                    }
                  catch (const CORBA::Exception& ex)
                    {
                      if (TAO_debug_level > 0)
                        ACE_DEBUG ((LM_DEBUG, " %s ", static_cast<char const*>(flows[i])));

                      ex._tao_print_exception (
                        "producer_check: not a producer");

                    }
                }
            }
          catch (const CORBA::Exception&)
            {
              // Since the full profile failed try setting the source id
              // for the sep instead.
              // @@Naga: What do we do if in the light profile the sep has
              // many producers who do not have flow interfaces. Then
              // the streamctrl has to give an array of source ids to
              // the sep.
              this->sep_a_->set_source_id (this->source_id_++);
            }
          if (!this->mcastconfigif_)
            {
              ACE_NEW_RETURN (this->mcastconfigif_,
                              TAO_MCastConfigIf,
                              0);
              // @@: Deactivating the object thru poa means calling remove_ref after _this.
              this->mcastconfigif_ptr_ = this->mcastconfigif_->_this ();
            }
          // Multicast source being added.
          CORBA::Boolean result = this->vdev_a_->set_Mcast_peer (this->streamctrl_.in (),
                                                                 this->mcastconfigif_ptr_.in (),
                                                                 the_qos,
                                                                 the_flows);
          if (!result)
            ACE_ERROR_RETURN ((LM_ERROR, "set_Mcast_peer failed\n"), 0);
        }

      if (CORBA::is_nil (a_party))
        {
          if (!CORBA::is_nil (this->vdev_b_.in ()))
            {
              // Multicast sink being added.
              if (!this->mcastconfigif_)
                ACE_ERROR_RETURN ((LM_ERROR, "first add a source and then a sink\n"), 0);
              this->mcastconfigif_->set_peer (this->vdev_b_.in (),
                                              the_qos,
                                              the_flows);
            }

          int connect_leaf_success = 0;
          try
            {
              // @@: define null interfaces for Atm so that they can be implemented once
              //  ACE adds support for ATM multicast.
              connect_leaf_success = this->sep_a_->connect_leaf (this->sep_b_.in (),
                                                                 the_qos,
                                                                 the_flows);
              connect_leaf_success = 1;
            }
          catch (const AVStreams::notSupported&)
            {
              if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "connect_leaf failed\n"));
              connect_leaf_success = 0;
            }
          catch (const CORBA::Exception& ex)
            {
              ex._tao_print_exception (
                "TAO_StreamCtrl::bind_devs");
            }
          if (!connect_leaf_success)
            {
              if (TAO_debug_level > 0)
                ACE_DEBUG ((LM_DEBUG,"TAO_StreamCtrl::bind_devs Multiconnect\n"));
              AVStreams::flowSpec connect_flows = the_flows;
              this->sep_a_->multiconnect (the_qos, connect_flows);
              this->sep_b_->multiconnect (the_qos, connect_flows);
            }
        }

      if (!CORBA::is_nil (a_party) && !CORBA::is_nil (b_party))
        {
          // Check to see if the MMDevice contains FDev objects
          // If it contains FDev objects, then we are using the
          // Full profile, and we want to call bind() instead
          // of connect() on the the streamctrl
          if( a_party->is_property_defined("Flows") &&
              b_party->is_property_defined("Flows") )
          {
              if (TAO_debug_level > 0) {
                //FUZZ: disable check_for_lack_ACE_OS
                ACE_DEBUG ((LM_DEBUG, "(%N,%l) Full profile, invoking bind()\n"));
                //FUZZ: enable check_for_lack_ACE_OS
              }

              // It is full profile
              // we have feps in the sep then dont call connect
              // instead call bind on the streamctrl.
              this->bind (this->sep_a_.in (),
                          this->sep_b_.in (),
                          the_qos,
                          the_flows);



          }
          // This is the light profile, call connect()
          else  if (!CORBA::is_nil (this->vdev_a_.in ()) && !CORBA::is_nil (this->vdev_b_.in ()))
          {
              if (TAO_debug_level > 0) {
                //FUZZ: disable check_for_lack_ACE_OS
                ACE_DEBUG ((LM_DEBUG, "(%N,%l) Light profile, invoking connect()\n"));
                //FUZZ: enable check_for_lack_ACE_OS
              }

              // Tell the 2 VDev's about one another
              this->vdev_a_->set_peer (this->streamctrl_.in (),
                                       this->vdev_b_.in (),
                                       the_qos,
                                       the_flows);

              this->vdev_b_->set_peer (this->streamctrl_.in (),
                                       this->vdev_a_.in (),
                                       the_qos,
                                       the_flows);


              // Now connect the streams together. This will
              // establish the connection
              CORBA::Boolean result  =
                this->sep_a_->connect (this->sep_b_.in (),
                                       the_qos,
                                       the_flows);
              if (result == 0)
                ACE_ERROR_RETURN ((LM_ERROR, "sep_a->connect (sep_b) failed\n"), 0);
          }
        }
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("TAO_StreamCtrl::bind_devs");
      return 0;
    }
  return 1;
}

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.

{
  try
    {
      TAO_Basic_StreamCtrl::destroy (flow_spec);
      if (this->flow_connection_map_.current_size () > 0)
        return;

      MMDevice_Map_Iterator a_iterator (this->mmdevice_a_map_);
      MMDevice_Map::ENTRY *entry = 0;
      for (;a_iterator.next (entry)!= 0;a_iterator.advance ())
        {
          entry->int_id_.sep_->destroy (flow_spec);
        }
      MMDevice_Map_Iterator b_iterator (this->mmdevice_b_map_);
      for (;b_iterator.next (entry)!= 0;b_iterator.advance ())
        {
          entry->int_id_.sep_->destroy (flow_spec);
        }
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("TAO_StreamCtrl::destroy");
      return;
    }

  int result = TAO_AV_Core::deactivate_servant (this);
  if (result < 0)
    if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_StreamCtrl::destroy failed\n"));
}

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.

{
  MMDevice_Map_Hash_Key key (adev);
  MMDevice_Map_Entry entry;
  int result = -1;
  result = this->mmdevice_a_map_.find (key, entry);
  if (result < 0)
    {
      result = this->mmdevice_a_map_.find (key, entry);
      if (result < 0)
        return AVStreams::VDev::_nil ();
    }
  sep = AVStreams::StreamEndPoint::_duplicate (entry.sep_.in ());
  return AVStreams::VDev::_duplicate (entry.vdev_.in ());
}

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.

{
  if (TAO_debug_level > 0)
  ACE_DEBUG ((LM_DEBUG,
              "TAO_StreamCtrl::modify_QoS\n"));


  if (this->mcastconfigif_ != 0)
    {
      // call modify_Qos on the root VDev which is the mcast configif.
      if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "Cannot Modify the Qos for multipoint streams\n"));
    }
  else
    {
      try
        {
          AVStreams::flowSpec in_flowspec;
          AVStreams::flowSpec out_flowspec;

          in_flowspec.length (0);
          out_flowspec.length (0);

          int in_index = 0;
          int out_index = 0;

          AVStreams::flowSpec flowspec;
          if (the_spec.length () == 0)
            {
              // Apply modify_qos to all the flows
              flowspec = this->flows_;
              MMDevice_Map_Iterator iterator (this->mmdevice_a_map_);
              MMDevice_Map::ENTRY *entry = 0;
              for (;iterator.next (entry) !=  0;iterator.advance ())
                {
                  flowspec = entry->int_id_.flowspec_;
                }
            }
          else
            {
              flowspec = the_spec;
            }

          if (TAO_debug_level > 0)
            ACE_DEBUG ((LM_DEBUG,
                        "TAO_StreamCtrl::modify_QoS\n"));


          for (u_int i=0;i < flowspec.length ();i++)
            {
              TAO_Forward_FlowSpec_Entry entry;
              entry.parse (flowspec [i]);
              int direction = entry.direction ();
              if (direction == 0)
                {
                  in_flowspec.length (in_index + 1);
                  in_flowspec [in_index++] = CORBA::string_dup (entry.entry_to_string ());
                }
              else
                {
                  out_flowspec.length (out_index + 1);
                  out_flowspec [out_index++] = CORBA::string_dup (entry.entry_to_string ());
                }
            }

          if (in_flowspec.length () != 0)
            {
              this->vdev_a_->modify_QoS (new_qos, in_flowspec);
            }

          if (out_flowspec.length () != 0)
            {
              this->vdev_b_->modify_QoS (new_qos, out_flowspec);
            }
        }
      catch (const CORBA::Exception& ex)
        {
          ex._tao_print_exception ("TAO_StreamCtrl::modify_QoS");
          return 0;
        }

    }
  return 1;
}

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.

{
  try
    {
      TAO_Basic_StreamCtrl::start (flow_spec);
      if (this->flow_connection_map_.current_size () > 0)
        return;

      MMDevice_Map_Iterator a_iterator (this->mmdevice_a_map_);
      MMDevice_Map::ENTRY *entry = 0;
      for (;a_iterator.next (entry)!= 0;a_iterator.advance ())
        {
          entry->int_id_.sep_->start (flow_spec);
        }
      MMDevice_Map_Iterator b_iterator (this->mmdevice_b_map_);
      for (;b_iterator.next (entry)!= 0;b_iterator.advance ())
        {
          entry->int_id_.sep_->start (flow_spec);
        }
    }
  catch (const AVStreams::noSuchFlow&)
    {
      throw; 
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("TAO_StreamCtrl::start");
      throw; 
    }
  catch(...)
    {
      printf ("TAO_StreamCtrl::start - unknow exception\n");
    }
}

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.

{
  try
    {
      TAO_Basic_StreamCtrl::stop (flow_spec);
      if (this->flow_connection_map_.current_size () > 0)
        return;
      MMDevice_Map_Iterator a_iterator (this->mmdevice_a_map_);
      MMDevice_Map::ENTRY *entry = 0;
      for (;a_iterator.next (entry)!= 0;a_iterator.advance ())
        {
          entry->int_id_.sep_->stop (flow_spec);
        }
      MMDevice_Map_Iterator b_iterator (this->mmdevice_b_map_);
      for (;b_iterator.next (entry)!= 0;b_iterator.advance ())
        {
          entry->int_id_.sep_->stop (flow_spec);
        }
    }
  catch (const AVStreams::noSuchFlow&)
    {
      throw; 
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("TAO_StreamCtrl::stop");
      throw; 
    }
  catch(...)
    {
      printf ("TAO_StreamCtrl::stop - unknow exception\n");
    }
}

void TAO_StreamCtrl::unbind ( void   )  [virtual]

unbind the stream. Same effect as Basic_StreamCtrl::destroy ()

Definition at line 1147 of file AVStreams_i.cpp.

{
  try
    {
      if (this->flow_connection_map_.current_size () > 0)
        return;

      AVStreams::flowSpec flow_spec;
      flow_spec.length(0);

      MMDevice_Map_Iterator a_iterator (this->mmdevice_a_map_);
      MMDevice_Map::ENTRY *entry = 0;
      for (;a_iterator.next (entry)!= 0;a_iterator.advance ())
        {
          entry->int_id_.sep_->destroy (flow_spec);
        }
      MMDevice_Map_Iterator b_iterator (this->mmdevice_b_map_);
      for (;b_iterator.next (entry)!= 0;b_iterator.advance ())
        {
          entry->int_id_.sep_->destroy (flow_spec);
        }
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("TAO_StreamCtrl::unbind");
      return;
    }
}

void TAO_StreamCtrl::unbind_dev ( AVStreams::MMDevice_ptr  dev,
const AVStreams::flowSpec the_spec 
) [virtual]

Definition at line 1183 of file AVStreams_i.cpp.

{
}

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.

{
}


Member Data Documentation

Definition at line 277 of file AVStreams_i.h.

AVStreams::MCastConfigIf_var TAO_StreamCtrl::mcastconfigif_ptr_ [protected]

Definition at line 278 of file AVStreams_i.h.

Definition at line 275 of file AVStreams_i.h.

Definition at line 276 of file AVStreams_i.h.

Definition at line 280 of file AVStreams_i.h.

AVStreams::StreamCtrl_var TAO_StreamCtrl::streamctrl_ [protected]

Definition at line 279 of file AVStreams_i.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines