summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authoralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-02-19 16:55:14 +0000
committeralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-02-19 16:55:14 +0000
commit33154a7188879cc98a43a05432c371a9265b7442 (patch)
tree5b296e312d7814897b0d41fecf3a2d36b1aee985 /libmpdemux
parent8432755f2ed5caf899270f85a053fac65270c0ac (diff)
downloadmpv-33154a7188879cc98a43a05432c371a9265b7442.tar.bz2
mpv-33154a7188879cc98a43a05432c371a9265b7442.tar.xz
gif library incompatibility fixes and prefere libungif over libgif. Patch by Joey Parrish <joey@nicewarrior.org>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9464 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/demux_gif.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libmpdemux/demux_gif.c b/libmpdemux/demux_gif.c
index dbc6841212..e5dcb47b9b 100644
--- a/libmpdemux/demux_gif.c
+++ b/libmpdemux/demux_gif.c
@@ -24,9 +24,12 @@ static unsigned char *pallete = NULL;
#define GIF_SIGNATURE (('G' << 16) | ('I' << 8) | 'F')
+#ifndef HAVE_GIF_TVT_HACK
+// not supported by certain versions of the library
int my_read_gif(GifFileType *gif, uint8_t *buf, int len) {
return stream_read(gif->UserData, buf, len);
}
+#endif
int gif_check_file(demuxer_t *demuxer)
{
@@ -156,7 +159,17 @@ demuxer_t* demux_open_gif(demuxer_t* demuxer)
// go back to the beginning
stream_seek(demuxer->stream,demuxer->stream->start_pos);
+#ifdef HAVE_GIF_TVT_HACK
+ // without the TVT functionality of libungif, a hard seek must be
+ // done to the beginning of the file. this is because libgif is
+ // unable to use mplayer's cache, and without this lseek libgif will
+ // not read from the beginning of the file and the command will fail.
+ // with this hack enabled, you will lose the ability to stream a GIF.
+ lseek(demuxer->stream->fd, 0, SEEK_SET);
+ gif = DGifOpenFileHandle(demuxer->stream->fd);
+#else
gif = DGifOpen(demuxer->stream, my_read_gif);
+#endif
if (!gif) {
PrintGifError();
return NULL;