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 "orbsvcs/Naming/Naming_Client.h"
16 #include "orbsvcs/AV/AVStreams_i.h"
17 #include "orbsvcs/AV/Endpoint_Strategy.h"
18 #include "orbsvcs/AV/Policy.h"
19 #include "orbsvcs/AV/Protocol_Factory.h"
22 * @class Receiver_Callback
24 * @brief Application defined callback object.
26 * AVStreams calls this class when data shows up from a sender.
28 class Receiver_Callback
: public TAO_AV_Callback
34 // Method that is called when there is data to be received from a
36 int receive_frame (ACE_Message_Block
*frame
,
37 TAO_AV_frame_info
*frame_info
,
38 const ACE_Addr
&peer_address
);
40 // Called when the sender is done sending data and wants to close
41 // down the connection.
42 int handle_destroy ();
45 /// Keeping a count of the incoming frames.
48 /// Message block into which data is read from a file and then sent.
49 ACE_Message_Block mb_
;
53 * @class Receiver_StreamEndPoint
55 * @brief Application defined stream endpoint object.
57 * AVStreams calls this class during connection setup.
59 class Receiver_StreamEndPoint
: public TAO_Server_StreamEndPoint
62 // Create a receiver application callback.
63 int get_callback (const char *flowname
,
64 TAO_AV_Callback
*&callback
);
66 /// Set protocol object corresponding to the transport protocol
68 int set_protocol_object (const char *flowname
,
69 TAO_AV_Protocol_Object
*object
);
73 /// Receiver application callback.
74 Receiver_Callback callback_
;
80 * @brief Receiver application class.
82 * This class receives data from a AV sender and writes it to
94 /// Initialize data components.
98 /// Set the protocol object corresponding to the transport protocol chosen.
99 void protocol_object (TAO_AV_Protocol_Object
*protocol_object
);
101 /// Set the protocol object corresponding to the transport protocol chosen.
102 TAO_AV_Protocol_Object
* protocol_object ();
104 FILE * input_file ();
107 /// The Naming Service Client.
108 TAO_Naming_Client naming_client_
;
110 /// The endpoint reactive strategy.
111 TAO_AV_Endpoint_Reactive_Strategy_B
112 <Receiver_StreamEndPoint
,TAO_VDev
,AV_Null_MediaCtrl
> reactive_strategy_
;
114 /// Receiver MMDevice.
115 TAO_MMDevice
*mmdevice_
;
117 /// Rate at which the data will be sent.
120 /// Protocol object corresponding to the transport protocol selected.
121 TAO_AV_Protocol_Object
*protocol_object_
;
123 /// File handle of the file read from.
126 /// Number of frames sent.
129 /// File from which data is read.
130 ACE_CString filename_
;
132 /// Method to parse the command line arguments.
133 int parse_args (int argc
, ACE_TCHAR
*argv
[]);
135 /// Message block into which data is read from a file and then sent.
136 ACE_Message_Block mb_
;