UniMRCP  1.7.0
mpf_engine.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 MPF_ENGINE_H
18 #define MPF_ENGINE_H
19 
20 /**
21  * @file mpf_engine.h
22  * @brief Media Processing Framework Engine
23  */
24 
25 #include "apt_task.h"
26 #include "mpf_message.h"
27 
29 
30 /** MPF task message definition */
32 
33 /**
34  * Create MPF engine.
35  * @param id the identifier of the engine
36  * @param pool the pool to allocate memory from
37  */
38 MPF_DECLARE(mpf_engine_t*) mpf_engine_create(const char *id, apr_pool_t *pool);
39 
40 /**
41  * Create MPF codec manager.
42  * @param pool the pool to allocate memory from
43  */
45 
46 /**
47  * Register MPF codec manager.
48  * @param engine the engine to register codec manager for
49  * @param codec_manager the codec manager to register
50  */
52 
53 /**
54  * Create MPF context.
55  * @param engine the engine to create context for
56  * @param name the informative name of the context
57  * @param obj the external object associated with context
58  * @param max_termination_count the max number of terminations in context
59  * @param pool the pool to allocate memory from
60  */
62  mpf_engine_t *engine,
63  const char *name,
64  void *obj,
65  apr_size_t max_termination_count,
66  apr_pool_t *pool);
67 
68 /**
69  * Destroy MPF context.
70  * @param context the context to destroy
71  */
73 
74 /**
75  * Get external object associated with MPF context.
76  * @param context the context to get object from
77  */
79 
80 /**
81  * Get task.
82  * @param engine the engine to get task from
83  */
85 
86 /**
87  * Set task msg type to send responses and events with.
88  * @param engine the engine to set task msg type for
89  * @param type the type to set
90  */
92 
93 /**
94  * Create task message(if not created) and add MPF termination message to it.
95  * @param engine the engine task message belongs to
96  * @param command_id the MPF command identifier
97  * @param context the context to add termination to
98  * @param termination the termination to add
99  * @param descriptor the termination dependent descriptor
100  * @param task_msg the task message to create and add constructed MPF message to
101  */
103  mpf_engine_t *engine,
104  mpf_command_type_e command_id,
105  mpf_context_t *context,
106  mpf_termination_t *termination,
107  void *descriptor,
108  mpf_task_msg_t **task_msg);
109 
110 /**
111  * Create task message(if not created) and add MPF association message to it.
112  * @param engine the engine task message belongs to
113  * @param command_id the MPF command identifier
114  * @param context the context to add association of terminations for
115  * @param termination the termination to associate
116  * @param assoc_termination the termination to associate
117  * @param task_msg the task message to create and add constructed MPF message to
118  */
120  mpf_engine_t *engine,
121  mpf_command_type_e command_id,
122  mpf_context_t *context,
123  mpf_termination_t *termination,
124  mpf_termination_t *assoc_termination,
125  mpf_task_msg_t **task_msg);
126 
127 /**
128  * Create task message(if not created) and add MPF topology message to it.
129  * @param engine the engine task message belongs to
130  * @param command_id the MPF command identifier
131  * @param context the context to modify topology for
132  * @param task_msg the task message to create and add constructed MPF message to
133  */
135  mpf_engine_t *engine,
136  mpf_command_type_e command_id,
137  mpf_context_t *context,
138  mpf_task_msg_t **task_msg);
139 
140 /**
141  * Send MPF task message.
142  * @param engine the engine to send task message to
143  * @param task_msg the task message to send
144  */
146 
147 /**
148  * Set scheduler rate.
149  * @param engine the engine to set rate for
150  * @param rate the rate (n times faster than real-time)
151  */
153 
154 /**
155  * Get the identifier of the engine .
156  * @param engine the engine to get name of
157  */
158 MPF_DECLARE(const char*) mpf_engine_id_get(const mpf_engine_t *engine);
159 
160 
162 
163 #endif /* MPF_ENGINE_H */
apt_task_msg_type_e
Definition: apt_task_msg.h:30
apt_bool_t mpf_engine_message_send(mpf_engine_t *engine, mpf_task_msg_t **task_msg)
Definition: apt_task_msg.h:53
Definition: mpf_termination.h:51
mpf_engine_t * mpf_engine_create(const char *id, apr_pool_t *pool)
#define APT_END_EXTERN_C
Definition: apt.h:38
int apt_bool_t
Definition: apt.h:57
void mpf_engine_task_msg_type_set(mpf_engine_t *engine, apt_task_msg_type_e type)
void * mpf_engine_context_object_get(const mpf_context_t *context)
APT_BEGIN_EXTERN_C typedef apt_task_msg_t mpf_task_msg_t
Definition: mpf_engine.h:31
typedefAPT_BEGIN_EXTERN_C struct mpf_engine_t mpf_engine_t
Definition: mpf_types.h:30
mpf_codec_manager_t * mpf_engine_codec_manager_create(apr_pool_t *pool)
#define MPF_DECLARE(type)
Definition: mpf.h:40
#define APT_BEGIN_EXTERN_C
Definition: apt.h:36
apt_bool_t mpf_engine_scheduler_rate_set(mpf_engine_t *engine, unsigned long rate)
apt_bool_t mpf_engine_assoc_message_add(mpf_engine_t *engine, mpf_command_type_e command_id, mpf_context_t *context, mpf_termination_t *termination, mpf_termination_t *assoc_termination, mpf_task_msg_t **task_msg)
struct mpf_context_t mpf_context_t
Definition: mpf_types.h:42
apt_bool_t mpf_engine_context_destroy(mpf_context_t *context)
typedefAPT_BEGIN_EXTERN_C struct apt_task_t apt_task_t
Definition: apt_task.h:31
Thread Execution Abstraction.
mpf_command_type_e
Definition: mpf_message.h:47
Media Processing Framework Message Definitions.
apt_task_t * mpf_task_get(const mpf_engine_t *engine)
apt_bool_t mpf_engine_termination_message_add(mpf_engine_t *engine, mpf_command_type_e command_id, mpf_context_t *context, mpf_termination_t *termination, void *descriptor, mpf_task_msg_t **task_msg)
apt_bool_t mpf_engine_topology_message_add(mpf_engine_t *engine, mpf_command_type_e command_id, mpf_context_t *context, mpf_task_msg_t **task_msg)
const char * mpf_engine_id_get(const mpf_engine_t *engine)
struct mpf_codec_manager_t mpf_codec_manager_t
Definition: mpf_types.h:39
mpf_context_t * mpf_engine_context_create(mpf_engine_t *engine, const char *name, void *obj, apr_size_t max_termination_count, apr_pool_t *pool)
apt_bool_t mpf_engine_codec_manager_register(mpf_engine_t *engine, const mpf_codec_manager_t *codec_manager)