[MPlayer-dev-eng] Audio Filter howto?

Anders Johansson ajh at watri.org.au
Fri Jul 4 02:15:30 CEST 2003


Hi Gustavo,

> Hello,
> 
>    I'm trying to create a af_export, that is, a audio filter that
> exports the sound from mplayer.
>    I'm doing that because I need the audio from mplayer to use with
> another software I'll work... that software needs 2 channel with 512
> samples int16.

Dos it neeed a continous stream of samples or is it OK if you get a
chunk every now and then. The reasonm I ask is that if you need a
continous stream then mmap may not be the best solution, it would
probably be a lot better to use some sort of pipe.

>    Ok, I looked at af.h and af_volume.c to get a idea on how to do
> that... but I still have some questions.
>    
>    af->data will have valid values?

yes, but you never know how many. Look af af_delay for examples of
buffering.

> 
>    How to convert data->audio (from play()) to 2 ch with 512 int16
> samples?

You don't have to just set 

af->data->format = AF_FORMAT_SI | AF_FORMAT_NE;
af->data->bps    = 2;

and return FALSE from AF_CONTROL_REINIT, until af->data->format and
af->data->bps are correct (AF_CONTROL_REINIT is called many times).
af_format will automagically be inserted to give you your desired
sample format.

>    What is the best form to export data? I'm thinking to use mmap(),
> but I never used it, so need to learn... anyone to give me some
> examples / pointers ?

See above.

> Sorry for that amount of questions... hope that you will help me :)
> 
> Gustavo

Good luck,
//Anders






More information about the MPlayer-dev-eng mailing list