1
mirror of https://github.com/mpv-player/mpv synced 2024-12-28 06:03:45 +01:00

libgif/libungif based demuxer support for libmpdemux.

patch by Joey Parrish <joey@nicewarrior.org>


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9130 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi 2003-01-28 00:12:23 +00:00
parent 7b603cfb2c
commit 0cf1424936
10 changed files with 81 additions and 9 deletions

View File

@ -346,9 +346,10 @@ Andriy N. Gritsenko <andrej@lucky.net>
* skip-deinterlace video filter
* MUXER layer, and new MPEG-PS muxer
Joey Parrish <joey@yunamusic.com>
Joey Parrish <joey@nicewarrior.org>
* various fixes
* -vo gif89 author
* -vo gif89a author
* gif demuxer author
Juergen Hammelmann <juergen.hammelmann@gmx.de>
* TOOLS/menvcd author

View File

@ -65,6 +65,7 @@
<LI><A HREF="formats.html#ogg">2.1.1.12 OGG/OGM files</A></LI>
<LI><A HREF="formats.html#sdp">2.1.1.13 SDP files</A></LI>
<LI><A HREF="formats.html#pva">2.1.1.14 PVA files</A></LI>
<LI><A HREF="formats.html#gif">2.1.1.15 GIF files</A></LI>
</UL>
</LI>
<LI><A HREF="formats.html#audio_formats">2.1.2 Audio formats</A>

View File

@ -233,6 +233,34 @@
<A HREF="http://www.technotrend.de/download/av_format_v1.pdf">http://www.technotrend.de/download/av_format_v1.pdf</A></P>
<H4><A NAME="gif">2.1.1.15 GIF files</A></H4>
<P>The <B>GIF</B> format is a common format for web graphics. There are two
versions of the GIF spec, GIF87a and GIF89a. The main difference is that
GIF89a allows for animation. MPlayer supports both formats through use
of libungif or another libgif-compatible library. Non-animated GIFs will
be displayed as single frame videos. (Use the <CODE>-loop</CODE> and
<CODE>-fixed-vo</CODE> options to display these longer.)</P>
<P>MPlayer currently does not support seeking in GIF files. GIF files do
not necessarily have a fixed frame size, nor a fixed framerate. Rather,
each frame is of independant size and is supposed to be positioned in a
certain place on a field of fixed-size. The framerate is controlled by
an optional block before each frame that specifies a next frame's delay
in centiseconds.</P>
<P>Standard GIF files contain 24-bit RGB frames with at most an 8-bit
indexed pallete. These frames are usually LZW-compressed, although
some GIF encoders produce uncompressed frames to avoid patent issues
with LZW compression.</P>
<P>Though many common Linux distributions come with libungif, you can
download a copy from the following address:
<A HREF="http://prtr-13.ucsc.edu/~badger/software/libungif/index.shtml">http://prtr-13.ucsc.edu/~badger/software/libungif/index.shtml</A></P>
<P>The GIF specification can be downloaded from the following address:
<A HREF="http://www.w3.org/Graphics/GIF/spec-gif89a.txt">http://www.w3.org/Graphics/GIF/spec-gif89a.txt</A></P>
<H3><A NAME="audio_formats">2.1.2 Audio formats</A></H3>
<P>MPlayer is a <B>Movie</B> and not a <B>Media</B> player, although

View File

@ -152,3 +152,9 @@
Note, that similarity of real and asf has some background - they worked
together on the (never finished/used) ASF v2 spec for some time.
- GIF files:
The GIF format is a common format for web graphics that supports
animation. These are read through libungif or compatible library.
Variable frame delays are supported, but seeking is not supported.
Seeking will be supported once an index of gif frames can be built.

View File

