msfilter.h 17.8 KB
Newer Older
aymeric's avatar
aymeric committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
/*
mediastreamer2 library - modular sound and video processing and streaming
Copyright (C) 2006  Simon MORLAT (simon.morlat@linphone.org)

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

#ifndef msfilter_h
#define msfilter_h

#include "mscommon.h"
#include "msqueue.h"
#include "allfilters.h"

/**
 * @file msfilter.h
 * @brief mediastreamer2 msfilter.h include file
 *
 * This file provide the API needed to create, link,
 * unlink, find and destroy filter.
 *
 * It also provides definitions if you wish to implement
 * your own filters.
 *
 */

/**
 * @defgroup mediastreamer2_filter Filter API - manage mediastreamer2 filters.
 * @ingroup mediastreamer2_api
 * @{
 */

/**
 * Structure for filter's methods (init, preprocess, process, postprocess, uninit).
 * @var MSFilterFunc
 */
typedef void (*MSFilterFunc)(struct _MSFilter *f);

/**
 * Structure for filter's methods used to set filter's options.
 * @var MSFilterMethodFunc
 */
typedef int (*MSFilterMethodFunc)(struct _MSFilter *f, void *arg);

/**
 * Structure for filter's methods used as a callback to notify events.
 * @var MSFilterNotifyFunc
 */
61
typedef void (*MSFilterNotifyFunc)(void *userdata, struct _MSFilter *f, unsigned int id, void *arg);
aymeric's avatar
aymeric committed
62 63 64 65 66 67 68 69 70 71 72 73

struct _MSFilterMethod{
	int id;
	MSFilterMethodFunc method;
};


/**
 * Structure for holding filter's methods to set filter's options.
 * @var MSFilterMethod
 */
typedef struct _MSFilterMethod MSFilterMethod;
74 75 76 77
/**
 * Filter's category
 *
 */
aymeric's avatar
aymeric committed
78
enum _MSFilterCategory{
79
	/**others*/
aymeric's avatar
aymeric committed
80
	MS_FILTER_OTHER,
81
	/**used by encoders*/
aymeric's avatar
aymeric committed
82
	MS_FILTER_ENCODER,
83
	/**used by decoders*/
aymeric's avatar
aymeric committed
84 85 86 87 88 89 90 91 92 93 94 95 96 97
	MS_FILTER_DECODER
};

/**
 * Structure to describe filter's category.
 * <PRE>
 *     MS_FILTER_OTHER
 *     MS_FILTER_ENCODER
 *     MS_FILTER_DECODER
 * </PRE>
 * @var MSFilterCategory
 */
typedef enum _MSFilterCategory MSFilterCategory;

98 99 100 101 102 103
enum _MSFilterFlags{
	MS_FILTER_IS_PUMP = 1
};

typedef enum _MSFilterFlags MSFilterFlags;

104 105 106 107 108 109 110

struct _MSFilterStats{
	const char *name; /*<filter name*/
	uint64_t elapsed; /*<cumulative number of nanoseconds elapsed */
	unsigned int count; /*<number of time the filter is called for processing*/
};

111
typedef struct _MSFilterStats MSFilterStats;
112

aymeric's avatar
aymeric committed
113 114 115 116 117 118 119 120 121 122 123 124 125 126
struct _MSFilterDesc{
	MSFilterId id;	/* the id declared in allfilters.h */
	const char *name; /* filter name */
	const char *text; /*some descriptive text*/
	MSFilterCategory category;
	const char *enc_fmt; /* must be set if MS_FILTER_ENCODER/MS_FILTER_DECODER */
	int ninputs; /*number of inputs */
	int noutputs; /*number of outputs */
	MSFilterFunc init;
	MSFilterFunc preprocess;	/* called once before processing */
	MSFilterFunc process;		/* called every tick to do the filter's job*/
	MSFilterFunc postprocess;	/*called once after processing */
	MSFilterFunc uninit;
	MSFilterMethod *methods;
127
	unsigned int flags;
aymeric's avatar
aymeric committed
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
};

