[vlc-devel] [PATCH 01/10] [RFC] core: add demux-filter objects to intercept & filter demuxer calls

Steve Lhomme robux4 at gmail.com
Mon May 9 17:36:24 CEST 2016


On Mon, May 9, 2016 at 4:53 PM, Rémi Denis-Courmont <remi at remlab.net> wrote:
> Le 2016-05-09 13:18, Steve Lhomme a écrit :
>>
>> diff --git a/include/vlc_demux.h b/include/vlc_demux.h
>> index 45f5416..836adac 100644
>> --- a/include/vlc_demux.h
>> +++ b/include/vlc_demux.h
>> @@ -40,12 +40,23 @@
>>   * Demultiplexer modules interface
>>   */
>>
>> +#define DEMUX_FILTER_COMMON_MEMBERS                                  \
>> +    VLC_COMMON_MEMBERS                                               \
>> +    module_t    *p_module;                                           \
>> +    union {                                                          \
>> +        int (*pf_demux)       ( demux_t * );                         \
>> +        int (*pf_filter_demux)( demux_filter_t * );                  \
>> +    };                                                               \
>> +    union {                                                          \
>> +        int (*pf_control)( demux_t *, int i_query, va_list args);    \
>> +        int (*pf_filter_control)( demux_filter_t *, int i_query,
>> va_list args);        \
>> +    };                                                               \
>> +    demux_sys_t *p_sys;                                              \
>> +    demux_filter_t       *p_next;
>> +
>
>
> This is as ugly and unjustified as it was before.

Now that the demux_filter_t has no extra member I could make demux_t a
sub-class of demux_filter_t but that would involve an extra
indirection to access these members on all existing code.

The idea is that a demux_filter can be used in many places where a
demuxer is used when it's not the demuxer trying to access itself and
its finer/local details.

The unions were done to simplify typing of the demux filters with
stricter/safer typing.

In the end a demux filter may just be a demux_t with all the extra
fields not set (and the final demux_t having p_next to NULL). But I
think it will lead to a lot of errors in the code where a demux_t
would be assumed to be an actual demuxer and the top demux filter is
used instead. I did a pass on all the current code with the proper
typing to make sure it doesn't happen but in the future mistakes could
happen again if we don't have stronger typing.

> --
> Rémi Denis-Courmont
> http://www.remlab.net/
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list