[vlc-devel] [PATCH 2/3] input/decoder.c: fixed code-duplication

Filip Roséen filip at videolabs.io
Mon May 23 16:37:50 CEST 2016


> > -            if( p_packetizer->pf_get_cc )
> > -                DecoderGetCc( p_dec, p_packetizer );
> 
> You forgot DecoderGetCc that is done only for Video.
> I don't know if it can be done for audio too.

Oh my, that was indeed very stupid of me; thanks! `p_packetizer->pf_get_cc`
should be NULL for audio, given that it is initialized to such in LoadDecoder,
and grepping for "pf_get_cc" in modules/ yields:

    modules/stream_out/transcode/video.c:    id->p_decoder->pf_get_cc = NULL;
    modules/codec/libmpeg2.c:    p_dec->pf_get_cc = GetCc;
    modules/packetizer/h264.c:    p_dec->pf_get_cc = GetCc;
    modules/packetizer/mpegvideo.c:    p_dec->pf_get_cc = GetCc;
    modules/packetizer/vc1.c:    p_dec->pf_get_cc = GetCc;

However, this might be beyond my scope of knowledge at the current time, so if
this is potentially a breaking change (checkinf p_packetizer->pf_get_cc even if
the decoder is for audi).. well, then this patch certainly should not apply at
all.

And a refactor that stills removes the code duplication might not be worth the
removal of the code-duplication (as such would add complexity).

> Maybe put p_dec as the first argument (because every DecoderFoo use a
> decoder_t as a first arg)?

Very good point, see attached patch that address both issues you noted.

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20160523/68a98e84/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-input-decoder.c-fixed-code-duplication.patch
Type: text/x-diff
Size: 7673 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20160523/68a98e84/attachment.patch>


More information about the vlc-devel mailing list