UniMRCP  1.3.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
mpf_object.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: mpf_object.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
17  */
18 
19 #ifndef MPF_OBJECT_H
20 #define MPF_OBJECT_H
21 
22 /**
23  * @file mpf_object.h
24  * @brief Media Processing Object Base (bridge, multiplexor, mixer, ...)
25  */
26 
27 #include "mpf_types.h"
28 
30 
31 /** MPF object declaration */
32 typedef struct mpf_object_t mpf_object_t;
33 
34 /** Media processing objects base */
35 struct mpf_object_t {
36  /** Informative name used for debugging */
37  const char *name;
38  /** Virtual destroy */
40  /** Virtual process */
42  /** Virtual trace of media path */
43  void (*trace)(mpf_object_t *object);
44 };
45 
46 /** Initialize object */
47 static APR_INLINE void mpf_object_init(mpf_object_t *object, const char *name)
48 {
49  object->name = name;
50  object->destroy = NULL;
51  object->process = NULL;
52  object->trace = NULL;
53 }
54 
55 /** Destroy object */
56 static APR_INLINE void mpf_object_destroy(mpf_object_t *object)
57 {
58  if(object->destroy)
59  object->destroy(object);
60 }
61 
62 /** Process object */
63 static APR_INLINE void mpf_object_process(mpf_object_t *object)
64 {
65  if(object->process)
66  object->process(object);
67 }
68 
69 /** Trace media path */
70 static APR_INLINE void mpf_object_trace(mpf_object_t *object)
71 {
72  if(object->trace)
73  object->trace(object);
74 }
75 
76 
78 
79 #endif /* MPF_OBJECT_H */