[Ffmpeg-devel] [PATCH] introduce swscale interface inlibavcodec

Luca Abeni lucabe72
Tue Apr 4 11:10:12 CEST 2006

Hi Michael,

On Mon, 2006-04-03 at 23:23 +0200, Michael Niedermayer wrote:
> > So, the first attached patch introduces the swscale interface in
> > libavcodec, and the second one modifies ffmpeg.c to use it (a similar
> > patch is also needed for output_example.c and ffplay.c... I'll provide
> > it if the first patch is accepted).
> patches look ok
Ok, good. It seems I am getting near to have all the pieces in place ;-)

sws-emulation.diff does not depend on other patches and should not break
anything, so I'll commit it soon.

move-ffmpeg-to-sws.diff depends on the cropping/padding patchset I
posted earlier, so I'll commit it only after such patchset is accepted.
In the meanwhile, I'll post the patch for moving output_example.c and
ffplay.c to the sws interface.

> > After applying these two patches, importing swscale becomes really easy
> > (and the ffmpeg patch for importing it is much smaller...). In fact, I
> > already have a working patch: I'll post it later, after checking if all
> > the previous comments have been properly addressed (BTW, Michael, is the
> > "USE_AVUTIL" thing I put in my last patch ok? If not, let me know and
> > I'll remove it).
> what USE_AVUTIL? i dont remember ...
The one in swscaler_glue.c and swsutil.h in my last "import swscale" patch.
Basically, swsutil.h contains something like
+#include "avutil.h"
+#ifdef USE_AVUTIL
+#define av_malloc sws_malloc
+#define av_free sws_free
+#define av_log sws_log
+extern void *(*av_malloc)(unsigned int size);
+extern void (*av_free)(void *ptr);
+extern void (*av_log)(void*, int level, const char *fmt, ...);

The idea is that if USE_AVUTIL is defined (and it currently is not),
then av_{free, malloc, log} are directly used. If it is not defined, the
functions passed to sws_global_init() are used.
When/if av_{free, malloc, log} will be moved to libavutil, swscale will
be automagically ready for that (we will only need to define USE_AVUTIL
in config.h).

When I wrote that part of the code, this seemed to be a smart idea :)
But I am ready to remove this stuff if it is not acceptable.

Copy this in your signature, if you think it is important:
                               N O    W A R ! ! !

More information about the ffmpeg-devel mailing list