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_termination_factory.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
17  */
18 
19 #ifndef MPF_TERMINATION_FACTORY_H
20 #define MPF_TERMINATION_FACTORY_H
21 
22 /**
23  * @file mpf_termination_factory.h
24  * @brief MPF Termination Factory
25  */
26 
27 #include "mpf_types.h"
28 
29 APT_BEGIN_EXTERN_C
30 
31 /** MPF termination factory */
32 struct mpf_termination_factory_t {
33 	/** Virtual create */
34 	mpf_termination_t* (*create_termination)(mpf_termination_factory_t *factory, void *obj, apr_pool_t *pool);
35 	/** Virtual assign engine */
36 	apt_bool_t (*assign_engine)(mpf_termination_factory_t *factory, mpf_engine_t *media_engine);
37 };
38 
39 /**
40  * Assign media engine to termination factory.
41  * @param termination_factory the termination factory to assign media engine to
42  * @param media_engine the media engine to assign
43  */
44 MPF_DECLARE(apt_bool_t) mpf_termination_factory_engine_assign(
45 										mpf_termination_factory_t *termination_factory,
46 										mpf_engine_t *media_engine);
47 
48 /**
49  * Create MPF termination from termination factory.
50  * @param termination_factory the termination factory to create termination from
51  * @param obj the external object associated with termination
52  * @param pool the pool to allocate memory from
53  */
54 MPF_DECLARE(mpf_termination_t*) mpf_termination_create(
55 										mpf_termination_factory_t *termination_factory,
56 										void *obj,
57 										apr_pool_t *pool);
58 
59 /**
60  * Create raw MPF termination.
61  * @param obj the external object associated with termination
62  * @param audio_stream the audio stream of the termination
63  * @param video_stream the video stream of the termination
64  * @param pool the pool to allocate memory from
65  */
66 MPF_DECLARE(mpf_termination_t*) mpf_raw_termination_create(
67 										void *obj,
68 										mpf_audio_stream_t *audio_stream,
69 										mpf_video_stream_t *video_stream,
70 										apr_pool_t *pool);
71 
72 /**
73  * Destroy MPF termination.
74  * @param termination the termination to destroy
75  */
76 MPF_DECLARE(apt_bool_t) mpf_termination_destroy(mpf_termination_t *termination);
77 
78 /**
79  * Get termination name.
80  * @param termination the termination to get name of
81  */
82 MPF_DECLARE(const char*) mpf_termination_name_get(const mpf_termination_t *termination);
83 
84 /**
85  * Get associated object.
86  * @param termination the termination to get object from
87  */
88 MPF_DECLARE(void*) mpf_termination_object_get(const mpf_termination_t *termination);
89 
90 /**
91  * Get audio stream.
92  * @param termination the termination to get audio stream from
93  */
94 MPF_DECLARE(mpf_audio_stream_t*) mpf_termination_audio_stream_get(const mpf_termination_t *termination);
95 
96 /**
97  * Get video stream.
98  * @param termination the termination to get video stream from
99  */
100 MPF_DECLARE(mpf_video_stream_t*) mpf_termination_video_stream_get(const mpf_termination_t *termination);
101 
102 
103 APT_END_EXTERN_C
104 
105 #endif /* MPF_TERMINATION_FACTORY_H */
106