[FFmpeg-devel] [PATCH 2/2] Deprecate sws_getContext(), use sws_alloc_context() and sws_init_context() instead.

Michael Niedermayer michaelni
Tue Sep 28 19:57:01 CEST 2010


On Tue, Sep 28, 2010 at 06:43:41PM +0200, Stefano Sabatini wrote:
> On date Tuesday 2010-09-28 18:38:41 +0200, Stefano Sabatini encoded:
> > ---
> >  swscale.h |   11 +++++++++++
> >  utils.c   |   16 +++++++++++++---
> >  2 files changed, 24 insertions(+), 3 deletions(-)
> > 
> > diff --git a/utils.c b/utils.c
> > index c817a4d..826547d 100644
> > --- a/utils.c
> > +++ b/utils.c
> [...]
> > @@ -1564,9 +1566,17 @@ struct SwsContext *sws_getCachedContext(struct SwsContext *context,
> >      }
> >  
> 
> >      if (!context) {
> > -        return sws_getContext(srcW, srcH, srcFormat,
> > -                              dstW, dstH, dstFormat, flags,
> > -                              srcFilter, dstFilter, param);
> > +        if (!(context = sws_alloc_context()))
> > +            return NULL;
> > +        context->srcW      = srcW;
> > +        context->srcH      = srcH;
> > +        context->srcFormat = srcFormat;
> > +        context->dstFormat = dstFormat;
> > +        context->flags     = flags;
> > +        context->param[0]  = param[0];
> > +        context->param[1]  = param[1];
> > +        if (sws_init_context(context, srcFilter, dstFilter) < 0)
> > +            return NULL;
> >      }
> >      return context;
> 
> Fixed leak, updated.
> -- 
> FFmpeg = Fundamentalist and Formidable Marvellous Practical Ecumenical Guru

>  swscale.h |   11 +++++++++++
>  utils.c   |   18 +++++++++++++++---
>  2 files changed, 26 insertions(+), 3 deletions(-)
> 6ae71331a92835f36cf8bd83e45a0a32948ce81b  0002-Deprecate-sws_getContext-use-sws_alloc_context-and.patch
> From 0d0f2d2638a25110c8e26d751f6a03b49eeee52c Mon Sep 17 00:00:00 2001

ok (if tested)

[..]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100928/4516869f/attachment.pgp>



More information about the ffmpeg-devel mailing list