Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Jan 2017 22:41:15 +0000 (UTC)
From:      Guido Falsi <madpilot@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r430414 - in head/graphics/amide: . files
Message-ID:  <201701022241.v02MfFBs037116@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: madpilot
Date: Mon Jan  2 22:41:15 2017
New Revision: 430414
URL: https://svnweb.freebsd.org/changeset/ports/430414

Log:
  Modify amide port to use  ffmpeg 3.x
  
  Actual patch is a mix of work from subitter and my modifications
  based on debian patch from [1]
  
  While here, fix the DCMTK option.
  
  PR:		215240
  Submitted by:	jbeich
  Obtained From:	https://anonscm.debian.org/viewvc/debian-med/trunk/packages/amide/trunk/debian/patches/libav10.patch?view=markup&pathrev=16327 [1]

Added:
  head/graphics/amide/files/patch-src_mpeg__encode.c   (contents, props changed)
Modified:
  head/graphics/amide/Makefile
  head/graphics/amide/files/patch-Makefile.in
  head/graphics/amide/files/patch-configure
  head/graphics/amide/files/patch-src-alignment_mutual_information.c

Modified: head/graphics/amide/Makefile
==============================================================================
--- head/graphics/amide/Makefile	Mon Jan  2 21:15:34 2017	(r430413)
+++ head/graphics/amide/Makefile	Mon Jan  2 22:41:15 2017	(r430414)
@@ -2,7 +2,7 @@
 
 PORTNAME=	amide
 PORTVERSION=	1.0.5
-PORTREVISION=	4
+PORTREVISION=	5
 CATEGORIES=	graphics
 MASTER_SITES=	SF
 
@@ -34,12 +34,13 @@ VOLPACK_DESC=	Use volpack
 XMEDCON_DESC=	Use xmedcon
 
 OPTIONS_SUB=			yes
-DCMTK_CONFIGURE_ENABLE=		libdcmdata
+DCMTK_CONFIGURE_ON=		--enable-libdcmdata
+DCMTK_CONFIGURE_OFF=		--enable-libdcmdata=no
 DCMTK_LIB_DEPENDS=		libdcmdata.so:devel/dcmtk
 FAME_CONFIGURE_ENABLE=		libfame
 FAME_LIB_DEPENDS=		libfame.so:multimedia/libfame
 FFMPEG_CONFIGURE_ENABLE=	ffmpeg
-FFMPEG_LIB_DEPENDS=		libavcodec0.so:multimedia/ffmpeg0
+FFMPEG_LIB_DEPENDS=		libavcodec.so:multimedia/ffmpeg
 GSL_CONFIGURE_ENABLE=		libgsl
 GSL_LIB_DEPENDS=		libgsl.so:math/gsl
 VOLPACK_CONFIGURE_ENABLE=	libvolpack
@@ -53,8 +54,6 @@ post-patch:
 		${WRKSRC}/amide_config.h.in
 	@${REINPLACE_CMD} \
 		-e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
-		-e 's|libavcodec|libavcodec0|g' \
-		-e 's|libavutil|libavutil0|g' \
 		${WRKSRC}/configure
 
 .include <bsd.port.mk>

Modified: head/graphics/amide/files/patch-Makefile.in
==============================================================================
--- head/graphics/amide/files/patch-Makefile.in	Mon Jan  2 21:15:34 2017	(r430413)
+++ head/graphics/amide/files/patch-Makefile.in	Mon Jan  2 22:41:15 2017	(r430414)
@@ -1,6 +1,6 @@
---- Makefile.in.orig	2014-01-25 23:25:32.000000000 +0100
-+++ Makefile.in	2014-01-27 13:14:16.876831395 +0100
-@@ -89,8 +89,7 @@
+--- Makefile.in.orig	2014-01-27 03:04:32 UTC
++++ Makefile.in
+@@ -89,8 +89,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/g
  	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
  	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
  	$(top_srcdir)/configure.ac

