3 //=============================================================================
7 * This application reads data from a file and sends it to s
10 * @author Yamuna Krishnamurthy <yamuna@cs.wustl.edu>
12 //=============================================================================
15 #include "orbsvcs/Naming/Naming_Client.h"
16 #include "orbsvcs/AV/AVStreams_i.h"
17 #include "orbsvcs/AV/Endpoint_Strategy.h"
18 #include "orbsvcs/AV/Protocol_Factory.h"
21 * @class Sender_Callback
23 * @brief Application defined callback object.
25 * AVStreams calls this class when data shows up from a sender.
27 class Sender_Callback
: public TAO_AV_Callback
33 // Method that is called when there is data to be received from a
35 int receive_frame (ACE_Message_Block
*frame
,
36 TAO_AV_frame_info
*frame_info
,
37 const ACE_Addr
&peer_address
);
39 // Called when the sender is done sending data and wants to close
40 // down the connection.
41 // int handle_destroy ();
44 /// Keeping a count of the incoming frames.
49 * @class Sender_StreamEndPoint
51 * @brief Defines a sender stream endpoint.
53 class Sender_StreamEndPoint
: public TAO_Client_StreamEndPoint
56 /// Create the application callback and return its handle to
57 /// AVStreams for further application callbacks.
58 int get_callback (const char *flowname
,
59 TAO_AV_Callback
*&callback
);
61 /// Set protocol object corresponding to the transport protocol
63 int set_protocol_object (const char *flowname
,
64 TAO_AV_Protocol_Object
*object
);
67 /// Application callback.
68 Sender_Callback callback_
;
71 typedef TAO_AV_Endpoint_Reactive_Strategy_A
72 <Sender_StreamEndPoint
,
75 SENDER_ENDPOINT_STRATEGY
;
80 * @brief Sender Application.
82 * Class is responsible for streaming (and pacing) data to a
91 /// Method to initialize the various data components.
95 /// Method to pace and send data from a file.
98 /// Set the protocol object corresponding to the transport protocol chosen.
99 void protocol_object (TAO_AV_Protocol_Object
*protocol_object
);
106 /// Method to parse the command line arguments.
107 int parse_args (int argc
, ACE_TCHAR
*argv
[]);
109 /// Method that binds the sender to the receiver.
110 int bind_to_receiver ();
112 /// The endpoint strategy used by the sender.
113 SENDER_ENDPOINT_STRATEGY endpoint_strategy_
;
115 /// The receiver MMDevice that the sender connects to.
116 AVStreams::MMDevice_var receiver_mmdevice_
;
118 /// The sender MMDevice.
119 TAO_MMDevice
*sender_mmdevice_
;
121 /// Stream controller
122 TAO_StreamCtrl
*streamctrl_
;
124 /// Number of frames sent.
127 /// File from which data is read.
128 ACE_CString filename_
;
130 /// The Naming Service client.
131 TAO_Naming_Client naming_client_
;
133 /// File handle of the file read from.
136 /// Selected protocol - default is UDP
137 ACE_CString protocol_
;
139 /// Rate at which the data will be sent.
142 /// Message block into which data is read from a file and then sent.
143 ACE_Message_Block mb_
;
145 /// Protocol object corresponding to the transport protocol selected.
146 TAO_AV_Protocol_Object
*protocol_object_
;