Bug#803839:

salsaman salsaman at gmail.com
Tue Mar 8 14:58:17 UTC 2016


I believe it may be possible to use FF_API_PIX_FMT to determine the older
version complatibility. Somebody please confirm this if possible.

Attached is a (I think correct) patch for the current svn version of LiVES.
With some minor adjustment it should be possible to apply it to older
versions of LiVES.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-multimedia-maintainers/attachments/20160308/d847fdd4/attachment-0001.html>
-------------- next part --------------
Index: libweed/weed-compat.h
===================================================================
--- libweed/weed-compat.h	(revision 2352)
+++ libweed/weed-compat.h	(working copy)
@@ -42,7 +42,7 @@
 
 */
 
-/* (C) Gabriel "Salsaman" Finch, 2005 - 2012 */
+/* (C) Gabriel "Salsaman" Finch, 2005 - 2016 */
 
 #ifndef __WEED_COMPAT_H__
 #define __WEED_COMPAT_H__
@@ -595,6 +595,8 @@
 #include <weed/weed-palettes.h>
 #endif
 
+#ifdef FF_API_PIX_FMT
+
 int avi_pix_fmt_to_weed_palette(enum PixelFormat pix_fmt, int *clamped) {
   // clamped may be set to NULL if you are not interested in the value
 
@@ -635,7 +637,7 @@
   case PIX_FMT_YUVJ420P:
     if (clamped) *clamped=WEED_YUV_CLAMPING_UNCLAMPED;
     return WEED_PALETTE_YUV420P;
-
+    
   default:
     return WEED_PALETTE_END;
   }
@@ -642,10 +644,7 @@
 }
 
 
-
-
 enum PixelFormat weed_palette_to_avi_pix_fmt(int pal, int *clamped) {
-
   switch (pal) {
   case WEED_PALETTE_RGB24:
       return PIX_FMT_RGB24;
@@ -684,11 +683,100 @@
   default:
     return PIX_FMT_NONE;
   }
+}
 
-  return PIX_FMT_NONE;
+#else
 
+int avi_pix_fmt_to_weed_palette(enum AVPixelFormat pix_fmt, int *clamped) {
+  // clamped may be set to NULL if you are not interested in the value
+
+  switch (pix_fmt) {
+  case AV_PIX_FMT_RGB24:
+    return WEED_PALETTE_RGB24;
+  case AV_PIX_FMT_BGR24:
+    return WEED_PALETTE_BGR24;
+  case AV_PIX_FMT_RGBA:
+    return WEED_PALETTE_RGBA32;
+  case AV_PIX_FMT_BGRA:
+    return WEED_PALETTE_BGRA32;
+  case AV_PIX_FMT_ARGB:
+    return WEED_PALETTE_ARGB32;
+  case AV_PIX_FMT_YUV444P:
+    return WEED_PALETTE_YUV444P;
+  case AV_PIX_FMT_YUV422P:
+    return WEED_PALETTE_YUV422P;
+  case AV_PIX_FMT_YUV420P:
+    return WEED_PALETTE_YUV420P;
+  case AV_PIX_FMT_YUYV422:
+    return WEED_PALETTE_YUYV;
+  case AV_PIX_FMT_UYVY422:
+    return WEED_PALETTE_UYVY;
+  case AV_PIX_FMT_UYYVYY411:
+    return WEED_PALETTE_YUV411;
+  case AV_PIX_FMT_GRAY8:
+    return WEED_PALETTE_A8;
+  case AV_PIX_FMT_MONOWHITE:
+  case AV_PIX_FMT_MONOBLACK:
+    return WEED_PALETTE_A1;
+  case AV_PIX_FMT_YUVJ422P:
+    if (clamped) *clamped=WEED_YUV_CLAMPING_UNCLAMPED;
+    return WEED_PALETTE_YUV422P;
+  case AV_PIX_FMT_YUVJ444P:
+    if (clamped) *clamped=WEED_YUV_CLAMPING_UNCLAMPED;
+    return WEED_PALETTE_YUV444P;
+  case AV_PIX_FMT_YUVJ420P:
+    if (clamped) *clamped=WEED_YUV_CLAMPING_UNCLAMPED;
+    return WEED_PALETTE_YUV420P;
+    
+  default:
+    return WEED_PALETTE_END;
+  }
 }
 
+
+enum AVPixelFormat weed_palette_to_avi_pix_fmt(int pal, int *clamped) {
+  switch (pal) {
+  case WEED_PALETTE_RGB24:
+      return AV_PIX_FMT_RGB24;
+  case WEED_PALETTE_BGR24:
+    return AV_PIX_FMT_BGR24;
+  case WEED_PALETTE_RGBA32:
+    return AV_PIX_FMT_RGBA;
+  case WEED_PALETTE_BGRA32:
+    return AV_PIX_FMT_BGRA;
+  case WEED_PALETTE_ARGB32:
+    return AV_PIX_FMT_ARGB;
+  case WEED_PALETTE_YUV444P:
+    if (clamped && *clamped==WEED_YUV_CLAMPING_UNCLAMPED)
+      return AV_PIX_FMT_YUVJ444P;
+    return AV_PIX_FMT_YUV444P;
+  case WEED_PALETTE_YUV422P:
+    if (clamped && *clamped==WEED_YUV_CLAMPING_UNCLAMPED)
+      return AV_PIX_FMT_YUVJ422P;
+    return AV_PIX_FMT_YUV422P;
+  case WEED_PALETTE_YUV420P:
+    if (clamped && *clamped==WEED_YUV_CLAMPING_UNCLAMPED)
+      return AV_PIX_FMT_YUVJ420P;
+    return AV_PIX_FMT_YUV420P;
+  case WEED_PALETTE_YUYV:
+    return AV_PIX_FMT_YUYV422;
+  case WEED_PALETTE_UYVY:
+    return AV_PIX_FMT_UYVY422;
+  case WEED_PALETTE_YUV411:
+    return AV_PIX_FMT_UYYVYY411;
+
+  case WEED_PALETTE_A8:
+    return AV_PIX_FMT_GRAY8;
+  case WEED_PALETTE_A1:
+    return AV_PIX_FMT_MONOBLACK;
+
+  default:
+    return AV_PIX_FMT_NONE;
+  }
+}
+  
+#endif
+  
 #endif // HAVE_AVUTIL
 #endif // HAVE_AVCODEC
 
