PM123 Decoder Plug-ins

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

     int  DLLENTRY decoder_init  ( void **w )
     BOOL DLLENTRY 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 DLLENTRY 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 decoder_plug.h file. The decoder necessarily should support following commands: DECODER_SETUP, DECODER_PLAY, DECODER_STOP and DECODER_JUMPTO.

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 DLLENTRY decoder_status( void *w )
     ULONG DLLENTRY 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 DLLENTRY decoder_fileinfo ( char *filename, DECODER_INFO *info )
     ULONG DLLENTRY 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 DLLENTRY decoder_cdinfo( char *drive, DECODER_CDINFO *info )

This is used by PM123 before calling decoder_trackinfo.

    ULONG DLLENTRY decoder_saveinfo( char* filename, DECODER_INFO* info );

It is called if it is necessary to change the meta information for the specified file and the decoder supports this feature. See decoder_support.

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

This is used by PM123 to suggest to the user what he can play with the decoder and what features are supported. Extentions can be for example "*.MOD".