[MPlayer-dev-eng] New audio filter layer finished

Arpi arpi at thot.banki.hu
Tue Oct 1 00:13:03 CEST 2002


Hi,

> I have finished the new audio filter layer (see attached diff). Please
> have a look, the diff doesn't brake anything, it actually works pretty
> well. 
> 
> I will put the filters in a new directory is that ok?  

first i wanted to say to no, but looking at your code it's independent
enough to be ok to put it into a new dir.

> I will commit in three days if no one has any objections.
please commit the libaf dir content asap. but only that!
it looks ok for me, but your modifications to libmpcodecs aren't ok.
i see that you also have problems with buffering there, and there are
other issues too: some codecs decodes at initialization state too!
also this check/workaround isn't too nice:

+    // Make sure the output data chunk will fit in the buffer
+    if(af_outputlen(sh_audio->audio_out_minsize) > maxlen)
+      return 0;

i would introduce a middle buffer. or even better using the current
audio_out buffer as 'decoded audio' and add a new buffer, probably outside
of sh_audio (it has no use to put it there) for the filtered audio waiting
for playback.

so:
demuxer -> (sh->audio_in_buf) -> decoder -> sh->audio_out_buf -> libaf -> playback_buf

the playback buffer could be allocated after decoder & af initialization, to
size af_outsize(size of sh->audio_out_buf)

we can either move af calls out of libmpcodecs (to mplayer/mencoder core) or
left it there, but fixing it to do filtering after codec initialization too,
as some codecs decodes small chunk of audio data at init state, to verify
that the DLL work or to detect various parameters, like frame size (exported
by audio decoder)...
while the later is not so clean, it's preferred as no duplicated code in
mplayer/mencoder/xxx (xxx=future projects using libmpcodecs :))

> If you want to test it apply the patch and try this:
> ./mplayer  -channels 4 -srate 48000  movie.avi

btw -srate is a different thing, at leats in mplayer.
it sets teh soundcard's playback rate but it isn't used for a-v calculation,
so using it in filters will confuse a-v sync.
we should either change -srate behaviour for mplayer or add a new switch.

btw 2.
your code seems to use statics for some important context/config storage.
it's ok _now_, but it will make paralell processing of multiple audio tracks
(interesting for mencoder) impossible :(

you should introduce a context/handle type parameter for the af API,
pointing to a struct conatining config/etc parameters of teh given audio
stream. i mean something like vf->priv for video filters.


A'rpi / Astral & ESP-team

--
Developer of MPlayer, the Movie Player for Linux - http://www.MPlayerHQ.hu



More information about the MPlayer-dev-eng mailing list