/**
 * Structure for filter's description.
 * @var MSFilterDesc
 */
typedef struct _MSFilterDesc MSFilterDesc;

struct _MSFilter{
	MSFilterDesc *desc;
	/*protected attributes */
	ms_mutex_t lock;
	MSQueue **inputs;
	MSQueue **outputs;
	MSFilterNotifyFunc notify;
	void *notify_ud;
	void *data;
	struct _MSTicker *ticker;
	/*private attributes */
	uint32_t last_tick;
148
	MSFilterStats *stats;
aymeric's avatar
aymeric committed
149 150 151 152 153 154 155 156 157 158
	bool_t seen;
};


/**
 * Structure to create/link/unlink/destroy filter's object.
 * @var MSFilter
 */
typedef struct _MSFilter MSFilter;

159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
struct _MSConnectionPoint{
	MSFilter *filter;
	int pin;
};

/**
 * Structure that represents a connection point of a MSFilter
 * @var MSConnectionPoint
 */
typedef struct _MSConnectionPoint MSConnectionPoint;

struct _MSConnectionHelper{
	MSConnectionPoint last;
};

/**
 * Structure that holds data when using the ms_connection_helper_* functions.
 * @var MSConnectionHelper
**/
typedef struct _MSConnectionHelper MSConnectionHelper;

aymeric's avatar
aymeric committed
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200

