callbacks.h File Reference

Callback functions definitions for use in mad_decoder struct. More...

#include "mad.h"

Include dependency graph for callbacks.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Variables

enum mad_flow(* input_callback )(void *user_data, struct mad_stream *stream)
 The purpose of this callback is to (re)fill the stream buffer which is to be decoded.
enum mad_flow(* header_callback )(void *user_data, struct mad_header const *header)
 The function called after MPEG headers have been decoded .
enum mad_flow(* filter_callback )(void *user_data, struct mad_stream const *stream, struct mad_frame *)
 The filter callback function is called after decoding a frame, but before synthesis.
enum mad_flow(* output_callback )(void *user_data, struct mad_header const *header, struct mad_pcm *pcm)
 The purpose of this callback is to output (or play) the decoded PCM audio.
enum mad_flow(* error_callback )(void *user_data, struct mad_stream *stream, struct mad_frame *frame)
 The error callback function is called whenever a decoding error occurs.
enum mad_flow(* message_callback )(void *user_data, void *message, unsigned int *size)
 The message callback function is only used with MAD_DECODER_MODE_ASYNC, and is called whenever the parent process sends a message via mad_decoder_message().


Detailed Description

Callback functions definitions for use in mad_decoder struct.

See also:
decoder::run_sync for details.

Definition in file callbacks.h.


Variable Documentation

enum mad_flow(* error_callback)(void *user_data, struct mad_stream *stream, struct mad_frame *frame)

The error callback function is called whenever a decoding error occurs.

The error is indicated by stream->error; the list of possible MAD_ERROR_* errors can be found in the stream.h header file.

Parameters:
user_data This can hold whatever you want -- for example, song title, length, number of frames
stream the mad input stream the error occured in.
frame the mad frame the error occured in.
See also:
minimad::error() function for an example

decoder::error_default()

Referenced by run_sync().

enum mad_flow(* filter_callback)(void *user_data, struct mad_stream const *stream, struct mad_frame *)

The filter callback function is called after decoding a frame, but before synthesis.

Here it is possible to modify the frame's subband samples, for example to perform a uniform attenuation/amplification, or to do other special processing in the frequency domain.

Parameters:
user_data This can hold whatever you want
stream the mad input stream currently processed.
frame the MPEG frame just decoded.

enum mad_flow(* header_callback)(void *user_data, struct mad_header const *header)

The function called after MPEG headers have been decoded .

Parameters:
user_data This can hold whatever you want -- for example, song title, length, number of frames
header the mad header just read.

enum mad_flow(* input_callback)(void *user_data, struct mad_stream *stream)

The purpose of this callback is to (re)fill the stream buffer which is to be decoded.

Parameters:
user_data This can hold whatever you want
stream the mad input stream you need to fill.
See also:
minimad::input() function for an example

enum mad_flow(* message_callback)(void *user_data, void *message, unsigned int *size)

The message callback function is only used with MAD_DECODER_MODE_ASYNC, and is called whenever the parent process sends a message via mad_decoder_message().

This callback can generate a reply by overwriting the message buffer that is passed to it. (The size of the reply must be the same or smaller than the message.)

Parameters:
user_data This can hold whatever you want
message the message to send
size of the message
See also:
decoder::check_message() , decoder::send()

enum mad_flow(* output_callback)(void *user_data, struct mad_header const *header, struct mad_pcm *pcm)

The purpose of this callback is to output (or play) the decoded PCM audio.

It is called after each frame of MPEG audio data has been completely decoded.

Parameters:
user_data This can hold whatever you want
header the stream header
pcm the audio data to output.
See also:
minimad::output() function for an example


Generated on Tue Jun 10 12:14:17 2008 for libmad by  doxygen 1.5.5