Date: Fri, 28 Aug 2015 10:32:05 +0000 (UTC) From: Jan Beich <jbeich@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r395460 - in head/multimedia/mplayer2: . files Message-ID: <201508281032.t7SAW54O014001@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jbeich Date: Fri Aug 28 10:32:04 2015 New Revision: 395460 URL: https://svnweb.freebsd.org/changeset/ports/395460 Log: multimedia/mplayer2: make GIF=on actually work GIF option was both auto-disabled during configure and broken when forced to be enabled. So, bump PORTREVISION to restore GIF support for users with GIF=on. PR: 202404 Submitted by: Carlos J Puga Medina <cpm@fbsd.es> (maintainer) MFH: 2015Q3 Added: head/multimedia/mplayer2/files/patch-libvo_vo_gif89a.c (contents, props changed) Modified: head/multimedia/mplayer2/Makefile (contents, props changed) head/multimedia/mplayer2/files/patch-libmpdemux-demux_gif.c (contents, props changed) Modified: head/multimedia/mplayer2/Makefile ============================================================================== --- head/multimedia/mplayer2/Makefile Fri Aug 28 10:12:38 2015 (r395459) +++ head/multimedia/mplayer2/Makefile Fri Aug 28 10:32:04 2015 (r395460) @@ -2,7 +2,7 @@ PORTNAME= mplayer2 PORTVERSION= ${MPLAYER2_PORT_VERSION} -PORTREVISION= 14 +PORTREVISION= 15 CATEGORIES= multimedia audio MASTER_SITES= LOCAL/gblach/ @@ -91,6 +91,7 @@ CONFIGURE_ARGS+= --disable-inet6 .if ${PORT_OPTIONS:MGIF} LIB_DEPENDS+= libgif.so:${PORTSDIR}/graphics/giflib +CONFIGURE_ARGS+= --enable-gif .else CONFIGURE_ARGS+= --disable-gif .endif Modified: head/multimedia/mplayer2/files/patch-libmpdemux-demux_gif.c ============================================================================== --- head/multimedia/mplayer2/files/patch-libmpdemux-demux_gif.c Fri Aug 28 10:12:38 2015 (r395459) +++ head/multimedia/mplayer2/files/patch-libmpdemux-demux_gif.c Fri Aug 28 10:32:04 2015 (r395460) @@ -1,19 +1,86 @@ --- libmpdemux/demux_gif.c.orig 2013-07-09 16:33:16 UTC +++ libmpdemux/demux_gif.c -@@ -44,6 +44,16 @@ typedef struct { +@@ -93,14 +93,14 @@ static int demux_gif_fill_buffer(demuxer - #define GIF_SIGNATURE (('G' << 16) | ('I' << 8) | 'F') + while (type != IMAGE_DESC_RECORD_TYPE) { + if (DGifGetRecordType(gif, &type) == GIF_ERROR) { +- PrintGifError(); ++ printf("%s\n", GifErrorString(GIF_ERROR)); + return 0; // oops + } + if (type == TERMINATE_RECORD_TYPE) + return 0; // eof + if (type == SCREEN_DESC_RECORD_TYPE) { + if (DGifGetScreenDesc(gif) == GIF_ERROR) { +- PrintGifError(); ++ printf("%s\n", GifErrorString(GIF_ERROR)); + return 0; // oops + } + } +@@ -108,7 +108,7 @@ static int demux_gif_fill_buffer(demuxer + int code; + unsigned char *p = NULL; + if (DGifGetExtension(gif, &code, &p) == GIF_ERROR) { +- PrintGifError(); ++ printf("%s\n", GifErrorString(GIF_ERROR)); + return 0; // oops + } + if (code == 0xF9) { +@@ -137,7 +137,7 @@ static int demux_gif_fill_buffer(demuxer + comments[length] = 0; + printf("%s", comments); + if (DGifGetExtensionNext(gif, &p) == GIF_ERROR) { +- PrintGifError(); ++ printf("%s\n", GifErrorString(GIF_ERROR)); + return 0; // oops + } + } +@@ -145,7 +145,7 @@ static int demux_gif_fill_buffer(demuxer + } + while (p != NULL) { + if (DGifGetExtensionNext(gif, &p) == GIF_ERROR) { +- PrintGifError(); ++ printf("%s\n", GifErrorString(GIF_ERROR)); + return 0; // oops + } + } +@@ -153,7 +153,7 @@ static int demux_gif_fill_buffer(demuxer + } -+static void PrintGifError(void) -+{ -+ char *Err = GifErrorString(); -+ -+ if (Err != NULL) -+ fprintf(stderr, "\nGIF-LIB error: %s.\n", Err); -+ else -+ fprintf(stderr, "\nGIF-LIB undefined error %d.\n", GifError()); -+} -+ - #ifndef CONFIG_GIF_TVT_HACK - // not supported by certain versions of the library - static int my_read_gif(GifFileType *gif, uint8_t *buf, int len) + if (DGifGetImageDesc(gif) == GIF_ERROR) { +- PrintGifError(); ++ printf("%s\n", GifErrorString(GIF_ERROR)); + return 0; // oops + } + +@@ -166,7 +166,7 @@ static int demux_gif_fill_buffer(demuxer + memset(dp->buffer, gif->SBackGroundColor, priv->w * priv->h); + + if (DGifGetLine(gif, buf, len) == GIF_ERROR) { +- PrintGifError(); ++ printf("%s\n", GifErrorString(GIF_ERROR)); + free(buf); + return 0; // oops + } +@@ -256,10 +256,10 @@ static demuxer_t* demux_open_gif(demuxer + lseek(demuxer->stream->fd, 0, SEEK_SET); + gif = DGifOpenFileHandle(demuxer->stream->fd); + #else +- gif = DGifOpen(demuxer->stream, my_read_gif); ++ gif = DGifOpen(demuxer->stream, my_read_gif, NULL); + #endif + if (!gif) { +- PrintGifError(); ++ printf("%s\n", GifErrorString(GIF_ERROR)); + free(priv); + return NULL; + } +@@ -301,7 +301,7 @@ static void demux_close_gif(demuxer_t* d + gif_priv_t *priv = demuxer->priv; + if (!priv) return; + if (priv->gif && DGifCloseFile(priv->gif) == GIF_ERROR) +- PrintGifError(); ++ printf("%s\n", GifErrorString(GIF_ERROR)); + free(priv->refimg); + free(priv); + } Added: head/multimedia/mplayer2/files/patch-libvo_vo_gif89a.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/multimedia/mplayer2/files/patch-libvo_vo_gif89a.c Fri Aug 28 10:32:04 2015 (r395460) @@ -0,0 +1,117 @@ +--- libvo/vo_gif89a.c.orig 2013-07-09 16:33:16 UTC ++++ libvo/vo_gif89a.c +@@ -44,13 +44,13 @@ + * entire argument being interpretted as the filename. + */ + +-#include <gif_lib.h> +- + #include <stdio.h> + #include <stdlib.h> + #include <string.h> + #include <unistd.h> + ++#include <gif_lib.h> ++ + #include "config.h" + #include "subopt-helper.h" + #include "video_out.h" +@@ -69,6 +69,15 @@ static const vo_info_t info = { + + const LIBVO_EXTERN(gif89a) + ++#if defined GIFLIB_MAJOR && GIFLIB_MAJOR >= 5 ++#define EGifOpenFileName(a, b) EGifOpenFileName(a, b, NULL) ++#define MakeMapObject GifMakeMapObject ++#define FreeMapObject GifFreeMapObject ++#define QuantizeBuffer GifQuantizeBuffer ++#if defined GIFLIB_MINOR && GIFLIB_MINOR >= 1 ++#define EGifCloseFile(a) EGifCloseFile(a, NULL) ++#endif ++#endif + + // how many frames per second we are aiming for during output. + static float target_fps; +@@ -92,6 +101,8 @@ static uint32_t img_width; + static uint32_t img_height; + // image data for slice rendering + static uint8_t *slice_data = NULL; ++// pointer for whole frame rendering ++static uint8_t *frame_data = NULL; + // reduced image data for flip_page + static uint8_t *reduce_data = NULL; + // reduced color map for flip_page +@@ -156,7 +167,7 @@ static int config(uint32_t s_width, uint + uint32_t d_height, uint32_t flags, char *title, + uint32_t format) + { +-#ifdef CONFIG_GIF_4 ++#if defined CONFIG_GIF_4 || GIFLIB_MAJOR >= 5 + // these are control blocks for the gif looping extension. + char LB1[] = "NETSCAPE2.0"; + char LB2[] = { 1, 0, 0 }; +@@ -185,23 +196,25 @@ static int config(uint32_t s_width, uint + return 1; + } + ++ new_gif = EGifOpenFileName(gif_filename, 0); ++ if (new_gif == NULL) { ++ mp_msg(MSGT_VO, MSGL_ERR, "GIF89a: error opening file \"%s\" for output.\n", gif_filename); ++ return 1; ++ } ++ ++#if defined GIFLIB_MAJOR && GIFLIB_MAJOR >= 5 ++ EGifSetGifVersion(new_gif, 1); ++#elif defined CONFIG_GIF_4 + // the EGifSetGifVersion line causes segfaults in certain + // earlier versions of libungif. i don't know exactly which, + // but certainly in all those before v4. if you have problems, + // you need to upgrade your gif library. +-#ifdef CONFIG_GIF_4 + EGifSetGifVersion("89a"); + #else + mp_msg(MSGT_VO, MSGL_ERR, "GIF89a: Your version of libungif needs to be upgraded.\n"); + mp_msg(MSGT_VO, MSGL_ERR, "GIF89a: Some functionality has been disabled.\n"); + #endif + +- new_gif = EGifOpenFileName(gif_filename, 0); +- if (new_gif == NULL) { +- mp_msg(MSGT_VO, MSGL_ERR, "GIF89a: error opening file \"%s\" for output.\n", gif_filename); +- return 1; +- } +- + slice_data = malloc(img_width * img_height * 3); + if (slice_data == NULL) { + mp_msg(MSGT_VO, MSGL_ERR, "GIF89a: malloc failed.\n"); +@@ -231,7 +244,12 @@ static int config(uint32_t s_width, uint + + // set the initial width and height info. + EGifPutScreenDesc(new_gif, s_width, s_height, 256, 0, reduce_cmap); +-#ifdef CONFIG_GIF_4 ++#if defined GIFLIB_MAJOR && GIFLIB_MAJOR >= 5 ++ EGifPutExtensionLeader(new_gif, 0xFF); ++ EGifPutExtensionBlock(new_gif, 11, LB1); ++ EGifPutExtensionBlock(new_gif, 3, LB2); ++ EGifPutExtensionTrailer(new_gif); ++#elif defined CONFIG_GIF_4 + // version 3 of libungif does not support multiple control blocks. + // looping requires multiple control blocks. + // therefore, looping is only enabled for v4 and up. +@@ -311,7 +329,8 @@ static void flip_page(void) + + static int draw_frame(uint8_t *src[]) + { +- return 1; ++ frame_data = src[0]; ++ return 0; + } + + static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y) +@@ -370,6 +389,7 @@ static void uninit(void) + // set the pointers back to null. + new_gif = NULL; + gif_filename = NULL; ++ frame_data = NULL; + slice_data = NULL; + reduce_data = NULL; + reduce_cmap = NULL;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201508281032.t7SAW54O014001>