@ -33,10 +33,10 @@ endif
OBJS_MENCODER = $(SRCS_MENCODER:.c=.o)
OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o)
VO_LIBS = $(AA_LIB) $(X_LIB) $(SDL_LIB) $(GGI_LIB) $(MP1E_LIB) $(MLIB_LIB) $(SVGA_LIB) $(DIRECTFB_LIB) $(GIF_LIB)
VO_LIBS = $(AA_LIB) $(X_LIB) $(SDL_LIB) $(GGI_LIB) $(MP1E_LIB) $(MLIB_LIB) $(SVGA_LIB) $(DIRECTFB_LIB)
AO_LIBS = $(ARTS_LIB) $(ESD_LIB) $(NAS_LIB) $(SGIAUDIO_LIB)
CODEC_LIBS = $(AV_LIB) $(FAME_LIB) $(MAD_LIB) $(VORBIS_LIB) $(FAAD_LIB) $(LIBLZO_LIB) $(XVID_LIB) $(DECORE_LIB) $(PNG_LIB) $(Z_LIB) $(JPEG_LIB) $(ALSA_LIB) $(XMMS_LIB)
COMMON_LIBS = libmpcodecs/libmpcodecs.a mp3lib/libMP3.a liba52/liba52.a libmpeg2/libmpeg2.a $(W32_LIB) $(DS_LIB) libaf/libaf.a libmpdemux/libmpdemux.a input/libinput.a $(PP_LIB) postproc/libswscale.a linux/libosdep.a $(CSS_LIB) $(CODEC_LIBS) $(FREETYPE_LIB) $(TERMCAP_LIB) $(CDPARANOIA_LIB) $(STREAMING_LIB) $(WIN32_LIB)
COMMON_LIBS = libmpcodecs/libmpcodecs.a mp3lib/libMP3.a liba52/liba52.a libmpeg2/libmpeg2.a $(W32_LIB) $(DS_LIB) libaf/libaf.a libmpdemux/libmpdemux.a input/libinput.a $(PP_LIB) postproc/libswscale.a linux/libosdep.a $(CSS_LIB) $(CODEC_LIBS) $(FREETYPE_LIB) $(TERMCAP_LIB) $(CDPARANOIA_LIB) $(STREAMING_LIB) $(WIN32_LIB) $(GIF_LIB)
CFLAGS = $(OPTFLAGS) -Ilibmpdemux -Iloader -Ilibvo $(FREETYPE_INC) $(EXTRA_INC) $(CDPARANOIA_INC) $(SDL_INC) # -Wall

8
configure vendored
View File

@ -167,7 +167,7 @@ Optional features:
--disable-sortsub Disable subtitles sorting [enabled]
Codecs:
--enable-gif enable gif89a output support [autodetect]
--enable-gif enable gif support [autodetect]
--enable-png enable png input/output support [autodetect]
--enable-jpeg enable jpeg input/output support [autodetect]
--enable-liblzo enable external liblzo support [autodetect]
@ -2888,7 +2888,7 @@ else
fi
echocheck "GIF89a support"
echocheck "GIF support"
if test "$_gif" = auto ; then
_gif=no
cat > $TMPC << EOF
@ -2915,9 +2915,10 @@ fi
if test "$_gif" = yes ; then
_def_gif='#define HAVE_GIF 1'
_vosrc="$_vosrc vo_gif89a.c"
_codecmodules="gif $_codecmodules"
_vomodules="gif89a $_vomodules"
_mkf_gif="yes"
_gif="yes (old version, some functions disabled)"
_gif="yes (old version, some encoding functions disabled)"
_def_gif_4='#undef HAVE_GIF_4'
cat > $TMPC << EOF
@ -2939,6 +2940,7 @@ else
_def_gif='#undef HAVE_GIF'
_def_gif_4='#undef HAVE_GIF_4'
_novomodules="gif89a $_novomodules"
_nocodecmodules="gif $_codecmodules"
_mkf_gif="no"
fi
echores "$_gif"

View File

@ -3,7 +3,7 @@ LIBNAME = libmpdemux.a
include ../config.mak
SRCS = mp3_hdr.c video.c mpeg_hdr.c cache2.c asfheader.c aviheader.c aviprint.c muxer.c muxer_avi.c muxer_mpeg.c demux_asf.c demux_avi.c demux_mov.c parse_mp4.c demux_mpg.c demux_pva.c demux_viv.c demuxer.c dvdauth.c dvdnav_stream.c open.c parse_es.c stream.c tv.c tvi_dummy.c tvi_v4l.c tvi_bsdbt848.c frequencies.c demux_fli.c demux_real.c demux_y4m.c yuv4mpeg.c yuv4mpeg_ratio.c demux_nuv.c demux_film.c demux_roq.c mf.c demux_mf.c demux_audio.c demux_demuxers.c demux_ogg.c demux_bmp.c cdda.c demux_rawaudio.c demux_rawvideo.c cddb.c cdinfo.c demux_rawdv.c ai_alsa.c ai_oss.c audio_in.c demux_smjpeg.c cue_read.c extension.c
SRCS = mp3_hdr.c video.c mpeg_hdr.c cache2.c asfheader.c aviheader.c aviprint.c muxer.c muxer_avi.c muxer_mpeg.c demux_asf.c demux_avi.c demux_mov.c parse_mp4.c demux_mpg.c demux_pva.c demux_viv.c demuxer.c dvdauth.c dvdnav_stream.c open.c parse_es.c stream.c tv.c tvi_dummy.c tvi_v4l.c tvi_bsdbt848.c frequencies.c demux_fli.c demux_real.c demux_y4m.c yuv4mpeg.c yuv4mpeg_ratio.c demux_nuv.c demux_film.c demux_roq.c mf.c demux_mf.c demux_audio.c demux_demuxers.c demux_ogg.c demux_bmp.c cdda.c demux_rawaudio.c demux_rawvideo.c cddb.c cdinfo.c demux_rawdv.c ai_alsa.c ai_oss.c audio_in.c demux_smjpeg.c cue_read.c extension.c demux_gif.c
ifeq ($(XMMS_PLUGINS),yes)
SRCS += demux_xmms.c
endif

