Type Alias FLAC__StreamDecoderLengthCallback

Source
pub type FLAC__StreamDecoderLengthCallback = Option<unsafe extern "C" fn(decoder: *const FLAC__StreamDecoder, stream_length: *mut FLAC__uint64, client_data: *mut c_void) -> FLAC__StreamDecoderLengthStatus>;
Expand description

Signature for the length callback.

A function pointer matching this signature may be passed to FLAC__stream_decoder_init*_stream(). The supplied function will be called when the decoder wants to know the total length of the stream in bytes.

Here is an example of a length callback for stdio streams: \code FLAC__StreamDecoderLengthStatus length_cb(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data) { FILE file = ((MyClientData)client_data)->file; struct stat filestats;

if(file == stdin) return FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED; else if(fstat(fileno(file), &filestats) != 0) return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR; else { *stream_length = (FLAC__uint64)filestats.st_size; return FLAC__STREAM_DECODER_LENGTH_STATUS_OK; } } \endcode

\note In general, FLAC__StreamDecoder functions which change the state should not be called on the \a decoder while in the callback.

\param decoder The decoder instance calling the callback. \param stream_length A pointer to storage for the length of the stream in bytes. \param client_data The callee’s client data set through FLAC__stream_decoder_init_*(). \retval FLAC__StreamDecoderLengthStatus The callee’s return status.

Aliased Type§

pub enum FLAC__StreamDecoderLengthCallback {
    None,
    Some(unsafe extern "C" fn(*const FLAC__StreamDecoder, *mut u64, *mut c_void) -> u32),
}

Variants§

§1.0.0

None

No value.

§1.0.0

Some(unsafe extern "C" fn(*const FLAC__StreamDecoder, *mut u64, *mut c_void) -> u32)

Some value of type T.