MSFilters

Name

MSFilters -- The basic mediastreamer element.

Synopsis


#include <msfilter.h>


struct      MSFilter;
int         ms_filter_add_link              (MSFilter *m1,
                                             guchar pin1,
                                             MSFilter *m2,
                                             guchar pin2,
                                             int linktype);
int         ms_filter_remove_link           (MSFilter *m1,
                                             guchar pin1,
                                             MSFilter *m2,
                                             guchar pin2,
                                             int linktype);

Description

MSFilter is the base class for all mediastreamer processing filters: codec compression, soundcard read, souncard write, etc... MSFilter objects have to be linked between them to form a processing chain, that is then attached to a MSSync object (synchronisation source) in order to be scheduled for processing.

Details

struct MSFilter

struct MSFilter
{
	struct _MSFilterClass *klass;
	guchar finputs;   /* number of connected fifo inputs*/
	guchar foutputs;  /* number of connected fifo outputs*/
	guchar qinputs;   /* number of connected queue inputs*/
	guchar qoutputs;  /* number of connected queue outputs*/
	gint min_fifo_size; /* set when linking*/
	gint r_mingran;				/* read minimum granularity (for fifos).
					It can be zero so that the filter can accept any size of reading data*/
	MSFifo **infifos; /*pointer to a table of pointer to input fifos*/
	MSFifo **outfifos;  /*pointer to a table of pointer to output fifos*/
	MSQueue **inqueues;  /*pointer to a table of pointer to input queues*/
	MSQueue **outqueues;  /*pointer to a table of pointer to output queues*/
	void *sync;				/* the sync attached to this filter if it is a source */
};

Only programmers implementing derivated objects of MSFilter are interested by the content of the structure.


ms_filter_add_link ()

int         ms_filter_add_link              (MSFilter *m1,
                                             guchar pin1,
                                             MSFilter *m2,
                                             guchar pin2,
                                             int linktype);

This function links two MSFilter object between them. It must be used to make chains of filters. All data outgoing from pin1 of m1 will go to the input pin2 of m2. The way to communicate can be fifos or queues, depending of the nature of the filters. Filters can have multiple queue pins and multiple fifo pins, but most of them have only one queue input/output or only one fifo input/output. Fifos are usally used by filters doing audio processing, while queues are used by filters doing video processing.


ms_filter_remove_link ()

int         ms_filter_remove_link           (MSFilter *m1,
                                             guchar pin1,
                                             MSFilter *m2,
                                             guchar pin2,
                                             int linktype);

Unlink pin1 of filter m1 from pin2 of filter m2. linktype specifies what type of connection is removed.