BASS_Encode_StopEx

Frees an encoder or all encoders on a channel, optionally delaying it until queued data has been processed.

BOOL BASS_Encode_StopEx(
    DWORD handle,
    DWORD flags
);

Parameters

handleThe encoder or channel handle... a HENCODE, HSTREAM, HMUSIC, or HRECORD.
flagsA combination of these flags.
BASS_ENCODE_STOP_WAITWait for queued data to be processed. The encoder will be freed once any data remaining in its queue has been processed, and it will not accept any new data in the meantime. This is ignored if the encoder does not have a queue.
BASS_ENCODE_STOP_ASYNCAsynchronously wait for queued data to be processed. This does the same as BASS_ENCODE_STOP_WAIT except that the processing does not happen within the function call. If neither flag is specified then any queued data is discarded.
BASS_ENCODE_STOP_TERMINATEOverride the BASS_CONFIG_ENCODE_TERMINATE setting with the value in the HIWORD - use MAKELONG(flags,timeout).

Return value

If successful, TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_HANDLEhandle is not valid.

Remarks

When the BASS_ENCODE_STOP_ASYNC flag is used to free asynchronously, BASS_Encode_SetNotify can be used to get notification of when the encoder is actually freed. BASS_Encode_Stop (or this function with no flags) can subsequently be used to cancel the queue processing and free the encoder immediately.

A command-line encoder process (eg. started by BASS_Encode_Start) will be forcefully terminated if it does not finish up within a period determined by the BASS_CONFIG_ENCODE_TERMINATE config option or the BASS_ENCODE_STOP_TERMINATE flag.

See also

BASS_Encode_Start, BASS_Encode_Stop