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

Filip Roséen filip at videolabs.io
Mon May 23 17:45:27 CEST 2016


Attached is a patch that circumvents any potential issue by giving
DecoderDispatchBlock a new argument named `b_do_cc` which simply toggles any
potential invocation of `DecoderGetCc` on/off.

The pertinent changes compared to the previous patch are below:

    diff --git a/src/input/decoder.c b/src/input/decoder.c
    index d723acf..5e4fbf6 100644
    --- a/src/input/decoder.c
    +++ b/src/input/decoder.c
    @@ -1207,7 +1207,7 @@ static void DecoderProcessSpu( decoder_t *p_dec, block_t *p_block )
      * \param pf_decode pointer-to-function responsible for decoding the passed block
      **/ 
     static void DecoderDispatchBlock( decoder_t * p_dec, block_t * p_block,
    -  void( *pf_decode )( decoder_t*, block_t* ) )
    +  void( *pf_decode )( decoder_t*, block_t* ), bool b_do_cc )
     {
         decoder_owner_sys_t *p_owner = p_dec->p_owner;
     
    @@ -1236,7 +1236,7 @@ static void DecoderDispatchBlock( decoder_t * p_dec, block_t * p_block,
                     }   
                 }   
     
    -            if( p_packetizer->pf_get_cc )
    +            if( b_do_cc && p_packetizer->pf_get_cc )
                     DecoderGetCc( p_dec, p_packetizer );
     
                 while( p_packetized_block )
    @@ -1289,8 +1289,8 @@ static void DecoderProcess( decoder_t *p_dec, block_t *p_block )
     
         switch( p_dec->fmt_out.i_cat )
         {   
    -        case VIDEO_ES: return DecoderDispatchBlock( p_dec, p_block, &DecoderDecodeVideo );
    -        case AUDIO_ES: return DecoderDispatchBlock( p_dec, p_block, &DecoderDecodeAudio );
    +        case VIDEO_ES: return DecoderDispatchBlock( p_dec, p_block, &DecoderDecodeVideo,  true );
    +        case AUDIO_ES: return DecoderDispatchBlock( p_dec, p_block, &DecoderDecodeAudio, false );
             case   SPU_ES: return DecoderProcessSpu( p_dec, p_block );
     
             default:

See the attached file for the full patch.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20160523/382aa089/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-input-decoder.c-fixed-code-duplication.patch
Type: text/x-diff
Size: 7712 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20160523/382aa089/attachment-0001.patch>


More information about the vlc-devel mailing list