# MSFilters

## Name

MSFilters -- The basic mediastreamer element.

## Synopsis

    #include <msfilter.h>

                MSFilter;
    int         ms_filter_add_link              (MSFilter *m1,
                                                 MSFilter *m2);

## 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

### MSFilter

    typedef struct {
    	struct _MSFilterClass *klass;
    	GMutex *lock;
    	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*/
    	MSFilterNotifyFunc notify_event;
    	gpointer userdata;
    } MSFilter;

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

struct _MSFilterClass *`klass`; | Pointer to the class structure.
GMutex *`lock`; |
guchar `finputs`; | Number of fifo inputs currently in use.
guchar `foutputs`; | Number of fifo outputs currently in use.
guchar `qinputs`; | Number of queue inputs currently in use.
guchar `qoutputs`; | Number of queue outputs currently in use.
gint `min_fifo_size`; |
gint `r_mingran`; |
MSFifo **`infifos`; | Pointer to a table of fifo inputs
MSFifo **`outfifos`; | Pointer to a table of ffo ouputs
MSQueue **`inqueues`; | Pointer to a table of queue inputs
MSQueue **`outqueues`; | Pointer to a table of queue qoutputs
MSFilterNotifyFunc `notify_event`; |
gpointer `userdata`; |

### ms_filter_add_link ()

    int         ms_filter_add_link              (MSFilter *m1,
                                                 MSFilter *m2);

`m1` : |
`m2` : |
Returns : |