00001 /* 00002 * Copyright 2008-2010 Arsen Chaloyan 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 * 00016 * $Id: mpf_context.h 1709 2010-05-24 17:12:11Z achaloyan $ 00017 */ 00018 00019 #ifndef MPF_CONTEXT_H 00020 #define MPF_CONTEXT_H 00021 00022 /** 00023 * @file mpf_context.h 00024 * @brief MPF Context 00025 */ 00026 00027 #include "mpf_types.h" 00028 00029 APT_BEGIN_EXTERN_C 00030 00031 /** Opaque factory of media contexts */ 00032 typedef struct mpf_context_factory_t mpf_context_factory_t; 00033 00034 /** 00035 * Create factory of media contexts. 00036 */ 00037 MPF_DECLARE(mpf_context_factory_t*) mpf_context_factory_create(apr_pool_t *pool); 00038 00039 /** 00040 * Destroy factory of media contexts. 00041 */ 00042 MPF_DECLARE(void) mpf_context_factory_destroy(mpf_context_factory_t *factory); 00043 00044 /** 00045 * Process factory of media contexts. 00046 */ 00047 MPF_DECLARE(apt_bool_t) mpf_context_factory_process(mpf_context_factory_t *factory); 00048 00049 /** 00050 * Create MPF context. 00051 * @param factory the factory context belongs to 00052 * @param name the informative name of the context 00053 * @param obj the external object associated with context 00054 * @param max_termination_count the max number of terminations in context 00055 * @param pool the pool to allocate memory from 00056 */ 00057 MPF_DECLARE(mpf_context_t*) mpf_context_create( 00058 mpf_context_factory_t *factory, 00059 const char *name, 00060 void *obj, 00061 apr_size_t max_termination_count, 00062 apr_pool_t *pool); 00063 00064 /** 00065 * Destroy MPF context. 00066 * @param context the context to destroy 00067 */ 00068 MPF_DECLARE(apt_bool_t) mpf_context_destroy(mpf_context_t *context); 00069 00070 /** 00071 * Get external object associated with MPF context. 00072 * @param context the context to get object from 00073 */ 00074 MPF_DECLARE(void*) mpf_context_object_get(const mpf_context_t *context); 00075 00076 /** 00077 * Add termination to context. 00078 * @param context the context to add termination to 00079 * @param termination the termination to add 00080 */ 00081 MPF_DECLARE(apt_bool_t) mpf_context_termination_add(mpf_context_t *context, mpf_termination_t *termination); 00082 00083 /** 00084 * Subtract termination from context. 00085 * @param context the context to subtract termination from 00086 * @param termination the termination to subtract 00087 */ 00088 MPF_DECLARE(apt_bool_t) mpf_context_termination_subtract(mpf_context_t *context, mpf_termination_t *termination); 00089 00090 /** 00091 * Add association between specified terminations. 00092 * @param context the context to add association in the scope of 00093 * @param termination1 the first termination to associate 00094 * @param termination2 the second termination to associate 00095 */ 00096 MPF_DECLARE(apt_bool_t) mpf_context_association_add(mpf_context_t *context, mpf_termination_t *termination1, mpf_termination_t *termination2); 00097 00098 /** 00099 * Remove association between specified terminations. 00100 * @param context the context to remove association in the scope of 00101 * @param termination1 the first termination 00102 * @param termination2 the second termination 00103 */ 00104 MPF_DECLARE(apt_bool_t) mpf_context_association_remove(mpf_context_t *context, mpf_termination_t *termination1, mpf_termination_t *termination2); 00105 00106 /** 00107 * Reset assigned associations and destroy applied topology. 00108 * @param context the context to reset associations for 00109 */ 00110 MPF_DECLARE(apt_bool_t) mpf_context_associations_reset(mpf_context_t *context); 00111 00112 /** 00113 * Apply topology. 00114 * @param context the context to apply topology for 00115 */ 00116 MPF_DECLARE(apt_bool_t) mpf_context_topology_apply(mpf_context_t *context); 00117 00118 /** 00119 * Destroy topology. 00120 * @param context the context to destroy topology for 00121 */ 00122 MPF_DECLARE(apt_bool_t) mpf_context_topology_destroy(mpf_context_t *context); 00123 00124 /** 00125 * Process context. 00126 * @param context the context to process 00127 */ 00128 MPF_DECLARE(apt_bool_t) mpf_context_process(mpf_context_t *context); 00129 00130 00131 APT_END_EXTERN_C 00132 00133 #endif /* MPF_CONTEXT_H */