[vlc-devel] [vlc-commits] filter_chain: uniform filter_chain_Append{Converter, Filter} return type

Rémi Denis-Courmont remi at remlab.net
Sat Jul 1 20:30:21 CEST 2017


Le 1 juillet 2017 20:01:21 GMT+02:00, Thomas Guillem <thomas at gllm.fr> a écrit :
>
>On Sat, Jul 1, 2017, at 19:30, Rémi Denis-Courmont wrote:
>> Le 1 juillet 2017 18:24:48 GMT+02:00, Victorien Le Couviour--Tuffet
>> <git at videolan.org> a écrit :>> vlc | branch: master | Victorien Le
>Couviour--Tuffet
>>> <victorien.lecouviour.tuffet at gmail.com> | Fri Jun 23 10:24:16 2017
>>> +0200| [40bd2515d996a4b9c47b2199fac61a9fdea310bb] | committer:
>Thomas
>>> Guillem
>>>>> 
>>> 
>>> filter_chain: uniform filter_chain_Append{Converter,Filter}
>>> return type
>>>>>
>>>
>>>> 
>http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=40bd2515d996a4b9c47b2199fac61a9fdea310bb>>
>---
>>> 
>>> 
>>> 
>>>  include/vlc_filter.h                 |  5 ++---
>>> 
>>>  modules/stream_out/transcode/video.c |  2 +-
>>> 
>>>  modules/video_chroma/chain.c         | 10 +++++-----
>>> 
>>>  src/misc/filter_chain.c              |  4 ++--
>>> 
>>>  src/video_output/display.c           |  3 ++-
>>> 
>>>  src/video_output/video_output.c      |  4 ++--
>>> 
>>>  6 files changed, 14 insertions(+), 14 deletions(-)
>>> 
>>> 
>>> 
>>> diff --git a/include/vlc_filter.h b/include/vlc_filter.h
>>> 
>>> index a3ecc2c1b3..3db7281671 100644
>>> 
>>> --- a/include/vlc_filter.h
>>> 
>>> +++ b/include/vlc_filter.h
>>> 
>>> @@ -330,10 +330,9 @@ VLC_API filter_t
>>> *filter_chain_AppendFilter(filter_chain_t *chain,
>>>>>   * \param chain filter chain to append a filter to
>>> 
>>>   * \param fmt_in filter input format
>>> 
>>>   * \param fmt_out filter output format
>>> 
>>> - * \retval 0 on success
>>> 
>>> - * \retval -1 on failure
>>> 
>>> + * \return a pointer to the filter or NULL on error
>>> 
>>>   */
>>> 
>>> -VLC_API int filter_chain_AppendConverter(filter_chain_t *chain,
>>>>> +VLC_API filter_t *filter_chain_AppendConverter(filter_chain_t
>>> *chain,
>>>>>      const es_format_t *fmt_in, const es_format_t *fmt_out);
>>> 
>>>  
>>> 
>>>  /**
>>> 
>>> diff --git a/modules/stream_out/transcode/video.c
>>> b/modules/stream_out/transcode/video.c
>>>>> index 50b21bc0ff..b4bc000db3 100644
>>> 
>>> --- a/modules/stream_out/transcode/video.c
>>> 
>>> +++ b/modules/stream_out/transcode/video.c
>>> 
>>> @@ -69,7 +69,7 @@ static int video_update_format_decoder( decoder_t
>>> *p_dec )
>>>>>      filter_chain_Reset( test_chain, &p_dec->fmt_out,
>&p_dec->fmt_out
>>>      );
>>>>>  
>>> 
>>>      int chain_works = filter_chain_AppendConverter( test_chain,
>&p_dec-
>>>      >fmt_out,
>>>>> -                                  &id->p_encoder->fmt_in );
>>> 
>>> +                                                    &id->p_encoder-
>>>                                                      >fmt_in ) !=
>>>                                                      NULL ? 0 : -1;
>>>>>      filter_chain_Delete( test_chain );
>>> 
>>>      msg_Dbg( stream, "Filter chain testing done, input chroma %4.4s
>>>      seems to be %s for transcode",
>>>>>                       (char *)&p_dec->fmt_out.video.i_chroma,
>>> 
>>> diff --git a/modules/video_chroma/chain.c
>>> b/modules/video_chroma/chain.c
>>>>> index be4c26e611..eb20daa817 100644
>>> 
>>> --- a/modules/video_chroma/chain.c
>>> 
>>> +++ b/modules/video_chroma/chain.c
>>> 
>>> @@ -310,7 +310,7 @@ static int BuildFilterChain( filter_t *p_filter
>)
>>>>>          video_format_FixRgb(&fmt_mid.video);
>>> 
>>>  
>>> 
>>>          if( filter_chain_AppendConverter( p_filter->p_sys->p_chain,
>>>>> -                                          NULL, &fmt_mid ) ==
>>>                                            VLC_SUCCESS )
>>>>> +                                          NULL, &fmt_mid ) )
>>> 
>>>          {
>>> 
>>>              if( filter_chain_AppendFilter(
>p_filter->p_sys->p_chain,
>>>>>                                             p_filter->psz_name,
>p_filter-
>>>                                             >p_cfg,
>>>>> @@ -355,8 +355,8 @@ static int CreateChain( filter_t *p_parent,
>>> es_format_t *p_fmt_mid )
>>>>>      }
>>> 
>>>      else
>>> 
>>>      {
>>> 
>>> -        if( filter_chain_AppendConverter( p_parent->p_sys->p_chain,
>>>>> -                                          NULL, p_fmt_mid ) )
>>> 
>>> +        if( !filter_chain_AppendConverter(
>p_parent->p_sys->p_chain,
>>>>> +                                           NULL, p_fmt_mid ) )
>>> 
>>>              return VLC_EGENERIC;
>>> 
>>>      }
>>> 
>>>  
>>> 
>>> @@ -368,8 +368,8 @@ static int CreateChain( filter_t *p_parent,
>>> es_format_t *p_fmt_mid )
>>>>>      }
>>> 
>>>      else
>>> 
>>>      {
>>> 
>>> -        if( filter_chain_AppendConverter( p_parent->p_sys->p_chain,
>>>>> -                                          p_fmt_mid, NULL ) )
>>> 
>>> +        if( !filter_chain_AppendConverter(
>p_parent->p_sys->p_chain,
>>>>> +                                           p_fmt_mid, NULL ) )
>>> 
>>>              goto error;
>>> 
>>>      }
>>> 
>>>      return VLC_SUCCESS;
>>> 
>>> diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
>>> 
>>> index 741a63c9ad..7e038dbbb8 100644
>>> 
>>> --- a/src/misc/filter_chain.c
>>> 
>>> +++ b/src/misc/filter_chain.c
>>> 
>>> @@ -274,11 +274,11 @@ filter_t *filter_chain_AppendFilter(
>>> filter_chain_t *chain,
>>>>>                                       fmt_in, fmt_out );
>>> 
>>>  }
>>> 
>>>  
>>> 
>>> -int filter_chain_AppendConverter( filter_chain_t *chain,
>>> 
>>> +filter_t *filter_chain_AppendConverter( filter_chain_t *chain,
>>> 
>>>      const es_format_t *fmt_in, const es_format_t *fmt_out )
>>> 
>>>  {
>>> 
>>>      return filter_chain_AppendInner( chain, NULL, chain->conv_cap,
>>>      NULL,
>>>>> -                                     fmt_in, fmt_out ) != NULL ?
>0 :
>>>                                       -1;
>>>>> +                                     fmt_in, fmt_out );
>>> 
>>>  }
>>> 
>>>  
>>> 
>>>  void filter_chain_DeleteFilter( filter_chain_t *chain, filter_t
>>>  *filter )
>>>>> diff --git a/src/video_output/display.c
>b/src/video_output/display.c
>>>>> index aaa24b053d..57210df5fd 100644
>>> 
>>> --- a/src/video_output/display.c
>>> 
>>> +++ b/src/video_output/display.c
>>> 
>>> @@ -462,7 +462,8 @@ static int
>>> VoutDisplayCreateRender(vout_display_t *vd)
>>>>>          es_format_InitFromVideo(&dst, i == 0 ? &v_dst :
>&v_dst_cmp);
>>>>>  
>>> 
>>>          filter_chain_Reset(osys->filters, &src, &dst);
>>> 
>>> -        ret = filter_chain_AppendConverter(osys->filters, &src,
>>>          &dst);
>>>>> +        ret = filter_chain_AppendConverter(osys->filters, &src,
>>>          &dst)
>>>>> +            != NULL ? 0 : -1;
>>> 
>>>          es_format_Clean(&dst);
>>> 
>>>          if (ret == 0)
>>> 
>>>              break;
>>> 
>>> diff --git a/src/video_output/video_output.c
>>> b/src/video_output/video_output.c
>>>>> index c1ddc6a4d5..e46859ddd1 100644
>>> 
>>> --- a/src/video_output/video_output.c
>>> 
>>> +++ b/src/video_output/video_output.c
>>> 
>>> @@ -854,8 +854,8 @@ static void
>>> ThreadChangeFilters(vout_thread_t *vout,
>>>>>  
>>> 
>>>      if (!es_format_IsSimilar(&fmt_current, &fmt_target)) {
>>> 
>>>          msg_Dbg(vout, "Adding a filter to compensate for format
>>>          changes");
>>>>> -        if (filter_chain_AppendConverter(vout->p-
>>>          >filter.chain_interactive,
>>>>> -                                         &fmt_current,
>&fmt_target)
>>>                                           != 0) {
>>>>> +        if (!filter_chain_AppendConverter(vout->p-
>>>          >filter.chain_interactive,
>>>>> +                                          &fmt_current,
>>>                                            &fmt_target)) {
>>>>>              msg_Err(vout, "Failed to compensate for the format
>>>              changes, removing all filters");
>>>>>              ThreadDelAllFilterCallbacks(vout);
>>> 
>>>              filter_chain_Reset(vout->p->filter.chain_static,
>>>              &fmt_target, &fmt_target);
>>>>> 
>>> 
>>> 
>>> 
>>> vlc-commits mailing list
>>> 
>>> vlc-commits at videolan.org
>>> 
>>> https://mailman.videolan.org/listinfo/vlc-commits
>>> 
>> 
>> Repeating myself but WTF? This is counter-sensical.WTFF will you do
>> with the conversion filter pointer, which can't have variables, and
>> how the heck is this going to work with when the conversion chaining
>> is fixed (like audio already was)?!
>Language.
>
>>  -- 
>>  Rémi Denis-Courmont
>>  Typed on an inconvenient virtual keyboard 
>> _________________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel

Blah. If you don't want unpleasant feedback don't defer so much unpolished or poorly designed code for review work by so few unpaid people (mostly me really, in fact).

Nobody wouldn't be frustrated with having to do that.
-- 
Rémi Denis-Courmont
Typed on an inconvenient virtual keyboard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170701/9357d139/attachment.html>


More information about the vlc-devel mailing list