#ifdef __cplusplus
extern "C"{
#endif

/**
 * Register a filter description. (plugins use only!)
 *
 * When you build your own plugin, this method will
 * add the encoder or decoder to the internal list
 * of supported codec. Then, this plugin can be used
 * transparently from the application.
 *
 * ms_filter_get_encoder, ms_filter_get_decoder,
 * ms_filter_create_encoder, ms_filter_create_decoder
 * and ms_filter_codec_supported
 * can then be used as if the codec was internally.
 * supported.
 *
 * @param desc    a filter description.
 */
Simon Morlat's avatar
Simon Morlat committed
201
MS2_PUBLIC void ms_filter_register(MSFilterDesc *desc);
aymeric's avatar
aymeric committed
202 203 204 205 206 207 208 209 210 211 212 213 214

/**
 * Retrieve encoders according to codec name.
 *
 * Internal supported codecs:
 *    PCMU, PCMA, speex, gsm
 * Existing Public plugins:
 *    iLBC
 *
 * @param mime    A string indicating the codec.
 *
 * Returns: a MSFilterDesc if successfull, NULL otherwise.
 */
Simon Morlat's avatar
Simon Morlat committed
215
MS2_PUBLIC MSFilterDesc * ms_filter_get_encoder(const char *mime);
aymeric's avatar
aymeric committed
216 217 218 219 220 221 222 223 224 225 226 227 228

/**
 * Retrieve decoders according to codec name.
 *
 * Internal supported codecs:
 *    PCMU, PCMA, speex, gsm
 * Existing Public plugins:
 *    iLBC
 *
 * @param mime    A string indicating the codec.
 *
 * Returns: a MSFilterDesc if successfull, NULL otherwise.
 */
Simon Morlat's avatar
Simon Morlat committed
229
MS2_PUBLIC MSFilterDesc * ms_filter_get_decoder(const char *mime);
aymeric's avatar
aymeric committed
230

231 232 233 234 235 236 237 238 239
/**
 * Lookup a mediastreamer2 filter using its name.
 * If found, the descriptor (MSFilterDesc) is returned.
 * This descriptor can be used to instanciate the filter using ms_filter_new_from_desc()
 * This function can be useful to query the presence of a filter loaded as a plugin, for example.
 *
 * @param name The filter name.
**/
MS2_PUBLIC MSFilterDesc *ms_filter_lookup_by_name(const char *filter_name);
240

aymeric's avatar
aymeric committed
241 242 243 244 245 246 247 248 249 250 251 252
/**
 * Create encoder filter according to codec name.
 *
 * Internal supported codecs:
 *    PCMU, PCMA, speex, gsm
 * Existing Public plugins:
 *    iLBC
 *
 * @param mime    A string indicating the codec.
 *
 * Returns: a MSFilter if successfull, NULL otherwise.
 */
Simon Morlat's avatar
Simon Morlat committed
253
MS2_PUBLIC MSFilter * ms_filter_create_encoder(const char *mime);
aymeric's avatar
aymeric committed
254 255 256 257 258 259 260 261 262 263 264 265 266

/**
 * Create decoder filter according to codec name.
 *
 * Internal supported codecs:
 *    PCMU, PCMA, speex, gsm
 * Existing Public plugins:
 *    iLBC
 *
 * @param mime    A string indicating the codec.
 *
 * Returns: a MSFilter if successfull, NULL otherwise.
 */
Simon Morlat's avatar
Simon Morlat committed
267
MS2_PUBLIC MSFilter * ms_filter_create_decoder(const char *mime);
aymeric's avatar
aymeric committed
268 269 270 271 272 273 274 275 276 277 278 279 280

/**
 * Check if a encode or decode filter exists for a codec name.
 *
 * Internal supported codecs:
 *    PCMU, PCMA, speex, gsm
 * Existing Public plugins:
 *    iLBC
 *
 * @param mime    A string indicating the codec.
 *
 * Returns: TRUE if successfull, FALSE otherwise.
 */
Simon Morlat's avatar
Simon Morlat committed
281
MS2_PUBLIC bool_t ms_filter_codec_supported(const char *mime);
aymeric's avatar
aymeric committed
282 283 284 285 286 287 288 289

/**
 * Create decoder filter according to a filter's MSFilterId.
 *
 * @param id     A MSFilterId identifier for the filter.
 *
 * Returns: a MSFilter if successfull, NULL otherwise.
 */
Simon Morlat's avatar
Simon Morlat committed
290
MS2_PUBLIC MSFilter *ms_filter_new(MSFilterId id);
aymeric's avatar
aymeric committed
291 292 293 294 295 296 297 298

/**
 * Create decoder filter according to a filter's name.
 *
 * @param name   A name for the filter.
 *
 * Returns: a MSFilter if successfull, NULL otherwise.
 */
Simon Morlat's avatar
Simon Morlat committed
299
MS2_PUBLIC MSFilter *ms_filter_new_from_name(const char *name);
aymeric's avatar
aymeric committed
300 301 302 303 304 305

/**
 * Create decoder filter according to a filter's description.
 *
 * The primary use is to create your own filter's in your
 * application and avoid registration inside mediastreamer2.
306
 *
aymeric's avatar
aymeric committed
307 308 309 310
 * @param desc   A MSFilterDesc for the filter.
 *
 * Returns: a MSFilter if successfull, NULL otherwise.
 */
Simon Morlat's avatar
Simon Morlat committed
311
MS2_PUBLIC MSFilter *ms_filter_new_from_desc(MSFilterDesc *desc);
aymeric's avatar
aymeric committed
312 313 314 315 316 317 318 319 320 321 322 323

/**
 * Link one OUTPUT pin from a filter to an INPUT pin of another filter.
 *
 * All data coming from the OUTPUT pin of one filter will be distributed
 * to the INPUT pin of the second filter.
 *
 * @param f1   A MSFilter object containing the OUTPUT pin
 * @param pin1 An index of an OUTPUT pin.
 * @param f2   A MSFilter object containing the INPUT pin
 * @param pin2 An index of an INPUT pin.
 *
324
 * Returns: 0 if sucessful, -1 otherwise.
aymeric's avatar
aymeric committed
325
 */
Simon Morlat's avatar
Simon Morlat committed
326
MS2_PUBLIC int ms_filter_link(MSFilter *f1, int pin1, MSFilter *f2, int pin2);
aymeric's avatar
aymeric committed
327 328 329 330 331 332 333 334 335

/**
 * Unlink one OUTPUT pin from a filter to an INPUT pin of another filter.
 *
 * @param f1   A MSFilter object containing the OUTPUT pin
 * @param pin1 An index of an OUTPUT pin.
 * @param f2   A MSFilter object containing the INPUT pin
 * @param pin2 An index of an INPUT pin.
 *
336
 * Returns: 0 if sucessful, -1 otherwise.
aymeric's avatar
aymeric committed
337
 */
Simon Morlat's avatar
Simon Morlat committed
338
MS2_PUBLIC int ms_filter_unlink(MSFilter *f1, int pin1, MSFilter *f2, int pin2);
aymeric's avatar
aymeric committed
339 340 341 342 343 344 345 346 347 348

/**
 * Call a filter's method to set or get options.
 *
 * @param f    A MSFilter object.
 * @param id   A private filter ID for the option.
 * @param arg  A private user data for the filter.
 *
 * Returns: 0 if successfull, -1 otherwise.
 */
Simon Morlat's avatar
Simon Morlat committed
349
MS2_PUBLIC int ms_filter_call_method(MSFilter *f, unsigned int id, void *arg);
aymeric's avatar
aymeric committed
350 351 352 353 354

/**
 * Call a filter's method to set options.
 *
 * @param f    A MSFilter object.
Simon Morlat's avatar
Simon Morlat committed
355
 * @param id   A method ID.
aymeric's avatar
aymeric committed
356 357 358
 *
 * Returns: 0 if successfull, -1 otherwise.
 */
Simon Morlat's avatar
Simon Morlat committed
359
MS2_PUBLIC int ms_filter_call_method_noarg(MSFilter *f, unsigned int id);
aymeric's avatar
aymeric committed
360

Simon Morlat's avatar
Simon Morlat committed
361 362 363 364 365 366 367 368 369 370 371

/**
 * Returns whether the filter implements a given method
 *
 * @param f    A MSFilter object.
 * @param id   A method ID.
 *
 * Returns: 0 if successfull, -1 otherwise.
 */
MS2_PUBLIC bool_t ms_filter_has_method(MSFilter *f, unsigned int id);

aymeric's avatar
aymeric committed
372 373
/**
 * Set a callback on filter's to be informed of private filter's event.
374 375 376
 * This callback is called from the filter's MSTicker, unless a global event queue
 * is created to receive all filter's notification asynchronously.
 * See ms_event_queue_new() for details.
aymeric's avatar
aymeric committed
377 378 379 380 381
 *
 * @param f        A MSFilter object.
 * @param fn       A MSFilterNotifyFunc that will be called.
 * @param userdata A pointer to private data.
 *
382
 *
aymeric's avatar
aymeric committed
383
 */
Simon Morlat's avatar
Simon Morlat committed
384
MS2_PUBLIC void ms_filter_set_notify_callback(MSFilter *f, MSFilterNotifyFunc fn, void *userdata);
aymeric's avatar
aymeric committed
385

386

aymeric's avatar
aymeric committed
387 388 389 390 391 392 393
/**
 * Get MSFilterId's filter.
 *
 * @param f        A MSFilter object.
 *
 * Returns: MSFilterId if successfull, -1 otherwise.
 */
Simon Morlat's avatar
Simon Morlat committed
394
MS2_PUBLIC MSFilterId ms_filter_get_id(MSFilter *f);
aymeric's avatar
aymeric committed
395

396 397 398 399 400 401

/**
 * Obtain the list of current filter's neighbours, ie filters that are part of same graph.
 *
 * Returns: a MSList of MSFilter, that needs to be freed by the caller when no more needed.
**/
Simon Morlat's avatar
Simon Morlat committed
402
MS2_PUBLIC MSList * ms_filter_find_neighbours(MSFilter *me);
403

aymeric's avatar
aymeric committed
404 405 406 407 408 409
/**
 * Destroy a filter object.
 *
 * @param f        A MSFilter object.
 *
 */
Simon Morlat's avatar
Simon Morlat committed
410
MS2_PUBLIC void ms_filter_destroy(MSFilter *f);
aymeric's avatar
aymeric committed
411

412 413 414 415 416 417
/**
 * Initialize a MSConnectionHelper.
 *
 * @param h A MSConnectionHelper, usually (but not necessarily) on stack
 *
**/
Simon Morlat's avatar
Simon Morlat committed
418
MS2_PUBLIC void ms_connection_helper_start(MSConnectionHelper *h);
419 420 421

/**
 * \brief Enter a MSFilter to be connected into the MSConnectionHelper object.
422
 *
423 424
 * This functions enters a MSFilter to be connected into the MSConnectionHelper
 * object and connects it to the last entered if not the first one.
425
 * The MSConnectionHelper is useful to reduce the amount of code necessary to create graphs in case
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448
 * the connections are made in an ordered manner and some filters are present conditionally in graphs.
 * For example, instead of writing
 * \code
 * ms_filter_link(f1,0,f2,1);
 * ms_filter_link(f2,0,f3,0);
 * ms_filter_link(f3,1,f4,0);
 * \endcode
 * You can write:
 * \code
 * MSConnectionHelper h;
 * ms_connection_helper_start(&h);
 * ms_connection_helper_link(&h,f1,-1,0);
 * ms_connection_helper_link(&h,f2,1,0);
 * ms_connection_helper_link(&h,f3,0,1);
 * ms_connection_helper_link(&h,f4,0,-1);
 * \endcode
 * Which is a bit longer to write here, but now imagine f2 needs to be present in the graph only
 * in certain conditions: in the first case you have rewrite the two first lines, in the second case
 * you just need to replace the fourth line by:
 * \code
 * if (my_condition) ms_connection_helper_link(&h,f2,1,0);
 * \endcode
 *
449
 * @param h a connection helper
450 451 452
 * @param f a MSFilter
 * @param inpin an input pin number with which the MSFilter needs to connect to previously entered MSFilter
 * @param outpin an output pin number with which the MSFilter needs to be connected to the next entered MSFilter
453
 *
454 455
 * Returns: the return value of ms_filter_link() that is called internally to this function.
**/
Simon Morlat's avatar
Simon Morlat committed
456
MS2_PUBLIC int ms_connection_helper_link(MSConnectionHelper *h, MSFilter *f, int inpin, int outpin);
457 458 459 460


/**
 * \brief Enter a MSFilter to be disconnected into the MSConnectionHelper object.
461
 * Process exactly the same way as ms_connection_helper_link() but calls ms_filter_unlink() on the
462 463
 * entered filters.
**/
Simon Morlat's avatar
Simon Morlat committed
464
MS2_PUBLIC int ms_connection_helper_unlink(MSConnectionHelper *h, MSFilter *f, int inpin, int outpin);
465

466 467

/**
Simon Morlat's avatar
Simon Morlat committed
468
 * \brief Enable processing time measurements statistics for filters.
469 470
 *
**/
Simon Morlat's avatar
Simon Morlat committed
471
MS2_PUBLIC void ms_filter_enable_statistics(bool_t enabled);
472

Simon Morlat's avatar
Simon Morlat committed
473 474 475 476 477

/**
 * \brief Reset processing time statistics for filters.
 *
**/
Simon Morlat's avatar
Simon Morlat committed
478
MS2_PUBLIC void ms_filter_reset_statistics(void);
479

480 481 482 483
/**
 * \brief Retrieves statistics for running filters.
 * Returns a list of MSFilterStats
**/
Simon Morlat's avatar
Simon Morlat committed
484
MS2_PUBLIC const MSList * ms_filter_get_statistics(void);
485

Simon Morlat's avatar
Simon Morlat committed
486 487
/**
 * \brief Logs runtime statistics for running filters.
488
 *
Simon Morlat's avatar
Simon Morlat committed
489
**/
Simon Morlat's avatar
Simon Morlat committed
490
MS2_PUBLIC void ms_filter_log_statistics(void);
491 492


aymeric's avatar
aymeric committed
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517
/* I define the id taking the lower bits of the address of the MSFilterDesc object,
the method index (_cnt_) and the argument size */
/* I hope using this to avoid type mismatch (calling a method on the wrong filter)*/
#define MS_FILTER_METHOD_ID(_id_,_cnt_,_argsize_) \
	(  (((unsigned long)(_id_)) & 0xFFFF)<<16 | (_cnt_<<8) | (_argsize_ & 0xFF ))

#define MS_FILTER_METHOD(_id_,_count_,_argtype_) \
	MS_FILTER_METHOD_ID(_id_,_count_,sizeof(_argtype_))

#define MS_FILTER_METHOD_NO_ARG(_id_,_count_) \
	MS_FILTER_METHOD_ID(_id_,_count_,0)


#define MS_FILTER_BASE_METHOD(_count_,_argtype_) \
	MS_FILTER_METHOD_ID(MS_FILTER_BASE_ID,_count_,sizeof(_argtype_))

#define MS_FILTER_BASE_METHOD_NO_ARG(_count_) \
	MS_FILTER_METHOD_ID(MS_FILTER_BASE_ID,_count_,0)

#define MS_FILTER_EVENT(_id_,_count_,_argtype_) \
	MS_FILTER_METHOD_ID(_id_,_count_,sizeof(_argtype_))

#define MS_FILTER_EVENT_NO_ARG(_id_,_count_)\
	MS_FILTER_METHOD_ID(_id_,_count_,0)

518 519 520 521 522 523
/**
 *  some MSFilter base generic methods:
 **/
/**
 * Set filter output/input sampling frequency in hertz
 */
aymeric's avatar
aymeric committed
524
#define MS_FILTER_SET_SAMPLE_RATE	MS_FILTER_BASE_METHOD(0,int)
525 526 527 528
/**
 * Get filter output/input sampling frequency in hertz
 */

aymeric's avatar
aymeric committed
529
#define MS_FILTER_GET_SAMPLE_RATE	MS_FILTER_BASE_METHOD(1,int)
530 531 532
/**
 * Set filter output network bitrate in bit per seconds, this value include IP+UDP+RTP overhead
 */
aymeric's avatar
aymeric committed
533
#define MS_FILTER_SET_BITRATE		MS_FILTER_BASE_METHOD(2,int)
534 535 536
/**
 * Get filter output network bitrate in bit per seconds, this value include IP+UDP+RTP overhead
 */
aymeric's avatar
aymeric committed
537 538 539
#define MS_FILTER_GET_BITRATE		MS_FILTER_BASE_METHOD(3,int)
#define MS_FILTER_GET_NCHANNELS		MS_FILTER_BASE_METHOD(5,int)
#define MS_FILTER_SET_NCHANNELS		MS_FILTER_BASE_METHOD(6,int)
540 541 542
/**
 * Set codec dependent attributes as taken from the SDP
 */
aymeric's avatar
aymeric committed
543
#define MS_FILTER_ADD_FMTP		MS_FILTER_BASE_METHOD(7,const char)
544

aymeric's avatar
aymeric committed
545 546 547
#define MS_FILTER_ADD_ATTR		MS_FILTER_BASE_METHOD(8,const char)
#define MS_FILTER_SET_MTU		MS_FILTER_BASE_METHOD(9,int)
#define MS_FILTER_GET_MTU		MS_FILTER_BASE_METHOD(10,int)
548 549
/**Filters can return their latency in milliseconds (if known) using this method:*/
#define MS_FILTER_GET_LATENCY	MS_FILTER_BASE_METHOD(11,int)
aymeric's avatar
aymeric committed
550

551

552 553 554 555 556
enum _MSFilterInterfaceId{
	MSFilterInterfaceBegin=16384,
	MSFilterPlayerInterface,
	MSFilterRecorderInterface,
	MSFilterVideoDisplayInterface,
557
	MSFilterEchoCancellerInterface,
558 559
	MSFilterVideoDecoderInterface,
	MSFilterVideoCaptureInterface,
Yann Diorcet's avatar
Yann Diorcet committed
560
	MSFilterDecoderInterface,
561
	MSFilterVideoEncoderInterface,
562 563
	MSFilterAudioCaptureInterface,
	MSFilterAudioPlaybackInterface,
564 565 566 567 568
};

typedef enum _MSFilterInterfaceId MSFilterInterfaceId;


569
/* more specific methods: to be moved into implementation specific header files*/
aymeric's avatar
aymeric committed
570 571 572 573 574 575 576 577 578
#define MS_FILTER_SET_FILTERLENGTH 	MS_FILTER_BASE_METHOD(12,int)
#define MS_FILTER_SET_OUTPUT_SAMPLE_RATE MS_FILTER_BASE_METHOD(13,int)
#define MS_FILTER_ENABLE_DIRECTMODE	MS_FILTER_BASE_METHOD(14,int)
#define MS_FILTER_ENABLE_VAD		MS_FILTER_BASE_METHOD(15,int)
#define MS_FILTER_GET_STAT_DISCARDED	MS_FILTER_BASE_METHOD(16,int)
#define MS_FILTER_GET_STAT_MISSED	MS_FILTER_BASE_METHOD(17,int)
#define MS_FILTER_GET_STAT_INPUT	MS_FILTER_BASE_METHOD(18,int)
#define MS_FILTER_GET_STAT_OUTPUT	MS_FILTER_BASE_METHOD(19,int)
#define MS_FILTER_ENABLE_AGC 		MS_FILTER_BASE_METHOD(20,int)
aymeric's avatar
aymeric committed
579
#define MS_FILTER_SET_PLAYBACKDELAY MS_FILTER_BASE_METHOD(21,int)
580 581 582
#define MS_FILTER_ENABLE_HALFDUPLEX MS_FILTER_BASE_METHOD(22,int)
#define MS_FILTER_SET_VAD_PROB_START MS_FILTER_BASE_METHOD(23,int)
#define MS_FILTER_SET_VAD_PROB_CONTINUE MS_FILTER_BASE_METHOD(24,int)
583
#define MS_FILTER_SET_MAX_GAIN  MS_FILTER_BASE_METHOD(25,int)
584
#define MS_VIDEO_CAPTURE_SET_AUTOFOCUS MS_FILTER_BASE_METHOD(26,int)
jehan's avatar
jehan committed
585
/* pass value of type MSRtpPayloadPickerContext copied by the filter*/
586 587
#define MS_FILTER_SET_RTP_PAYLOAD_PICKER MS_FILTER_BASE_METHOD(27,void*)
#define MS_FILTER_SET_OUTPUT_NCHANNELS	MS_FILTER_BASE_METHOD(28,int)
588

589
#define MS_CONF_SPEEX_PREPROCESS_MIC	MS_FILTER_EVENT(MS_CONF_ID, 1, void*)
590 591
#define MS_CONF_CHANNEL_VOLUME	MS_FILTER_EVENT(MS_CONF_ID, 3, void*)

aymeric's avatar
aymeric committed
592 593
/** @} */

594
/*protected/ private methods*/
aymeric's avatar
aymeric committed
595 596 597 598 599
void ms_filter_process(MSFilter *f);
void ms_filter_preprocess(MSFilter *f, struct _MSTicker *t);
void ms_filter_postprocess(MSFilter *f);
bool_t ms_filter_inputs_have_data(MSFilter *f);
void ms_filter_notify(MSFilter *f, unsigned int id, void *arg);
600
void ms_filter_notify_synchronous(MSFilter *f, unsigned int id, void *arg);
aymeric's avatar
aymeric committed
601 602 603 604 605 606 607 608 609
void ms_filter_notify_no_arg(MSFilter *f, unsigned int id);
#define ms_filter_lock(f)	ms_mutex_lock(&(f)->lock)
#define ms_filter_unlock(f)	ms_mutex_unlock(&(f)->lock)
void ms_filter_unregister_all(void);

#ifdef __cplusplus
}
#endif

610 611
#include "msinterfaces.h"

aymeric's avatar
aymeric committed
612 613 614 615
/* used by awk script in Makefile.am to generate alldescs.c */
#define MS_FILTER_DESC_EXPORT(desc)

#endif