UniMRCP
1.3.0
Main Page
Related Pages
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
libs
mrcp-client
include
mrcp_application.h
Go to the documentation of this file.
1
/*
2
* Copyright 2008-2014 Arsen Chaloyan
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*
16
* $Id: mrcp_application.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
17
*/
18
19
#ifndef MRCP_APPLICATION_H
20
#define MRCP_APPLICATION_H
21
22
/**
23
* @file mrcp_application.h
24
* @brief MRCP User Level Application Interface
25
*/
26
27
#include "
mrcp_client_types.h
"
28
#include "
mpf_rtp_descriptor.h
"
29
#include "
mpf_stream.h
"
30
31
APT_BEGIN_EXTERN_C
32
33
/** MRCP application message declaration */
34
typedef
struct
mrcp_app_message_t
mrcp_app_message_t
;
35
36
/** MRCP signaling message declaration */
37
typedef
struct
mrcp_sig_message_t
mrcp_sig_message_t
;
38
39
/** MRCP application message dispatcher declaration */
40
typedef
struct
mrcp_app_message_dispatcher_t
mrcp_app_message_dispatcher_t
;
41
42
/** MRCP application message handler */
43
typedef
apt_bool_t
(*
mrcp_app_message_handler_f
)(
const
mrcp_app_message_t
*app_message);
44
45
/** Enumeration of MRCP signaling message types */
46
typedef
enum
{
47
MRCP_SIG_MESSAGE_TYPE_REQUEST
,
/**< request message */
48
MRCP_SIG_MESSAGE_TYPE_RESPONSE
,
/**< response message */
49
MRCP_SIG_MESSAGE_TYPE_EVENT
/**< event message */
50
}
mrcp_sig_message_type_e
;
51
52
/** Enumeration of MRCP signaling status codes */
53
typedef
enum
{
54
MRCP_SIG_STATUS_CODE_SUCCESS
,
/**< indicates success */
55
MRCP_SIG_STATUS_CODE_FAILURE
,
/**< request failed */
56
MRCP_SIG_STATUS_CODE_TERMINATE
,
/**< request failed, session/channel/connection unexpectedly terminated */
57
MRCP_SIG_STATUS_CODE_CANCEL
/**< request cancelled */
58
}
mrcp_sig_status_code_e
;
59
60
61
/** Enumeration of MRCP signaling commands (requests/responses) */
62
typedef
enum
{
63
MRCP_SIG_COMMAND_SESSION_UPDATE,
64
MRCP_SIG_COMMAND_SESSION_TERMINATE,
65
MRCP_SIG_COMMAND_CHANNEL_ADD,
66
MRCP_SIG_COMMAND_CHANNEL_REMOVE,
67
MRCP_SIG_COMMAND_RESOURCE_DISCOVER
68
}
mrcp_sig_command_e
;
69
70
/** Enumeration of MRCP signaling events */
71
typedef
enum
{
72
MRCP_SIG_EVENT_TERMINATE
73
}
mrcp_sig_event_e
;
74
75
76
/** Enumeration of MRCP application message types */
77
typedef
enum
{
78
MRCP_APP_MESSAGE_TYPE_SIGNALING
,
/**< signaling message type */
79
MRCP_APP_MESSAGE_TYPE_CONTROL
/**< control message type */
80
}
mrcp_app_message_type_e
;
81
82
/** MRCP signaling message definition */
83
struct
mrcp_sig_message_t
{
84
/** Message type (request/response/event) */
85
mrcp_sig_message_type_e
message_type
;
86
/** Command (request/response) identifier */
87
mrcp_sig_command_e
command_id
;
88
/** Event identifier */
89
mrcp_sig_event_e
event_id
;
90
/** Status code used in response */
91
mrcp_sig_status_code_e
status
;
92
};
93
94
95
/** MRCP application message definition */
96
struct
mrcp_app_message_t
{
97
/** Message type (signaling/control) */
98
mrcp_app_message_type_e
message_type
;
99
100
/** Application */
101
mrcp_application_t
*
application
;
102
/** Session */
103
mrcp_session_t
*
session
;
104
/** Channel */
105
mrcp_channel_t
*
channel
;
106
/** Session/resource descriptor */
107
mrcp_session_descriptor_t
*
descriptor
;
108
109
/** MRCP signaling message (used if message_type == MRCP_APP_MESSAGE_SIGNALING) */
110
mrcp_sig_message_t
sig_message
;
111
/** MRCP control message (used if message_type == MRCP_APP_MESSAGE_CONTROL) */
112
mrcp_message_t
*
control_message
;
113
};
114
115
/** MRCP application message dispatcher interface */
116
struct
mrcp_app_message_dispatcher_t
{
117
/** Response to mrcp_application_session_update()request */
118
apt_bool_t
(*
on_session_update
)(
mrcp_application_t
*application,
mrcp_session_t
*session,
mrcp_sig_status_code_e
status);
119
/** Response to mrcp_application_session_terminate()request */
120
apt_bool_t
(*
on_session_terminate
)(
mrcp_application_t
*application,
mrcp_session_t
*session,
mrcp_sig_status_code_e
status);
121
122
/** Response to mrcp_application_channel_add() request */
123
apt_bool_t
(*
on_channel_add
)(
mrcp_application_t
*application,
mrcp_session_t
*session,
mrcp_channel_t
*channel,
mrcp_sig_status_code_e
status);
124
/** Response to mrcp_application_channel_remove() request */
125
apt_bool_t
(*
on_channel_remove
)(
mrcp_application_t
*application,
mrcp_session_t
*session,
mrcp_channel_t
*channel,
mrcp_sig_status_code_e
status);
126
127
/** Response (event) to mrcp_application_message_send() request */
128
apt_bool_t
(*
on_message_receive
)(
mrcp_application_t
*application,
mrcp_session_t
*session,
mrcp_channel_t
*channel,
mrcp_message_t
*message);
129
130
/** Event indicating unexpected session/channel termination */
131
apt_bool_t
(*
on_terminate_event
)(
mrcp_application_t
*application,
mrcp_session_t
*session,
mrcp_channel_t
*channel);
132
133
/** Response to mrcp_application_resource_discover() request */
134
apt_bool_t
(*
on_resource_discover
)(
mrcp_application_t
*application,
mrcp_session_t
*session,
mrcp_session_descriptor_t
*descriptor,
mrcp_sig_status_code_e
status);
135
};
136
137
138
139
/**
140
* Create application instance.
141
* @param handler the event handler
142
* @param obj the external object
143
* @param pool the pool to allocate memory from
144
*/
145
MRCP_DECLARE
(
mrcp_application_t
*)
mrcp_application_create
(const
mrcp_app_message_handler_f
handler,
void
*obj, apr_pool_t *pool);
146
147
/**
148
* Destroy application instance.
149
* @param application the application to destroy
150
*/
151
MRCP_DECLARE
(
apt_bool_t
)
mrcp_application_destroy
(
mrcp_application_t
*application);
152
153
/**
154
* Get external object associated with the application.
155
* @param application the application to get object from
156
*/
157
MRCP_DECLARE
(
void
*)
mrcp_application_object_get
(const
mrcp_application_t
*application);
158
159
/**
160
* Get dir layout structure.
161
* @param application the application to get dir layout from
162
*/
163
MRCP_DECLARE
(const
apt_dir_layout_t
*)
mrcp_application_dir_layout_get
(const
mrcp_application_t
*application);
164
165
/**
166
* Create session.
167
* @param application the entire application
168
* @param profile the name of the profile to use
169
* @param obj the external object
170
* @return the created session instance
171
*/
172
MRCP_DECLARE
(
mrcp_session_t
*)
mrcp_application_session_create
(
mrcp_application_t
*application, const
char
*profile,
void
*obj);
173
174
/**
175
* Get memory pool the session object is created out of.
176
* @param session the session to get pool from
177
*/
178
MRCP_DECLARE
(apr_pool_t*)
mrcp_application_session_pool_get
(const
mrcp_session_t
*session);
179
180
/**
181
* Get session identifier.
182
* @param session the session to get identifier of
183
*/
184
MRCP_DECLARE
(const
apt_str_t
*)
mrcp_application_session_id_get
(const
mrcp_session_t
*session);
185
186
/**
187
* Get SIP or RTSP response code.
188
* @param session the session to use
189
*/
190
MRCP_DECLARE
(
int
)
mrcp_application_session_response_code_get
(const
mrcp_session_t
*session);
191
192
/**
193
* Get external object associated with the session.
194
* @param session the session to get object from
195
*/
196
MRCP_DECLARE
(
void
*)
mrcp_application_session_object_get
(const
mrcp_session_t
*session);
197
198
/**
199
* Set (associate) external object to the session.
200
* @param session the session to set object for
201
* @param obj the object to set
202
*/
203
MRCP_DECLARE
(
void
)
mrcp_application_session_object_set
(
mrcp_session_t
*session,
void
*obj);
204
205
/**
206
* Set name of the session (informative only used for debugging).
207
* @param session the session to set name for
208
* @param name the name to set
209
*/
210
MRCP_DECLARE
(
void
)
mrcp_application_session_name_set
(
mrcp_session_t
*session, const
char
*name);
211
212
/**
213
* Send session update request.
214
* @param session the session to update
215
*/
216
MRCP_DECLARE
(
apt_bool_t
)
mrcp_application_session_update
(
mrcp_session_t
*session);
217
218
/**
219
* Send session termination request.
220
* @param session the session to terminate
221
*/
222
MRCP_DECLARE
(
apt_bool_t
)
mrcp_application_session_terminate
(
mrcp_session_t
*session);
223
224
/**
225
* Destroy client session (session must be terminated prior to destroy).
226
* @param session the session to destroy
227
*/
228
MRCP_DECLARE
(
apt_bool_t
)
mrcp_application_session_destroy
(
mrcp_session_t
*session);
229
230
231
/**
232
* Create control channel.
233
* @param session the session to create channel for
234
* @param resource_id the resource identifier of the channel
235
* @param termination the media termination
236
* @param rtp_descriptor the RTP termination descriptor (NULL by default)
237
* @param obj the external object
238
*/
239
MRCP_DECLARE
(
mrcp_channel_t
*)
mrcp_application_channel_create
(
240
mrcp_session_t
*session,
241
mrcp_resource_id
resource_id,
242
mpf_termination_t
*termination,
243
mpf_rtp_termination_descriptor_t
*rtp_descriptor,
244
void
*obj);
245
246
/**
247
* Get external object associated with the channel.
248
* @param channel the channel to get object from
249
*/
250
MRCP_DECLARE
(
void
*)
mrcp_application_channel_object_get
(const
mrcp_channel_t
*channel);
251
252
/**
253
* Get RTP termination descriptor.
254
* @param channel the channel to get descriptor from
255
*/
256
MRCP_DECLARE
(
mpf_rtp_termination_descriptor_t
*)
mrcp_application_rtp_descriptor_get
(const
mrcp_channel_t
*channel);
257
258
/**
259
* Get codec descriptor of source stream.
260
* @param channel the channel to get descriptor from
261
*/
262
MRCP_DECLARE
(const
mpf_codec_descriptor_t
*)
mrcp_application_source_descriptor_get
(const
mrcp_channel_t
*channel);
263
264
/**
265
* Get codec descriptor of sink stream.
266
* @param channel the channel to get descriptor from
267
*/
268
MRCP_DECLARE
(const
mpf_codec_descriptor_t
*)
mrcp_application_sink_descriptor_get
(const
mrcp_channel_t
*channel);
269
270
/**
271
* Get associated audio stream.
272
* @param channel the channel to get associated stream from
273
*/
274
MRCP_DECLARE
(const
mpf_audio_stream_t
*)
mrcp_application_audio_stream_get
(const
mrcp_channel_t
*channel);
275
276
/**
277
* Send channel add request.
278
* @param session the session to create channel for
279
* @param channel the control channel
280
*/
281
MRCP_DECLARE
(
apt_bool_t
)
mrcp_application_channel_add
(
mrcp_session_t
*session,
mrcp_channel_t
*channel);
282
283
/**
284
* Create MRCP message.
285
* @param session the session
286
* @param channel the control channel
287
* @param method_id the method identifier of MRCP message
288
*/
289
MRCP_DECLARE
(
mrcp_message_t
*)
mrcp_application_message_create
(
mrcp_session_t
*session,
mrcp_channel_t
*channel,
mrcp_method_id
method_id);
290
291
/**
292
* Send MRCP message.
293
* @param session the session
294
* @param channel the control channel
295
* @param message the MRCP message to send
296
*/
297
MRCP_DECLARE
(
apt_bool_t
)
mrcp_application_message_send
(
mrcp_session_t
*session,
mrcp_channel_t
*channel,
mrcp_message_t
*message);
298
299
/**
300
* Remove channel.
301
* @param session the session to remove channel from
302
* @param channel the control channel to remove
303
*/
304
MRCP_DECLARE
(
apt_bool_t
)
mrcp_application_channel_remove
(
mrcp_session_t
*session,
mrcp_channel_t
*channel);
305
306
/**
307
* Discover resources.
308
* @param session the session to use as communication object
309
*/
310
MRCP_DECLARE
(
apt_bool_t
)
mrcp_application_resource_discover
(
mrcp_session_t
*session);
311
312
/**
313
* Dispatch application message.
314
* @param dispatcher the dispatcher inteface
315
* @param app_message the message to dispatch
316
*/
317
MRCP_DECLARE
(
apt_bool_t
)
mrcp_application_message_dispatch
(const
mrcp_app_message_dispatcher_t
*dispatcher, const
mrcp_app_message_t
*app_message);
318
319
/**
320
* Create audio termination
321
* @param session the session to create termination for
322
* @param stream_vtable the virtual table of audio stream
323
* @param capabilities the capabilities of the stream
324
* @param obj the external object
325
*/
326
MRCP_DECLARE
(
mpf_termination_t
*)
mrcp_application_audio_termination_create
(
327
mrcp_session_t
*session,
328
const
mpf_audio_stream_vtable_t
*stream_vtable,
329
mpf_stream_capabilities_t
*capabilities,
330
void
*obj);
331
/**
332
* Create source media termination
333
* @param session the session to create termination for
334
* @param stream_vtable the virtual table of audio stream
335
* @param codec_descriptor the descriptor of audio stream (NULL by default)
336
* @param obj the external object
337
* @deprecated @see mrcp_application_audio_termination_create()
338
*/
339
MRCP_DECLARE
(
mpf_termination_t
*)
mrcp_application_source_termination_create
(
340
mrcp_session_t
*session,
341
const
mpf_audio_stream_vtable_t
*stream_vtable,
342
mpf_codec_descriptor_t
*codec_descriptor,
343
void
*obj);
344
/**
345
* Create sink media termination
346
* @param session the session to create termination for
347
* @param stream_vtable the virtual table of audio stream
348
* @param codec_descriptor the descriptor of audio stream (NULL by default)
349
* @param obj the external object
350
* @deprecated @see mrcp_application_audio_termination_create()
351
*/
352
MRCP_DECLARE
(
mpf_termination_t
*)
mrcp_application_sink_termination_create
(
353
mrcp_session_t
*session,
354
const
mpf_audio_stream_vtable_t
*stream_vtable,
355
mpf_codec_descriptor_t
*codec_descriptor,
356
void
*obj);
357
358
APT_END_EXTERN_C
359
360
#endif
/* MRCP_APPLICATION_H */
Generated on Mon Feb 2 2015 19:41:39 for UniMRCP by
1.8.3.1