Lines 31-36
Link Here
|
31 |
#endif |
31 |
#endif |
32 |
|
32 |
|
33 |
void ms_filter_register(MSFilterDesc *desc){ |
33 |
void ms_filter_register(MSFilterDesc *desc){ |
|
|
34 |
ms_return_if_fail(desc!=NULL); |
34 |
MSFactory *factory = ms_factory_get_fallback(); |
35 |
MSFactory *factory = ms_factory_get_fallback(); |
35 |
if(factory) { |
36 |
if(factory) { |
36 |
ms_factory_register_filter(factory,desc); |
37 |
ms_factory_register_filter(factory,desc); |
Lines 83-88
Link Here
|
83 |
} |
84 |
} |
84 |
|
85 |
|
85 |
bool_t ms_filter_desc_implements_interface(MSFilterDesc *desc, MSFilterInterfaceId id){ |
86 |
bool_t ms_filter_desc_implements_interface(MSFilterDesc *desc, MSFilterInterfaceId id){ |
|
|
87 |
ms_return_val_if_fail(desc!=NULL,FALSE); |
86 |
MSFilterMethod *methods=desc->methods; |
88 |
MSFilterMethod *methods=desc->methods; |
87 |
if (!methods) return FALSE; |
89 |
if (!methods) return FALSE; |
88 |
for(;methods->id!=0;methods++){ |
90 |
for(;methods->id!=0;methods++){ |
Lines 109-123
Link Here
|
109 |
|
111 |
|
110 |
|
112 |
|
111 |
MSFilterId ms_filter_get_id(MSFilter *f){ |
113 |
MSFilterId ms_filter_get_id(MSFilter *f){ |
|
|
114 |
ms_return_val_if_fail(f!=NULL,-1); |
115 |
ms_return_val_if_fail(f->desc!=NULL,-1); |
112 |
return f->desc->id; |
116 |
return f->desc->id; |
113 |
} |
117 |
} |
114 |
|
118 |
|
115 |
const char * ms_filter_get_name(MSFilter *f) { |
119 |
const char * ms_filter_get_name(MSFilter *f) { |
|
|
120 |
ms_return_val_if_fail(f!=NULL,NULL); |
121 |
ms_return_val_if_fail(f->desc!=NULL,NULL); |
116 |
return f->desc->name; |
122 |
return f->desc->name; |
117 |
} |
123 |
} |
118 |
|
124 |
|
119 |
int ms_filter_link(MSFilter *f1, int pin1, MSFilter *f2, int pin2){ |
125 |
int ms_filter_link(MSFilter *f1, int pin1, MSFilter *f2, int pin2){ |
120 |
MSQueue *q; |
126 |
MSQueue *q; |
|
|
127 |
ms_return_val_if_fail(f1!=NULL,-1); |
128 |
ms_return_val_if_fail(f1->desc!=NULL,-1); |
129 |
ms_return_val_if_fail(f2!=NULL,-1); |
130 |
ms_return_val_if_fail(f2->desc!=NULL,-1); |
121 |
ms_message("ms_filter_link: %s:%p,%i-->%s:%p,%i",f1->desc->name,f1,pin1,f2->desc->name,f2,pin2); |
131 |
ms_message("ms_filter_link: %s:%p,%i-->%s:%p,%i",f1->desc->name,f1,pin1,f2->desc->name,f2,pin2); |
122 |
ms_return_val_if_fail(pin1<f1->desc->noutputs, -1); |
132 |
ms_return_val_if_fail(pin1<f1->desc->noutputs, -1); |
123 |
ms_return_val_if_fail(pin2<f2->desc->ninputs, -1); |
133 |
ms_return_val_if_fail(pin2<f2->desc->ninputs, -1); |
Lines 139-144
Link Here
|
139 |
|
149 |
|
140 |
int ms_filter_unlink(MSFilter *f1, int pin1, MSFilter *f2, int pin2){ |
150 |
int ms_filter_unlink(MSFilter *f1, int pin1, MSFilter *f2, int pin2){ |
141 |
MSQueue *q; |
151 |
MSQueue *q; |
|
|
152 |
ms_return_val_if_fail(f1!=NULL,-1); |
153 |
ms_return_val_if_fail(f1->desc!=NULL,-1); |
154 |
ms_return_val_if_fail(f2!=NULL,-1); |
155 |
ms_return_val_if_fail(f2->desc!=NULL,-1); |
142 |
ms_message("ms_filter_unlink: %s:%p,%i-->%s:%p,%i",f1 ? f1->desc->name : "!NULL!",f1,pin1,f2 ? f2->desc->name : "!NULL!",f2,pin2); |
156 |
ms_message("ms_filter_unlink: %s:%p,%i-->%s:%p,%i",f1 ? f1->desc->name : "!NULL!",f1,pin1,f2 ? f2->desc->name : "!NULL!",f2,pin2); |
143 |
ms_return_val_if_fail(pin1<f1->desc->noutputs, -1); |
157 |
ms_return_val_if_fail(pin1<f1->desc->noutputs, -1); |
144 |
ms_return_val_if_fail(pin2<f2->desc->ninputs, -1); |
158 |
ms_return_val_if_fail(pin2<f2->desc->ninputs, -1); |
Lines 198-203
Link Here
|
198 |
} |
212 |
} |
199 |
|
213 |
|
200 |
bool_t ms_filter_has_method(MSFilter *f, unsigned int id){ |
214 |
bool_t ms_filter_has_method(MSFilter *f, unsigned int id){ |
|
|
215 |
ms_return_val_if_fail(f!=NULL,FALSE); |
216 |
ms_return_val_if_fail(f->desc!=NULL,FALSE); |
201 |
MSFilterMethod *methods=f->desc->methods; |
217 |
MSFilterMethod *methods=f->desc->methods; |
202 |
int i; |
218 |
int i; |
203 |
for(i=0;methods!=NULL && methods[i].method!=NULL; i++) |
219 |
for(i=0;methods!=NULL && methods[i].method!=NULL; i++) |
Lines 210-215
Link Here
|
210 |
} |
226 |
} |
211 |
|
227 |
|
212 |
void ms_filter_destroy(MSFilter *f){ |
228 |
void ms_filter_destroy(MSFilter *f){ |
|
|
229 |
ms_return_if_fail(f!=NULL); |
230 |
ms_return_if_fail(f->desc!=NULL); |
213 |
if (f->desc->uninit!=NULL) |
231 |
if (f->desc->uninit!=NULL) |
214 |
f->desc->uninit(f); |
232 |
f->desc->uninit(f); |
215 |
if (f->inputs!=NULL) ms_free(f->inputs); |
233 |
if (f->inputs!=NULL) ms_free(f->inputs); |
Lines 221-226
Link Here
|
221 |
} |
239 |
} |
222 |
|
240 |
|
223 |
void ms_filter_process(MSFilter *f){ |
241 |
void ms_filter_process(MSFilter *f){ |
|
|
242 |
ms_return_if_fail(f!=NULL); |
243 |
ms_return_if_fail(f->desc!=NULL); |
224 |
MSTimeSpec start,stop; |
244 |
MSTimeSpec start,stop; |
225 |
uint64_t elapsed_time; |
245 |
uint64_t elapsed_time; |
226 |
|
246 |
|
Lines 239-244
Link Here
|
239 |
} |
259 |
} |
240 |
|
260 |
|
241 |
void ms_filter_task_process(MSFilterTask *task){ |
261 |
void ms_filter_task_process(MSFilterTask *task){ |
|
|
262 |
ms_return_if_fail(task!=NULL); |
242 |
MSTimeSpec start,stop; |
263 |
MSTimeSpec start,stop; |
243 |
MSFilter *f=task->f; |
264 |
MSFilter *f=task->f; |
244 |
/*ms_message("Executing task of filter %s:%p",f->desc->name,f);*/ |
265 |
/*ms_message("Executing task of filter %s:%p",f->desc->name,f);*/ |
Lines 257-262
Link Here
|
257 |
} |
278 |
} |
258 |
|
279 |
|
259 |
void ms_filter_preprocess(MSFilter *f, struct _MSTicker *t){ |
280 |
void ms_filter_preprocess(MSFilter *f, struct _MSTicker *t){ |
|
|
281 |
ms_return_if_fail(f!=NULL); |
260 |
f->last_tick=0; |
282 |
f->last_tick=0; |
261 |
f->ticker=t; |
283 |
f->ticker=t; |
262 |
if (f->desc->preprocess!=NULL) |
284 |
if (f->desc->preprocess!=NULL) |
Lines 264-275
Link Here
|
264 |
} |
286 |
} |
265 |
|
287 |
|
266 |
void ms_filter_postprocess(MSFilter *f){ |
288 |
void ms_filter_postprocess(MSFilter *f){ |
|
|
289 |
ms_return_if_fail(f!=NULL); |
290 |
ms_return_if_fail(f->desc!=NULL); |
267 |
if (f->desc->postprocess!=NULL) |
291 |
if (f->desc->postprocess!=NULL) |
268 |
f->desc->postprocess(f); |
292 |
f->desc->postprocess(f); |
269 |
f->ticker=NULL; |
293 |
f->ticker=NULL; |
270 |
} |
294 |
} |
271 |
|
295 |
|
272 |
bool_t ms_filter_inputs_have_data(MSFilter *f){ |
296 |
bool_t ms_filter_inputs_have_data(MSFilter *f){ |
|
|
297 |
ms_return_val_if_fail(f!=NULL,FALSE); |
298 |
ms_return_val_if_fail(f->desc!=NULL,FALSE); |
273 |
int i; |
299 |
int i; |
274 |
for(i=0;i<f->desc->ninputs;i++){ |
300 |
for(i=0;i<f->desc->ninputs;i++){ |
275 |
MSQueue *q=f->inputs[i]; |
301 |
MSQueue *q=f->inputs[i]; |
Lines 279-284
Link Here
|
279 |
} |
305 |
} |
280 |
|
306 |
|
281 |
void ms_filter_postpone_task(MSFilter *f, MSFilterFunc taskfunc){ |
307 |
void ms_filter_postpone_task(MSFilter *f, MSFilterFunc taskfunc){ |
|
|
308 |
ms_return_if_fail(f!=NULL); |
282 |
MSFilterTask *task; |
309 |
MSFilterTask *task; |
283 |
MSTicker *ticker=f->ticker; |
310 |
MSTicker *ticker=f->ticker; |
284 |
if (ticker==NULL){ |
311 |
if (ticker==NULL){ |
Lines 333-338
Link Here
|
333 |
} |
360 |
} |
334 |
|
361 |
|
335 |
MSTicker *ms_filter_get_ticker(MSFilter *f){ |
362 |
MSTicker *ms_filter_get_ticker(MSFilter *f){ |
|
|
363 |
ms_return_val_if_fail(f!=NULL,NULL); |
336 |
return f->ticker; |
364 |
return f->ticker; |
337 |
} |
365 |
} |
338 |
|
366 |
|
Lines 342-347
Link Here
|
342 |
} |
370 |
} |
343 |
|
371 |
|
344 |
int ms_connection_helper_link(MSConnectionHelper *h, MSFilter *f, int inpin, int outpin){ |
372 |
int ms_connection_helper_link(MSConnectionHelper *h, MSFilter *f, int inpin, int outpin){ |
|
|
373 |
ms_return_val_if_fail(h!=NULL,-1); |
345 |
int err=0; |
374 |
int err=0; |
346 |
if (h->last.filter==NULL){ |
375 |
if (h->last.filter==NULL){ |
347 |
h->last.filter=f; |
376 |
h->last.filter=f; |
Lines 357-362
Link Here
|
357 |
} |
386 |
} |
358 |
|
387 |
|
359 |
int ms_connection_helper_unlink(MSConnectionHelper *h, MSFilter *f, int inpin, int outpin){ |
388 |
int ms_connection_helper_unlink(MSConnectionHelper *h, MSFilter *f, int inpin, int outpin){ |
|
|
389 |
ms_return_val_if_fail(h!=NULL,-1); |
360 |
int err=0; |
390 |
int err=0; |
361 |
if (h->last.filter==NULL){ |
391 |
if (h->last.filter==NULL){ |
362 |
h->last.filter=f; |
392 |
h->last.filter=f; |