Modified: head/graphics/amide/files/patch-configure
==============================================================================
--- head/graphics/amide/files/patch-configure	Mon Jan  2 21:15:34 2017	(r430413)
+++ head/graphics/amide/files/patch-configure	Mon Jan  2 22:41:15 2017	(r430414)
@@ -1,6 +1,6 @@
---- configure.orig	2014-01-27 04:04:34.000000000 +0100
-+++ configure	2014-01-29 13:12:46.268622841 +0100
-@@ -16216,7 +16216,7 @@
+--- configure.orig	2014-01-27 03:04:34 UTC
++++ configure
+@@ -16216,7 +16216,7 @@ if test "x$ac_cv_func_bind_textdomain_co
                 DATADIRNAME=share
  else
    CATOBJEXT=.mo
@@ -9,7 +9,7 @@
  fi
  
  	    ;;
-@@ -16226,7 +16226,7 @@
+@@ -16226,7 +16226,7 @@ fi
  	    ;;
  	    *)
  	    CATOBJEXT=.mo
@@ -18,7 +18,7 @@
  	    ;;
  	    esac
  fi
-@@ -16914,12 +16914,12 @@
+@@ -16914,12 +16914,12 @@ else
  if test "x$ac_cv_func_bind_textdomain_codeset" = xyes; then :
    DATADIRNAME=share
  else
@@ -33,7 +33,7 @@
      ;;
      esac
  fi
-@@ -17612,8 +17612,8 @@
+@@ -17612,8 +17612,8 @@ else
    THREAD_LIBS=""
  fi
  
@@ -44,7 +44,16 @@
  saved_libs="${LIBS}"
  LIBS="${LIBS} ${AMIDE_LIBDCMDATA_LIBS}"
  saved_cxxflags="${CXXFLAGS}"
-@@ -18154,6 +18154,7 @@
+@@ -17643,6 +17643,8 @@ if ac_fn_cxx_try_link "$LINENO"; then :
+ else
+   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libdcmdata was not found." >&5
+ $as_echo "$as_me: WARNING: libdcmdata was not found." >&2;}
++  AMIDE_LIBDCMDATA_LIBS=""
++  AMIDE_LIBDCMDATA_CFLAGS=""
+ fi
+ rm -f core conftest.err conftest.$ac_objext \
+     conftest$ac_exeext conftest.$ac_ext
+@@ -18154,6 +18156,7 @@ $as_echo_n "checking for libfame - versi
        ac_save_CFLAGS="$CFLAGS"
        ac_save_LIBS="$LIBS"
        CFLAGS="$CFLAGS $LIBFAME_CFLAGS"
@@ -52,7 +61,7 @@
        LIBS="$LIBFAME_LIBS $LIBS"
        rm -f conf.libfametest
        if test "$cross_compiling" = yes; then :
-@@ -18165,6 +18166,7 @@
+@@ -18165,6 +18168,7 @@ else
  #include <fame.h>
  #include <stdio.h>
  #include <stdlib.h>

Modified: head/graphics/amide/files/patch-src-alignment_mutual_information.c
==============================================================================
--- head/graphics/amide/files/patch-src-alignment_mutual_information.c	Mon Jan  2 21:15:34 2017	(r430413)
+++ head/graphics/amide/files/patch-src-alignment_mutual_information.c	Mon Jan  2 22:41:15 2017	(r430414)
@@ -1,5 +1,5 @@
---- src/alignment_mutual_information.c.orig	2012-01-22 17:25:06.000000000 +0100
-+++ src/alignment_mutual_information.c	2013-08-28 10:30:30.265534615 +0200
+--- src/alignment_mutual_information.c.orig	2012-01-22 16:25:06 UTC
++++ src/alignment_mutual_information.c
 @@ -28,6 +28,13 @@
  #include "amitk_data_set_DOUBLE_0D_SCALING.h"
  #include "alignment_mutual_information.h"
@@ -14,7 +14,7 @@
  /* this algorithm will calculate the amount of mutual information between two data sets in their current orientations    */
  /* it is a re-write of the original algorithm for purposes of improved speed. the hope is that it won't affect accuracy. */
  /* rather than computing mutual information for the whole volume of data, the algorithm computes it for three orthogonal */
