3 //=============================================================================
7 * This application receives data from a AV sender and writes it to
10 * @author Yamuna Krishnamurthy <yamuna@cs.wustl.edu>
12 //=============================================================================
15 #include "Connection_Manager.h"
16 #include "orbsvcs/AV/AVStreams_i.h"
17 #include "orbsvcs/AV/Endpoint_Strategy.h"
18 #include "orbsvcs/AV/Policy.h"
21 * @class Signal_Handler
23 * This class Handles the SIGINT signal through the Reactor.
24 * Useful to gracefully release the process
26 class Signal_Handler
: public ACE_Event_Handler
31 /// Override this method to implement graceful shutdown.
32 int handle_signal(int signum
, siginfo_t
*,ucontext_t
*);
36 * @class Receiver_Callback
38 * @brief Application defined callback object.
40 * AVStreams calls this class when data shows up from a sender.
42 class Receiver_Callback
: public TAO_AV_Callback
48 /// Method that is called when there is data to be received from a
50 int receive_frame (ACE_Message_Block
*frame
,
51 TAO_AV_frame_info
*frame_info
,
52 const ACE_Addr
&peer_address
);
54 int handle_destroy ();
56 /// Accessor methods for the flowname of the callback.
57 ACE_CString
&flowname ();
58 void flowname (const ACE_CString
&flowname
);
61 //// Keeping a count of the incoming frames.
64 //// Flowname of the flow.
65 ACE_CString flowname_
;
69 * @class Receiver_StreamEndPoint
71 * @brief Application defined stream endpoint object.
73 * AVStreams calls this class during connection setup.
75 class Receiver_StreamEndPoint
: public TAO_Server_StreamEndPoint
78 /// Create a receiver application callback.
79 int get_callback (const char *flowname
,
80 TAO_AV_Callback
*&callback
);
82 //// Called when a distributor tries to connect to the receiver
83 virtual CORBA::Boolean
handle_connection_requested (AVStreams::flowSpec
&the_spec
);
86 //// Receiver application callback.
87 Receiver_Callback callback_
;
93 * @brief Receiver application class.
95 * This class receives data from a AV sender and writes it to
105 virtual ~Receiver ();
107 //// Initialize data components.
112 int parse_args (int argc
,
115 //// Name of the output file.
116 ACE_CString
output_file_name ();
118 ACE_CString
sender_name ();
119 ACE_CString
receiver_name ();
124 //// Connection manager.
125 Connection_Manager connection_manager_
;
127 //// The endpoint reactive strategy.
128 TAO_AV_Endpoint_Reactive_Strategy_B
129 <Receiver_StreamEndPoint
,TAO_VDev
,AV_Null_MediaCtrl
> reactive_strategy_
;
131 //// The receiver MMDevice.
132 AVStreams::MMDevice_var mmdevice_obj_
;
134 //// Receiver MMDevice.
135 TAO_MMDevice
*mmdevice_
;
137 //// The sender MMDevice
138 AVStreams::MMDevice_var sender_mmdevice_
;
140 //// File name of the file into which received data is written.
141 ACE_CString output_file_name_
;
144 ACE_CString sender_name_
;
147 ACE_CString receiver_name_
;
149 //// Reference to the signal handler.
150 Signal_Handler signal_handler_
;