Decoder Plug-ins

Decoder plug-ins must implement and export the functions defined in decoder_plug.h.

int _System decoder_init(void **w)
BOOL _System decoder_uninit(void *w)

Init function is called when pm123 needs the specified decoder to play the stream demanded by the user. So only one decoder plug-in is active at any given time. It should initialize the necessary semaphores and threads. decoder_uninit is called when another decoder than yours is needed, and should destroy the decoder's thread, semaphores, other opened handles and free allocated memory for w.

ULONG _System decoder_command(void *w, ULONG msg, DECODER_PARAMS *params)

There is a lot of commands to implement for this function. Parameters needed for each of the are described in the definition of the structure in the .h file.

The decoder plug-in MUST WinPostMsg() the following messages to hwnd:

Streaming metadata currently is for SHOUTcast (and icecast is using the same method), so it is a string with the following format:
StreamingTitle='blah blah';StreamingURL='more useless information';
Only StreamingTitle is used by pm123.

ULONG _System decoder_status(void *w)

ULONG _System decoder_length(void *w) The call to this function must be valid even if DECODER_STARTING or DECODER_STOPPED is reported (when the stream plays too fast for example).

ULONG _System decoder_fileinfo(char *filename, DECODER_INFO *info)
ULONG _System decoder_trackinfo(char *drive, int track, DECODER_INFO *info)

decoder_fileinfo and decoder_trackinfo (for CD decoders) must be independant from the current status of the decoder. It should always be functionnaly and give consistent results in any conditions.

ULONG _System decoder_cdinfo(char *drive, DECODER_CDINFO *info)

This is used by pm123 before calling decoder_trackinfo.

ULONG _System decoder_support(char *fileext[], int *size)

This is used by pm123 to suggest to the user what he can play with the decoder. Extentions can be for example "*.MOD".


Last revised April 7, 2001, Copyright © Taneli Leppä <rosmo@sektori.com>, Samuel Audet <guardia@cam.org>