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 ();
44 void flowname (const char*);
47 /// Keeping a count of the incoming frames.
50 /// Message block into which data is read from a file and then sent.
51 ACE_Message_Block mb_
;
53 ACE_CString flowname_
;
55 /// File handle of the file into which received data is written.
60 * @class Receiver_StreamEndPoint
62 * @brief Application defined stream endpoint object.
64 * AVStreams calls this class during connection setup.
66 class Receiver_StreamEndPoint
: public TAO_Server_StreamEndPoint
69 // Create a receiver application callback.
70 int get_callback (const char *flowname
,
71 TAO_AV_Callback
*&callback
);
73 /// Set protocol object corresponding to the transport protocol
75 int set_protocol_object (const char *flowname
,
76 TAO_AV_Protocol_Object
*object
);
82 * @brief Receiver application class.
84 * This class receives data from a AV sender and writes it to
96 /// Initialize data components.
100 /// Set the protocol object corresponding to the transport protocol chosen.
101 void protocol_object (TAO_AV_Protocol_Object
*protocol_object
);
103 /// Set the protocol object corresponding to the transport protocol chosen.
104 TAO_AV_Protocol_Object
* protocol_object ();
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 /// Number of frames sent.
126 /// File from which data is read.
127 ACE_CString filename_
;
129 /// Method to parse the command line arguments.
130 int parse_args (int argc
, ACE_TCHAR
*argv
[]);
132 /// Message block into which data is read from a file and then sent.
133 ACE_Message_Block mb_
;