streamMedia_common.h

Go to the documentation of this file.
1 
2 /*
3  * ====================== WARNING ======================
4  *
5  * THE CONTENTS OF THIS FILE HAVE BEEN AUTO-GENERATED.
6  * DO NOT MODIFY IN ANY WAY.
7  *
8  * ====================== WARNING ======================
9  */
10 /**
11  * @file streamMedia_common.h
12  *
13  * Type definitions for streamMedia.
14  *
15  */
16 #ifndef STREAMMEDIA_COMMON_H_INCLUDE_GUARD
17 #define STREAMMEDIA_COMMON_H_INCLUDE_GUARD
18 
19 
20 #include "legato.h"
21 
22 // Interface specific includes
23 #include "le_audio_common.h"
24 
25 #define IFGEN_STREAMMEDIA_PROTOCOL_ID "71717928ce6a572295ba603be121d6e3"
26 #define IFGEN_STREAMMEDIA_MSG_SIZE 1825
27 /** @addtogroup streamMedia
28  * @{ **/
29 
30 
31 //--------------------------------------------------------------------------------------------------
32 /**
33  * The maximum length of the textual representation of an IP address.
34  */
35 //--------------------------------------------------------------------------------------------------
36 #define STREAMMEDIA_MAX_IP_LENGTH 15
37 
38 //--------------------------------------------------------------------------------------------------
39 /**
40  * The maximum length of the optional RTCP BYE packet reason string length.
41  */
42 //--------------------------------------------------------------------------------------------------
43 #define STREAMMEDIA_MAX_BYE_REASON_LENGTH 255
44 
45 //--------------------------------------------------------------------------------------------------
46 /**
47  * The maximum length of a RTCP SDES packet field string length.
48  */
49 //--------------------------------------------------------------------------------------------------
50 #define STREAMMEDIA_MAX_SDES_FIELD_LENGTH 255
51 
52 //--------------------------------------------------------------------------------------------------
53 /**
54  * The default RTP port.
55  */
56 //--------------------------------------------------------------------------------------------------
57 #define STREAMMEDIA_DEFAULT_RTP_PORT 4000
58 
59 //--------------------------------------------------------------------------------------------------
60 /**
61  * RTCP packet reception events, related to the RTCP packet type. See
62  * <a href="https://tools.ietf.org/pdf/rfc3550.pdf">RFC-3550</a> for more details.
63  */
64 //--------------------------------------------------------------------------------------------------
65 typedef enum
66 {
68  ///< RTCP Session Description packet has been received.
70  ///< RTCP BYE packet has been received.
72  ///< RTCP Sender Report packet has been received.
74  ///< RTCP Receiver Report packet has been received.
76  ///< RTCP Application-specific packet has been received.
77 }
79 
80 
81 //--------------------------------------------------------------------------------------------------
82 /**
83  * Reference type used by Add/Remove functions for EVENT 'streamMedia_Rtcp'
84  */
85 //--------------------------------------------------------------------------------------------------
86 typedef struct streamMedia_RtcpHandler* streamMedia_RtcpHandlerRef_t;
87 
88 
89 //--------------------------------------------------------------------------------------------------
90 /**
91  * Handler for RTCP packet reception.
92  *
93  */
94 //--------------------------------------------------------------------------------------------------
95 typedef void (*streamMedia_RtcpHandlerFunc_t)
96 (
97  le_audio_StreamRef_t streamRef,
98  ///< Audio stream reference.
100  ///< Event value.
101  void* contextPtr
102  ///<
103 );
104 
105 
106 //--------------------------------------------------------------------------------------------------
107 /**
108  * Get if this client bound locally.
109  */
110 //--------------------------------------------------------------------------------------------------
111 LE_SHARED bool ifgen_streamMedia_HasLocalBinding
112 (
113  void
114 );
115 
116 
117 //--------------------------------------------------------------------------------------------------
118 /**
119  * Init data that is common across all threads
120  */
121 //--------------------------------------------------------------------------------------------------
122 LE_SHARED void ifgen_streamMedia_InitCommonData
123 (
124  void
125 );
126 
127 
128 //--------------------------------------------------------------------------------------------------
129 /**
130  * Perform common initialization and open a session
131  */
132 //--------------------------------------------------------------------------------------------------
133 LE_SHARED le_result_t ifgen_streamMedia_OpenSession
134 (
135  le_msg_SessionRef_t _ifgen_sessionRef,
136  bool isBlocking
137 );
138 
139 //--------------------------------------------------------------------------------------------------
140 /**
141  * Open the received audio stream of the RTP interface.
142  *
143  * @return Reference to the input audio stream, NULL if the function fails.
144  */
145 //--------------------------------------------------------------------------------------------------
146 LE_SHARED le_audio_StreamRef_t ifgen_streamMedia_OpenAudioRtpRx
147 (
148  le_msg_SessionRef_t _ifgen_sessionRef,
149  int32_t localPort
150  ///< [IN] The local UDP socket port for the RTP session.
151 );
152 
153 //--------------------------------------------------------------------------------------------------
154 /**
155  * Open the transmitted audio stream of the RTP interface.
156  *
157  * @return Reference to the output audio stream, NULL if the function fails.
158  */
159 //--------------------------------------------------------------------------------------------------
160 LE_SHARED le_audio_StreamRef_t ifgen_streamMedia_OpenAudioRtpTx
161 (
162  le_msg_SessionRef_t _ifgen_sessionRef,
163  int32_t localPort,
164  ///< [IN] The local UDP socket port for the RTP
165  ///< session.
166  const char* LE_NONNULL remoteIpAddress,
167  ///< [IN] The IP address of the remote peer.
168  int32_t remotePort
169  ///< [IN] The port of the remote peer.
170 );
171 
172 //--------------------------------------------------------------------------------------------------
173 /**
174  * Start the RTP stream. This must be called after connecting the RTP interface to start
175  * RTP reception or transmission.
176  *
177  * @return LE_FAULT Function failed.
178  * @return LE_OK Function succeeded.
179  */
180 //--------------------------------------------------------------------------------------------------
181 LE_SHARED le_result_t ifgen_streamMedia_Start
182 (
183  le_msg_SessionRef_t _ifgen_sessionRef,
184  le_audio_StreamRef_t streamRef
185  ///< [IN] Audio stream reference.
186 );
187 
188 //--------------------------------------------------------------------------------------------------
189 /**
190  * Stop the RTP stream.
191  *
192  * @return LE_FAULT Function failed.
193  * @return LE_OK Function succeeded.
194  */
195 //--------------------------------------------------------------------------------------------------
196 LE_SHARED le_result_t ifgen_streamMedia_Stop
197 (
198  le_msg_SessionRef_t _ifgen_sessionRef,
199  le_audio_StreamRef_t streamRef
200  ///< [IN] Audio stream reference.
201 );
202 
203 //--------------------------------------------------------------------------------------------------
204 /**
205  * Send a RTCP Session Description packet (SDES) using
206  * <a href="http://www.pjsip.org/pjmedia/docs/html/group__PJMED__RTCP.htm#
207  * ga8ddca87e2b3ab0b02635edd66d7de748">pjmedia_rtcp_build_rtcp_sdes()</a>.
208  *
209  * @return LE_FAULT Function failed.
210  * @return LE_OK Function succeeded.
211  */
212 //--------------------------------------------------------------------------------------------------
213 LE_SHARED le_result_t ifgen_streamMedia_SendRtcpSdes
214 (
215  le_msg_SessionRef_t _ifgen_sessionRef,
216  le_audio_StreamRef_t streamRef,
217  ///< [IN] Audio stream reference.
218  const char* LE_NONNULL cname,
219  ///< [IN] The optional source canonical name.
220  const char* LE_NONNULL name,
221  ///< [IN] The optional source name.
222  const char* LE_NONNULL email,
223  ///< [IN] The optional source email.
224  const char* LE_NONNULL phone,
225  ///< [IN] The optional source phone.
226  const char* LE_NONNULL loc,
227  ///< [IN] The optional source location.
228  const char* LE_NONNULL tool,
229  ///< [IN] The optional source tool.
230  const char* LE_NONNULL note
231  ///< [IN] The optional source note.
232 );
233 
234 //--------------------------------------------------------------------------------------------------
235 /**
236  * Send a RTCP BYE packet using
237  * <a href="http://www.pjsip.org/pjmedia/docs/html/group__PJMED__RTCP.htm#
238  * ga9eb25597d5815cee68fe7fdc3b4cd9e9">pjmedia_rtcp_build_rtcp_bye()</a>.
239  *
240  * @return LE_FAULT Function failed.
241  * @return LE_OK Function succeeded.
242  */
243 //--------------------------------------------------------------------------------------------------
244 LE_SHARED le_result_t ifgen_streamMedia_SendRtcpBye
245 (
246  le_msg_SessionRef_t _ifgen_sessionRef,
247  le_audio_StreamRef_t streamRef,
248  ///< [IN] Audio stream reference.
249  const char* LE_NONNULL reason
250  ///< [IN] The optional BYE reason.
251 );
252 
253 //--------------------------------------------------------------------------------------------------
254 /**
255  * Close an RTP stream.
256  *
257  */
258 //--------------------------------------------------------------------------------------------------
259 LE_SHARED void ifgen_streamMedia_Close
260 (
261  le_msg_SessionRef_t _ifgen_sessionRef,
262  le_audio_StreamRef_t streamRef
263  ///< [IN] Audio stream reference.
264 );
265 
266 //--------------------------------------------------------------------------------------------------
267 /**
268  * Add handler function for EVENT 'streamMedia_Rtcp'
269  *
270  * This event provides information on RTCP packet type.
271  *
272  */
273 //--------------------------------------------------------------------------------------------------
274 LE_SHARED streamMedia_RtcpHandlerRef_t ifgen_streamMedia_AddRtcpHandler
275 (
276  le_msg_SessionRef_t _ifgen_sessionRef,
277  le_audio_StreamRef_t streamRef,
278  ///< [IN] Audio stream reference.
280  ///< [IN]
281  void* contextPtr
282  ///< [IN]
283 );
284 
285 //--------------------------------------------------------------------------------------------------
286 /**
287  * Remove handler function for EVENT 'streamMedia_Rtcp'
288  */
289 //--------------------------------------------------------------------------------------------------
290 LE_SHARED void ifgen_streamMedia_RemoveRtcpHandler
291 (
292  le_msg_SessionRef_t _ifgen_sessionRef,
294  ///< [IN]
295 );
296 /** @} **/
297 #endif // STREAMMEDIA_COMMON_H_INCLUDE_GUARD
#define LE_SHARED
Definition: le_basics.h:287
le_result_t
Definition: le_basics.h:46
RTCP Receiver Report packet has been received.
Definition: streamMedia_common.h:73
void(* streamMedia_RtcpHandlerFunc_t)(le_audio_StreamRef_t streamRef, streamMedia_RtcpEvent_t event, void *contextPtr)
Definition: streamMedia_common.h:96
streamMedia_RtcpEvent_t
Definition: streamMedia_common.h:65
RTCP Application-specific packet has been received.
Definition: streamMedia_common.h:75
RTCP Session Description packet has been received.
Definition: streamMedia_common.h:67
RTCP BYE packet has been received.
Definition: streamMedia_common.h:69
struct le_msg_Session * le_msg_SessionRef_t
Definition: le_messaging.h:860
struct le_audio_Stream * le_audio_StreamRef_t
Definition: le_audio_common.h:191
RTCP Sender Report packet has been received.
Definition: streamMedia_common.h:71
struct streamMedia_RtcpHandler * streamMedia_RtcpHandlerRef_t
Definition: streamMedia_common.h:86