[vlc-devel] Dynamic range compressor patch

Rémi Denis-Courmont remi at remlab.net
Thu Jun 24 22:46:33 CEST 2010


On Thu, 24 Jun 2010 21:05:42 +0200, Laurent Aimar <fenrir at elivagar.org>
wrote:
>  Doing a small float cliping function would reduce the code (and so
> improve readability) IMHO.

Yes.

>  You may also create only one callback and check the value of psz_cmd
> inside but that depends on one preferences.

I really don't like that pattern. The code would not really be any simpler,
with all those strcmp() around. If the clipping values were identical, we
could have passed a float pointer as p_data (p_sys can be retrieved from
p_this), and then:
   *(float *)p_data = newval.f_float;
But the clipping values are different, so it won't work. Then I strongly
prefer one callback per variable.

But the worse part is, this (anti-)pattern tends to get overused and you
get multiplexed callbacks that do almost completely unrelated things
depending on psz_cmd. This is confusing, and sometimes makes locking more
difficult rather than easier.

-- 
Rémi Denis-Courmont
http://www.remlab.net
http://fi.linkedin.com/in/remidenis




More information about the vlc-devel mailing list