[MPlayer-dev-eng] [PATCH] New commands for loading/unloading audio filters at runtime
Jehan Pagès
jehan.marmottard at gmail.com
Fri Apr 2 14:27:21 CEST 2010
Hi,
I already sent the patch a few days ago but maybe my messages went
over the radar as I had no answer, then I have just seen the patch doc
and figures it may be why I had no answer (especially not naming my
previous emails with [PATCH]). So I try again by following all the
rules (at least hopefully, tell me if I still do something wrong). :)
So this patch adds 4 commands:
./mplayer -input cmdlist |grep af
af_switch String
af_add String
af_del String
af_clr
1/ "af_switch" removes all your loaded filters and load the ones from
the comma-separated list of filters in parameter (with arguments if
necessary). The format is the same as the command line options -vf,
-vf-add, etc.
For instance running "af_switch scaletempo=speed=tempo,karaoke" would
first unload any currently loaded audio filters, then load the
scaletempo filter (with the arguments "speed=tempo") and the filter
karaoke.
2/ "af_add" is similar to af_switch except that it does not unload the
currently loaded filters (it adds the new list over the current list).
3/ "af_del" removes the filters from the comma-separated list of
filter's names in parameter (if a filter is loaded several times, it
does not removes all occurrences, but the first in the list).
Example: "af_del karaoke,scaletempo" unloads the first occurrences of
karaoke and scaletempo.
4/ af_clr unloads all currently audio filters.
- Interest of this patch: it allows me to add a filter on the fly, by
instance by binding a key to it (or for GUIs to add filter in an
easier way), without having to stop, run again the media file, then
seek to the previous timestamp again and again. For instance, if I
want to try and suppress the voice on a song with the karaoke filter,
with a simple binding, I can switch the voice on and off while playing
the song (if the voice is symetric in the stereo media, of course, but
this is just an example, not a discussion on the karaoke filter). Or
if I want to change the arguments of my scaletempo filter without
restarting, etc.
For me at least this is a killer feature. And I am sure other people
as well would find it interesting.
- Possible improvement note: af_add uses the af_add function in
libaf/af.h, which states:
* The filter will be inserted somewhere nice in the
* list of filters (i.e. at the beginning unless the
* first filter is the format filter (why??).
So this is a prepend function (but leaving the format filter always
first for some reason). I was thinking that it could be interesting to
have also an append function (because some combinations of audio
filter can definitely render differently depending on their order,
like effect pedals on instruments). But for this, the easier would be
to make the already existing af_append public from libaf/af.c. What do
you think? Can I do so?
So here it is. I hope my patch application is fine and that you will
find this feature useful. Tell me if I have to change anything to be
included in the repository.
Bye and thanks.
Jehan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mplayer_af_filters.patch.base64
Type: application/octet-stream
Size: 6151 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20100402/0880107d/attachment.obj>
More information about the MPlayer-dev-eng
mailing list