📄 avstreams_i.cpp
字号:
// AVStreams_i.cpp,v 5.123 2003/11/04 05:21:31 dhinton Exp
// ============================================================================
//
// = LIBRARY
// cos
//
// = FILENAME
// AVStreams_i.cpp
//
// = AUTHOR
// Sumedh Mungee <sumedh@cs.wustl.edu>
// Nagarajan Surendran <naga@cs.wustl.edu>
//
// ============================================================================
#include "AVStreams_i.h"
#include "sfp.h"
#include "MCast.h"
#include "RTCP.h"
#include "tao/debug.h"
#include "tao/ORB_Core.h"
#include "tao/Any.h"
#include "ace/OS_NS_arpa_inet.h"
#if !defined (__ACE_INLINE__)
#include "AVStreams_i.i"
#endif /* __ACE_INLINE__ */
ACE_RCSID (AV,
AVStreams_i,
"AVStreams_i.cpp,v 5.123 2003/11/04 05:21:31 dhinton Exp")
//------------------------------------------------------------
// TAO_AV_Qos
//------------------------------------------------------------
TAO_AV_QoS::TAO_AV_QoS (void)
{
}
TAO_AV_QoS::TAO_AV_QoS (AVStreams::streamQoS &stream_qos)
{
this->set (stream_qos);
}
int
TAO_AV_QoS::convert (AVStreams::streamQoS &/*network_qos*/)
{
return -1;
}
// ----------------------------------------------------------------------
// AV_Null_MediaCtrl
// ----------------------------------------------------------------------
AV_Null_MediaCtrl::AV_Null_MediaCtrl (void)
{
}
// ----------------------------------------------------------------------
// TAO_Basic_StreamCtrl
// ----------------------------------------------------------------------
// Constructor
TAO_Basic_StreamCtrl::TAO_Basic_StreamCtrl (void)
:flow_count_ (0)
{
}
// Stop the transfer of data of the stream
// Empty the_spec means apply operation to all flows
void
TAO_Basic_StreamCtrl::stop (const AVStreams::flowSpec &flow_spec
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
AVStreams::noSuchFlow))
{
ACE_TRY
{
// @@Call stop on the Related MediaCtrl. call stop on the flow
// connections.
if (this->flow_connection_map_.current_size () > 0)
{
if (flow_spec.length () > 0)
for (u_int i=0;i<flow_spec.length ();i++)
{
char *flowname = TAO_AV_Core::get_flowname (flow_spec[i]);
ACE_CString flow_name_key (flowname);
AVStreams::FlowConnection_var flow_connection_entry;
if (this->flow_connection_map_.find (flow_name_key,
flow_connection_entry) == 0)
{
flow_connection_entry->stop (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
}
}
else
{
// call stop on all the flows.
FlowConnection_Map_Iterator iterator (this->flow_connection_map_);
FlowConnection_Map_Entry *entry;
for (;iterator.next (entry) != 0;iterator.advance ())
{
entry->int_id_->stop (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
}
}
}
}
ACE_CATCHANY
{
ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "TAO_Basic_StreamCtrl::stop");
return;
}
ACE_ENDTRY;
ACE_CHECK;
}
// Start the transfer of data in the stream.
// Empty the_spec means apply operation to all flows
void
TAO_Basic_StreamCtrl::start (const AVStreams::flowSpec &flow_spec
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
AVStreams::noSuchFlow))
{
ACE_TRY
{
// @@Call start on the Related MediaCtrl.
// call start on the flow connections.
if (this->flow_connection_map_.current_size () > 0)
{
if (flow_spec.length () > 0)
for (u_int i = 0; i < flow_spec.length (); i++)
{
char *flowname = TAO_AV_Core::get_flowname (flow_spec[i]);
ACE_CString flow_name_key (flowname);
FlowConnection_Map::ENTRY *flow_connection_entry = 0;
if (this->flow_connection_map_.find (flow_name_key,
flow_connection_entry) == 0)
{
flow_connection_entry->int_id_->start (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
}
}
else
{
// call start on all the flows.
FlowConnection_Map_Iterator iterator (this->flow_connection_map_);
FlowConnection_Map_Entry *entry = 0;
for (;iterator.next (entry) != 0;iterator.advance ())
{
entry->int_id_->start (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
}
}
}
}
ACE_CATCHANY
{
ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "TAO_Basic_StreamCtrl::start");
return;
}
ACE_ENDTRY;
ACE_CHECK;
}
// 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
void
TAO_Basic_StreamCtrl::destroy (const AVStreams::flowSpec &flow_spec
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
AVStreams::noSuchFlow))
{
ACE_TRY
{
// call stop on the flow connections.
if (this->flow_connection_map_.current_size () > 0)
{
if (flow_spec.length () > 0)
{
for (u_int i=0;i<flow_spec.length ();i++)
{
char *flowname = TAO_AV_Core::get_flowname (flow_spec[i]);
ACE_CString flow_name_key (flowname);
FlowConnection_Map::ENTRY *flow_connection_entry = 0;
if (this->flow_connection_map_.find (flow_name_key, flow_connection_entry) == 0)
{
flow_connection_entry->int_id_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
}
}
}
else
{
// call destroy on all the flows.
FlowConnection_Map_Iterator iterator (this->flow_connection_map_);
FlowConnection_Map_Entry *entry = 0;
for (;iterator.next (entry) != 0;iterator.advance ())
{
entry->int_id_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
}
}
}
}
ACE_CATCHANY
{
ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "TAO_Basic_StreamCtrl::destroy");
return;
}
ACE_ENDTRY;
ACE_CHECK;
}
// Changes the QoS associated with the stream
// Empty the_spec means apply operation to all flows
CORBA::Boolean
TAO_Basic_StreamCtrl::modify_QoS (AVStreams::streamQoS & /*new_qos*/,
const AVStreams::flowSpec &/*flowspec*/
ACE_ENV_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException,
AVStreams::noSuchFlow,
AVStreams::QoSRequestFailed))
{
return 1;
}
// Used by StreamEndPoint and VDev to inform StreamCtrl of events.
// E.g., loss of flow, reestablishment of flow, etc..
void
TAO_Basic_StreamCtrl::push_event (const struct CosPropertyService::Property &/*the_event*/
ACE_ENV_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG, "\n(%P|%t) Recieved event \""));
}
// Sets the flow protocol status.
void
TAO_Basic_StreamCtrl::set_FPStatus (const AVStreams::flowSpec &flow_spec,
const char *fp_name,
const CORBA::Any &fp_settings
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
AVStreams::noSuchFlow,
AVStreams::FPError))
{
if (!CORBA::is_nil (this->sep_a_.in ()))
{
this->sep_a_->set_FPStatus (flow_spec, fp_name, fp_settings ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
}
}
// Gets the flow connection.
CORBA::Object_ptr
TAO_Basic_StreamCtrl::get_flow_connection (const char *flow_name
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
AVStreams::noSuchFlow,
AVStreams::notSupported))
{
ACE_CString flow_name_key (flow_name);
AVStreams::FlowConnection_var flow_connection_entry;
if (this->flow_connection_map_.find (flow_name_key, flow_connection_entry) == 0){
return flow_connection_entry._retn();
}
else{
if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "(%N,%l) Cannot find flow: %s\n", flow_name ));
ACE_THROW_RETURN (AVStreams::noSuchFlow (), CORBA::Object::_nil ());
}
}
// Sets the flow connection.
void
TAO_Basic_StreamCtrl::set_flow_connection (const char *flow_name,
CORBA::Object_ptr flow_connection_obj
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
AVStreams::noSuchFlow,
AVStreams::notSupported))
{
AVStreams::FlowConnection_var flow_connection;
ACE_TRY
{
flow_connection = AVStreams::FlowConnection::_narrow (flow_connection_obj ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
}
ACE_CATCHANY
{
ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "TAO_Basic_StreamCtrl::set_flow_connection");
return;
}
ACE_ENDTRY;
ACE_CHECK;
// add the flowname and the flowconnection to the hashtable.
this->flows_.length (this->flow_count_ + 1);
this->flows_ [this->flow_count_++] = CORBA::string_dup (flow_name);
ACE_CString flow_name_key (flow_name);
if (this->flow_connection_map_.bind (flow_name_key, flow_connection) != 0)
{
if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "(%N,%l) Cannot find flow: %s\n", flow_name ));
ACE_THROW (AVStreams::noSuchFlow ());// is this right?
}
}
TAO_Basic_StreamCtrl::~TAO_Basic_StreamCtrl (void)
{
}
// ----------------------------------------------------------------------
// TAO_Negotiator
// ----------------------------------------------------------------------
CORBA::Boolean
TAO_Negotiator::negotiate (AVStreams::Negotiator_ptr /* remote_negotiator */,
const AVStreams::streamQoS &/* qos_spec */
ACE_ENV_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
ACE_DEBUG ((LM_DEBUG,
"TAO_Negotiator::negotiate\n"));
return 0;
}
// ----------------------------------------------------------------------
// MMDevice_Map_Hash_Key
// ----------------------------------------------------------------------
const int MMDevice_Map_Hash_Key::hash_maximum_ = 10000;
//default constructor.
MMDevice_Map_Hash_Key::MMDevice_Map_Hash_Key (void)
{
this->mmdevice_ = AVStreams::MMDevice::_nil ();
}
// constructor.
MMDevice_Map_Hash_Key::MMDevice_Map_Hash_Key (AVStreams::MMDevice_ptr mmdevice)
{
this->mmdevice_ = AVStreams::MMDevice::_duplicate (mmdevice);
}
// copy constructor.
MMDevice_Map_Hash_Key::MMDevice_Map_Hash_Key (const MMDevice_Map_Hash_Key& hash_key)
{
this->mmdevice_ = AVStreams::MMDevice::_duplicate (hash_key.mmdevice_);
}
// destructor.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -