[MPlayer-dev-eng] Audio Filter howto?

Gustavo Sverzut Barbieri gsbarbieri at yahoo.com.br
Fri Jul 4 02:32:53 CEST 2003


 --- Anders Johansson <ajh at watri.org.au> escreveu: > 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.

I will use this to pass data to GOOM, a "Audio visualization"
library... so no need to be a perfect stream IMO.
   Anyway... I don't know if you remember some time ago (last
September) I did something like, but using 'fifo'... I had the problem
with blocking and stuff... 
   What do you think? It is better to try fifo and use 'select()' to
avoid blocking or go with mmap()?


> >    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.
>

Ok
 
> > 
> >    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.
> 

Only that? :)

> >    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
> 


Gustavo

_______________________________________________________________________
Yahoo! Mail
Mais espaço, mais segurança e gratuito: caixa postal de 6MB, antivírus, proteção contra spam.
http://br.mail.yahoo.com/



More information about the MPlayer-dev-eng mailing list