[vlc-devel] [RFC] Regarding the use of *_Control()
Pierre d'Herbemont
pdherbemont at free.fr
Mon Apr 14 13:27:41 CEST 2008
Hi,
I am wondering why *_Control() type function are used a lot in VLC.
To sum up:
*_Control( obj, CONTROL, args...)
{
switch(CONTROL)
{
case TYPE:
break;
...
}
}
To me this produce some difficultly readable code, such as:
- demux_Control( in->p_demux, DEMUX_SET_NEXT_DEMUX_TIME, i_time )
Where:
- demux_set_next_demux_time( in->p_demux, i_time )
should have been enough.
I do understand that to do subclassing, and to add new functionality
to Control() function without breaking the ABI is quite easy.
I do doubt that this is a nice habit, and having internal function
pointers would have been much cleaner IMO. (no need to switch(), it's
easy to see if a function is supported or not, etc.)
For now I do plan to remove all public call to demux_Control, and
internalize them. (Next up would be to completely remove them...)
What do you think?
Pierre.
More information about the vlc-devel
mailing list