public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] dev/anarchy:master commit in: app-text/ghostscript-gpl/, media-video/ffmpegthumbnailer/files/, ...
@ 2011-02-16  2:52 Jory Pratt
  0 siblings, 0 replies; only message in thread
From: Jory Pratt @ 2011-02-16  2:52 UTC (permalink / raw
  To: gentoo-commits

commit:     f2f2752b24117dd9a678dd01780bcccc4993847d
Author:     Jory A. Pratt <anarchy <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 16 02:52:24 2011 +0000
Commit:     Jory Pratt <anarchy <AT> gentoo <DOT> org>
CommitDate: Wed Feb 16 02:52:24 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/anarchy.git;a=commit;h=f2f2752b

more libpng-1.5 fixes

---
 app-text/ghostscript-gpl/Manifest                  |    5 +
 .../files/ghostscript-gpl-9.00-libpng1.5.patch     |  196 ++++++++
 .../ghostscript-gpl/ghostscript-gpl-9.00-r1.ebuild |  198 ++++++++
 media-video/dvdauthor/Manifest                     |    3 +
 media-video/dvdauthor/dvdauthor-0.6.18.ebuild      |   36 ++
 .../files/dvdauthor-0.6.18-libpng-1.5.patch        |   25 +
 media-video/ffmpegthumbnailer/Manifest             |    5 +
 .../ffmpegthumbnailer-2.0.6.ebuild                 |   43 ++
 .../files/ffmpegthumbnailer-2.0.6-asneeded.patch   |   19 +
 .../files/ffmpegthumbnailer-2.0.6-flags.patch      |   25 +
 .../files/ffmpegthumbnailer-2.0.6-libpng-1.5.patch |   13 +
 media-video/mjpegtools/Manifest                    |    5 +
 .../files/mjpegtools-1.9.0-glibc-2.10.patch        |   11 +
 .../mjpegtools/files/mjpegtools-1.9.0-jpeg-7.patch |   24 +
 .../files/mjpegtools-1.9.0-libpng-1.5.patch        |  525 ++++++++++++++++++++
 media-video/mjpegtools/mjpegtools-1.9.0-r1.ebuild  |   88 ++++
 16 files changed, 1221 insertions(+), 0 deletions(-)

diff --git a/app-text/ghostscript-gpl/Manifest b/app-text/ghostscript-gpl/Manifest
new file mode 100644
index 0000000..9228e2b
--- /dev/null
+++ b/app-text/ghostscript-gpl/Manifest
@@ -0,0 +1,5 @@
+AUX ghostscript-gpl-9.00-libpng1.5.patch 6699 RMD160 984a970c768a24c4e7eae14bfac8432cb1031129 SHA1 adf2ae55d8d7242f808f852632ed26f7e574858f SHA256 228c65f1ed286122bf8ca96979932989ace83e162f7a894f99474886a41732bc
+DIST ghostscript-9.00.tar.xz 17377160 RMD160 4dd9bf15ccc3e23e11fdebc1d23155e1b9d8993b SHA1 873fbeedecc472ec804943bc5ded131fa8342251 SHA256 2d3afcf30873c8bf8619beeeb6d4c3370fc2944fd1bd47423461b6778daa8248
+DIST ghostscript-gpl-9.00-patchset-2.tar.bz2 12996 RMD160 b3ef870d4e690a4cd6984066f9846d5ec19879ee SHA1 fe6c48949f29b6a5d6bab7b8b3e588373e195b3f SHA256 842f073369414981467bd6264a6f2f77ef4ef53864a2ddd2ee8872d966b0ff41
+DIST gsdjvu-1.4.tar.gz 208611 RMD160 ecbb2fded61a29c4f49f852f99d106a0ba0eb48d SHA1 2650c85481de3aef66a4f7970d14a7dd36a1bc96 SHA256 7b5992f5203d662a7e03ce57d4a1b7a97990b0d3e09eb46ef1b4cb66d8d8c57d
+EBUILD ghostscript-gpl-9.00-r1.ebuild 5694 RMD160 3bd27762e6c56dfe1352cc0dbfcdb83990bc1649 SHA1 a198013448caeb6166a43ad165cd197828f3142c SHA256 6b48b5a816e6a06ae34b5a914b6bfe0612a4a4ea3465187bf7118ed4a355051a

diff --git a/app-text/ghostscript-gpl/files/ghostscript-gpl-9.00-libpng1.5.patch b/app-text/ghostscript-gpl/files/ghostscript-gpl-9.00-libpng1.5.patch
new file mode 100644
index 0000000..dca4f07
--- /dev/null
+++ b/app-text/ghostscript-gpl/files/ghostscript-gpl-9.00-libpng1.5.patch
@@ -0,0 +1,196 @@
+$NetBSD: patch-ak,v 1.5 2011/01/15 14:08:10 wiz Exp $
+
+Fix build with png-1.5. From John Bowler.
+
+--- base/gdevpng.c.orig	2008-07-17 02:34:01.000000000 +0000
++++ base/gdevpng.c
+@@ -36,12 +36,14 @@
+ #include "gdevpccm.h"
+ #include "gscdefs.h"
+ 
+-#define PNG_INTERNAL
+ /*
+  * libpng versions 1.0.3 and later allow disabling access to the stdxxx
+  * files while retaining support for FILE * I/O.
++ *
++ * This is a misunderstanding - this is a build time option for libpng,
++ * it has no effect on a user of libpng.
+  */
+-#define PNG_NO_CONSOLE_IO
++/*#define PNG_NO_CONSOLE_IO*/
+ /*
+  * Earlier libpng versions require disabling FILE * I/O altogether.
+  * This produces a compiler warning about no prototype for png_init_io.
+@@ -280,7 +282,7 @@ png_print_page(gx_device_printer * pdev,
+ 	goto done;
+     }
+     /* set error handling */
+-    if (setjmp(png_ptr->jmpbuf)) {
++    if (setjmp(png_jmpbuf(png_ptr))) {
+ 	/* If we get here, we had a problem reading the file */
+ 	code = gs_note_error(gs_error_VMerror);
+ 	goto done;
+@@ -290,19 +292,12 @@ png_print_page(gx_device_printer * pdev,
+     png_init_io(png_ptr, file);
+ 
+     /* set the file information here */
+-    info_ptr->width = pdev->width;
+-    info_ptr->height = pdev->height;
+-    /* resolution is in pixels per meter vs. dpi */
+-    info_ptr->x_pixels_per_unit =
+-	(png_uint_32) (pdev->HWResolution[0] * (100.0 / 2.54));
+-    info_ptr->y_pixels_per_unit =
+-	(png_uint_32) (pdev->HWResolution[1] * (100.0 / 2.54));
+-    info_ptr->phys_unit_type = PNG_RESOLUTION_METER;
+-    info_ptr->valid |= PNG_INFO_pHYs;
+     switch (depth) {
+ 	case 32:
+-	    info_ptr->bit_depth = 8;
+-	    info_ptr->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
++	    png_set_IHDR(png_ptr, info_ptr, pdev->width, pdev->height,
++	    	8, PNG_COLOR_TYPE_RGB_ALPHA,
++		PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
++		PNG_FILTER_TYPE_DEFAULT);
+ 	    png_set_invert_alpha(png_ptr);
+ 	    {   gx_device_pngalpha *ppdev = (gx_device_pngalpha *)pdev;
+ 		png_color_16 background;
+@@ -315,57 +310,69 @@ png_print_page(gx_device_printer * pdev,
+ 	    }
+ 	    break;
+ 	case 48:
+-	    info_ptr->bit_depth = 16;
+-	    info_ptr->color_type = PNG_COLOR_TYPE_RGB;
++	    png_set_IHDR(png_ptr, info_ptr, pdev->width, pdev->height,
++	    	16, PNG_COLOR_TYPE_RGB,
++		PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
++		PNG_FILTER_TYPE_DEFAULT);
+ #if defined(ARCH_IS_BIG_ENDIAN) && (!ARCH_IS_BIG_ENDIAN) 
+ 	    png_set_swap(png_ptr);
+ #endif
+ 	    break;
+ 	case 24:
+-	    info_ptr->bit_depth = 8;
+-	    info_ptr->color_type = PNG_COLOR_TYPE_RGB;
++	    png_set_IHDR(png_ptr, info_ptr, pdev->width, pdev->height,
++	    	8, PNG_COLOR_TYPE_RGB,
++		PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
++		PNG_FILTER_TYPE_DEFAULT);
+ 	    break;
+ 	case 8:
+-	    info_ptr->bit_depth = 8;
+-	    if (gx_device_has_color(pdev))
+-		info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
+-	    else
+-		info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
++	    png_set_IHDR(png_ptr, info_ptr, pdev->width, pdev->height,
++	    	8, gx_device_has_color(pdev) ?
++			PNG_COLOR_TYPE_PALETTE : PNG_COLOR_TYPE_GRAY,
++		PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
++		PNG_FILTER_TYPE_DEFAULT);
+ 	    break;
+ 	case 4:
+-	    info_ptr->bit_depth = 4;
+-	    info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
++	    png_set_IHDR(png_ptr, info_ptr, pdev->width, pdev->height,
++	    	4, PNG_COLOR_TYPE_PALETTE,
++		PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
++		PNG_FILTER_TYPE_DEFAULT);
+ 	    break;
+ 	case 1:
+-	    info_ptr->bit_depth = 1;
+-	    info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
++	    png_set_IHDR(png_ptr, info_ptr, pdev->width, pdev->height,
++	    	1, PNG_COLOR_TYPE_GRAY,
++		PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
++		PNG_FILTER_TYPE_DEFAULT);
+ 	    /* invert monocrome pixels */
+ 	    png_set_invert_mono(png_ptr);
+ 	    break;
++	default:
++	    png_error(png_ptr, "invalid bit depth");
+     }
+ 
++    /* resolution is in pixels per meter vs. dpi */
++    png_set_pHYs(png_ptr, info_ptr, 
++	(png_uint_32) (pdev->HWResolution[0] * (100.0 / 2.54)),
++	(png_uint_32) (pdev->HWResolution[1] * (100.0 / 2.54)),
++	PNG_RESOLUTION_METER);
++
+     /* set the palette if there is one */
+-    if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) {
++    if (png_get_color_type(png_ptr, info_ptr)  == PNG_COLOR_TYPE_PALETTE) {
+ 	int i;
+ 	int num_colors = 1 << depth;
+ 	gx_color_value rgb[3];
++	png_color palette[256];
++
++	if (num_colors > 256)
++	    num_colors = 256;
+ 
+-	info_ptr->palette =
+-	    (void *)gs_alloc_bytes(mem, 256 * sizeof(png_color),
+-				   "png palette");
+-	if (info_ptr->palette == 0) {
+-	    code = gs_note_error(gs_error_VMerror);
+-	    goto done;
+-	}
+-	info_ptr->num_palette = num_colors;
+-	info_ptr->valid |= PNG_INFO_PLTE;
+ 	for (i = 0; i < num_colors; i++) {
+ 	    (*dev_proc(pdev, map_color_rgb)) ((gx_device *) pdev,
+ 					      (gx_color_index) i, rgb);
+-	    info_ptr->palette[i].red = gx_color_value_to_byte(rgb[0]);
+-	    info_ptr->palette[i].green = gx_color_value_to_byte(rgb[1]);
+-	    info_ptr->palette[i].blue = gx_color_value_to_byte(rgb[2]);
++	    palette[i].red = gx_color_value_to_byte(rgb[0]);
++	    palette[i].green = gx_color_value_to_byte(rgb[1]);
++	    palette[i].blue = gx_color_value_to_byte(rgb[2]);
+ 	}
++	png_set_PLTE(png_ptr, info_ptr, palette, num_colors);
+     }
+     /* add comment */
+     strncpy(software_key, "Software", sizeof(software_key));
+@@ -375,15 +382,14 @@ png_print_page(gx_device_printer * pdev,
+     text_png.key = software_key;
+     text_png.text = software_text;
+     text_png.text_length = strlen(software_text);
+-    info_ptr->text = &text_png;
+-    info_ptr->num_text = 1;
++    png_set_text(png_ptr, info_ptr, &text_png, 1);
+ 
+     /* write the file information */
+     png_write_info(png_ptr, info_ptr);
+ 
+     /* don't write the comments twice */
+-    info_ptr->num_text = 0;
+-    info_ptr->text = NULL;
++    /*info_ptr->num_text = 0;*/
++    /*info_ptr->text = NULL;*/
+ 
+     /* Write the contents of the image. */
+     for (y = 0; y < height; y++) {
+@@ -395,7 +401,7 @@ png_print_page(gx_device_printer * pdev,
+     png_write_end(png_ptr, info_ptr);
+ 
+     /* if you alloced the palette, free it here */
+-    gs_free_object(mem, info_ptr->palette, "png palette");
++    /*gs_free_object(mem, info_ptr->palette, "png palette");*/
+ 
+   done:
+     /* free the structures */
+@@ -405,6 +411,7 @@ png_print_page(gx_device_printer * pdev,
+     return code;
+ }
+ 
++#if 0 /* not required in 1.5 */
+ /*
+  * Patch around a static reference to a never-used procedure.
+  * This could be avoided if we were willing to edit pngconf.h to
+@@ -422,6 +429,7 @@ png_push_fill_buffer(png_structp png_ptr
+ {
+ }
+ #endif
++#endif
+ 
+ static int
+ pngalpha_open(gx_device * pdev)

diff --git a/app-text/ghostscript-gpl/ghostscript-gpl-9.00-r1.ebuild b/app-text/ghostscript-gpl/ghostscript-gpl-9.00-r1.ebuild
new file mode 100644
index 0000000..a2d7dd1
--- /dev/null
+++ b/app-text/ghostscript-gpl/ghostscript-gpl-9.00-r1.ebuild
@@ -0,0 +1,198 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-text/ghostscript-gpl/ghostscript-gpl-9.00-r1.ebuild,v 1.1 2011/02/01 19:02:39 tgurr Exp $
+
+EAPI=3
+inherit autotools eutils versionator flag-o-matic
+
+DESCRIPTION="Ghostscript is an interpreter for the PostScript language and for PDF"
+HOMEPAGE="http://ghostscript.com/"
+
+MY_P=${P/-gpl}
+GSDJVU_PV=1.4
+PVM=$(get_version_component_range 1-2)
+SRC_URI="!bindist? ( djvu? ( mirror://sourceforge/djvu/gsdjvu-${GSDJVU_PV}.tar.gz ) )
+	mirror://sourceforge/ghostscript/${MY_P}.tar.xz
+	mirror://gentoo/${P}-patchset-2.tar.bz2"
+
+LICENSE="GPL-3 CPL-1.0"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
+IUSE="bindist cups djvu gtk idn jpeg2k X"
+
+COMMON_DEPEND="app-text/libpaper
+	media-libs/freetype:2
+	media-libs/fontconfig
+	virtual/jpeg
+	>=media-libs/libpng-1.2.42
+	>=media-libs/tiff-3.9.2
+	>=sys-libs/zlib-1.2.3
+	!bindist? ( djvu? ( app-text/djvu ) )
+	cups? ( >=net-print/cups-1.3.8 )
+	gtk? ( >=x11-libs/gtk+-2.0 )
+	idn? ( net-dns/libidn )
+	jpeg2k? ( media-libs/jasper )
+	X? ( x11-libs/libXt x11-libs/libXext )"
+
+DEPEND="${COMMON_DEPEND}
+	app-arch/xz-utils
+	dev-util/pkgconfig"
+
+RDEPEND="${COMMON_DEPEND}
+	>=app-text/poppler-data-0.4.4
+	>=media-fonts/urw-fonts-2.4.9
+	linguas_ja? ( media-fonts/kochi-substitute )
+	linguas_ko? ( media-fonts/baekmuk-fonts )
+	linguas_zh_CN? ( media-fonts/arphicfonts )
+	linguas_zh_TW? ( media-fonts/arphicfonts )"
+
+S="${WORKDIR}/${MY_P}"
+
+LANGS="ja ko zh_CN zh_TW"
+for X in ${LANGS} ; do
+	IUSE="${IUSE} linguas_${X}"
+done
+
+pkg_setup() {
+	if use bindist && use djvu; then
+		ewarn "You have bindist in your USE, djvu support will NOT be compiled!"
+		ewarn "See http://djvu.sourceforge.net/gsdjvu/COPYING for details on licensing issues."
+	fi
+}
+
+src_prepare() {
+	# remove internal copies of various libraries
+	rm -rf "${S}/expat"
+	rm -rf "${S}/jasper"
+	rm -rf "${S}/jpeg"
+	rm -rf "${S}/libpng"
+	rm -rf "${S}/tiff"
+	rm -rf "${S}/zlib"
+	# remove internal urw-fonts
+	rm -rf "${S}/Resource/Font"
+	# remove internal CMaps (CMaps from poppler-data are used instead)
+	rm -rf "${S}/Resource/CMap"
+
+	# apply various patches, many borrowed from Fedora
+	# http://pkgs.fedoraproject.org/gitweb/?p=ghostscript.git
+	EPATCH_SUFFIX="patch" EPATCH_FORCE="yes"
+	EPATCH_SOURCE="${WORKDIR}/patches/"
+	epatch
+
+	epatch "${FILESDIR}"/${P}-libpng1.5.patch
+
+	if ! use bindist && use djvu ; then
+		unpack gsdjvu-${GSDJVU_PV}.tar.gz
+		cp gsdjvu-${GSDJVU_PV}/gsdjvu "${S}"
+		cp gsdjvu-${GSDJVU_PV}/gdevdjvu.c "${S}/base"
+		epatch "${WORKDIR}/patches-gsdjvu/gsdjvu-1.3-${PN}-8.64.patch"
+		epatch "${WORKDIR}/patches-gsdjvu/gsdjvu-1.4-${PN}-9.00-upstream-buildfixes.patch"
+		cp gsdjvu-${GSDJVU_PV}/ps2utf8.ps "${S}/lib"
+		cp "${S}/base/contrib.mak" "${S}/base/contrib.mak.gsdjvu"
+		grep -q djvusep "${S}/base/contrib.mak" || \
+			cat gsdjvu-${GSDJVU_PV}/gsdjvu.mak >> "${S}/base/contrib.mak"
+
+		# install ps2utf8.ps, bug #197818
+		sed -i -e '/$(EXTRA_INIT_FILES)/ a\ps2utf8.ps \\' "${S}/base/unixinst.mak" \
+			|| die "sed failed"
+	fi
+
+	if ! use gtk ; then
+		sed -i "s:\$(GSSOX)::" base/*.mak || die "gsx sed failed"
+		sed -i "s:.*\$(GSSOX_XENAME)$::" base/*.mak || die "gsxso sed failed"
+	fi
+
+	# search path fix
+	sed -i -e "s:\$\(gsdatadir\)/lib:/usr/share/ghostscript/${PVM}/$(get_libdir):" \
+		-e "s:exdir=.*:exdir=/usr/share/doc/${PF}/examples:" \
+		-e "s:docdir=.*:docdir=/usr/share/doc/${PF}/html:" \
+		-e "s:GS_DOCDIR=.*:GS_DOCDIR=/usr/share/doc/${PF}/html:" \
+		base/Makefile.in base/*.mak || die "sed failed"
+
+	cd "${S}"
+	eautoreconf
+
+	cd "${S}/jbig2dec"
+	eautoreconf
+
+	cd "${S}/ijs"
+	eautoreconf
+}
+
+src_configure() {
+	local FONTPATH
+	for path in \
+		/usr/share/fonts/urw-fonts \
+		/usr/share/fonts/Type1 \
+		/usr/share/fonts \
+		/usr/share/poppler/cMap/Adobe-CNS1 \
+		/usr/share/poppler/cMap/Adobe-GB1 \
+		/usr/share/poppler/cMap/Adobe-Japan1 \
+		/usr/share/poppler/cMap/Adobe-Japan2 \
+		/usr/share/poppler/cMap/Adobe-Korea1
+	do
+		FONTPATH="$FONTPATH${FONTPATH:+:}$path"
+	done
+
+	econf \
+		$(use_enable cups) \
+		$(use_enable gtk) \
+		$(use_with cups pdftoraster) \
+		$(use_with idn libidn) \
+		$(use_with jpeg2k jasper) \
+		$(use_with X x) \
+		--disable-compile-inits \
+		--enable-dynamic \
+		--enable-freetype \
+		--enable-fontconfig \
+		--with-drivers=ALL \
+		--with-fontpath="$FONTPATH" \
+		--with-ijs \
+		--with-jbig2dec \
+		--with-libpaper \
+		--with-system-libtiff
+
+	if ! use bindist && use djvu ; then
+		sed -i -e 's!$(DD)bbox.dev!& $(DD)djvumask.dev $(DD)djvusep.dev!g' Makefile
+	fi
+
+	cd "${S}/ijs"
+	econf
+}
+
+src_compile() {
+	emake -j1 so all || die "emake failed"
+
+	cd "${S}/ijs"
+	emake || die "ijs emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install-so install || die "emake install failed"
+
+	if ! use bindist && use djvu ; then
+		dobin gsdjvu || die "dobin gsdjvu install failed"
+	fi
+
+	# remove gsc in favor of gambit, bug #253064
+	rm -rf "${D}/usr/bin/gsc"
+
+	rm -rf "${D}/usr/share/doc/${PF}/html/"{README,PUBLIC}
+	dodoc doc/GS9_Color_Management.pdf || die "dodoc install failed"
+
+	cd "${S}/ijs"
+	emake DESTDIR="${D}" install || die "emake ijs install failed"
+
+	# rename the original cidfmap to cidfmap.GS
+	mv "${D}/usr/share/ghostscript/${PVM}/Resource/Init/cidfmap"{,.GS} || die
+
+	# install our own cidfmap to handle CJK fonts
+	insinto "/usr/share/ghostscript/${PVM}/Resource/Init"
+	doins "${WORKDIR}/fontmaps/CIDFnmap" || die "doins CIDFnmap failed"
+	doins "${WORKDIR}/fontmaps/cidfmap" || die "doins cidfmap failed"
+	for X in ${LANGS} ; do
+		if use linguas_${X} ; then
+			doins "${WORKDIR}/fontmaps/cidfmap.${X}" || die "doins cidfmap.${X} failed"
+		fi
+	done
+}

diff --git a/media-video/dvdauthor/Manifest b/media-video/dvdauthor/Manifest
new file mode 100644
index 0000000..335b881
--- /dev/null
+++ b/media-video/dvdauthor/Manifest
@@ -0,0 +1,3 @@
+AUX dvdauthor-0.6.18-libpng-1.5.patch 631 RMD160 51b0e0e4b36947163153a52a59907978b1c34812 SHA1 3c01fcd6a6f9667994af8e94822bb19e5eb88341 SHA256 7a16d0dd5a37525a345b2e75f122b9ecfb43beed388eb7a8f33f0ab7b8b9e176
+DIST dvdauthor-0.6.18.tar.gz 392809 RMD160 d7571a8371305aefb283f433440b3be2264e9e34 SHA1 7b6e190a3903f617d08368e3cc5e6fd80677e2fb SHA256 0e21c2d9c09f7e347c4c9bd7b691455f524ec2e91bcafc18b84d7b7fb3a9cb26
+EBUILD dvdauthor-0.6.18.ebuild 855 RMD160 0fe7354da217a9020bd34308c1a0fcfda9bb50f1 SHA1 aaf7f2b1104673a0fdd618596dd4fe2ae670ec4f SHA256 136156d874204a94b13d1bc8fc13ba8fe1e16f9061fea6f6f000d3d82b1ef4fc

diff --git a/media-video/dvdauthor/dvdauthor-0.6.18.ebuild b/media-video/dvdauthor/dvdauthor-0.6.18.ebuild
new file mode 100644
index 0000000..0dbb672
--- /dev/null
+++ b/media-video/dvdauthor/dvdauthor-0.6.18.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-video/dvdauthor/dvdauthor-0.6.14.ebuild,v 1.3 2008/12/21 14:51:30 nixnut Exp $
+
+EAPI="2"
+
+inherit eutils
+
+DESCRIPTION="Tools for generating DVD files to be played on standalone DVD players"
+HOMEPAGE="http://dvdauthor.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc ~ppc64 ~sparc x86"
+IUSE=""
+
+DEPEND="media-libs/libdvdread
+	>=media-gfx/imagemagick-5.5.7.14
+	>=dev-libs/libxml2-2.6.0
+	media-libs/freetype
+	dev-libs/fribidi
+	media-libs/libpng"
+
+src_unpack() {
+	unpack ${A}
+}
+
+src_prepare() {
+	epatch "${FILESDIR}/${P}-libpng-1.5.patch"
+}
+
+src_install() {
+	make install DESTDIR="${D}" || die "installation failed"
+	dodoc README TODO ChangeLog
+}

diff --git a/media-video/dvdauthor/files/dvdauthor-0.6.18-libpng-1.5.patch b/media-video/dvdauthor/files/dvdauthor-0.6.18-libpng-1.5.patch
new file mode 100644
index 0000000..d234187
--- /dev/null
+++ b/media-video/dvdauthor/files/dvdauthor-0.6.18-libpng-1.5.patch
@@ -0,0 +1,25 @@
+$NetBSD: patch-ab,v 1.4 2011/01/27 00:00:58 wiz Exp $
+
+Fix build with png-1.5.
+Accepted upstream in
+https://github.com/ldo/dvdauthor/commit/c82aaa4eb1a1c36bf7e2b7ae3c9140d0bf8000b5
+
+--- src/spuunmux.c.orig	2010-03-05 06:37:06.000000000 +0000
++++ src/spuunmux.c
+@@ -38,6 +38,7 @@
+ #include <netinet/in.h>
+ 
+ #include <png.h>
++#include <zlib.h>
+ 
+ #include "rgb.h"
+ #include "common.h"
+@@ -483,7 +484,7 @@ static int write_png(char *file_name,str
+     return -1;
+     }
+ 
+-    if (setjmp(png_ptr->jmpbuf)) {
++    if (setjmp(png_jmpbuf(png_ptr))) {
+     png_destroy_write_struct(&png_ptr, &info_ptr);
+     fclose(fp);
+     return -1;

diff --git a/media-video/ffmpegthumbnailer/Manifest b/media-video/ffmpegthumbnailer/Manifest
new file mode 100644
index 0000000..ff2afd9
--- /dev/null
+++ b/media-video/ffmpegthumbnailer/Manifest
@@ -0,0 +1,5 @@
+AUX ffmpegthumbnailer-2.0.6-asneeded.patch 763 RMD160 602d8a289b5da40e65d27f17fbe5781f5f601088 SHA1 e81d9f7b63b71c45a14f5b25c4397f4c37991ff1 SHA256 355341d389b90c31d0a80ba6ff92f6cbbcc3da397878f4b50b05500a8ac9a2e7
+AUX ffmpegthumbnailer-2.0.6-flags.patch 797 RMD160 58371ffbda3b458c202883e31b36697c826470a7 SHA1 4705bca7e0836782875117eff57883016ba09e0a SHA256 1f8bfe8a1cafdda386fbe2d19920874a001c64d58e5e1ca86aee7762755c4db4
+AUX ffmpegthumbnailer-2.0.6-libpng-1.5.patch 466 RMD160 c5992ae8ca6822dfd5a5c5862facc7a7ef3e8cf2 SHA1 1c804b3ac26f13c59aae5670a90804225e3c23fc SHA256 668af27cb56823de1fb6f7de50b279d01cf16c9f20725d024323f0d194a6287b
+DIST ffmpegthumbnailer-2.0.6.tar.gz 340052 RMD160 8c635c6d35b699ea9d2ef753fc70aa23827c0a57 SHA1 c565eb31910ea03801045e19230870c7e772b1a6 SHA256 e9752c0fd3c9bbe20382b527a11d5d4abf2386d0a18ae77fc0e6b1eeb00b7dcd
+EBUILD ffmpegthumbnailer-2.0.6.ebuild 1165 RMD160 c67e18cbbba68cbc5bcb108fb441872af644a260 SHA1 d1b1d9f2d897a6dfa7e34f51965f7b9267185f9f SHA256 ccf92ef3e5bf4e46722c14e5bd543f6c7890a3de9d9908569f6418536c475b37

diff --git a/media-video/ffmpegthumbnailer/ffmpegthumbnailer-2.0.6.ebuild b/media-video/ffmpegthumbnailer/ffmpegthumbnailer-2.0.6.ebuild
new file mode 100644
index 0000000..022e695
--- /dev/null
+++ b/media-video/ffmpegthumbnailer/ffmpegthumbnailer-2.0.6.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-video/ffmpegthumbnailer/ffmpegthumbnailer-2.0.6.ebuild,v 1.2 2011/01/09 14:05:49 ssuominen Exp $
+
+EAPI=2
+inherit autotools eutils
+
+DESCRIPTION="Lightweight video thumbnailer that can be used by file managers"
+HOMEPAGE="http://code.google.com/p/ffmpegthumbnailer/"
+SRC_URI="http://${PN}.googlecode.com/files/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
+IUSE="gtk jpeg png"
+
+COMMON_DEPEND=">=media-video/ffmpeg-0.5
+	png? ( >=media-libs/libpng-1.4 )
+	jpeg? ( virtual/jpeg )"
+RDEPEND="${COMMON_DEPEND}
+	gtk? ( >=dev-libs/glib-2.14:2 )"
+DEPEND="${COMMON_DEPEND}
+	dev-util/pkgconfig"
+
+src_prepare() {
+	epatch "${FILESDIR}"/${P}-{asneeded,flags,libpng-1.5}.patch
+	eautoreconf
+}
+
+src_configure() {
+	econf \
+		--disable-dependency-tracking \
+		--disable-static \
+		$(use_enable png) \
+		$(use_enable jpeg) \
+		$(use_enable gtk gio)
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die
+	dodoc AUTHORS ChangeLog README
+	find "${D}" -name '*.la' -delete
+}

diff --git a/media-video/ffmpegthumbnailer/files/ffmpegthumbnailer-2.0.6-asneeded.patch b/media-video/ffmpegthumbnailer/files/ffmpegthumbnailer-2.0.6-asneeded.patch
new file mode 100644
index 0000000..d48c187
--- /dev/null
+++ b/media-video/ffmpegthumbnailer/files/ffmpegthumbnailer-2.0.6-asneeded.patch
@@ -0,0 +1,19 @@
+http://code.google.com/p/ffmpegthumbnailer/issues/detail?id=75
+
+--- Makefile.am
++++ Makefile.am
+@@ -39,12 +39,12 @@
+ libffmpegthumbnailer_includedir         = $(includedir)/libffmpegthumbnailer
+ libffmpegthumbnailer_la_CXXFLAGS        = $(AM_CXXFLAGS) $(FFMPEG_CFLAGS) $(PNG_CFLAGS)
+ libffmpegthumbnailer_la_LDFLAGS         = -version-info 4:6:0
+-libffmpegthumbnailer_la_LIBADD          = $(DL_LIBS) $(FFMPEG_LIBS) $(PNG_LIBS) $(JPEG_LIBS)
++libffmpegthumbnailer_la_LIBADD          = $(FFMPEG_LIBS) $(PNG_LIBS) $(JPEG_LIBS)
+ 
+ bin_PROGRAMS = ffmpegthumbnailer
+ 
+ ffmpegthumbnailer_SOURCES = main.cpp
+-ffmpegthumbnailer_LDADD = libffmpegthumbnailer.la
++ffmpegthumbnailer_LDADD = $(DL_LIBS) libffmpegthumbnailer.la
+ 
+ if ENABLE_UNITTEST
+ check_PROGRAMS = testrunner

diff --git a/media-video/ffmpegthumbnailer/files/ffmpegthumbnailer-2.0.6-flags.patch b/media-video/ffmpegthumbnailer/files/ffmpegthumbnailer-2.0.6-flags.patch
new file mode 100644
index 0000000..2262fae
--- /dev/null
+++ b/media-video/ffmpegthumbnailer/files/ffmpegthumbnailer-2.0.6-flags.patch
@@ -0,0 +1,25 @@
+http://code.google.com/p/ffmpegthumbnailer/issues/detail?id=76
+
+--- configure.ac
++++ configure.ac
+@@ -104,9 +104,9 @@
+ fi
+ 
+ ########################################################################
+-# Compiler flags
++# Preprocessor flags
+ ########################################################################
+-CXXFLAGS=-D__STDC_CONSTANT_MACROS
++CPPFLAGS="$CPPFLAGS -D__STDC_CONSTANT_MACROS"
+ 
+ ########################################################################
+ # Check debug mode
+@@ -118,7 +118,7 @@
+ AM_CONDITIONAL(DEBUG, test "$enable_debug" = "yes")
+ if test "$DEBUG" = "yes"; then
+     AC_DEFINE(ENABLE_DEBUG, [], "Enable debug mode")
+-    CXXFLAGS+=" -g -O1 -Wall -Werror -Wfatal-errors"
++    CXXFLAGS="$CXXFLAGS -g -O1 -Wall -Werror -Wfatal-errors"
+ fi
+ 
+ AC_ARG_ENABLE(unittests,

diff --git a/media-video/ffmpegthumbnailer/files/ffmpegthumbnailer-2.0.6-libpng-1.5.patch b/media-video/ffmpegthumbnailer/files/ffmpegthumbnailer-2.0.6-libpng-1.5.patch
new file mode 100644
index 0000000..7236f7e
--- /dev/null
+++ b/media-video/ffmpegthumbnailer/files/ffmpegthumbnailer-2.0.6-libpng-1.5.patch
@@ -0,0 +1,13 @@
+$NetBSD: patch-aa,v 1.1 2011/01/20 20:21:16 gavan Exp $
+
+--- libffmpegthumbnailer/pngwriter.cpp.orig	2011-01-06 19:01:50.000000000 +0000
++++ libffmpegthumbnailer/pngwriter.cpp
+@@ -49,7 +49,7 @@ PngWriter::PngWriter(std::vector<uint8_t
+ , m_InfoPtr(NULL)
+ {
+     init();
+-    png_set_write_fn(m_PngPtr, (voidp) &outputBuffer, writeDataCallback, NULL);
++    png_set_write_fn(m_PngPtr, (png_voidp) &outputBuffer, writeDataCallback, NULL);
+ }
+ 
+ PngWriter::~PngWriter()

diff --git a/media-video/mjpegtools/Manifest b/media-video/mjpegtools/Manifest
new file mode 100644
index 0000000..2b1e89e
--- /dev/null
+++ b/media-video/mjpegtools/Manifest
@@ -0,0 +1,5 @@
+AUX mjpegtools-1.9.0-glibc-2.10.patch 429 RMD160 ef7f706aeda7ebfa04dbd43b70a5e3e6faf24610 SHA1 3029f0e835e693b144298ed9f8143c9566be26f3 SHA256 0a76b418df4daa1603c827001ede6a1b3da4457b5d3aefeda0a656cd88ad446b
+AUX mjpegtools-1.9.0-jpeg-7.patch 774 RMD160 22c50dd28617159eaa89aefb4647e21d4d9972e7 SHA1 2bdb1b3b8591cede11d4a133a758e8ead35db4dd SHA256 2c9b90a283e8e6d95bd9573cd16310107c654d0d701a7dff7e47ee1a773da7cf
+AUX mjpegtools-1.9.0-libpng-1.5.patch 17513 RMD160 7a90ed82d4961899d9dc41038e7c609e928edb67 SHA1 2ff5b27e1629cce9bcec98167177bea16a758ed8 SHA256 bc412fc619f4f21f754e88b7760abd29b6950a3f6f3cce98010fb9938de1fb4d
+DIST mjpegtools-1.9.0.tar.gz 1718063 RMD160 79e0eb4bce468bb8f12da336e29abe8fab390a5f SHA1 1701233354c7ea86b5b7808c4dd5d03a71118e48 SHA256 a9322aaab1e0835fbaa00fc10e58e885833454fa0ad6f57c60c89a78f7ed1711
+EBUILD mjpegtools-1.9.0-r1.ebuild 2185 RMD160 4d0f93672d39cbd525a775e26eadfed56f7ed8ec SHA1 f889de24b5dd5121a711f3692527e3e2f33a431f SHA256 ec3fe615b29daa54d0a8b994e4ed3228a8e2cfdcb545f68351e9ba9ec111fe0d

diff --git a/media-video/mjpegtools/files/mjpegtools-1.9.0-glibc-2.10.patch b/media-video/mjpegtools/files/mjpegtools-1.9.0-glibc-2.10.patch
new file mode 100644
index 0000000..e161560
--- /dev/null
+++ b/media-video/mjpegtools/files/mjpegtools-1.9.0-glibc-2.10.patch
@@ -0,0 +1,11 @@
+--- mjpegtools-1.9.0/mplex/lpcmstrm_in.cpp.orig	2009-05-27 01:31:46.000000000 -0700
++++ mjpegtools-1.9.0/mplex/lpcmstrm_in.cpp	2009-05-27 01:33:09.000000000 -0700
+@@ -53,7 +53,7 @@
+ 
+ bool LPCMStream::Probe(IBitStream &bs )
+ {
+-    char *last_dot = strrchr( bs.StreamName(), '.' );
++    const char *last_dot = strrchr( bs.StreamName(), '.' );
+     return 
+         last_dot != NULL 
+         && strcmp( last_dot+1, "lpcm") == 0;

diff --git a/media-video/mjpegtools/files/mjpegtools-1.9.0-jpeg-7.patch b/media-video/mjpegtools/files/mjpegtools-1.9.0-jpeg-7.patch
new file mode 100644
index 0000000..ec36731
--- /dev/null
+++ b/media-video/mjpegtools/files/mjpegtools-1.9.0-jpeg-7.patch
@@ -0,0 +1,24 @@
+Fix segmentation fault with jpeg-7 and above where dinfo.do_fancy_upsampling isn't set by default to FALSE anymore.
+
+Patch by: Salah Coronya
+
+http://bugs.gentoo.org/show_bug.cgi?id=293919
+
+--- lavtools/jpegutils.c
++++ lavtools/jpegutils.c
+@@ -502,6 +502,7 @@
+ 
+    jpeg_read_header (&dinfo, TRUE);
+    dinfo.raw_data_out = TRUE;
++   dinfo.do_fancy_upsampling = FALSE;
+    dinfo.out_color_space = JCS_YCbCr;
+    dinfo.dct_method = JDCT_IFAST;
+    guarantee_huff_tables(&dinfo);
+@@ -599,6 +600,7 @@
+       if (field > 0) {
+          jpeg_read_header (&dinfo, TRUE);
+          dinfo.raw_data_out = TRUE;
++         dinfo.do_fancy_upsampling = FALSE;
+          dinfo.out_color_space = JCS_YCbCr;
+          dinfo.dct_method = JDCT_IFAST;
+          jpeg_start_decompress (&dinfo);

diff --git a/media-video/mjpegtools/files/mjpegtools-1.9.0-libpng-1.5.patch b/media-video/mjpegtools/files/mjpegtools-1.9.0-libpng-1.5.patch
new file mode 100644
index 0000000..2aacb18
--- /dev/null
+++ b/media-video/mjpegtools/files/mjpegtools-1.9.0-libpng-1.5.patch
@@ -0,0 +1,525 @@
+$NetBSD: patch-ac,v 1.11 2011/02/10 17:06:27 wiz Exp $
+
+Fix build with png-1.5, from John Bowler <jbowler@acm.org>.
+https://sourceforge.net/tracker/?func=detail&aid=3177485&group_id=5776&atid=105776
+
+--- lavtools/png2yuv.c.orig	2007-11-08 17:31:50.000000000 +0000
++++ lavtools/png2yuv.c
+@@ -49,12 +49,9 @@ png2yuv
+ 
+ #include "subsample.h"
+ #include "colorspace.h"
+-//#include "mplexconsts.hh"
+ 
+ #define DEFAULT_CHROMA_MODE Y4M_CHROMA_420JPEG
+ 
+-#define MAXPIXELS (2800*1152)  /**< Maximum size of final image */
+-
+ typedef struct _parameters 
+ {
+   char *pngformatstr;
+@@ -70,14 +67,10 @@ typedef struct _parameters 
+   int ss_mode; /**< subsampling mode (based on ssm_id from subsample.h) */
+ 
+   int new_width; /// new MPEG2 width, in case the original one is uneven
++  int new_height; /// new MPEG2 width, in case the original one is uneven
+ } parameters_t;
+ 
+ 
+-struct _parameters *sh_param; 
+-png_structp png_ptr;
+-png_infop info_ptr, end_info;
+-uint8_t *raw0, *raw1, *raw2;  /* buffer for RGB first, and then Y/Cb/Cr planes of decoded PNG */
+-
+ /*
+  * The User Interface parts 
+  */
+@@ -152,8 +145,6 @@ static void parse_commandline(int argc, 
+   param->interleave = -1;
+   param->verbose = 1;
+   param->ss_mode = DEFAULT_CHROMA_MODE;
+-  //param->mza_filename = NULL;
+-  //param->make_z_alpha = 0;
+ 
+   /* parse options */
+   for (;;) {
+@@ -240,93 +231,43 @@ static void parse_commandline(int argc, 
+     }
+ }
+ 
+-void png_separation(png_structp png_ptr, png_row_infop row_info, png_bytep data)
+-{
+-  int row_nr = png_ptr->row_number; // internal variable ? 
+-  int i, width = row_info->width; 
+-  int new_width = sh_param->new_width;
+-
+-  /* contents of row_info:
+-   *  png_uint_32 width      width of row
+-   *  png_uint_32 rowbytes   number of bytes in row
+-   *  png_byte color_type    color type of pixels
+-   *  png_byte bit_depth     bit depth of samples
+-   *  png_byte channels      number of channels (1-4)
+-   *  png_byte pixel_depth   bits per pixel (depth*channels)
+-   */
+-
+-  //mjpeg_debug("PNG YUV transformation callback; color_type is %d row_number %d\n", 
+-  //	 row_info->color_type, row_nr);
+-
+-  if(row_info->color_type == PNG_COLOR_TYPE_GRAY) // only Z available
+-    {
+-      //mjpeg_debug("Grayscale to YUV, row %d", row_nr);
+-      for (i = 0; i < width; i++)
+-	{
+-	  raw0[i + row_nr * new_width] = data[i];
+-	  raw1[i + row_nr * new_width] = data[i];
+-	  raw2[i + row_nr * new_width] = data[i];
+-	}
+-      return;
+-    }
+-
+-  if(row_info->color_type == PNG_COLOR_TYPE_RGB) // Z and Alpha available
+-    {
+-      //mjpeg_info("RGB to YUV, row %d", row_nr);
+-      for (i = 0; i < width; i++)
+-	{
+-	  raw0[i + row_nr * new_width] = data[i*3];
+-	  raw1[i + row_nr * new_width] = data[i*3 + 1];
+-	  raw2[i + row_nr * new_width] = data[i*3 + 2];
+-	}
+-      return;
+-    }
+-
+-  mjpeg_error_exit1("mpegz: UNKNOWN COLOR FORMAT %d in PNG transformation !\n", row_info->color_type);
+-}
+-
+ 
+ /*
+  * The file handling parts 
+  */
+ /** 
+ Reads one PNG file. 
+-@param process Process the image data (0 for initial parameter determination)
++@param process Process the image data (NULL for initial parameter determination)
+ @returns -1 on failure, 1 on sucess
++@on success returns RGB data in the second, yuv, parameter
+ */
+-int decode_png(const char *pngname, int process, parameters_t *param)
++int decode_png(const char *pngname, uint8_t *yuv[], parameters_t *param)
+ {
+-  int num_pass = 1;
+-  int bit_depth, color_type;
++  png_structp png_ptr;
++  png_infop info_ptr;
+   FILE *pngfile;
+-  //png_byte hdptr[8];
+-
+-  /* Now open this PNG file, and examine its header to retrieve the 
+-     YUV4MPEG info that shall be written */
+-  pngfile = fopen(pngname, "rb");
+-  if (!pngfile)
+-    {
+-      perror("PNG file open failed:");
+-      return -1;
+-    }
+ 
+-  //fread(hdptr, 1, 8, pngfile);
++  /* libpng needs two structs - a png_struct and a png_info, there is no
++   * need to make the third, another png_info, because that is only used
++   * to store data (such as textual information) that can come after the
++   * PNG image.  This code only cares about the image.
++   */
++  info_ptr = NULL;
++  pngfile = NULL;
++  png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
++  if (!png_ptr)
++    mjpeg_error_exit1("%s: Could not allocate PNG read struct !", pngname);
+ 
+-#if 0 
+-  bool is_png = !png_sig_cmp(hdptr, 0, 8);
+-  if (!is_png)
++  /* This needs to be done immediately after creation of the png_struct
++   * because storage allocation failures will longjmp back to here:
++   */
++  if (setjmp(png_jmpbuf(png_ptr)))
+     {
+-      mjpeg_error("%s is _no_ PNG file !\n");
++      png_destroy_read_struct(&png_ptr, &info_ptr, 0);
++      if (pngfile) (void)fclose(pngfile);
++      mjpeg_error("%s: Corrupted PNG file !", pngname);
+       return -1;
+     }
+-#endif
+-  
+-  png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+-  if (!png_ptr)
+-    mjpeg_error_exit1("%s: Could not allocate PNG read struct !", pngname);
+-  
+-  png_init_io(png_ptr, pngfile);
+-  //png_set_sig_bytes(png_ptr, 8);
+   
+   info_ptr = png_create_info_struct(png_ptr);
+   if (!info_ptr)
+@@ -336,79 +277,101 @@ int decode_png(const char *pngname, int 
+       mjpeg_error_exit1("%s: Could not allocate PNG info struct !", pngname);
+     }
+   
+-  end_info = png_create_info_struct(png_ptr);
+-  if (!end_info)
++  /* Now open this PNG file, and examine its header to retrieve the 
++     YUV4MPEG info that shall be written */
++  pngfile = fopen(pngname, "rb");
++  if (!pngfile)
+     {
+-      png_destroy_read_struct(&png_ptr, &info_ptr,
+-			      (png_infopp)NULL);
+-      mjpeg_error_exit1("%s: Could not allocate PNG end info struct !", pngname);
++      perror(pngname);
++      png_error(png_ptr, "PNG file open failed");
+     }
+-  
+-  if (setjmp(png_jmpbuf(png_ptr)))
++
++  png_init_io(png_ptr, pngfile);
++
++  if (yuv)
+     {
+-      png_destroy_read_struct(&png_ptr, &info_ptr,
+-			      &end_info);
+-      mjpeg_error("%s: Corrupted PNG file !", pngname);
+-      return -1;
++      png_uint_32 nr, input_height, input_width, output_height, output_width;
++      uint8_t *r, *g, *b;
++      png_bytepp rows;
++
++      /* The code uses png_read_png to obtain a complete buffered copy of the
++       * PNG file reduced (or expanded) to 8 bit RGB.  This is a little wasteful
++       * in the case of a non-interlaced image - the code could work row by
++       * row without buffering the whole image - but the interlaced case is
++       * almost impossible to handle this way so it is better to be simple and
++       * correct.
++       */
++#     if PNG_LIBPNG_VER >= 10500 && PNG_LIBPNG_VER < 10502
++	  /* There is a bug in 1.5 before 1.5.2 which causes png_read_png to
++	   * whine most terribly on interlaced images, this stops it:
++	   */
++          (void)png_set_interlace_handling(png_ptr);
++#     endif
++      png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_STRIP_16 |
++	PNG_TRANSFORM_STRIP_ALPHA | PNG_TRANSFORM_EXPAND |
++	PNG_TRANSFORM_GRAY_TO_RGB /* requires libpng 1.4 or later */, 0);
++
++      /* And return the separated data to the parameters. */
++      rows = png_get_rows(png_ptr, info_ptr);
++
++      /* Since the PNG files for the frames are separate the actual PNG file 
++       * that was read could be unrelated - a random width and height.  Because
++       * the output may be interleaved the output height may be twice the input
++       * PNG height.  Because the MPEG code requires an even width the output
++       * width may be one more than the original frame width.
++       *
++       * For the interleaving the PNG data is smashed into the lower half of
++       * the yuv rows.  For the other cases the input data is cropped or
++       * top-lefted as appropriate.
++       */
++      output_height = param->new_height;
++
++      input_height = png_get_image_height(png_ptr, info_ptr);
++      if (input_height > output_height)
++          input_height = output_height;
++
++      output_width = param->new_width;
++
++      input_width = png_get_image_width(png_ptr, info_ptr);
++      if (input_width > output_width)
++        input_width = output_width;
++
++      /* Breaking up the RGB data is not hard to do, the separated channels are
++       * simply packed into the three raw yuv arrays with new_width values per
++       * row.
++       */
++      r = yuv[0];
++      g = yuv[1];
++      b = yuv[2];
++      for (nr=0; nr<input_height; ++nr)
++        {
++	  png_uint_32 nc;
++	  png_bytep row = *rows++;
++
++	  for (nc=0; nc<input_width; ++nc)
++	    {
++	    	*r++ = *row++;
++		*g++ = *row++;
++		*b++ = *row++;
++	    }
++	
++	  /* Pad the output: */
++	  for (; nc<output_width; ++nc)
++	    *r++ = *g++ = *b++ = 0;
++	}
+     }
+-  
+-  if (process)
+-    png_set_read_user_transform_fn(png_ptr, png_separation);
+-  png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_STRIP_16 | PNG_TRANSFORM_STRIP_ALPHA, NULL);
+-  
+-  if (png_get_IHDR(png_ptr, info_ptr, &param->width, &param->height, &bit_depth,
+-		       //   &color_type, &interlace_type, &compression_type, &filter_type))
+-		   &color_type, NULL, NULL, NULL))	
+-    num_pass = png_set_interlace_handling(png_ptr);
+   else
+-    mjpeg_error_exit1("PNG header reading failed !!\n");
+-#if 0 
+-  mjpeg_info("Reading info struct...\n");
+-  png_read_info(png_ptr, info_ptr);
+-  mjpeg_info("Done...\n");
+-  
+-  if (png_get_IHDR(png_ptr, info_ptr, &param->width, &param->height, &bit_depth,
+-		       //   &color_type, &interlace_type, &compression_type, &filter_type))
+-		   &color_type, NULL, NULL, NULL))	
+-    num_pass = png_set_interlace_handling(png_ptr);
+-  else
+-    mjpeg_error_exit1("PNG header reading failed !!\n");
+-  
+-  if (process)
+     {
+-      printf("%d passes needed\n\n", num_pass);
+-      
+-      if (bit_depth != 8 && bit_depth != 16)
+-	{
+-	  mjpeg_error_exit1("Invalid bit_depth %d, only 8 and 16 bit allowed !!\n", bit_depth);
+-	}
+-      
+-      png_set_strip_16(png_ptr); // always has to strip the 16bit input, MPEG can't handle it	  
+-      png_set_strip_alpha(png_ptr); // Alpha can't be processed until Z/Alpha is integrated
+-      
+-      printf("\nAllocating row buffer...");
+-      png_set_read_user_transform_fn(png_ptr, png_separation);
+-      png_bytep row_buf = (png_bytep)png_malloc(png_ptr,
+-						png_get_rowbytes(png_ptr, info_ptr));
+-      
+-      for (int n=0; n < num_pass; n++)
+-	for (int y=0; y < sh_param->height; y++)
+-	  {
+-	    printf("Writing row data for pass %d\n", n);
+-	    png_read_rows(png_ptr, (png_bytepp)&row_buf, NULL, 1);
+-	  }
+-      
+-      png_free(png_ptr, row_buf);	      
+-    }
+-  png_read_end(png_ptr, info_ptr);
+-#endif  
+-  if (setjmp(png_ptr->jmpbuf)) {
+-    png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
+-    return 2;
++      /* Just return the image width and height in *param */
++      png_read_info(png_ptr, info_ptr);
++
++      param->width = png_get_image_width(png_ptr, info_ptr);
++      param->height = png_get_image_height(png_ptr, info_ptr);
+     }
+ 
++  /* Successful exit: */
++  png_destroy_read_struct(&png_ptr, &info_ptr, 0);
+   fclose(pngfile);
+-
+   return 1;
+ }
+ 
+@@ -419,13 +382,17 @@ int decode_png(const char *pngname, int 
+  */
+ static int init_parse_files(parameters_t *param)
+ { 
+-  char pngname[255];
++  char pngname[PATH_MAX+1]; /* See POSIX 1003.1 section 2.9.5 */
+ 
+   snprintf(pngname, sizeof(pngname), 
+ 	   param->pngformatstr, param->begin);
+   mjpeg_debug("Analyzing %s to get the right pic params", pngname);
+   
+-  if (decode_png(pngname, 0, param) == -1)
++  /* The first frame (the param->begin frame) determines the height and
++   * width of the output.  Passing NULL instead of yuv (see below) causes
++   * decode_png to fill in param with the image dimensions.
++   */
++  if (decode_png(pngname, NULL, param) == -1)
+     mjpeg_error_exit1("Reading of %s failed.\n", pngname);
+ 
+   mjpeg_info("Image dimensions are %ux%u",
+@@ -455,6 +422,7 @@ static int init_parse_files(parameters_t
+ 
+   if (!(param->interleave) && (param->interlace != Y4M_ILACE_NONE)) 
+     {
++      /* So the height in 'param' might be twice the PNG input height:*/
+       param->height *= 2;
+       mjpeg_info("Non-interleaved fields (image height doubled)");
+     }
+@@ -466,33 +434,29 @@ static int init_parse_files(parameters_t
+ static int generate_YUV4MPEG(parameters_t *param)
+ {
+   uint32_t frame;
+-  //size_t pngsize;
+-  char pngname[FILENAME_MAX];
+-  uint8_t *yuv[3];  /* buffer for Y/U/V planes of decoded PNG */
++  uint8_t *yuv[3];  /* Buffers, initially for R,G,B then Y,Cb,Cr */
+   y4m_stream_info_t streaminfo;
+   y4m_frame_info_t frameinfo;
+ 
+-  if ((param->width % 2) == 0)
+-    param->new_width = param->width;
+-  else
+-    {
+-      param->new_width = ((param->width >> 1) + 1) << 1;
+-      printf("Setting new, even image width %d", param->new_width);
+-    }
++  /* Make the output even, so the output may be one larger than the
++   * original PNG image width.
++   */
++  param->new_width = param->width + (param->width & 1);
++  param->new_height = param->height + (param->height & 1);
+ 
+   mjpeg_info("Now generating YUV4MPEG stream.");
+   y4m_init_stream_info(&streaminfo);
+   y4m_init_frame_info(&frameinfo);
+ 
+   y4m_si_set_width(&streaminfo, param->new_width);
+-  y4m_si_set_height(&streaminfo, param->height);
++  y4m_si_set_height(&streaminfo, param->new_height);
+   y4m_si_set_interlace(&streaminfo, param->interlace);
+   y4m_si_set_framerate(&streaminfo, param->framerate);
+   y4m_si_set_chroma(&streaminfo, param->ss_mode);
+ 
+-  yuv[0] = (uint8_t *)malloc(param->new_width * param->height * sizeof(yuv[0][0]));
+-  yuv[1] = (uint8_t *)malloc(param->new_width * param->height * sizeof(yuv[1][0]));
+-  yuv[2] = (uint8_t *)malloc(param->new_width * param->height * sizeof(yuv[2][0]));
++  yuv[0] = (uint8_t *)malloc(param->new_width * param->new_height * sizeof(yuv[0][0]));
++  yuv[1] = (uint8_t *)malloc(param->new_width * param->new_height * sizeof(yuv[1][0]));
++  yuv[2] = (uint8_t *)malloc(param->new_width * param->new_height * sizeof(yuv[2][0]));
+ 
+   y4m_write_stream_header(STDOUT_FILENO, &streaminfo);
+ 
+@@ -500,15 +464,13 @@ static int generate_YUV4MPEG(parameters_
+        (frame < param->numframes + param->begin) || (param->numframes == -1);
+        frame++) 
+     {
+-      //      if (frame < 25)
+-      //      else      
+-      //snprintf(pngname, sizeof(pngname), param->pngformatstr, frame - 25);
++      char pngname[PATH_MAX+1];
+       snprintf(pngname, sizeof(pngname), param->pngformatstr, frame);
+             
+-      raw0 = yuv[0];
+-      raw1 = yuv[1];
+-      raw2 = yuv[2];
+-      if (decode_png(pngname, 1, param) == -1)
++      /* decode_png reads the PNG into the yuv buffers as r,g,b [0..255]
++       * values.
++       */
++      if (decode_png(pngname, yuv, param) == -1)
+ 	{
+ 	  mjpeg_info("Read from '%s' failed:  %s", pngname, strerror(errno));
+ 	  if (param->numframes == -1) 
+@@ -523,79 +485,18 @@ static int generate_YUV4MPEG(parameters_
+ 	} 
+       else 
+ 	{
+-#if 0 
+-	  mjpeg_debug("Preparing frame");
+-	  
+-	  /* Now open this PNG file, and examine its header to retrieve the 
+-	     YUV4MPEG info that shall be written */
+-
+-	  if ((param->interlace == Y4M_ILACE_NONE) || (param->interleave == 1)) 
+-	    {
+-	      mjpeg_info("Processing non-interlaced/interleaved %s.", 
+-			 pngname, pngsize);
+-
+-	      decode_png(imagedata, 0, 420, yuv[0], yuv[1], yuv[2], 
+-			 param->width, param->height, param->new_width);
+-	      
+-#if 0 
+-	      if (param->make_z_alpha)
+-		{
+-		  mjpeg_info("Writing Z/Alpha data.\n");
+-		  za_write(real_z_imagemap, param->width, param->height,z_alpha_fp,frame);
+-		}
+-#endif
+-	    } 
+-	  else 
+-	    {
+-	      mjpeg_error_exit1("Can't handle interlaced PNG information (yet) since there is no standard for it.\n"
+-				"Use interleaved mode (-L option) to create interlaced material.");
+-
+-	      switch (param->interlace) 
+-		{		  
+-		case Y4M_ILACE_TOP_FIRST:
+-		  mjpeg_info("Processing interlaced, top-first %s", pngname);
+-#if 0 
+-		  decode_jpeg_raw(jpegdata, jpegsize,
+-				  Y4M_ILACE_TOP_FIRST,
+-				  420, param->width, param->height,
+-				  yuv[0], yuv[1], yuv[2]);
+-#endif
+-		  break;
+-		case Y4M_ILACE_BOTTOM_FIRST:
+-		  mjpeg_info("Processing interlaced, bottom-first %s", pngname);
+-#if 0 
+-		  decode_jpeg_raw(jpegdata, jpegsize,
+-				  Y4M_ILACE_BOTTOM_FIRST,
+-				  420, param->width, param->height,
+-				  yuv[0], yuv[1], yuv[2]);
+-#endif
+-		  break;
+-		default:
+-		  mjpeg_error_exit1("FATAL logic error?!?");
+-		  break;
+-		}
+-	    }
+-#endif
+ 	  mjpeg_debug("Converting frame to YUV format.");
+ 	  /* Transform colorspace, then subsample (in place) */
+-	  convert_RGB_to_YCbCr(yuv, param->height *  param->new_width);
+-	  chroma_subsample(param->ss_mode, yuv, param->new_width, param->height);
++	  convert_RGB_to_YCbCr(yuv, param->new_height *  param->new_width);
++	  chroma_subsample(param->ss_mode, yuv, param->new_width, param->new_height);
+ 
+ 	  mjpeg_debug("Frame decoded, now writing to output stream.");
+ 	}
+-      
++
+       mjpeg_debug("Frame decoded, now writing to output stream.");
+       y4m_write_frame(STDOUT_FILENO, &streaminfo, &frameinfo, yuv);
+     }
+ 
+-#if 0 
+-  if (param->make_z_alpha)
+-    {
+-      za_write_end(z_alpha_fp);
+-      fclose(z_alpha_fp);
+-    }
+-#endif
+-
+   y4m_fini_stream_info(&streaminfo);
+   y4m_fini_frame_info(&frameinfo);
+   free(yuv[0]);
+@@ -614,7 +515,6 @@ static int generate_YUV4MPEG(parameters_
+ int main(int argc, char ** argv)
+ { 
+   parameters_t param;
+-  sh_param = &param;
+ 
+   y4m_accept_extensions(1);
+ 
+@@ -632,13 +532,3 @@ int main(int argc, char ** argv)
+ 
+   return 0;
+ }
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-

diff --git a/media-video/mjpegtools/mjpegtools-1.9.0-r1.ebuild b/media-video/mjpegtools/mjpegtools-1.9.0-r1.ebuild
new file mode 100644
index 0000000..f566364
--- /dev/null
+++ b/media-video/mjpegtools/mjpegtools-1.9.0-r1.ebuild
@@ -0,0 +1,88 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-video/mjpegtools/mjpegtools-1.9.0-r1.ebuild,v 1.7 2010/11/07 19:15:03 anarchy Exp $
+
+EAPI="1"
+
+inherit flag-o-matic toolchain-funcs eutils libtool
+
+MY_P=${P/_/}
+
+DESCRIPTION="Tools for MJPEG video"
+HOMEPAGE="http://mjpeg.sourceforge.net/"
+SRC_URI="mirror://sourceforge/mjpeg/${MY_P}.tar.gz"
+
+LICENSE="as-is"
+SLOT="1"
+KEYWORDS="alpha amd64 ppc ppc64 sparc x86"
+IUSE="gtk dv quicktime sdl X yv12 v4l dga png mmx"
+
+RDEPEND="virtual/jpeg
+	gtk? ( x11-libs/gtk+:2 )
+	dv? ( >=media-libs/libdv-0.99 )
+	quicktime? ( virtual/quicktime )
+	png? ( media-libs/libpng )
+	sdl? ( >=media-libs/libsdl-1.2.7-r3 )
+	X? ( x11-libs/libX11
+		x11-libs/libXt )"
+
+DEPEND="${RDEPEND}
+	mmx? ( dev-lang/nasm )
+	>=sys-apps/sed-4
+	dev-util/pkgconfig"
+
+S="${WORKDIR}/${MY_P}"
+
+src_unpack() {
+	unpack ${A}
+	cd "${S}"
+	sed -i -e '/ARCHFLAGS=/s:=.*:=:' configure
+	epatch "${FILESDIR}"/${P}-glibc-2.10.patch \
+		"${FILESDIR}"/${P}-jpeg-7.patch \
+		"${FILESDIR}"/${P}-libpng-1.5.patch
+}
+
+src_compile() {
+	local myconf
+
+	if use yv12 && use dv; then
+		myconf="${myconf} --with-dv-yv12"
+	elif use yv12; then
+		ewarn "yv12 support is possible when 'dv' is in your USE flags."
+	fi
+
+	[[ $(gcc-major-version) -eq 3 ]] && append-flags -mno-sse2
+
+	append-flags -fno-strict-aliasing
+
+	econf \
+		$(use_with X x) \
+		$(use_enable dga xfree-ext) \
+		$(use_with quicktime libquicktime) \
+		$(use_with png libpng) \
+		$(use_with v4l) \
+		$(use_with gtk) \
+		$(use_with sdl) \
+		$(use_with dv libdv /usr) \
+		$(use_enable mmx simd-accel) \
+		--enable-largefile \
+		--without-jpeg-mmx \
+		${myconf} || die "configure failed"
+
+	emake || die "emake failed"
+
+	cd docs
+	local infofile
+	for infofile in mjpeg*info*; do
+		echo "INFO-DIR-SECTION Miscellaneous" >> ${infofile}
+		echo "START-INFO-DIR-ENTRY" >> ${infofile}
+		echo "* mjpeg-howto: (mjpeg-howto).					 How to use the mjpeg-tools" >> ${infofile}
+		echo "END-INFO-DIR-ENTRY" >> ${infofile}
+	done
+}
+
+src_install() {
+	einstall || die "install failed"
+	dodoc mjpeg_howto.txt README* PLANS NEWS TODO HINTS BUGS ChangeLog \
+		AUTHORS CHANGES
+}



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-02-16  2:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-16  2:52 [gentoo-commits] dev/anarchy:master commit in: app-text/ghostscript-gpl/, media-video/ffmpegthumbnailer/files/, Jory Pratt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox