aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjbeich <jbeich@FreeBSD.org>2015-08-28 18:32:04 +0800
committerjbeich <jbeich@FreeBSD.org>2015-08-28 18:32:04 +0800
commit135b06e853da838b7852a79753cfb2c13f786b1b (patch)
treec195fc76e70f9c32abc683933a75b2d8daeac5a3
parentb7aed42fd39952c88b0269b54dac48db2a127a46 (diff)
downloadfreebsd-ports-gnome-135b06e853da838b7852a79753cfb2c13f786b1b.tar.gz
freebsd-ports-gnome-135b06e853da838b7852a79753cfb2c13f786b1b.tar.zst
freebsd-ports-gnome-135b06e853da838b7852a79753cfb2c13f786b1b.zip
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
-rw-r--r--multimedia/mplayer2/Makefile3
-rw-r--r--multimedia/mplayer2/files/patch-libmpdemux-demux_gif.c97
-rw-r--r--multimedia/mplayer2/files/patch-libvo_vo_gif89a.c117
3 files changed, 201 insertions, 16 deletions
diff --git a/multimedia/mplayer2/Makefile b/multimedia/mplayer2/Makefile
index 51157e4b0f8c..039a17f1ff2e 100644
--- a/multimedia/mplayer2/Makefile
+++ b/multimedia/mplayer2/Makefile
@@ -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
diff --git a/multimedia/mplayer2/files/patch-libmpdemux-demux_gif.c b/multimedia/mplayer2/files/patch-libmpdemux-demux_gif.c
index 35673608ea8e..b3e1394b47a3 100644
--- a/multimedia/mplayer2/files/patch-libmpdemux-demux_gif.c
+++ b/multimedia/mplayer2/files/patch-libmpdemux-demux_gif.c
@@ -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);
+ }
diff --git a/multimedia/mplayer2/files/patch-libvo_vo_gif89a.c b/multimedia/mplayer2/files/patch-libvo_vo_gif89a.c
new file mode 100644
index 000000000000..7420e7973321
--- /dev/null
+++ b/multimedia/mplayer2/files/patch-libvo_vo_gif89a.c
@@ -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;