[vlc-devel] [PATCH 04/11] qt: save/retrieve video filters to/from the playlist

Thomas Guillem thomas at gllm.fr
Tue May 30 13:45:54 CEST 2017



On Mon, May 29, 2017, at 19:25, Rémi Denis-Courmont wrote:
> Le maanantaina 29. toukokuuta 2017, 18.52.58 EEST Thomas Guillem a écrit
> :
> > ---
> >  modules/gui/qt/components/extended_panels.cpp | 25
> > ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
> > 
> > diff --git a/modules/gui/qt/components/extended_panels.cpp
> > b/modules/gui/qt/components/extended_panels.cpp index
> > de070d3625..b66297ac30 100644
> > --- a/modules/gui/qt/components/extended_panels.cpp
> > +++ b/modules/gui/qt/components/extended_panels.cpp
> > @@ -93,13 +93,18 @@ static QString OptionFromWidgetName( QObject *obj )
> > 
> >  static inline void setup_vfilter( intf_thread_t *p_intf, const char*
> > psz_name, QWidget *widget ) {
> > -    vlc_object_t *p_obj = ( vlc_object_t * )
> > -        vlc_object_find_name( p_intf->obj.libvlc, psz_name );
> > +    const char *psz_filter_type = GetVFilterType( p_intf, psz_name );
> > +    if( psz_filter_type == NULL )
> > +        return;
> > +
> > +    char *psz_filters = var_InheritString( THEPL, psz_filter_type );
> > +    if( psz_filters == NULL )
> > +        return;
> > +
> >      QCheckBox *checkbox = qobject_cast<QCheckBox*>( widget );
> >      QGroupBox *groupbox = qobject_cast<QGroupBox*>( widget );
> > -    if( p_obj )
> > +    if( strstr( psz_filters, psz_name ) )
> 
> Substring search might lead to false positives.

OK

> 
> >      {
> > -        vlc_object_release( p_obj ); \
> >          if( checkbox ) checkbox->setChecked( true ); \
> >          else if (groupbox) groupbox->setChecked( true ); \
> >      }
> > @@ -108,6 +113,7 @@ static inline void setup_vfilter( intf_thread_t *p_intf,
> > const char* psz_name, Q if( checkbox ) checkbox->setChecked( false );
> >          else if (groupbox) groupbox->setChecked( false );
> >      }
> > +    free( psz_filters );
> >  }
> > 
> >  #define SETUP_VFILTER( widget ) \
> > @@ -309,13 +315,10 @@ static void ChangeVFiltersString( struct intf_thread_t
> > *p_intf, const char *psz_ /* Vout is not kept, so put that in the config */
> >      config_PutPsz( p_intf, psz_filter_type, qtu( result ) );
> > 
> > -    /* Try to set on the fly */
> > -    if( !strcmp( psz_filter_type, "video-splitter" ) )
> > -    {
> > -        playlist_t *p_playlist = THEPL;
> > -        var_SetString( p_playlist, psz_filter_type, qtu( result ) );
> > -    }
> > -    else
> > +    var_SetString( THEPL, psz_filter_type, qtu( result ) );
> > +
> > +    /* Try to set non splitter filters on the fly */
> > +    if( strcmp( psz_filter_type, "video-splitter" ) )
> >      {
> >          vout_thread_t *p_vout = THEMIM->getVout();
> >          if( p_vout )
> 
> Is that code executed during initialization as a side effect? If so, it
> *will* 
> cause races.

No, like before my changes, this code is executed only on user
interaction: if the user enable/disable a filter via the checkbox, or if
the user change a non command variable (that need a filter restart).

> 
> -- 
> 雷米‧德尼-库尔蒙
> https://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