UniMRCP  1.7.0
mrcp_engine_impl.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008-2015 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 
17 #ifndef MRCP_ENGINE_IMPL_H
18 #define MRCP_ENGINE_IMPL_H
19 
20 /**
21  * @file mrcp_engine_impl.h
22  * @brief MRCP Engine Realization Interface (typically should be implemented in plugins)
23  */
24 
25 #include "mrcp_engine_types.h"
26 #include "mpf_stream.h"
27 
29 
30 /** Create engine */
32  mrcp_resource_id resource_id,
33  void *obj,
34  const mrcp_engine_method_vtable_t *vtable,
35  apr_pool_t *pool);
36 
37 /** Send engine open response */
38 static APR_INLINE apt_bool_t mrcp_engine_open_respond(mrcp_engine_t *engine, apt_bool_t status)
39 {
40  return engine->event_vtable->on_open(engine,status);
41 }
42 
43 /** Send engine close response */
44 static APR_INLINE apt_bool_t mrcp_engine_close_respond(mrcp_engine_t *engine)
45 {
46  return engine->event_vtable->on_close(engine);
47 }
48 
49 
50 /** Get engine config */
52 
53 /** Get engine param by name */
54 const char* mrcp_engine_param_get(const mrcp_engine_t *engine, const char *name);
55 
56 
57 /** Create engine channel */
59  mrcp_engine_t *engine,
60  const mrcp_engine_channel_method_vtable_t *method_vtable,
61  void *method_obj,
62  mpf_termination_t *termination,
63  apr_pool_t *pool);
64 
65 /** Create audio termination */
67  void *obj,
68  const mpf_audio_stream_vtable_t *stream_vtable,
69  mpf_stream_capabilities_t *capabilities,
70  apr_pool_t *pool);
71 
72 /** Create engine channel and source media termination
73  * @deprecated @see mrcp_engine_channel_create() and mrcp_engine_audio_termination_create()
74  */
76  mrcp_engine_t *engine,
77  const mrcp_engine_channel_method_vtable_t *channel_vtable,
78  const mpf_audio_stream_vtable_t *stream_vtable,
79  void *method_obj,
80  mpf_codec_descriptor_t *codec_descriptor,
81  apr_pool_t *pool);
82 
83 /** Create engine channel and sink media termination
84  * @deprecated @see mrcp_engine_channel_create() and mrcp_engine_audio_termination_create()
85  */
87  mrcp_engine_t *engine,
88  const mrcp_engine_channel_method_vtable_t *channel_vtable,
89  const mpf_audio_stream_vtable_t *stream_vtable,
90  void *method_obj,
91  mpf_codec_descriptor_t *codec_descriptor,
92  apr_pool_t *pool);
93 
94 /** Send channel open response */
95 static APR_INLINE apt_bool_t mrcp_engine_channel_open_respond(mrcp_engine_channel_t *channel, apt_bool_t status)
96 {
97  return channel->event_vtable->on_open(channel,status);
98 }
99 
100 /** Send channel close response */
101 static APR_INLINE apt_bool_t mrcp_engine_channel_close_respond(mrcp_engine_channel_t *channel)
102 {
103  return channel->event_vtable->on_close(channel);
104 }
105 
106 /** Send response/event message */
107 static APR_INLINE apt_bool_t mrcp_engine_channel_message_send(mrcp_engine_channel_t *channel, mrcp_message_t *message)
108 {
109  return channel->event_vtable->on_message(channel,message);
110 }
111 
112 /** Get channel identifier */
113 static APR_INLINE const char* mrcp_engine_channel_id_get(mrcp_engine_channel_t *channel)
114 {
115  return channel->id.buf;
116 }
117 
118 /** Get MRCP version channel is created in the scope of */
119 static APR_INLINE mrcp_version_e mrcp_engine_channel_version_get(const mrcp_engine_channel_t *channel)
120 {
121  return channel->mrcp_version;
122 }
123 
124 /** Get codec descriptor of the audio source stream */
126 
127 /** Get codec descriptor of the audio sink stream */
129 
130 
132 
133 #endif /* MRCP_ENGINE_IMPL_H */
const mrcp_engine_event_vtable_t * event_vtable
Definition: mrcp_engine_types.h:129
const mpf_codec_descriptor_t * mrcp_engine_sink_stream_codec_get(const mrcp_engine_channel_t *channel)
Definition: mpf_termination.h:51
MPF Bidirectional Stream.
Definition: mpf_stream.h:69
#define APT_END_EXTERN_C
Definition: apt.h:38
int apt_bool_t
Definition: apt.h:57
Definition: mrcp_engine_types.h:99
Definition: mrcp_engine_types.h:73
mrcp_version_e
Definition: mrcp_types.h:30
mrcp_engine_channel_t * mrcp_engine_channel_create(mrcp_engine_t *engine, const mrcp_engine_channel_method_vtable_t *method_vtable, void *method_obj, mpf_termination_t *termination, apr_pool_t *pool)
APT_BEGIN_EXTERN_C mrcp_engine_t * mrcp_engine_create(mrcp_resource_id resource_id, void *obj, const mrcp_engine_method_vtable_t *vtable, apr_pool_t *pool)
apt_bool_t(* on_close)(mrcp_engine_channel_t *channel)
Definition: mrcp_engine_types.h:67
const mrcp_engine_channel_event_vtable_t * event_vtable
Definition: mrcp_engine_types.h:79
const mpf_codec_descriptor_t * mrcp_engine_source_stream_codec_get(const mrcp_engine_channel_t *channel)
Definition: mpf_stream_descriptor.h:43
#define APT_BEGIN_EXTERN_C
Definition: apt.h:36
apt_bool_t(* on_close)(mrcp_engine_t *channel)
Definition: mrcp_engine_types.h:115
apt_bool_t(* on_open)(mrcp_engine_channel_t *channel, apt_bool_t status)
Definition: mrcp_engine_types.h:65
apt_str_t id
Definition: mrcp_engine_types.h:87
apr_size_t mrcp_resource_id
Definition: mrcp_types.h:68
Definition: mrcp_engine_types.h:150
const mrcp_engine_config_t * mrcp_engine_config_get(const mrcp_engine_t *engine)
mrcp_version_e mrcp_version
Definition: mrcp_engine_types.h:89
Definition: mrcp_engine_types.h:51
apt_bool_t(* on_open)(mrcp_engine_t *channel, apt_bool_t status)
Definition: mrcp_engine_types.h:113
MRCP Engine Types.
mrcp_engine_channel_t * mrcp_engine_sink_channel_create(mrcp_engine_t *engine, const mrcp_engine_channel_method_vtable_t *channel_vtable, const mpf_audio_stream_vtable_t *stream_vtable, void *method_obj, mpf_codec_descriptor_t *codec_descriptor, apr_pool_t *pool)
Definition: mrcp_engine_types.h:119
const char * mrcp_engine_param_get(const mrcp_engine_t *engine, const char *name)
apt_bool_t(* on_message)(mrcp_engine_channel_t *channel, mrcp_message_t *message)
Definition: mrcp_engine_types.h:69
mpf_termination_t * mrcp_engine_audio_termination_create(void *obj, const mpf_audio_stream_vtable_t *stream_vtable, mpf_stream_capabilities_t *capabilities, apr_pool_t *pool)
mrcp_engine_channel_t * mrcp_engine_source_channel_create(mrcp_engine_t *engine, const mrcp_engine_channel_method_vtable_t *channel_vtable, const mpf_audio_stream_vtable_t *stream_vtable, void *method_obj, mpf_codec_descriptor_t *codec_descriptor, apr_pool_t *pool)
char * buf
Definition: apt_string.h:38
Definition: mrcp_message.h:37
Definition: mpf_codec_descriptor.h:63