-@@ -209,7 +216,7 @@
+@@ -209,7 +216,7 @@ gdouble calculate_mutual_information(Ami
        //g_print("\t\%i", mutual_information_array[i][j] );  // for point-wise counts
        // g_print("\t\%4.3f", incremental_mi );               // for point-wise probability
        

Added: head/graphics/amide/files/patch-src_mpeg__encode.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/amide/files/patch-src_mpeg__encode.c	Mon Jan  2 22:41:15 2017	(r430414)
@@ -0,0 +1,77 @@
+--- src/mpeg_encode.c.orig	2014-01-23 20:13:52 UTC
++++ src/mpeg_encode.c
+@@ -143,6 +143,7 @@ static void convert_rgb_pixbuf_to_yuv(yu
+ 
+ #include <libavcodec/avcodec.h>
+ 
++#include <libavutil/frame.h>
+ 
+ typedef struct {
+   AVCodec *codec;
+@@ -234,11 +235,11 @@ gpointer mpeg_encode_setup(gchar * outpu
+ 
+   switch(type) {
+   case ENCODE_MPEG4:
+-    codec_type = CODEC_ID_MPEG4;
++    codec_type = AV_CODEC_ID_MPEG4;
+     break;
+   case ENCODE_MPEG1:
+   default:
+-    codec_type=CODEC_ID_MPEG1VIDEO;
++    codec_type=AV_CODEC_ID_MPEG1VIDEO;
+     break;
+   }
+ 
+@@ -268,7 +269,7 @@ gpointer mpeg_encode_setup(gchar * outpu
+     return NULL;
+   }
+ 
+-  encode->picture= avcodec_alloc_frame();
++  encode->picture= av_frame_alloc();
+   if (!encode->picture) {
+     g_warning("couldn't allocate memory for encode->picture");
+     encode_free(encode);
+@@ -293,7 +294,7 @@ gpointer mpeg_encode_setup(gchar * outpu
+   encode->context->time_base= (AVRational){1,FRAMES_PER_SECOND};
+   encode->context->gop_size = 10; /* emit one intra frame every ten frames */
+   encode->context->max_b_frames=10;
+-  encode->context->pix_fmt = PIX_FMT_YUV420P;
++  encode->context->pix_fmt = AV_PIX_FMT_YUV420P;
+ 
+   /* encoding parameters */
+   encode->context->sample_aspect_ratio= (AVRational){1,1}; /* our pixels are square */
+@@ -355,6 +356,10 @@ gpointer mpeg_encode_setup(gchar * outpu
+   encode->picture->linesize[1] = encode->context->width/2;
+   encode->picture->linesize[2] = encode->context->width/2;
+ 
++  encode->picture->width = xsize;
++  encode->picture->height = ysize;
++  encode->picture->format = AV_PIX_FMT_YUV420P;
++
+   return (gpointer) encode;
+ }
+ 
+@@ -362,12 +367,21 @@ gpointer mpeg_encode_setup(gchar * outpu
+ gboolean mpeg_encode_frame(gpointer data, GdkPixbuf * pixbuf) {
+   encode_t * encode = data;
+   gint out_size;
++  AVPacket packet = { 0 };
++  int ret, got_output = 0;
+ 
+   convert_rgb_pixbuf_to_yuv(encode->yuv, pixbuf);
+ 
+   /* encode the image */
+-  out_size = avcodec_encode_video(encode->context, encode->output_buffer, encode->output_buffer_size, encode->picture);
+-  fwrite(encode->output_buffer, 1, out_size, encode->output_file);
++  av_init_packet(&packet);
++  packet.data = encode->output_buffer;
++  packet.size = encode->output_buffer_size;
++  ret = avcodec_encode_video2(encode->context, &packet,
++			      encode->picture, &got_output);
++  if (ret < 0)
++      return FALSE;
++
++  fwrite(packet.data, 1, packet.size, encode->output_file);
+ 
+   return TRUE;
+ };



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701022241.v02MfFBs037116>