[vlc-devel] [PATCH 12/26] video context: add a Create/Release function for the video context

Thomas Guillem thomas at gllm.fr
Mon Sep 23 15:45:00 CEST 2019


On Mon, Sep 23, 2019, at 15:42, Thomas Guillem wrote:
> 
> 
> On Fri, Sep 20, 2019, at 16:28, Steve Lhomme wrote:
> > ---
> >  include/vlc_picture.h       |  3 +++
> >  src/input/decoder_helpers.c | 15 +++++++++++++++
> >  src/libvlccore.sym          |  2 ++
> >  src/video_output/display.c  | 10 ++++++----
> >  4 files changed, 26 insertions(+), 4 deletions(-)
> > 
> > diff --git a/include/vlc_picture.h b/include/vlc_picture.h
> > index c314c9c2075..99495ca43a4 100644
> > --- a/include/vlc_picture.h
> > +++ b/include/vlc_picture.h
> > @@ -85,6 +85,9 @@ typedef struct vlc_video_context
> >      vlc_decoder_device *device;
> >  } vlc_video_context;
> >  
> > +VLC_API vlc_video_context * vlc_video_context_Create(vlc_decoder_device *);
> > +VLC_API void vlc_video_context_Release(vlc_video_context *);
> 
> Call it Destroy if there is no refcount.

Forget this review, refcount are added in the next commit.

> 
> > +
> >  /**
> >   * Video picture
> >   */
> > diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
> > index 96001db5ba0..6a9a106aefa 100644
> > --- a/src/input/decoder_helpers.c
> > +++ b/src/input/decoder_helpers.c
> > @@ -190,3 +190,18 @@ vlc_decoder_device_Release(vlc_decoder_device *device)
> >          vlc_object_delete(device);
> >      }
> >  }
> > +
> > +/* video context */
> > +
> > +vlc_video_context * vlc_video_context_Create(vlc_decoder_device *device)
> > +{
> > +    vlc_video_context *vctx = malloc(sizeof(*vctx));
> > +    if (unlikely(vctx == NULL))
> > +        return NULL;
> > +    vctx->device = device;
> > +    return vctx;
> > +}
> > +void vlc_video_context_Release(vlc_video_context *vctx)
> > +{
> > +    free(vctx);
> > +}
> > diff --git a/src/libvlccore.sym b/src/libvlccore.sym
> > index fb2952ee5ef..ab065f94bf4 100644
> > --- a/src/libvlccore.sym
> > +++ b/src/libvlccore.sym
> > @@ -941,3 +941,5 @@ vlc_media_tree_Unlock
> >  vlc_media_tree_Find
> >  vlc_media_tree_Preparse
> >  vlc_viewpoint_to_4x4
> > +vlc_video_context_Create
> > +vlc_video_context_Release
> > diff --git a/src/video_output/display.c b/src/video_output/display.c
> > index 97603317d17..7b550334dba 100644
> > --- a/src/video_output/display.c
> > +++ b/src/video_output/display.c
> > @@ -770,13 +770,11 @@ vout_display_t *vout_display_New(vlc_object_t *parent,
> >      if (owner)
> >          vd->owner = *owner;
> >  
> > -    vlc_video_context fake_vctx = {
> > -        .device = dec_device,
> > -    };
> > +    vlc_video_context *fake_vctx = vlc_video_context_Create(dec_device);
> >  
> >      if (vlc_module_load(vd, "vout display", module, module && *module != '\0',
> >                          vout_display_start, vd, &osys->cfg, &vd->fmt,
> > -                        &fake_vctx) == NULL)
> > +                        fake_vctx) == NULL)
> >          goto error;
> >  
> >  #if defined(__OS2__)
> > @@ -798,8 +796,12 @@ vout_display_t *vout_display_New(vlc_object_t *parent,
> >          video_format_Clean(&vd->fmt);
> >          goto error;
> >      }
> > +    if (fake_vctx)
> > +        vlc_video_context_Release(fake_vctx);
> >      return vd;
> >  error:
> > +    if (fake_vctx)
> > +        vlc_video_context_Release(fake_vctx);
> >      video_format_Clean(&vd->source);
> >      vlc_object_delete(vd);
> >      return NULL;
> > -- 
> > 2.17.1
> > 
> > _______________________________________________
> > vlc-devel mailing list
> > To unsubscribe or modify your subscription options:
> > https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> 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