Page 1 of 1

Enabling Audio Filters

Posted: 04 Jul 2013 19:48
by sherington
I am trying to resurrect my libvlc equalizer patch from last year.

With that old version of the patch I realise now that my main troubles were due to finding a reliable way to enable the equalizer audio filter at the right time, and especially to make sure it was enabled when an aout was created (the idea was the equalizer could be enabled after or *before* media started playing, and it's settings would automatically apply).

I have a much cleaner patch now that works very nicely (at least imho) but has one major problem - it requires that the equalizer filter be pre-enabled by passing "--audio-filter=equalizer" to libvlc_new. I can live with that personally, but clearly that is not ideal for the API, so I am trying to resolve it to dynamically enable/disable the filter as needed...

I have two scenarios:

1. Enable equalizer when an aout has been created (after media has started playing).
2. Enable equalizer when there is no aout created yet (before media has started playing).

For #1 it's quite easy to enable the audio filter. The "set equalizer" method in the libvlc media player can get a reference to the aout and enable the filter.

My problem is #2.

I'm in the "set equalizer" method in the libvlc media player, I set my new equalizer settings, but I don't have an aout so I can't enable the filter. Then a bit later I start the media playing and no equalizer is applied.

I don't know how/where to detect that an aout has been created and conditionally enable the filter at that point, or if I should be using a completely different approach.

The upshot is that right now my new patch works but relies on the filter being enabled at libvlc creation time, and to turn off the equalizer I basically reset all the equalizer variables back to 0 rather than disabling the filter.

So finally I get to my question: does anyone please have any suggestion on how I should be handling the enabling/disabling of this audio filter? Or is there some other way to do this that I should be looking at?

Re: Enabling Audio Filters

Posted: 04 Jul 2013 20:28
by Rémi Denis-Courmont
There are lot of similar cases. See how fullscreen is enabled without video output...

IMHO, the real problem is how to enable filters generically. We cannot add one new set of LibVLC functions for each and every A/V filter.

Re: Enabling Audio Filters

Posted: 05 Jul 2013 08:14
by sherington
Ok, thanks, I'll see if I can work it out.

On your other point about enabling filters generically, do you just mean something like mp->libvlc_media_player_enable_audio_filter(filtername), and this would work before media was playing, and then other methods to set the various specific filter values? Or something else?

Re: Enabling Audio Filters

Posted: 06 Jul 2013 10:03
by Rémi Denis-Courmont
I don't mind making a special case for equalization because of the presets. But there are many filters that people may want to use, and we cannot keep on adding specific functions for each and every one of them.