UniMRCP  1.7.0
mpf_object.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_OBJECT_H
18 #define MPF_OBJECT_H
19 
20 /**
21  * @file mpf_object.h
22  * @brief Media Processing Object Base (bridge, multiplexor, mixer, ...)
23  */
24 
25 #include "mpf_types.h"
26 
28 
29 /** MPF object declaration */
30 typedef struct mpf_object_t mpf_object_t;
31 
32 /** Media processing objects base */
33 struct mpf_object_t {
34  /** Informative name used for debugging */
35  const char *name;
36  /** Virtual destroy */
38  /** Virtual process */
40  /** Virtual trace of media path */
41  void (*trace)(mpf_object_t *object);
42 };
43 
44 /** Initialize object */
45 static APR_INLINE void mpf_object_init(mpf_object_t *object, const char *name)
46 {
47  object->name = name;
48  object->destroy = NULL;
49  object->process = NULL;
50  object->trace = NULL;
51 }
52 
53 /** Destroy object */
54 static APR_INLINE void mpf_object_destroy(mpf_object_t *object)
55 {
56  if(object->destroy)
57  object->destroy(object);
58 }
59 
60 /** Process object */
61 static APR_INLINE void mpf_object_process(mpf_object_t *object)
62 {
63  if(object->process)
64  object->process(object);
65 }
66 
67 /** Trace media path */
68 static APR_INLINE void mpf_object_trace(mpf_object_t *object)
69 {
70  if(object->trace)
71  object->trace(object);
72 }
73 
74 
76 
77 #endif /* MPF_OBJECT_H */
apt_bool_t(* destroy)(mpf_object_t *object)
Definition: mpf_object.h:37
#define APT_END_EXTERN_C
Definition: apt.h:38
int apt_bool_t
Definition: apt.h:57
#define APT_BEGIN_EXTERN_C
Definition: apt.h:36
void(* trace)(mpf_object_t *object)
Definition: mpf_object.h:41
MPF Types Declarations.
apt_bool_t(* process)(mpf_object_t *object)
Definition: mpf_object.h:39
Definition: mpf_object.h:33
const char * name
Definition: mpf_object.h:35