PM123 Filter Plug-ins

Filter plug-ins must implement and export the functions defined in filter_plug.h. The interface has changed with plug-in level 2. Although they look very similar they are completely different.

Interface level 3 (current)

     ULONG DLLENTRY filter_init(void** f, FILTER_PARAMS2* params)

A level 3 filter plug-in may completely virtualize the output of data. It may change the sampling rate, it may change the number of bytes per samples or even the time axis. See the output plug-in interface description for detailed information on the different functions.

     void DLLENTRY filter_update(void* f, const FILTER_PARAMS2* params)

This function is called to update the procedure entry points and the callback pointers that you received at the filter_init call. This will be used to load and/or unload filters at runtime by future versions of PM123. Be sure that the replacement of the entry points is an atomic operation.

     BOOL DLLENTRY filter_uninit(void* f)

Uninitialize the plug-in, free any storage related to f and return TRUE unless you are in real big trouble.

Interface level 1 (supported by proxy)

     ULONG DLLENTRY filter_init  (void** f, FILTER_PARAMS* params)
BOOL DLLENTRY filter_uninit(void* f)

The filter_init function is called when filter plug-in is about to be used. Multiple filter plug-ins are chained, so the pointers to output_play_samples and it's parameter f, might belong to another filter plug-in and not necessarily to the active output plug-in.

     int DLLENTRY filter_play_samples(void* f, FORMAT_INFO* format, char* buf,
int len, int posmarker)

This function is called by the decoder or a previous in chain filter plug-in to filter samples. Note that this function's prototype is identical to output_play_samples. This makes it possible to chain filter plug-ins.

Once you have modified the data in satisfactory way, call the output_play_samples function with it's parameter f received from the init function, and use it with the modified samples of your filter plug-in.