View File

@ -133,6 +133,7 @@ extern void demux_close_rawdv(demuxer_t* demuxer);
extern void demux_close_pva(demuxer_t* demuxer);
extern void demux_close_smjpeg(demuxer_t* demuxer);
extern void demux_close_xmms(demuxer_t* demuxer);
extern void demux_close_gif(demuxer_t* demuxer);
#ifdef USE_TV
#include "tv.h"
@ -199,6 +200,10 @@ void free_demuxer(demuxer_t *demuxer){
case DEMUXER_TYPE_XMMS:
demux_close_xmms(demuxer); break;
#endif
#ifdef HAVE_GIF
case DEMUXER_TYPE_GIF:
demux_close_gif(demuxer); break;
#endif
}
// free streams:
@ -276,6 +281,7 @@ int demux_y4m_fill_buffer(demuxer_t *demux);
int demux_audio_fill_buffer(demux_stream_t *ds);
int demux_pva_fill_buffer(demuxer_t *demux);
int demux_xmms_fill_buffer(demuxer_t *demux,demux_stream_t *ds);
int demux_gif_fill_buffer(demuxer_t *demux);
extern int demux_demuxers_fill_buffer(demuxer_t *demux,demux_stream_t *ds);
extern int demux_ogg_fill_buffer(demuxer_t *d);
@ -325,6 +331,9 @@ int demux_fill_buffer(demuxer_t *demux,demux_stream_t *ds){
case DEMUXER_TYPE_RTP: return demux_rtp_fill_buffer(demux, ds);
#endif
case DEMUXER_TYPE_SMJPEG: return demux_smjpeg_fill_buffer(demux);
#ifdef HAVE_GIF
case DEMUXER_TYPE_GIF: return demux_gif_fill_buffer(demux);
#endif
}
return 0;
}
@ -549,6 +558,8 @@ extern int smjpeg_check_file(demuxer_t *demuxer);
extern int demux_open_smjpeg(demuxer_t* demuxer);
extern int bmp_check_file(demuxer_t *demuxer);
extern int demux_xmms_open(demuxer_t* demuxer);
extern int gif_check_file(demuxer_t *demuxer);
extern int demux_open_gif(demuxer_t* demuxer);
extern demuxer_t* init_avi_with_ogg(demuxer_t* demuxer);
@ -758,6 +769,19 @@ if(file_format==DEMUXER_TYPE_UNKNOWN || file_format==DEMUXER_TYPE_ROQ){
demuxer = NULL;
}
}
#ifdef HAVE_GIF
//=============== Try to open as GIF file: =================
if(file_format==DEMUXER_TYPE_UNKNOWN || file_format==DEMUXER_TYPE_GIF){
demuxer=new_demuxer(stream,DEMUXER_TYPE_GIF,audio_id,video_id,dvdsub_id);
if(gif_check_file(demuxer)){
mp_msg(MSGT_DEMUXER,MSGL_INFO,MSGTR_Detected_XXX_FileFormat,"GIF");
file_format=DEMUXER_TYPE_GIF;
} else {
free_demuxer(demuxer);
demuxer = NULL;
}
}
#endif
//=============== Try to open as BMP file: =================
if(file_format==DEMUXER_TYPE_UNKNOWN || file_format==DEMUXER_TYPE_BMP){
demuxer=new_demuxer(stream,DEMUXER_TYPE_BMP,audio_id,video_id,dvdsub_id);
@ -958,6 +982,12 @@ switch(file_format){
if (!demux_open_film(demuxer)) return NULL;
break;
}
#ifdef HAVE_GIF
case DEMUXER_TYPE_GIF: {
if (!demux_open_gif(demuxer)) return NULL;
break;
}
#endif
case DEMUXER_TYPE_BMP: {
if (!demux_open_bmp(demuxer)) return NULL;
break;

View File

@ -36,11 +36,12 @@
#define DEMUXER_TYPE_XMMS 25
#define DEMUXER_TYPE_RAWVIDEO 26
#define DEMUXER_TYPE_MPEG4_ES 27
#define DEMUXER_TYPE_GIF 28
// This should always match the higest demuxer type number.
// Unless you want to disallow users to force the demuxer to some types
#define DEMUXER_TYPE_MIN 0
#define DEMUXER_TYPE_MAX 27
#define DEMUXER_TYPE_MAX 28
#define DEMUXER_TYPE_DEMUXERS (1<<16)
// A virtual demuxer type for the network code

View File

@ -412,6 +412,9 @@ int video_read_frame(sh_video_t* sh_video,float* frame_time_ptr,unsigned char**
// frame_time = 1/25.0;
}
}
case DEMUXER_TYPE_GIF:
frame_time=d_video->pts-pts1;
break;
}
if(demuxer->file_format==DEMUXER_TYPE_MPEG_PS ||