[FFmpeg-devel] [PATCH] Implement avfilter_add_colorspaces()

Michael Niedermayer michaelni
Fri Jan 1 01:35:01 CET 2010


On Thu, Dec 31, 2009 at 06:38:10PM +0100, Stefano Sabatini wrote:
> On date Thursday 2009-12-31 17:54:20 +0100, Michael Niedermayer encoded:
> > On Thu, Dec 31, 2009 at 01:48:29AM +0100, Stefano Sabatini wrote:
> > > On date Thursday 2009-12-31 01:18:27 +0100, Michael Niedermayer encoded:
> > > > On Wed, Dec 30, 2009 at 01:32:36AM +0100, Stefano Sabatini wrote:
> > > [...]
> > > > > Index: libavfilter-soc/ffmpeg/libavfilter/avfilter.h
> > > > > ===================================================================
> > > > > --- libavfilter-soc.orig/ffmpeg/libavfilter/avfilter.h	2009-12-30 01:24:53.000000000 +0100
> > > > > +++ libavfilter-soc/ffmpeg/libavfilter/avfilter.h	2009-12-30 01:25:01.000000000 +0100
> > > > > @@ -192,6 +192,12 @@
> > > > >  AVFilterFormats *avfilter_make_format_list(const enum PixelFormat *pix_fmts);
> > > > >  
> > > > >  /**
> > > > > + * Adds pix_fmt to the list of formats pointed by formats, and updates
> > > > > + * formats to point to the new updated list.
> > > > > + */
> > > > > +void avfilter_add_colorspace(AVFilterFormats **formats, enum PixelFormat pix_fmt);
> > > > 
> > > > why **formats and not *formats ?
> > > 
> > > The list of formats is re-allocated, so its address may
> > > change. Alternatively we could have:
> > 
> > formats->formats is reallocated, i dont see formats being
> 
> Ouch lack of sleep I guess...
> -- 
> FFmpeg = Frenzy and Frightening Merciless Portable Elitist Guru

>  avfilter.h |    5 +++++
>  formats.c  |    7 +++++++
>  2 files changed, 12 insertions(+)
> 0048a6361dff9d45e99c5fb63282372cba5b14a5  implement-add-colorspace.patch
> Index: libavfilter-soc/ffmpeg/libavfilter/avfilter.h
> ===================================================================
> --- libavfilter-soc.orig/ffmpeg/libavfilter/avfilter.h	2009-12-30 01:24:53.000000000 +0100
> +++ libavfilter-soc/ffmpeg/libavfilter/avfilter.h	2009-12-31 18:27:57.000000000 +0100
> @@ -192,6 +192,11 @@
>  AVFilterFormats *avfilter_make_format_list(const enum PixelFormat *pix_fmts);
>  
>  /**
> + * Adds pix_fmt to the list of formats in formats.
> + */
> +void avfilter_add_colorspace(AVFilterFormats *formats, enum PixelFormat pix_fmt);
> +
> +/**
>   * Returns a list of all colorspaces supported by FFmpeg.
>   */
>  AVFilterFormats *avfilter_all_colorspaces(void);
> Index: libavfilter-soc/ffmpeg/libavfilter/formats.c
> ===================================================================
> --- libavfilter-soc.orig/ffmpeg/libavfilter/formats.c	2009-12-30 01:24:53.000000000 +0100
> +++ libavfilter-soc/ffmpeg/libavfilter/formats.c	2009-12-31 18:34:57.000000000 +0100
> @@ -85,6 +85,13 @@
>      return formats;
>  }
>  
> +void avfilter_add_colorspace(AVFilterFormats *formats, enum PixelFormat pix_fmt)
> +{
> +    formats->formats = av_realloc(formats->formats,
> +                                  sizeof(formats->formats) * ++formats->format_count);
> +    formats->formats[formats->format_count-1] = pix_fmt;

ENOMEM checking missing

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

I hate to see young programmers poisoned by the kind of thinking
Ulrich Drepper puts forward since it is simply too narrow -- Roman Shaposhnik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100101/358a2139/attachment.pgp>



More information about the ffmpeg-devel mailing list