Index: lives-plugins/plugins/decoders/mkv_decoder.c
===================================================================
--- lives-plugins/plugins/decoders/mkv_decoder.c	(revision 2406)
+++ lives-plugins/plugins/decoders/mkv_decoder.c	(working copy)
@@ -1,5 +1,5 @@
 // LiVES - mkv decoder plugin
-// (c) G. Finch 2011 <salsaman at xs4all.nl,salsaman at gmail.com>
+// (c) G. Finch 2011 - 2016 <salsaman at gmail.com>
 
 /*
  * This file is free software; you can redistribute it and/or
@@ -40,7 +40,7 @@
 #include <sys/stat.h>
 #include <pthread.h>
 
-const char *plugin_version="LiVES mkv decoder version 1.2";
+const char *plugin_version="LiVES mkv decoder version 1.3";
 
 #ifdef HAVE_AV_CONFIG_H
 #undef HAVE_AV_CONFIG_H
@@ -901,7 +901,7 @@
   out->data = newdata;
   memcpy(out->data+out->size, in->data, in->size);
   out->size += in->size;
-  av_destruct_packet(in);
+  av_packet_unref(in);
   av_free(in);
   return 0;
 }
Index: lives-plugins/plugins/decoders/mpegts_decoder.c
===================================================================
--- lives-plugins/plugins/decoders/mpegts_decoder.c	(revision 2406)
+++ lives-plugins/plugins/decoders/mpegts_decoder.c	(working copy)
@@ -1,5 +1,5 @@
 // LiVES - mpegts decoder plugin
-// (c) G. Finch 2012 - 2014 <salsaman at gmail.com>
+// (c) G. Finch 2012 - 2016 <salsaman at gmail.com>
 
 /*
  * This file is free software; you can redistribute it and/or
@@ -34,7 +34,7 @@
 #include <endian.h>
 #endif
 
-const char *plugin_version="LiVES mpegts decoder version 1.2a";
+const char *plugin_version="LiVES mpegts decoder version 1.3";
 
 #ifdef HAVE_AV_CONFIG_H
 #undef HAVE_AV_CONFIG_H
@@ -1023,7 +1023,10 @@
 static void new_pes_packet(PESContext *pes, AVPacket *pkt) {
   av_init_packet(pkt);
 
+#if !HAVE_AVPACKET_UNREF
   pkt->destruct = av_destruct_packet;
+#endif
+  
   pkt->data = pes->buffer;
   pkt->size = pes->data_index;
 
Index: src/colourspace.c
===================================================================
--- src/colourspace.c	(revision 2432)
+++ src/colourspace.c	(working copy)
@@ -80,8 +80,13 @@
   int iheight;
   int width;
   int height;
+#ifdef FF_API_PIX_FMT
   enum PixelFormat ipixfmt;
   enum PixelFormat opixfmt;
+#else
+  enum AVPixelFormat ipixfmt;
+  enum AVPixelFormat opixfmt;
+#endif
   int flags;
   struct SwsContext *ctx;
 };
@@ -10313,7 +10318,12 @@
 
 static struct SwsContext *swscale_find_context(int iwidth, int iheight,
     int width, int height,
-    enum PixelFormat ipixfmt, enum PixelFormat opixfmt, int flags) {
+#ifdef FF_API_PIX_FMT
+    enum PixelFormat ipixfmt, enum PixelFormat opixfmt, int flags)
+#else
+    enum AVPixelFormat ipixfmt, enum AVPixelFormat opixfmt, int flags)
+#endif  
+{
   register int i;
   struct _swscale_ctx tmpctx;
 
@@ -10351,7 +10361,12 @@
 }
 
 
-static void swscale_add_context(int iwidth, int iheight, int width, int height, enum PixelFormat ipixfmt, enum PixelFormat opixfmt,
+static void swscale_add_context(int iwidth, int iheight, int width, int height,
+#ifdef FF_API_PIX_FMT
+				enum PixelFormat ipixfmt, enum PixelFormat opixfmt,
+#else
+				enum AVPixelFormat ipixfmt, enum AVPixelFormat opixfmt,
+#endif
                                 int flags, struct SwsContext *ctx) {
   // add at head of list
   register int i;
@@ -10496,8 +10511,12 @@
 
     boolean store_ctx=FALSE;
 
+#ifdef FF_API_PIX_FMT
     enum PixelFormat ipixfmt,opixfmt;
-
+#else
+    enum AVPixelFormat ipixfmt,opixfmt;
+#endif
+    
     int flags;
 
     old_layer=weed_plant_copy(layer);


More information about the pkg-multimedia-maintainers mailing list