[gegl] Bug 583951 – Patch to replace deprecated img_convert function
- From: Martin Nordholts <martinn src gnome org>
- To: svn-commits-list gnome org
- Subject: [gegl] Bug 583951 – Patch to replace deprecated img_convert function
- Date: Wed, 27 May 2009 12:14:25 -0400 (EDT)
commit d937ae00ffed0729ab823bf9fe591592d6762fb1
Author: Ozan Caglayan <ozan pardus org tr>
Date: Wed May 27 17:51:00 2009 +0200
Bug 583951 â?? Patch to replace deprecated img_convert function
---
operations/workshop/external/Makefile.am | 2 +-
operations/workshop/external/ff-save.c | 27 +++++++++++++++++++++++----
2 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/operations/workshop/external/Makefile.am b/operations/workshop/external/Makefile.am
index e0d1f96..59ac915 100644
--- a/operations/workshop/external/Makefile.am
+++ b/operations/workshop/external/Makefile.am
@@ -21,7 +21,7 @@ endif
if HAVE_AVFORMAT
ops += ff_save.la
ff_save_la_SOURCES = ff-save.c
-ff_save_la_LIBADD = $(op_libs) $(AVFORMAT_LIBS)
+ff_save_la_LIBADD = $(op_libs) $(AVFORMAT_LIBS) -lswscale
ff_save_la_CFLAGS = $(AM_CFLAGS) $(AVFORMAT_CFLAGS)
endif
diff --git a/operations/workshop/external/ff-save.c b/operations/workshop/external/ff-save.c
index bc20b83..68acf53 100755
--- a/operations/workshop/external/ff-save.c
+++ b/operations/workshop/external/ff-save.c
@@ -22,6 +22,8 @@
#include <glib/gi18n-lib.h>
+#include <libswscale/swscale.h>
+
#ifdef GEGL_CHANT_PROPERTIES
@@ -648,14 +650,31 @@ write_video_frame (GeglChantO *op,
if (c->pix_fmt != PIX_FMT_RGB24)
{
+ struct SwsContext *img_convert_ctx;
+
/* as we only generate a RGB24 picture, we must convert it
to the codec pixel format if needed */
fill_yuv_image (op, p->tmp_picture, p->frame_count, c->width,
c->height);
- /* FIXME: img_convert is deprecated. Update code to use sws_scale(). */
- img_convert ((AVPicture *) p->picture, c->pix_fmt,
- (AVPicture *) p->tmp_picture, PIX_FMT_RGB24,
- c->width, c->height);
+
+ img_convert_ctx = sws_getContext(c->width, c->height, c->pix_fmt,
+ c->width, c->height, PIX_FMT_RGB24,
+ SWS_BICUBIC, NULL, NULL, NULL);
+
+ if (img_convert_ctx == NULL)
+ {
+ fprintf(stderr, "ff_save: Cannot initialize conversion context.");
+ }
+ else
+ {
+ sws_scale(img_convert_ctx,
+ p->tmp_picture->data,
+ p->tmp_picture->linesize,
+ 0,
+ c->height,
+ p->picture->data,
+ p->picture->linesize);
+ }
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]