[vlc-devel] [PATCH 2/4] subpicture private data condition

Yuval Tze yuvaltze at gmail.com
Fri Mar 25 17:07:41 CET 2011


When creating a subpicture with update functions, private data is also
created, otherwise it left null.
When calling subpicture update, there was an assumption that private data
was created if the subpicture contains update functions.

Subfilter2 may want to modify the subpicture update functions. so there may
be a situation that subpicture is created without update functions (and
private data) but eventually will have update functions (without private
data), and the assumption will be wrong.

Maybe the right solution is that subfilters2 will re-create subpictures with
their own update functions, but it seems to me like too much overhead.


2011/3/25 Rémi Denis-Courmont <remi at remlab.net>

> On Fri, 25 Mar 2011 00:22:50 +0200, Yuval Tze <yuvaltze at gmail.com> wrote:
> > check that the private data is not null before accessing it.
>
> Is it because private is NULL for sub, and non-NULL for sub2? It would be
> nice to include an explanatory comment in the patch for future generations
> of VLC developers ;-)
>
> > ---
> >  src/misc/subpicture.c |   10 +++++-----
> >  1 files changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/src/misc/subpicture.c b/src/misc/subpicture.c
> > index 3e84a27..a1ee386 100644
> > --- a/src/misc/subpicture.c
> > +++ b/src/misc/subpicture.c
> > @@ -152,11 +152,11 @@ void subpicture_Update( subpicture_t
> *p_subpicture,
> >      if( !p_upd->pf_validate )
> >          return;
> >      if( !p_upd->pf_validate( p_subpicture,
> > -                          !video_format_IsSimilar( p_fmt_src,
> > -                                                   &p_private->src ),
> > p_fmt_src,
> > -                          !video_format_IsSimilar( p_fmt_dst,
> > -                                                   &p_private->dst ),
> > p_fmt_dst,
> > -                          i_ts ) )
> > +                             p_private ? !video_format_IsSimilar(
> > p_fmt_src, &p_private->src ) : false,
> > +                             p_fmt_src,
> > +                             p_private ? !video_format_IsSimilar(
> > p_fmt_dst, &p_private->dst ) : false,
> > +                             p_fmt_dst,
> > +                             i_ts ) )
> >          return;
> >
> >      subpicture_region_ChainDelete( p_subpicture->p_region );
>
> --
> Rémi Denis-Courmont
> http://www.remlab.net/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20110325/46db2830/attachment.html>


More information about the vlc-devel mailing list