I'm writing an Audio Filter Module similiar to the Headphone Effect, but to give a more realistic effect it is able to load SOFA (http://www.sofaconventions.org) files and read the SimpleFreeFieldHRIR data. So it is possible to load different (measured or simulated) HeadRelatedTransferFunctions. The idea is to use these transfer functions for different loudspeaker positions with the according input channel and get so a spatialized effect of the loudspeakers over headphones.
I stumbled on some problems with the VLCcore and to set the right parameters for the filter. For this Module to work I need a specific samplerate to match the samplerate in the loaded file. Additionaly my wish is to support from Mono to 8.1 of Audio for input, but the output of the module and preferably the output itself is to be always stereo. Any other output format is pointless. In the Open() Function I get the i_SamRate with the desired Samplerate in Hertz.
Code: Select all
filter_t *p_filter = (filter_t *)p_this;
...
p_filter->fmt_in.audio.i_rate = i_SamRate;
p_filter->fmt_out.audio.i_rate = p_filter->fmt_in.audio.i_rate;
p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32 ;
p_filter->fmt_out.audio = p_filter->fmt_in.audio;
p_filter->fmt_out.audio.i_channels = 2;
p_filter->fmt_out.audio.i_physical_channels = 0x6;
p_filter->fmt_out.audio.i_original_channels = 0x6;
Problem 1.) If I load a .wav file with a different samplingrate than the SOFA file vlc crashes. Mp3s and Ogg files get correct resampled.
Code: Select all
*** Error in `./vlc': free(): invalid next size (normal): 0xa47d6d18 ***
======= Backtrace: =========
/lib/i386-linux-gnu/libc.so.6(+0x767e2)[0xb75ad7e2]
/lib/i386-linux-gnu/libc.so.6(+0x77530)[0xb75ae530]
/home/andreasfuchs/vlc-2.1.0-rc1/src/.libs/libvlccore.so.5(+0x8167b)[0xb74c567b]
/home/andreasfuchs/vlc-2.1.0-rc1/modules/audio_filter/.libs/libsimple_channel_mixer_plugin.so(+0x1dfe)[0xa4e26dfe]
/home/andreasfuchs/vlc-2.1.0-rc1/src/.libs/libvlccore.so.5(aout_FiltersPlay+0x135)[0xb74b9525]
/home/andreasfuchs/vlc-2.1.0-rc1/src/.libs/libvlccore.so.5(+0x73444)[0xb74b7444]
/home/andreasfuchs/vlc-2.1.0-rc1/src/.libs/libvlccore.so.5(+0x39300)[0xb747d300]
/home/andreasfuchs/vlc-2.1.0-rc1/src/.libs/libvlccore.so.5(+0x3a8f9)[0xb747e8f9]
/home/andreasfuchs/vlc-2.1.0-rc1/src/.libs/libvlccore.so.5(+0x3aae2)[0xb747eae2]
/lib/i386-linux-gnu/libpthread.so.0(+0x6d78)[0xb76f6d78]
/lib/i386-linux-gnu/libc.so.6(clone+0x5e)[0xb76283de]
======= Memory map: ========
...
a4700000-a47f2000 rw-p 00000000 00:00 0
a47f2000-a4800000 ---p 00000000 00:00 0
...(core dumped)
Problem 2.) If I have a mono file for input, the output is still mono (except i set the output module fix to stereo like the alsa driver on linux.) Is there a fix for example the pulse audio driver? It would be nice not to be dependet on the output driver or the user to manually set the stereo mode. If i have more channels than stereo the output of the filter is also mixed to more channels, which is pointless. The problem here is the policy to give the output the same number of channels as the input, but in my case this is rather unfortunate. What shall I or can I do?
I'm not sure how to contribute this plugin. Shall I just push it to the master branch? It is one Module *.c file, additionally I edited three files of the qt4 interface to control it. I added the netcdf library and at this point it need to be installed in /usr/local/ to compile and run ( or the vlc directory when cross compiled for windows). Later some help how to put external libraries inside the vlc directories to compile and run (included precompiled dlls for windows) will be appreciated.
Thanks,
Andi