[vlc-devel] Plugin downmix-to-stereo
Jean-Baptiste Kempf
jb at videolan.org
Mon Feb 27 22:00:18 CET 2012
On Mon, Feb 27, 2012 at 09:43:59PM +0100, Jean-Baptiste Kempf wrote :
> +#include <vlc_block.h>
Unnecessary include.
> +#define DOWNMIX_MAX_OUTPUT_CHANNELS 6
Why not 8, btw?
> +/* define channel matrix for 5.0 surround audio */
> +#define DOWNMIX_FORMAT_5_0 ( AOUT_CHAN_LEFT | AOUT_CHAN_CENTER | AOUT_CHAN_RIGHT | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT )
> +
> +/* define channel matrix for 5.1 surround audio by adding an LFE channel */
> +#define DOWNMIX_FORMAT_5_1 ( DOWNMIX_FORMAT_5_0 | AOUT_CHAN_LFE )
6.1 and 7.1 are hard to do?
> +vlc_module_begin()
> +set_shortname(N_("Downmix to stereo"))
> +set_description(N_("Downmix from 5.x channels to stereo"))
> +set_help(N_("This channel mixer provides downward mixing from the 5.1 and 5.0 (surround) channel matrices to the 2.0 (stereo) channel matrix. It does so by applying the ITU-R BS.775-2 downward mixing matrix to the selected audio output channels and muting the remaining channels. LFE channel information is irrelevant for downward mixing and thus discarded."))
> +set_capability("audio filter", 3)
> +set_category(CAT_AUDIO)
> +set_subcategory(SUBCAT_AUDIO_AFILTER)
> +set_callbacks(Open, Close)
Please reindent!
And same for options.
> + /* initialise data structure */
> + p_sys->i_output_channel_left = var_CreateGetInteger(p_filter->p_parent,
> + "downmix2stereo-output-channel-left");
> + p_sys->i_output_channel_right = var_CreateGetInteger(p_filter->p_parent,
> + "downmix2stereo-output-channel-right");
> + p_sys->b_downmix_to_mono = var_CreateGetBool(p_filter->p_parent,
> + "downmix2stereo-downmix-to-mono");
var_InheritInteger is not ok for you?
> + /* check whether audio input and output formats match */
> + if (fmt_in.i_format != fmt_out.i_format)
> + {
> + /* display warning message and signal failure */
> + msg_Warn(p_filter, "audio input and output formats do not match");
> + return -1;
Please return VLC_EGENERIC;
> + else if (fmt_in.i_rate != fmt_out.i_rate)
> + {
> + /* display warning message and signal failure */
> + msg_Warn(p_filter, "audio input and output sample rates do not match");
> + return -1;
idem.
> + return -1;
and again.
> + msg_Info(p_filter, "detected compatible audio channel format");
Info? really?
> + return 0;
Please use VLC_SUCCESS
Rest seems ok
Best regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
More information about the vlc-devel
mailing list