smpeg-0.4.5+cvs20030824.orig/0042755000175000017500000000000007721741434015345 5ustar hoseheadhoseheadsmpeg-0.4.5+cvs20030824.orig/Makefile.in0100644000175000017500000005162407721741433017414 0ustar hoseheadhosehead# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. # These are the subdirectories that are always built SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include DESTDIR = pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_alias = @host_alias@ host_triplet = @host@ AS = @AS@ ASFLAGS = @ASFLAGS@ BINARY_AGE = @BINARY_AGE@ CC = @CC@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ CXX = @CXX@ DLLTOOL = @DLLTOOL@ GL_LIBS = @GL_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_CONFIG = @GTK_CONFIG@ GTK_LIBS = @GTK_LIBS@ HAVE_LIB = @HAVE_LIB@ INTERFACE_AGE = @INTERFACE_AGE@ LIB = @LIB@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIB = @LTLIB@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAJOR_VERSION = @MAJOR_VERSION@ MAKEINFO = @MAKEINFO@ MICRO_VERSION = @MICRO_VERSION@ MINOR_VERSION = @MINOR_VERSION@ OBJDUMP = @OBJDUMP@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ SMPEG_RLD_FLAGS = @SMPEG_RLD_FLAGS@ VERSION = @VERSION@ SUBDIRS = audio video CXXLD = cc bin_SCRIPTS = smpeg-config # The smpeg library target lib_LTLIBRARIES = libsmpeg.la libsmpeg_la_SOURCES = MPEG.cpp MPEGring.cpp MPEGlist.cpp MPEGstream.cpp MPEGsystem.cpp MPEGfilter.c smpeg.cpp libsmpegincludedir = $(includedir)/smpeg libsmpeginclude_HEADERS = MPEG.h MPEGaction.h MPEGaudio.h MPEGerror.h MPEGfilter.h MPEGring.h MPEGlist.h MPEGstream.h MPEGsystem.h MPEGvideo.h smpeg.h libsmpeg_la_LDFLAGS = -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -lstdc++ libsmpeg_la_LIBADD = audio/libaudio.la video/libvideo.la EXTRA_DIST = CHANGES COPYING TODO README README.SDL_mixer plaympeg.1 gtv.1 VisualC.zip smpeg.m4 autogen.sh @HAVE_GTK_TRUE@GTK_PLAYER = gtv @HAVE_GTK_FALSE@GTK_PLAYER = @HAVE_OPENGL_TRUE@OPENGL_PLAYER = glmovie @HAVE_OPENGL_FALSE@OPENGL_PLAYER = bin_PROGRAMS = plaympeg $(GTK_PLAYER) $(OPENGL_PLAYER) # Sources for plaympeg man_MANS = plaympeg.1 gtv.1 plaympeg_SOURCES = plaympeg.c plaympeg_LDADD = libsmpeg.la # Sources for gtv gtv_SOURCES = gtv.c gtv.h gtv_LDADD = @GTK_LIBS@ libsmpeg.la # Sources for glmovie glmovie_SOURCES = glmovie-tile.c glmovie.c glmovie.h glmovie_LDADD = @GL_LIBS@ libsmpeg.la # M4 macro file for inclusion with autoconf m4datadir = $(datadir)/aclocal m4data_DATA = smpeg.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = smpeg-config smpeg.spec LTLIBRARIES = $(lib_LTLIBRARIES) DEFS = @DEFS@ -I. -I$(srcdir) CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ X_CFLAGS = @X_CFLAGS@ X_LIBS = @X_LIBS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ libsmpeg_la_DEPENDENCIES = audio/libaudio.la video/libvideo.la libsmpeg_la_OBJECTS = MPEG.lo MPEGring.lo MPEGlist.lo MPEGstream.lo \ MPEGsystem.lo MPEGfilter.lo smpeg.lo PROGRAMS = $(bin_PROGRAMS) plaympeg_OBJECTS = plaympeg.o plaympeg_DEPENDENCIES = libsmpeg.la plaympeg_LDFLAGS = gtv_OBJECTS = gtv.o gtv_DEPENDENCIES = libsmpeg.la gtv_LDFLAGS = glmovie_OBJECTS = glmovie-tile.o glmovie.o glmovie_DEPENDENCIES = libsmpeg.la glmovie_LDFLAGS = SCRIPTS = $(bin_SCRIPTS) CXXFLAGS = @CXXFLAGS@ CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ man1dir = $(mandir)/man1 MANS = $(man_MANS) NROFF = nroff DATA = $(m4data_DATA) HEADERS = $(libsmpeginclude_HEADERS) DIST_COMMON = README COPYING Makefile.am Makefile.in TODO acinclude.m4 \ aclocal.m4 config.guess config.sub configure configure.in install-sh \ ltconfig ltmain.sh missing mkinstalldirs smpeg-config.in smpeg.spec.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar GZIP_ENV = --best SOURCES = $(libsmpeg_la_SOURCES) $(plaympeg_SOURCES) $(gtv_SOURCES) $(glmovie_SOURCES) OBJECTS = $(libsmpeg_la_OBJECTS) $(plaympeg_OBJECTS) $(gtv_OBJECTS) $(glmovie_OBJECTS) all: all-redirect .SUFFIXES: .SUFFIXES: .S .c .cpp .lo .o .s $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status $(ACLOCAL_M4): configure.in acinclude.m4 cd $(srcdir) && $(ACLOCAL) config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) smpeg-config: $(top_builddir)/config.status smpeg-config.in cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status smpeg.spec: $(top_builddir)/config.status smpeg.spec.in cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status mostlyclean-libLTLIBRARIES: clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) distclean-libLTLIBRARIES: maintainer-clean-libLTLIBRARIES: install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(libdir) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \ $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \ else :; fi; \ done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) list='$(lib_LTLIBRARIES)'; for p in $$list; do \ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ done .c.o: $(COMPILE) -c $< .s.o: $(COMPILE) -c $< .S.o: $(COMPILE) -c $< mostlyclean-compile: -rm -f *.o core *.core clean-compile: distclean-compile: -rm -f *.tab.c maintainer-clean-compile: .c.lo: $(LIBTOOL) --mode=compile $(COMPILE) -c $< .s.lo: $(LIBTOOL) --mode=compile $(COMPILE) -c $< .S.lo: $(LIBTOOL) --mode=compile $(COMPILE) -c $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: maintainer-clean-libtool: libsmpeg.la: $(libsmpeg_la_OBJECTS) $(libsmpeg_la_DEPENDENCIES) $(CXXLINK) -rpath $(libdir) $(libsmpeg_la_LDFLAGS) $(libsmpeg_la_OBJECTS) $(libsmpeg_la_LIBADD) $(LIBS) mostlyclean-binPROGRAMS: clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) distclean-binPROGRAMS: maintainer-clean-binPROGRAMS: install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ if test -f $$p; then \ echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) list='$(bin_PROGRAMS)'; for p in $$list; do \ rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ done plaympeg: $(plaympeg_OBJECTS) $(plaympeg_DEPENDENCIES) @rm -f plaympeg $(LINK) $(plaympeg_LDFLAGS) $(plaympeg_OBJECTS) $(plaympeg_LDADD) $(LIBS) gtv: $(gtv_OBJECTS) $(gtv_DEPENDENCIES) @rm -f gtv $(LINK) $(gtv_LDFLAGS) $(gtv_OBJECTS) $(gtv_LDADD) $(LIBS) glmovie: $(glmovie_OBJECTS) $(glmovie_DEPENDENCIES) @rm -f glmovie $(LINK) $(glmovie_LDFLAGS) $(glmovie_OBJECTS) $(glmovie_LDADD) $(LIBS) install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_SCRIPTS)'; for p in $$list; do \ if test -f $$p; then \ echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \ $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \ else if test -f $(srcdir)/$$p; then \ echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \ $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \ else :; fi; fi; \ done uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) list='$(bin_SCRIPTS)'; for p in $$list; do \ rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \ done .cpp.o: $(CXXCOMPILE) -c $< .cpp.lo: $(LTCXXCOMPILE) -c $< install-man1: $(mkinstalldirs) $(DESTDIR)$(man1dir) @list='$(man1_MANS)'; \ l2='$(man_MANS)'; for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \ $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \ done uninstall-man1: @list='$(man1_MANS)'; \ l2='$(man_MANS)'; for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \ rm -f $(DESTDIR)$(man1dir)/$$inst; \ done install-man: $(MANS) @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-man1 uninstall-man: @$(NORMAL_UNINSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-man1 install-m4dataDATA: $(m4data_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(m4datadir) @list='$(m4data_DATA)'; for p in $$list; do \ if test -f $(srcdir)/$$p; then \ echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(m4datadir)/$$p"; \ $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(m4datadir)/$$p; \ else if test -f $$p; then \ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(m4datadir)/$$p"; \ $(INSTALL_DATA) $$p $(DESTDIR)$(m4datadir)/$$p; \ fi; fi; \ done uninstall-m4dataDATA: @$(NORMAL_UNINSTALL) list='$(m4data_DATA)'; for p in $$list; do \ rm -f $(DESTDIR)$(m4datadir)/$$p; \ done install-libsmpegincludeHEADERS: $(libsmpeginclude_HEADERS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(libsmpegincludedir) @list='$(libsmpeginclude_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(libsmpegincludedir)/$$p"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(libsmpegincludedir)/$$p; \ done uninstall-libsmpegincludeHEADERS: @$(NORMAL_UNINSTALL) list='$(libsmpeginclude_HEADERS)'; for p in $$list; do \ rm -f $(DESTDIR)$(libsmpegincludedir)/$$p; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. @SET_MAKE@ all-recursive install-data-recursive install-exec-recursive \ installdirs-recursive install-recursive uninstall-recursive \ check-recursive installcheck-recursive info-recursive dvi-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ rev="$$subdir $$rev"; \ test "$$subdir" != "." || dot_seen=yes; \ done; \ test "$$dot_seen" = "no" && rev=". $$rev"; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ awk ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ here=`pwd` && cd $(srcdir) \ && mkid -f$$here/ID $$unique $(LISP) TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) tags=; \ here=`pwd`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ awk ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) mostlyclean-tags: clean-tags: distclean-tags: -rm -f TAGS ID maintainer-clean-tags: distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist -rm -rf $(distdir) GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz mkdir $(distdir)/=build mkdir $(distdir)/=inst dc_install_base=`cd $(distdir)/=inst && pwd`; \ cd $(distdir)/=build \ && ../configure --srcdir=.. --prefix=$$dc_install_base \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) dist -rm -rf $(distdir) @banner="$(distdir).tar.gz is ready for distribution"; \ dashes=`echo "$$banner" | sed s/./=/g`; \ echo "$$dashes"; \ echo "$$banner"; \ echo "$$dashes" dist: distdir -chmod -R a+r $(distdir) GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) -rm -rf $(distdir) dist-all: distdir -chmod -R a+r $(distdir) GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) -rm -rf $(distdir) distdir: $(DISTFILES) -rm -rf $(distdir) mkdir $(distdir) -chmod 777 $(distdir) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done for subdir in $(SUBDIRS); do \ if test "$$subdir" = .; then :; else \ test -d $(distdir)/$$subdir \ || mkdir $(distdir)/$$subdir \ || exit 1; \ chmod 777 $(distdir)/$$subdir; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ || exit 1; \ fi; \ done info-am: info: info-recursive dvi-am: dvi: dvi-recursive check-am: all-am check: check-recursive installcheck-am: installcheck: installcheck-recursive install-exec-am: install-libLTLIBRARIES install-binPROGRAMS \ install-binSCRIPTS install-exec: install-exec-recursive install-data-am: install-man install-m4dataDATA \ install-libsmpegincludeHEADERS install-data: install-data-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am install: install-recursive uninstall-am: uninstall-libLTLIBRARIES uninstall-binPROGRAMS \ uninstall-binSCRIPTS uninstall-man uninstall-m4dataDATA \ uninstall-libsmpegincludeHEADERS uninstall: uninstall-recursive all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(MANS) $(DATA) \ $(HEADERS) all-redirect: all-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install installdirs: installdirs-recursive installdirs-am: $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(bindir) \ $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1 \ $(DESTDIR)$(m4datadir) $(DESTDIR)$(libsmpegincludedir) mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: mostlyclean-am: mostlyclean-libLTLIBRARIES mostlyclean-compile \ mostlyclean-libtool mostlyclean-binPROGRAMS \ mostlyclean-tags mostlyclean-generic mostlyclean: mostlyclean-recursive clean-am: clean-libLTLIBRARIES clean-compile clean-libtool \ clean-binPROGRAMS clean-tags clean-generic \ mostlyclean-am clean: clean-recursive distclean-am: distclean-libLTLIBRARIES distclean-compile \ distclean-libtool distclean-binPROGRAMS distclean-tags \ distclean-generic clean-am -rm -f libtool distclean: distclean-recursive -rm -f config.status maintainer-clean-am: maintainer-clean-libLTLIBRARIES \ maintainer-clean-compile maintainer-clean-libtool \ maintainer-clean-binPROGRAMS maintainer-clean-tags \ maintainer-clean-generic distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." maintainer-clean: maintainer-clean-recursive -rm -f config.status .PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \ clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \ uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \ distclean-compile clean-compile maintainer-clean-compile \ mostlyclean-libtool distclean-libtool clean-libtool \ maintainer-clean-libtool mostlyclean-binPROGRAMS distclean-binPROGRAMS \ clean-binPROGRAMS maintainer-clean-binPROGRAMS uninstall-binPROGRAMS \ install-binPROGRAMS uninstall-binSCRIPTS install-binSCRIPTS \ install-man1 uninstall-man1 install-man uninstall-man \ uninstall-m4dataDATA install-m4dataDATA \ uninstall-libsmpegincludeHEADERS install-libsmpegincludeHEADERS \ install-data-recursive uninstall-data-recursive install-exec-recursive \ uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ all-recursive check-recursive installcheck-recursive info-recursive \ dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ install-exec install-data-am install-data install-am install \ uninstall-am uninstall all-redirect all-am all installdirs-am \ installdirs mostlyclean-generic distclean-generic clean-generic \ maintainer-clean-generic clean mostlyclean distclean maintainer-clean # Rule to build tar-gzipped distribution package $(PACKAGE)-$(VERSION).tar.gz: dist # Rule to build RPM distribution package rpm: $(PACKAGE)-$(VERSION).tar.gz cp $(PACKAGE)-$(VERSION).tar.gz /usr/src/redhat/SOURCES rpm -ba smpeg.spec # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: smpeg-0.4.5+cvs20030824.orig/README0100644000175000017500000000471507325113570016221 0ustar hoseheadhosehead SDL MPEG Player Library (SMPEG) Version 0.4.5 July 17, 2001 Written by Karl Robillard and Sam Lantinga, Loki Software, Inc. Streaming MPEG support contributed by Vivien Chappelier. SMPEG is a free MPEG1 video player library with sound support. Video playback is based on the ubiquitous Berkeley MPEG player, mpeg_play v2.2. Audio is played through a slightly modified mpegsound library, part of Splay v0.8.2. SMPEG supports MPEG audio (MP3), MPEG-1 video, and MPEG system streams. This library is distributed under the GNU Library Public License (LGPL) version 2. plaympeg, gtv, and glmovie are simple video players provided to test the library. The C library interface is 'documented' in smpeg.h, and the C++ library interface is spread out over the MPEG*.h files. This is a work in progress. Only 16 or 32 bit color depth is supported. The player will dynamically conver to other color depths, but playback will be much faster if your display is already set to 16 bit color depth. Currently it has only been tested on Linux. Requirements: * Simple DirectMedia Layer v1.2.0 or newer http://www.libsdl.org/ To make: Type 'make all'. This should build libsmpeg.a and plaympeg Usage: plaympeg [--noaudio] [--novideo] [--double|-2] [--loop|-l] file ... Known Issues: The MPEG decoding is a fairly slow and mathematically intensive process. It could use even further optimization. There isn't any synchronization between the audio and video threads, and system stream timestamps are ignored. The video is synchronized with audio by using video framerate and elapsed time. They are are synchronized well enough for short clips, but long movies, or movies with visual audio cues (like speech) don't look very good. Reporting bugs: Please report any bugs and/or fixes to smpeg@lokigames.com. Looking at the code: The functions that should be optimized to improve performance are: Color16DitherImageMod() (Uses 5ms CPU, called few times) Twox2Color16DitherImageMod() (Uses 10ms CPU, called few times) j_rev_dct() (Uses 0.01ms CPU, but called many times) ParseReconBlock() (Uses 0.01ms CPU, but called many times) To improve framerate scheduling, look at timeSync() in video/gdith.cpp Links: Berkeley MPEG player http://bmrc.berkeley.edu/frame/research/mpeg Splay http://my.netian.com/~polarb SDL http://www.libsdl.org/ smpeg-0.4.5+cvs20030824.orig/COPYING0100644000175000017500000006126106761142237016400 0ustar hoseheadhosehead GNU LIBRARY GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights. Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library. Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license. The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such. Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better. However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library. Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one. GNU LIBRARY GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! smpeg-0.4.5+cvs20030824.orig/Makefile.am0100644000175000017500000000334007544514764017403 0ustar hoseheadhosehead ## Makefile.am for the smpeg library # These are the subdirectories that are always built SUBDIRS = audio video CXXLD = cc bin_SCRIPTS = smpeg-config # The smpeg library target lib_LTLIBRARIES = libsmpeg.la libsmpeg_la_SOURCES = \ MPEG.cpp \ MPEGring.cpp \ MPEGlist.cpp \ MPEGstream.cpp \ MPEGsystem.cpp \ MPEGfilter.c \ smpeg.cpp libsmpegincludedir = $(includedir)/smpeg libsmpeginclude_HEADERS = \ MPEG.h \ MPEGaction.h \ MPEGaudio.h \ MPEGerror.h \ MPEGfilter.h \ MPEGring.h \ MPEGlist.h \ MPEGstream.h \ MPEGsystem.h \ MPEGvideo.h \ smpeg.h libsmpeg_la_LDFLAGS = \ -release $(LT_RELEASE) \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -lstdc++ libsmpeg_la_LIBADD = \ audio/libaudio.la \ video/libvideo.la EXTRA_DIST = \ CHANGES \ COPYING \ TODO \ README \ README.SDL_mixer \ plaympeg.1 \ gtv.1 \ VisualC.zip \ smpeg.m4 \ autogen.sh # Sample MPEG players if HAVE_GTK GTK_PLAYER = gtv else GTK_PLAYER = endif if HAVE_OPENGL OPENGL_PLAYER = glmovie else OPENGL_PLAYER = endif bin_PROGRAMS = plaympeg $(GTK_PLAYER) $(OPENGL_PLAYER) # Sources for plaympeg man_MANS = plaympeg.1 gtv.1 plaympeg_SOURCES = plaympeg.c plaympeg_LDADD = libsmpeg.la # Sources for gtv gtv_SOURCES = gtv.c gtv.h gtv_LDADD = @GTK_LIBS@ libsmpeg.la # Sources for glmovie glmovie_SOURCES = glmovie-tile.c glmovie.c glmovie.h glmovie_LDADD = @GL_LIBS@ libsmpeg.la # M4 macro file for inclusion with autoconf m4datadir = $(datadir)/aclocal m4data_DATA = smpeg.m4 # Rule to build tar-gzipped distribution package $(PACKAGE)-$(VERSION).tar.gz: dist # Rule to build RPM distribution package rpm: $(PACKAGE)-$(VERSION).tar.gz cp $(PACKAGE)-$(VERSION).tar.gz /usr/src/redhat/SOURCES rpm -ba smpeg.spec smpeg-0.4.5+cvs20030824.orig/TODO0100644000175000017500000000033507101152363016016 0ustar hoseheadhosehead * Add fast stream skip support - being worked on by Damien Chavarria * Rewrite the stream code to use condition variables * Add ATI hardware MPEG decoding acceleration * Add MMX versions of pixel-doubled dither routines smpeg-0.4.5+cvs20030824.orig/acinclude.m40100644000175000017500000005250507267426214017541 0ustar hoseheadhosehead# Configure paths for SDL # Sam Lantinga 9/21/99 # stolen from Manish Singh # stolen back from Frank Belew # stolen from Manish Singh # Shamelessly stolen from Owen Taylor dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS dnl AC_DEFUN(AM_PATH_SDL, [dnl dnl Get the cflags and libraries from the sdl-config script dnl AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], sdl_prefix="$withval", sdl_prefix="") AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], sdl_exec_prefix="$withval", sdl_exec_prefix="") AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], , enable_sdltest=yes) if test x$sdl_exec_prefix != x ; then sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" if test x${SDL_CONFIG+set} != xset ; then SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config fi fi if test x$sdl_prefix != x ; then sdl_args="$sdl_args --prefix=$sdl_prefix" if test x${SDL_CONFIG+set} != xset ; then SDL_CONFIG=$sdl_prefix/bin/sdl-config fi fi AC_PATH_PROG(SDL_CONFIG, sdl-config, no) min_sdl_version=ifelse([$1], ,0.11.0,$1) AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) no_sdl="" if test "$SDL_CONFIG" = "no" ; then no_sdl=yes else SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_sdltest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" dnl dnl Now check if the installed SDL is sufficiently new. (Also sanity dnl checks the results of sdl-config to some extent dnl rm -f conf.sdltest AC_TRY_RUN([ #include #include #include #include "SDL.h" char* my_strdup (char *str) { char *new_str; if (str) { new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); strcpy (new_str, str); } else new_str = NULL; return new_str; } int main (int argc, char *argv[]) { int major, minor, micro; char *tmp_version; /* This hangs on some systems (?) system ("touch conf.sdltest"); */ { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = my_strdup("$min_sdl_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_sdl_version"); exit(1); } if (($sdl_major_version > major) || (($sdl_major_version == major) && ($sdl_minor_version > minor)) || (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) { return 0; } else { printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); printf("*** best to upgrade to the required version.\n"); printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); printf("*** to point to the correct copy of sdl-config, and remove the file\n"); printf("*** config.cache before re-running configure\n"); return 1; } } ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_sdl" = x ; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$SDL_CONFIG" = "no" ; then echo "*** The sdl-config script installed by SDL could not be found" echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the SDL_CONFIG environment variable to the" echo "*** full path to sdl-config." else if test -f conf.sdltest ; then : else echo "*** Could not run SDL test program, checking why..." CFLAGS="$CFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" AC_TRY_LINK([ #include #include "SDL.h" ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding SDL or finding the wrong" echo "*** version of SDL. If it is not finding SDL, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means SDL was incorrectly installed" echo "*** or that you have moved SDL since it was installed. In the latter case, you" echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi SDL_CFLAGS="" SDL_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(SDL_CFLAGS) AC_SUBST(SDL_LIBS) rm -f conf.sdltest ]) ## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*- ## Copyright (C) 1996-1999, 2000 Free Software Foundation, Inc. ## Originally by Gordon Matzigkeit , 1996 ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ## ## As a special exception to the GNU General Public License, if you ## distribute this file as part of a program that contains a ## configuration script generated by Autoconf, you may include it under ## the same distribution terms that you use for the rest of that program. # serial 40 AC_PROG_LIBTOOL AC_DEFUN(AC_PROG_LIBTOOL, [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl # Save cache, so that ltconfig can load it AC_CACHE_SAVE # Actually configure libtool. ac_aux_dir is where install-sh is found. CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \ || AC_MSG_ERROR([libtool configure failed]) # Reload cache, that may have been modified by ltconfig AC_CACHE_LOAD # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl # Redirect the config.log output again, so that the ltconfig log is not # clobbered by the next message. exec 5>>./config.log ]) AC_DEFUN(AC_LIBTOOL_SETUP, [AC_PREREQ(2.13)dnl AC_REQUIRE([AC_ENABLE_SHARED])dnl AC_REQUIRE([AC_ENABLE_STATIC])dnl AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([AC_PROG_RANLIB])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_LD])dnl AC_REQUIRE([AC_PROG_NM])dnl AC_REQUIRE([AC_PROG_LN_S])dnl dnl case "$target" in NONE) lt_target="$host" ;; *) lt_target="$target" ;; esac # Check for any special flags to pass to ltconfig. libtool_flags="--cache-file=$cache_file" test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], [libtool_flags="$libtool_flags --enable-dlopen"]) ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], [libtool_flags="$libtool_flags --enable-win32-dll"]) AC_ARG_ENABLE(libtool-lock, [ --disable-libtool-lock avoid locking (might break parallel builds)]) test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" # Some flags need to be propagated to the compiler or linker for good # libtool support. case "$lt_target" in *-*-irix6*) # Find out which ABI we are using. echo '[#]line __oline__ "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case "`/usr/bin/file conftest.o`" in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], [*-*-cygwin* | *-*-mingw*) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; ]) esac ]) # AC_LIBTOOL_DLOPEN - enable checks for dlopen support AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) # AC_ENABLE_SHARED - implement the --enable-shared flag # Usage: AC_ENABLE_SHARED[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN(AC_ENABLE_SHARED, [dnl define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(shared, changequote(<<, >>)dnl << --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case "$enableval" in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$ac_save_ifs" ;; esac], enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl ]) # AC_DISABLE_SHARED - set the default shared flag to --disable-shared AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_SHARED(no)]) # AC_ENABLE_STATIC - implement the --enable-static flag # Usage: AC_ENABLE_STATIC[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN(AC_ENABLE_STATIC, [dnl define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(static, changequote(<<, >>)dnl << --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case "$enableval" in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$ac_save_ifs" ;; esac], enable_static=AC_ENABLE_STATIC_DEFAULT)dnl ]) # AC_DISABLE_STATIC - set the default static flag to --disable-static AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_STATIC(no)]) # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(fast-install, changequote(<<, >>)dnl << --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case "$enableval" in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$ac_save_ifs" ;; esac], enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl ]) # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_FAST_INSTALL(no)]) # AC_PROG_LD - find the path to the GNU or non-GNU linker AC_DEFUN(AC_PROG_LD, [AC_ARG_WITH(gnu-ld, [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl ac_prog=ld if test "$ac_cv_prog_gcc" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by GCC]) ac_prog=`($CC -print-prog-name=ld) 2>&5` case "$ac_prog" in # Accept absolute paths. changequote(,)dnl [\\/]* | [A-Za-z]:[\\/]*) re_direlt='/[^/][^/]*/\.\./' changequote([,])dnl # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(ac_cv_path_LD, [if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then ac_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then test "$with_gnu_ld" != no && break else test "$with_gnu_ld" != yes && break fi fi done IFS="$ac_save_ifs" else ac_cv_path_LD="$LD" # Let the user override the test with a path. fi]) LD="$ac_cv_path_LD" if test -n "$LD"; then AC_MSG_RESULT($LD) else AC_MSG_RESULT(no) fi test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) AC_PROG_LD_GNU ]) AC_DEFUN(AC_PROG_LD_GNU, [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, [# I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LD -v 2>&1 &5; then ac_cv_prog_gnu_ld=yes else ac_cv_prog_gnu_ld=no fi]) ]) # AC_PROG_NM - find the path to a BSD-compatible name lister AC_DEFUN(AC_PROG_NM, [AC_MSG_CHECKING([for BSD-compatible nm]) AC_CACHE_VAL(ac_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. ac_cv_path_NM="$NM" else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then ac_cv_path_NM="$ac_dir/nm -B" break elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then ac_cv_path_NM="$ac_dir/nm -p" break else ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags fi fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm fi]) NM="$ac_cv_path_NM" AC_MSG_RESULT([$NM]) ]) # AC_CHECK_LIBM - check for math library AC_DEFUN(AC_CHECK_LIBM, [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case "$lt_target" in *-*-beos* | *-*-cygwin*) # These system don't have libm ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, main, LIBM="-lm") ;; esac ]) # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for # the libltdl convenience library and INCLTDL to the include flags for # the libltdl header and adds --enable-ltdl-convenience to the # configure arguments. Note that LIBLTDL and INCLTDL are not # AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not # provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed # with '${top_builddir}/' and INCLTDL will be prefixed with # '${top_srcdir}/' (note the single quotes!). If your package is not # flat and you're not using automake, define top_builddir and # top_srcdir appropriately in the Makefiles. AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl case "$enable_ltdl_convenience" in no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; "") enable_ltdl_convenience=yes ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; esac LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) ]) # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for # the libltdl installable library and INCLTDL to the include flags for # the libltdl header and adds --enable-ltdl-install to the configure # arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is # AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed # libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will # be prefixed with '${top_builddir}/' and INCLTDL will be prefixed # with '${top_srcdir}/' (note the single quotes!). If your package is # not flat and you're not using automake, define top_builddir and # top_srcdir appropriately in the Makefiles. # In the future, this macro may have to be called after AC_PROG_LIBTOOL. AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_CHECK_LIB(ltdl, main, [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], [if test x"$enable_ltdl_install" = xno; then AC_MSG_WARN([libltdl not installed, but installation disabled]) else enable_ltdl_install=yes fi ]) if test x"$enable_ltdl_install" = x"yes"; then ac_configure_args="$ac_configure_args --enable-ltdl-install" LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) else ac_configure_args="$ac_configure_args --enable-ltdl-install=no" LIBLTDL="-lltdl" INCLTDL= fi ]) dnl old names AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl dnl This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL])dnl ################################################################### ## To: autoconf@gnu.org ## Subject: socklen_t ## From: lars brinkhoff ## Date: 26 Mar 1999 11:38:09 +0100 ## ## Here's an attempt at a check for socklen_t. AC_CHECK_TYPE doesn't ## work because it doesn't search . Maybe that macro ## should be changed instead. ## AC_DEFUN(AC_TYPE_SOCKLEN_T, [AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t, [ AC_TRY_COMPILE( [#include ], [socklen_t len = 42; return len;], ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no) ]) if test $ac_cv_type_socklen_t != yes; then AC_DEFINE(socklen_t, int) fi ]) smpeg-0.4.5+cvs20030824.orig/aclocal.m40100644000175000017500000020046507721741373017211 0ustar hoseheadhoseheaddnl aclocal.m4 generated automatically by aclocal 1.4-p6 dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A dnl PARTICULAR PURPOSE. # Configure paths for SDL # Sam Lantinga 9/21/99 # stolen from Manish Singh # stolen back from Frank Belew # stolen from Manish Singh # Shamelessly stolen from Owen Taylor dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS dnl AC_DEFUN(AM_PATH_SDL, [dnl dnl Get the cflags and libraries from the sdl-config script dnl AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], sdl_prefix="$withval", sdl_prefix="") AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], sdl_exec_prefix="$withval", sdl_exec_prefix="") AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], , enable_sdltest=yes) if test x$sdl_exec_prefix != x ; then sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" if test x${SDL_CONFIG+set} != xset ; then SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config fi fi if test x$sdl_prefix != x ; then sdl_args="$sdl_args --prefix=$sdl_prefix" if test x${SDL_CONFIG+set} != xset ; then SDL_CONFIG=$sdl_prefix/bin/sdl-config fi fi AC_PATH_PROG(SDL_CONFIG, sdl-config, no) min_sdl_version=ifelse([$1], ,0.11.0,$1) AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) no_sdl="" if test "$SDL_CONFIG" = "no" ; then no_sdl=yes else SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_sdltest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" dnl dnl Now check if the installed SDL is sufficiently new. (Also sanity dnl checks the results of sdl-config to some extent dnl rm -f conf.sdltest AC_TRY_RUN([ #include #include #include #include "SDL.h" char* my_strdup (char *str) { char *new_str; if (str) { new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); strcpy (new_str, str); } else new_str = NULL; return new_str; } int main (int argc, char *argv[]) { int major, minor, micro; char *tmp_version; /* This hangs on some systems (?) system ("touch conf.sdltest"); */ { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = my_strdup("$min_sdl_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_sdl_version"); exit(1); } if (($sdl_major_version > major) || (($sdl_major_version == major) && ($sdl_minor_version > minor)) || (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) { return 0; } else { printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); printf("*** best to upgrade to the required version.\n"); printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); printf("*** to point to the correct copy of sdl-config, and remove the file\n"); printf("*** config.cache before re-running configure\n"); return 1; } } ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_sdl" = x ; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$SDL_CONFIG" = "no" ; then echo "*** The sdl-config script installed by SDL could not be found" echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the SDL_CONFIG environment variable to the" echo "*** full path to sdl-config." else if test -f conf.sdltest ; then : else echo "*** Could not run SDL test program, checking why..." CFLAGS="$CFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" AC_TRY_LINK([ #include #include "SDL.h" ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding SDL or finding the wrong" echo "*** version of SDL. If it is not finding SDL, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means SDL was incorrectly installed" echo "*** or that you have moved SDL since it was installed. In the latter case, you" echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi SDL_CFLAGS="" SDL_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(SDL_CFLAGS) AC_SUBST(SDL_LIBS) rm -f conf.sdltest ]) # serial 40 AC_PROG_LIBTOOL AC_DEFUN(AC_PROG_LIBTOOL, [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl # Save cache, so that ltconfig can load it AC_CACHE_SAVE # Actually configure libtool. ac_aux_dir is where install-sh is found. CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \ || AC_MSG_ERROR([libtool configure failed]) # Reload cache, that may have been modified by ltconfig AC_CACHE_LOAD # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl # Redirect the config.log output again, so that the ltconfig log is not # clobbered by the next message. exec 5>>./config.log ]) AC_DEFUN(AC_LIBTOOL_SETUP, [AC_PREREQ(2.13)dnl AC_REQUIRE([AC_ENABLE_SHARED])dnl AC_REQUIRE([AC_ENABLE_STATIC])dnl AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([AC_PROG_RANLIB])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_LD])dnl AC_REQUIRE([AC_PROG_NM])dnl AC_REQUIRE([AC_PROG_LN_S])dnl dnl case "$target" in NONE) lt_target="$host" ;; *) lt_target="$target" ;; esac # Check for any special flags to pass to ltconfig. libtool_flags="--cache-file=$cache_file" test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], [libtool_flags="$libtool_flags --enable-dlopen"]) ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], [libtool_flags="$libtool_flags --enable-win32-dll"]) AC_ARG_ENABLE(libtool-lock, [ --disable-libtool-lock avoid locking (might break parallel builds)]) test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" # Some flags need to be propagated to the compiler or linker for good # libtool support. case "$lt_target" in *-*-irix6*) # Find out which ABI we are using. echo '[#]line __oline__ "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case "`/usr/bin/file conftest.o`" in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], [*-*-cygwin* | *-*-mingw*) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; ]) esac ]) # AC_LIBTOOL_DLOPEN - enable checks for dlopen support AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) # AC_ENABLE_SHARED - implement the --enable-shared flag # Usage: AC_ENABLE_SHARED[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN(AC_ENABLE_SHARED, [dnl define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(shared, changequote(<<, >>)dnl << --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case "$enableval" in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$ac_save_ifs" ;; esac], enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl ]) # AC_DISABLE_SHARED - set the default shared flag to --disable-shared AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_SHARED(no)]) # AC_ENABLE_STATIC - implement the --enable-static flag # Usage: AC_ENABLE_STATIC[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN(AC_ENABLE_STATIC, [dnl define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(static, changequote(<<, >>)dnl << --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case "$enableval" in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$ac_save_ifs" ;; esac], enable_static=AC_ENABLE_STATIC_DEFAULT)dnl ]) # AC_DISABLE_STATIC - set the default static flag to --disable-static AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_STATIC(no)]) # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(fast-install, changequote(<<, >>)dnl << --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case "$enableval" in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$ac_save_ifs" ;; esac], enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl ]) # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_FAST_INSTALL(no)]) # AC_PROG_LD - find the path to the GNU or non-GNU linker AC_DEFUN(AC_PROG_LD, [AC_ARG_WITH(gnu-ld, [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl ac_prog=ld if test "$ac_cv_prog_gcc" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by GCC]) ac_prog=`($CC -print-prog-name=ld) 2>&5` case "$ac_prog" in # Accept absolute paths. changequote(,)dnl [\\/]* | [A-Za-z]:[\\/]*) re_direlt='/[^/][^/]*/\.\./' changequote([,])dnl # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(ac_cv_path_LD, [if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then ac_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then test "$with_gnu_ld" != no && break else test "$with_gnu_ld" != yes && break fi fi done IFS="$ac_save_ifs" else ac_cv_path_LD="$LD" # Let the user override the test with a path. fi]) LD="$ac_cv_path_LD" if test -n "$LD"; then AC_MSG_RESULT($LD) else AC_MSG_RESULT(no) fi test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) AC_PROG_LD_GNU ]) AC_DEFUN(AC_PROG_LD_GNU, [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, [# I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LD -v 2>&1 &5; then ac_cv_prog_gnu_ld=yes else ac_cv_prog_gnu_ld=no fi]) ]) # AC_PROG_NM - find the path to a BSD-compatible name lister AC_DEFUN(AC_PROG_NM, [AC_MSG_CHECKING([for BSD-compatible nm]) AC_CACHE_VAL(ac_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. ac_cv_path_NM="$NM" else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then ac_cv_path_NM="$ac_dir/nm -B" break elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then ac_cv_path_NM="$ac_dir/nm -p" break else ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags fi fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm fi]) NM="$ac_cv_path_NM" AC_MSG_RESULT([$NM]) ]) # AC_CHECK_LIBM - check for math library AC_DEFUN(AC_CHECK_LIBM, [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case "$lt_target" in *-*-beos* | *-*-cygwin*) # These system don't have libm ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, main, LIBM="-lm") ;; esac ]) # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for # the libltdl convenience library and INCLTDL to the include flags for # the libltdl header and adds --enable-ltdl-convenience to the # configure arguments. Note that LIBLTDL and INCLTDL are not # AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not # provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed # with '${top_builddir}/' and INCLTDL will be prefixed with # '${top_srcdir}/' (note the single quotes!). If your package is not # flat and you're not using automake, define top_builddir and # top_srcdir appropriately in the Makefiles. AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl case "$enable_ltdl_convenience" in no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; "") enable_ltdl_convenience=yes ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; esac LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) ]) # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for # the libltdl installable library and INCLTDL to the include flags for # the libltdl header and adds --enable-ltdl-install to the configure # arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is # AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed # libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will # be prefixed with '${top_builddir}/' and INCLTDL will be prefixed # with '${top_srcdir}/' (note the single quotes!). If your package is # not flat and you're not using automake, define top_builddir and # top_srcdir appropriately in the Makefiles. # In the future, this macro may have to be called after AC_PROG_LIBTOOL. AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_CHECK_LIB(ltdl, main, [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], [if test x"$enable_ltdl_install" = xno; then AC_MSG_WARN([libltdl not installed, but installation disabled]) else enable_ltdl_install=yes fi ]) if test x"$enable_ltdl_install" = x"yes"; then ac_configure_args="$ac_configure_args --enable-ltdl-install" LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) else ac_configure_args="$ac_configure_args --enable-ltdl-install=no" LIBLTDL="-lltdl" INCLTDL= fi ]) dnl old names AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl dnl This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL])dnl AC_DEFUN(AC_TYPE_SOCKLEN_T, [AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t, [ AC_TRY_COMPILE( [#include ], [socklen_t len = 42; return len;], ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no) ]) if test $ac_cv_type_socklen_t != yes; then AC_DEFINE(socklen_t, int) fi ]) # lib-prefix.m4 serial 3 (gettext-0.12.2) dnl Copyright (C) 2001-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible. dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't dnl require excessive bracketing. ifdef([AC_HELP_STRING], [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], [AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed dnl to access previously installed libraries. The basic assumption is that dnl a user will want packages to use other packages he previously installed dnl with the same --prefix option. dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate dnl libraries, but is otherwise very convenient. AC_DEFUN([AC_LIB_PREFIX], [ AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) dnl By default, look in $includedir and $libdir. use_additional=yes AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) AC_LIB_ARG_WITH([lib-prefix], [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib --without-lib-prefix don't search for libraries in includedir and libdir], [ if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) else additional_includedir="$withval/include" additional_libdir="$withval/lib" fi fi ]) if test $use_additional = yes; then dnl Potentially add $additional_includedir to $CPPFLAGS. dnl But don't add it dnl 1. if it's the standard /usr/include, dnl 2. if it's already present in $CPPFLAGS, dnl 3. if it's /usr/local/include and we are using GCC on Linux, dnl 4. if it doesn't exist as a directory. if test "X$additional_includedir" != "X/usr/include"; then haveit= for x in $CPPFLAGS; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux*) haveit=yes;; esac fi fi if test -z "$haveit"; then if test -d "$additional_includedir"; then dnl Really add $additional_includedir to $CPPFLAGS. CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" fi fi fi fi dnl Potentially add $additional_libdir to $LDFLAGS. dnl But don't add it dnl 1. if it's the standard /usr/lib, dnl 2. if it's already present in $LDFLAGS, dnl 3. if it's /usr/local/lib and we are using GCC on Linux, dnl 4. if it doesn't exist as a directory. if test "X$additional_libdir" != "X/usr/lib"; then haveit= for x in $LDFLAGS; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test "X$additional_libdir" = "X/usr/local/lib"; then if test -n "$GCC"; then case $host_os in linux*) haveit=yes;; esac fi fi if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LDFLAGS. LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" fi fi fi fi fi ]) dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, dnl acl_final_exec_prefix, containing the values to which $prefix and dnl $exec_prefix will expand at the end of the configure script. AC_DEFUN([AC_LIB_PREPARE_PREFIX], [ dnl Unfortunately, prefix and exec_prefix get only finally determined dnl at the end of configure. if test "X$prefix" = "XNONE"; then acl_final_prefix="$ac_default_prefix" else acl_final_prefix="$prefix" fi if test "X$exec_prefix" = "XNONE"; then acl_final_exec_prefix='${prefix}' else acl_final_exec_prefix="$exec_prefix" fi acl_save_prefix="$prefix" prefix="$acl_final_prefix" eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" prefix="$acl_save_prefix" ]) dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the dnl variables prefix and exec_prefix bound to the values they will have dnl at the end of the configure script. AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], [ acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" $1 exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" ]) # lib-link.m4 serial 4 (gettext-0.12) dnl Copyright (C) 2001-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible. dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and dnl the libraries corresponding to explicit and implicit dependencies. dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and dnl augments the CPPFLAGS variable. AC_DEFUN([AC_LIB_LINKFLAGS], [ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) define([Name],[translit([$1],[./-], [___])]) define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ AC_LIB_LINKFLAGS_BODY([$1], [$2]) ac_cv_lib[]Name[]_libs="$LIB[]NAME" ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" ac_cv_lib[]Name[]_cppflags="$INC[]NAME" ]) LIB[]NAME="$ac_cv_lib[]Name[]_libs" LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" INC[]NAME="$ac_cv_lib[]Name[]_cppflags" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) AC_SUBST([LIB]NAME) AC_SUBST([LTLIB]NAME) dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the dnl results of this search when this library appears as a dependency. HAVE_LIB[]NAME=yes undefine([Name]) undefine([NAME]) ]) dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) dnl searches for libname and the libraries corresponding to explicit and dnl implicit dependencies, together with the specified include files and dnl the ability to compile and link the specified testcode. If found, it dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], [ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) define([Name],[translit([$1],[./-], [___])]) define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME dnl accordingly. AC_LIB_LINKFLAGS_BODY([$1], [$2]) dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, dnl because if the user has installed lib[]Name and not disabled its use dnl via --without-lib[]Name-prefix, he wants to use it. ac_save_CPPFLAGS="$CPPFLAGS" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ ac_save_LIBS="$LIBS" LIBS="$LIBS $LIB[]NAME" AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) LIBS="$ac_save_LIBS" ]) if test "$ac_cv_lib[]Name" = yes; then HAVE_LIB[]NAME=yes AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) AC_MSG_CHECKING([how to link with lib[]$1]) AC_MSG_RESULT([$LIB[]NAME]) else HAVE_LIB[]NAME=no dnl If $LIB[]NAME didn't lead to a usable library, we don't need dnl $INC[]NAME either. CPPFLAGS="$ac_save_CPPFLAGS" LIB[]NAME= LTLIB[]NAME= fi AC_SUBST([HAVE_LIB]NAME) AC_SUBST([LIB]NAME) AC_SUBST([LTLIB]NAME) undefine([Name]) undefine([NAME]) ]) dnl Determine the platform dependent parameters needed to use rpath: dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, dnl hardcode_direct, hardcode_minus_L. AC_DEFUN([AC_LIB_RPATH], [ AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh . ./conftest.sh rm -f ./conftest.sh acl_cv_rpath=done ]) wl="$acl_cv_wl" libext="$acl_cv_libext" shlibext="$acl_cv_shlibext" hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" hardcode_direct="$acl_cv_hardcode_direct" hardcode_minus_L="$acl_cv_hardcode_minus_L" dnl Determine whether the user wants rpath handling at all. AC_ARG_ENABLE(rpath, [ --disable-rpath do not hardcode runtime library paths], :, enable_rpath=yes) ]) dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and dnl the libraries corresponding to explicit and implicit dependencies. dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. AC_DEFUN([AC_LIB_LINKFLAGS_BODY], [ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) dnl By default, look in $includedir and $libdir. use_additional=yes AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) AC_LIB_ARG_WITH([lib$1-prefix], [ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib --without-lib$1-prefix don't search for lib$1 in includedir and libdir], [ if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) else additional_includedir="$withval/include" additional_libdir="$withval/lib" fi fi ]) dnl Search the library and its dependencies in $additional_libdir and dnl $LDFLAGS. Using breadth-first-seach. LIB[]NAME= LTLIB[]NAME= INC[]NAME= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='$1 $2' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= for name in $names_this_round; do already_handled= for n in $names_already_handled; do if test "$n" = "$name"; then already_handled=yes break fi done if test -z "$already_handled"; then names_already_handled="$names_already_handled $name" dnl See if it was already located by an earlier AC_LIB_LINKFLAGS dnl or AC_LIB_HAVE_LINKFLAGS call. uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" else dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined dnl that this library doesn't exist. So just drop it. : fi else dnl Search the library lib$name in $additional_libdir and $LDFLAGS dnl and the already constructed $LIBNAME/$LTLIBNAME. found_dir= found_la= found_so= found_a= if test $use_additional = yes; then if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then found_dir="$additional_libdir" found_so="$additional_libdir/lib$name.$shlibext" if test -f "$additional_libdir/lib$name.la"; then found_la="$additional_libdir/lib$name.la" fi else if test -f "$additional_libdir/lib$name.$libext"; then found_dir="$additional_libdir" found_a="$additional_libdir/lib$name.$libext" if test -f "$additional_libdir/lib$name.la"; then found_la="$additional_libdir/lib$name.la" fi fi fi fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then found_dir="$dir" found_so="$dir/lib$name.$shlibext" if test -f "$dir/lib$name.la"; then found_la="$dir/lib$name.la" fi else if test -f "$dir/lib$name.$libext"; then found_dir="$dir" found_a="$dir/lib$name.$libext" if test -f "$dir/lib$name.la"; then found_la="$dir/lib$name.la" fi fi fi ;; esac if test "X$found_dir" != "X"; then break fi done fi if test "X$found_dir" != "X"; then dnl Found the library. LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then dnl Linking with a shared library. We attempt to hardcode its dnl directory into the executable's runpath, unless it's the dnl standard /usr/lib. if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then dnl No hardcoding is needed. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else dnl Use an explicit option to hardcode DIR into the resulting dnl binary. dnl Potentially add DIR to ltrpathdirs. dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi dnl The hardcoding into $LIBNAME is system dependent. if test "$hardcode_direct" = yes; then dnl Using DIR/libNAME.so during linking hardcodes DIR into the dnl resulting binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then dnl Use an explicit option to hardcode DIR into the resulting dnl binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" dnl Potentially add DIR to rpathdirs. dnl The rpathdirs will be appended to $LIBNAME at the end. haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $found_dir" fi else dnl Rely on "-L$found_dir". dnl But don't add it if it's already contained in the LDFLAGS dnl or the already constructed $LIBNAME haveit= for x in $LDFLAGS $LIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" fi if test "$hardcode_minus_L" != no; then dnl FIXME: Not sure whether we should use dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" dnl here. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH dnl here, because this doesn't fit in flags passed to the dnl compiler. So give up. No hardcoding. This affects only dnl very old systems. dnl FIXME: Not sure whether we should use dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" dnl here. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then dnl Linking with a static library. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" else dnl We shouldn't come here, but anyway it's good to have a dnl fallback. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" fi fi dnl Assume the include files are nearby. additional_includedir= case "$found_dir" in */lib | */lib/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` additional_includedir="$basedir/include" ;; esac if test "X$additional_includedir" != "X"; then dnl Potentially add $additional_includedir to $INCNAME. dnl But don't add it dnl 1. if it's the standard /usr/include, dnl 2. if it's /usr/local/include and we are using GCC on Linux, dnl 3. if it's already present in $CPPFLAGS or the already dnl constructed $INCNAME, dnl 4. if it doesn't exist as a directory. if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux*) haveit=yes;; esac fi fi if test -z "$haveit"; then for x in $CPPFLAGS $INC[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then dnl Really add $additional_includedir to $INCNAME. INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" fi fi fi fi fi dnl Look for dependencies. if test -n "$found_la"; then dnl Read the .la file. It defines the variables dnl dlname, library_names, old_library, dependency_libs, current, dnl age, revision, installed, dlopen, dlpreopen, libdir. save_libdir="$libdir" case "$found_la" in */* | *\\*) . "$found_la" ;; *) . "./$found_la" ;; esac libdir="$save_libdir" dnl We use only dependency_libs. for dep in $dependency_libs; do case "$dep" in -L*) additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. dnl But don't add it dnl 1. if it's the standard /usr/lib, dnl 2. if it's /usr/local/lib and we are using GCC on Linux, dnl 3. if it's already present in $LDFLAGS or the already dnl constructed $LIBNAME, dnl 4. if it doesn't exist as a directory. if test "X$additional_libdir" != "X/usr/lib"; then haveit= if test "X$additional_libdir" = "X/usr/local/lib"; then if test -n "$GCC"; then case $host_os in linux*) haveit=yes;; esac fi fi if test -z "$haveit"; then haveit= for x in $LDFLAGS $LIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LIBNAME. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" fi fi haveit= for x in $LDFLAGS $LTLIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LTLIBNAME. LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" fi fi fi fi ;; -R*) dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then dnl Potentially add DIR to rpathdirs. dnl The rpathdirs will be appended to $LIBNAME at the end. haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $dir" fi dnl Potentially add DIR to ltrpathdirs. dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $dir" fi fi ;; -l*) dnl Handle this in the next round. names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` ;; *.la) dnl Handle this in the next round. Throw away the .la's dnl directory; it is already contained in a preceding -L dnl option. names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) dnl Most likely an immediate library name. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" ;; esac done fi else dnl Didn't find the library; assume it is in the system directories dnl known to the linker and runtime loader. (All the system dnl directories known to the linker should also be known to the dnl runtime loader, otherwise the system is severely misconfigured.) LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" fi fi fi done done if test "X$rpathdirs" != "X"; then if test -n "$hardcode_libdir_separator"; then dnl Weird platform: only the last -rpath option counts, the user must dnl pass all path elements in one option. We can arrange that for a dnl single library, but not when more than one $LIBNAMEs are used. alldirs= for found_dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" done dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" else dnl The -rpath options are cumulative. for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then dnl When using libtool, the option that works for both libraries and dnl executables is -R. The -R options are cumulative. for found_dir in $ltrpathdirs; do LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" done fi ]) dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, dnl unless already present in VAR. dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes dnl contains two or three consecutive elements that belong together. AC_DEFUN([AC_LIB_APPENDTOVAR], [ for element in [$2]; do haveit= for x in $[$1]; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then [$1]="${[$1]}${[$1]:+ }$element" fi done ]) # lib-ld.m4 serial 2 (gettext-0.12) dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl Subroutines of libtool.m4, dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision dnl with libtool.m4. dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. AC_DEFUN([AC_LIB_PROG_LD_GNU], [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, [# I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LD -v 2>&1 &5; then acl_cv_prog_gnu_ld=yes else acl_cv_prog_gnu_ld=no fi]) with_gnu_ld=$acl_cv_prog_gnu_ld ]) dnl From libtool-1.4. Sets the variable LD. AC_DEFUN([AC_LIB_PROG_LD], [AC_ARG_WITH(gnu-ld, [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by GCC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]* | [A-Za-z]:[\\/]*)] [re_direlt='/[^/][^/]*/\.\./'] # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(acl_cv_path_LD, [if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then acl_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then test "$with_gnu_ld" != no && break else test "$with_gnu_ld" != yes && break fi fi done IFS="$ac_save_ifs" else acl_cv_path_LD="$LD" # Let the user override the test with a path. fi]) LD="$acl_cv_path_LD" if test -n "$LD"; then AC_MSG_RESULT($LD) else AC_MSG_RESULT(no) fi test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) AC_LIB_PROG_LD_GNU ]) # Do all the work for Automake. This macro actually does too much -- # some checks are only needed if your package does certain things. # But this isn't really a big deal. # serial 1 dnl Usage: dnl AM_INIT_AUTOMAKE(package,version, [no-define]) AC_DEFUN([AM_INIT_AUTOMAKE], [AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL]) PACKAGE=[$1] AC_SUBST(PACKAGE) VERSION=[$2] AC_SUBST(VERSION) dnl test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi ifelse([$3],, AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) AC_REQUIRE([AM_SANITY_CHECK]) AC_REQUIRE([AC_ARG_PROGRAM]) dnl FIXME This is truly gross. missing_dir=`cd $ac_aux_dir && pwd` AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir) AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir) AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) AC_REQUIRE([AC_PROG_MAKE_SET])]) # Copyright 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"]) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.4-p6])]) # # Check to make sure that the build environment is sane. # AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftestfile # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` if test "[$]*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftestfile` fi if test "[$]*" != "X $srcdir/configure conftestfile" \ && test "[$]*" != "X conftestfile $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "[$]2" = conftestfile ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi rm -f conftest* AC_MSG_RESULT(yes)]) dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) dnl The program must properly implement --version. AC_DEFUN([AM_MISSING_PROG], [AC_MSG_CHECKING(for working $2) # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if ($2 --version) < /dev/null > /dev/null 2>&1; then $1=$2 AC_MSG_RESULT(found) else $1="$3/missing $2" AC_MSG_RESULT(missing) fi AC_SUBST($1)]) # Configure paths for GTK+ # Owen Taylor 97-11-3 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS dnl AC_DEFUN(AM_PATH_GTK, [dnl dnl Get the cflags and libraries from the gtk-config script dnl AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)], gtk_config_prefix="$withval", gtk_config_prefix="") AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)], gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="") AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program], , enable_gtktest=yes) for module in . $4 do case "$module" in gthread) gtk_config_args="$gtk_config_args gthread" ;; esac done if test x$gtk_config_exec_prefix != x ; then gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" if test x${GTK_CONFIG+set} != xset ; then GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config fi fi if test x$gtk_config_prefix != x ; then gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" if test x${GTK_CONFIG+set} != xset ; then GTK_CONFIG=$gtk_config_prefix/bin/gtk-config fi fi AC_PATH_PROG(GTK_CONFIG, gtk-config, no) min_gtk_version=ifelse([$1], ,0.99.7,$1) AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) no_gtk="" if test "$GTK_CONFIG" = "no" ; then no_gtk=yes else GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_gtktest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$GTK_LIBS $LIBS" dnl dnl Now check if the installed GTK is sufficiently new. (Also sanity dnl checks the results of gtk-config to some extent dnl rm -f conf.gtktest AC_TRY_RUN([ #include #include #include int main () { int major, minor, micro; char *tmp_version; system ("touch conf.gtktest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = g_strdup("$min_gtk_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_gtk_version"); exit(1); } if ((gtk_major_version != $gtk_config_major_version) || (gtk_minor_version != $gtk_config_minor_version) || (gtk_micro_version != $gtk_config_micro_version)) { printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, gtk_major_version, gtk_minor_version, gtk_micro_version); printf ("*** was found! If gtk-config was correct, then it is best\n"); printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); printf("*** before re-running configure\n"); } #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION) else if ((gtk_major_version != GTK_MAJOR_VERSION) || (gtk_minor_version != GTK_MINOR_VERSION) || (gtk_micro_version != GTK_MICRO_VERSION)) { printf("*** GTK+ header files (version %d.%d.%d) do not match\n", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); printf("*** library (version %d.%d.%d)\n", gtk_major_version, gtk_minor_version, gtk_micro_version); } #endif /* defined (GTK_MAJOR_VERSION) ... */ else { if ((gtk_major_version > major) || ((gtk_major_version == major) && (gtk_minor_version > minor)) || ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) { return 0; } else { printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", gtk_major_version, gtk_minor_version, gtk_micro_version); printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", major, minor, micro); printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); printf("*** correct copy of gtk-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } return 1; } ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_gtk" = x ; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$GTK_CONFIG" = "no" ; then echo "*** The gtk-config script installed by GTK could not be found" echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the GTK_CONFIG environment variable to the" echo "*** full path to gtk-config." else if test -f conf.gtktest ; then : else echo "*** Could not run GTK test program, checking why..." CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" AC_TRY_LINK([ #include #include ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GTK or finding the wrong" echo "*** version of GTK. If it is not finding GTK, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" echo "***" echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" echo "*** came with the system with the command" echo "***" echo "*** rpm --erase --nodeps gtk gtk-devel" ], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means GTK was incorrectly installed" echo "*** or that you have moved GTK since it was installed. In the latter case, you" echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi GTK_CFLAGS="" GTK_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) rm -f conf.gtktest ]) # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_SUBST($1_TRUE) AC_SUBST($1_FALSE) if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi]) smpeg-0.4.5+cvs20030824.orig/config.guess0100755000175000017500000011523007231351712017652 0ustar hoseheadhosehead#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. timestamp='2001-01-17' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Written by Per Bothner . # Please send patches to . # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. # # Only a few systems have been added to this list; please add others # (but try to keep the structure clean). # me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi dummy=dummy-$$ trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int dummy(){}" > $dummy.c for c in cc gcc c89 ; do ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 if test $? = 0 ; then CC_FOR_BUILD="$c"; break fi done rm -f $dummy.c $dummy.o $dummy.rel if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 8/24/94.) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # Netbsd (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # Determine the machine/vendor (is the vendor relevant). case "${UNAME_MACHINE}" in amiga) machine=m68k-unknown ;; arm32) machine=arm-unknown ;; atari*) machine=m68k-atari ;; sun3*) machine=m68k-sun ;; mac68k) machine=m68k-apple ;; macppc) machine=powerpc-apple ;; hp3[0-9][05]) machine=m68k-hp ;; ibmrt|romp-ibm) machine=romp-ibm ;; *) machine=${UNAME_MACHINE}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE}" in i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. cat <$dummy.s .data \$Lformat: .byte 37,100,45,37,120,10,0 # "%d-%x\n" .text .globl main .align 4 .ent main main: .frame \$30,16,\$26,0 ldgp \$29,0(\$27) .prologue 1 .long 0x47e03d80 # implver \$0 lda \$2,-1 .long 0x47e20c21 # amask \$2,\$1 lda \$16,\$Lformat mov \$0,\$17 not \$1,\$18 jsr \$26,printf ldgp \$29,0(\$26) mov 0,\$16 jsr \$26,exit .end main EOF $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then case `./$dummy` in 0-0) UNAME_MACHINE="alpha" ;; 1-0) UNAME_MACHINE="alphaev5" ;; 1-1) UNAME_MACHINE="alphaev56" ;; 1-101) UNAME_MACHINE="alphapca56" ;; 2-303) UNAME_MACHINE="alphaev6" ;; 2-307) UNAME_MACHINE="alphaev67" ;; esac fi rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; arc64:OpenBSD:*:*) echo mips64el-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hkmips:OpenBSD:*:*) echo mips-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mips-unknown-openbsd${UNAME_RELEASE} exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; atari*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; sun3*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD $dummy.c -o $dummy \ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i?86:AIX:*:*) echo i386-ibm-aix exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:4) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=4.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:5) case "`lsattr -El proc0 -a type -F value`" in PowerPC*) IBM_ARCH=powerpc IBM_MANUF=ibm ;; Itanium) IBM_ARCH=ia64 IBM_MANUF=unknown ;; POWER*) IBM_ARCH=power IBM_MANUF=ibm ;; *) IBM_ARCH=powerpc IBM_MANUF=ibm ;; esac echo ${IBM_ARCH}-${IBM_MANUF}-aix${UNAME_VERSION}.${UNAME_RELEASE} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) case "${HPUX_REV}" in 11.[0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; esac ;; esac fi ;; esac if [ "${HP_ARCH}" = "" ]; then sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi rm -f $dummy.c $dummy fi ;; esac echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i?86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; hppa*:OpenBSD:*:*) echo hppa-unknown-openbsd exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*X-MP:*:*:*) echo xmp-cray-unicos exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3D:*:*:*) echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; i?86:BSD/386:*:* | i?86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i386-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; *:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. ld_supported_emulations=`cd /; ld --help 2>&1 \ | sed -ne '/supported emulations:/!d s/[ ][ ]*/ /g s/.*supported emulations: *// s/ .*// p'` case "$ld_supported_emulations" in *ia64) echo "${UNAME_MACHINE}-unknown-linux" exit 0 ;; i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; elf_i?86) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" exit 0 ;; elf32_sparc) echo "${UNAME_MACHINE}-unknown-linux-gnu" exit 0 ;; armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" exit 0 ;; elf32arm*) echo "${UNAME_MACHINE}-unknown-linux-gnuoldld" exit 0 ;; armelf_linux*) echo "${UNAME_MACHINE}-unknown-linux-gnu" exit 0 ;; m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" exit 0 ;; elf32ppc | elf32ppclinux) # Determine Lib Version cat >$dummy.c < #if defined(__GLIBC__) extern char __libc_version[]; extern char __libc_release[]; #endif main(argc, argv) int argc; char *argv[]; { #if defined(__GLIBC__) printf("%s %s\n", __libc_version, __libc_release); #else printf("unkown\n"); #endif return 0; } EOF LIBC="" $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null if test "$?" = 0 ; then ./$dummy | grep 1\.99 > /dev/null if test "$?" = 0 ; then LIBC="libc1" fi fi rm -f $dummy.c $dummy echo powerpc-unknown-linux-gnu${LIBC} exit 0 ;; shelf_linux) echo "${UNAME_MACHINE}-unknown-linux-gnu" exit 0 ;; esac if test "${UNAME_MACHINE}" = "alpha" ; then cat <$dummy.s .data \$Lformat: .byte 37,100,45,37,120,10,0 # "%d-%x\n" .text .globl main .align 4 .ent main main: .frame \$30,16,\$26,0 ldgp \$29,0(\$27) .prologue 1 .long 0x47e03d80 # implver \$0 lda \$2,-1 .long 0x47e20c21 # amask \$2,\$1 lda \$16,\$Lformat mov \$0,\$17 not \$1,\$18 jsr \$26,printf ldgp \$29,0(\$26) mov 0,\$16 jsr \$26,exit .end main EOF LIBC="" $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then case `./$dummy` in 0-0) UNAME_MACHINE="alpha" ;; 1-0) UNAME_MACHINE="alphaev5" ;; 1-1) UNAME_MACHINE="alphaev56" ;; 1-101) UNAME_MACHINE="alphapca56" ;; 2-303) UNAME_MACHINE="alphaev6" ;; 2-307) UNAME_MACHINE="alphaev67" ;; esac objdump --private-headers $dummy | \ grep ld.so.1 > /dev/null if test "$?" = 0 ; then LIBC="libc1" fi fi rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 elif test "${UNAME_MACHINE}" = "mips" ; then cat >$dummy.c < /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #ifdef __MIPSEB__ printf ("%s-unknown-linux-gnu\n", argv[1]); #endif #ifdef __MIPSEL__ printf ("%sel-unknown-linux-gnu\n", argv[1]); #endif return 0; } EOF $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy elif test "${UNAME_MACHINE}" = "s390"; then echo s390-ibm-linux && exit 0 elif test "${UNAME_MACHINE}" = "x86_64"; then echo x86_64-unknown-linux-gnu && exit 0 elif test "${UNAME_MACHINE}" = "parisc" -o "${UNAME_MACHINE}" = "hppa"; then # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit 0 else # Either a pre-BFD a.out linker (linux-gnuoldld) # or one that does not give us useful --help. # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. # If ld does not provide *any* "supported emulations:" # that means it is gnuoldld. test -z "$ld_supported_emulations" \ && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 case "${UNAME_MACHINE}" in i?86) VENDOR=pc; ;; *) VENDOR=unknown; ;; esac # Determine whether the default compiler is a.out or elf cat >$dummy.c < #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); # else printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); # endif # else printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); # endif #else printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); #endif return 0; } EOF $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 fi ;; # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions # are messed up and put the nodename in both sysname and nodename. i?86:DYNIX/ptx:4*:*) echo i386-sequent-sysv4 exit 0 ;; i?86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; i?86:*:5:7*) # Fixed at (any) Pentium or better UNAME_MACHINE=i586 if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} fi exit 0 ;; i?86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; i?86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit 0 ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4.3${OS_REL} && exit 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) echo `uname -p`-apple-darwin${UNAME_RELEASE} exit 0 ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) if test "${UNAME_MACHINE}" = "x86pc"; then UNAME_MACHINE=pc fi echo `uname -p`-${UNAME_MACHINE}-nto-qnx exit 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; NSR-[KW]:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; i?86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit 0 ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit 0 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit 0 ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit 0 ;; *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) #if !defined (ultrix) printf ("vax-dec-bsd\n"); exit (0); #else printf ("vax-dec-ultrix\n"); exit (0); #endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: smpeg-0.4.5+cvs20030824.orig/config.sub0100755000175000017500000006553007231351712017324 0ustar hoseheadhosehead#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. timestamp='2001-01-12' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit 0;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | storm-chaos* | os2-emx*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \ | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \ | pyramid | mn10200 | mn10300 | tron | a29k \ | 580 | i960 | h8300 \ | x86 | ppcbe | mipsbe | mipsle | shbe | shle \ | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ | hppa64 \ | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ | alphaev6[78] \ | we32k | ns16k | clipper | i370 | sh | sh[34] \ | powerpc | powerpcle \ | 1750a | dsp16xx | pdp10 | pdp11 \ | mips16 | mips64 | mipsel | mips64el \ | mips64orion | mips64orionel | mipstx39 | mipstx39el \ | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ | mips64vr5000 | miprs64vr5000el | mcore \ | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ | thumb | d10v | d30v | fr30 | avr | openrisc) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i[234567]86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. # FIXME: clean up the formatting here. vax-* | tahoe-* | i[234567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \ | arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ | xmp-* | ymp-* \ | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \ | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ | hppa2.0n-* | hppa64-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ | alphaev6[78]-* \ | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ | clipper-* | orion-* \ | sparclite-* | pdp10-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ | mips64el-* | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ | mipstx39-* | mipstx39el-* | mcore-* \ | f30[01]-* | f700-* | s390-* | sv1-* | t3e-* \ | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \ | bs2000-* | tic54x-* | c54x-* | x86_64-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | ymp) basic_machine=ymp-cray os=-unicos ;; cray2) basic_machine=cray2-cray os=-unicos ;; [ctj]90-cray) basic_machine=c90-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i[34567]86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i[34567]86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i[34567]86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i[34567]86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; i386-go32 | go32) basic_machine=i386-unknown os=-go32 ;; i386-mingw32 | mingw32) basic_machine=i386-unknown os=-mingw32 ;; i[34567]86-pw32 | pw32) basic_machine=i586-unknown os=-pw32 ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mipsel*-linux*) basic_machine=mipsel-unknown os=-linux-gnu ;; mips*-linux*) basic_machine=mips-unknown os=-linux-gnu ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; mmix*) basic_machine=mmix-knuth os=-mmixware ;; monitor) basic_machine=m68k-rom68k os=-coff ;; msdos) basic_machine=i386-unknown os=-msdos ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexgen) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon) basic_machine=i686-pc ;; pentiumii | pentium2) basic_machine=i686-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sparclite-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=t3e-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; tower | tower-32) basic_machine=m68k-ncr ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xmp) basic_machine=xmp-cray os=-unicos ;; xps | xps100) basic_machine=xps100-honeywell ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; mips) if [ x$os = x-linux-gnu ]; then basic_machine=mips-unknown else basic_machine=mips-mips fi ;; romp) basic_machine=romp-ibm ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh3 | sh4) basic_machine=sh-unknown ;; sparc | sparcv9) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; c4x*) basic_machine=c4x-none os=-coff ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i[34567]86-*) ;; *) os=-nto$os ;; esac ;; -nto*) os=-nto-qnx ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -ptx*) vendor=sequent ;; -vxsim* | -vxworks*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: smpeg-0.4.5+cvs20030824.orig/configure0100755000175000017500000063471607721741400017261 0ustar hoseheadhosehead#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57. # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="README" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAJOR_VERSION MINOR_VERSION MICRO_VERSION INTERFACE_AGE BINARY_AGE VERSION ASFLAGS CCASFLAGS LT_RELEASE LT_CURRENT LT_REVISION LT_AGE build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX RANLIB ac_ct_RANLIB LN_S LIBTOOL AS CCAS SMPEG_RLD_FLAGS SDL_CONFIG SDL_CFLAGS SDL_LIBS GTK_CONFIG GTK_CFLAGS GTK_LIBS HAVE_GTK_TRUE HAVE_GTK_FALSE CPP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS GL_LIBS HAVE_OPENGL_TRUE HAVE_OPENGL_FALSE LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CXX_set=${CXX+set} ac_env_CXX_value=$CXX ac_cv_env_CXX_set=${CXX+set} ac_cv_env_CXX_value=$CXX ac_env_CXXFLAGS_set=${CXXFLAGS+set} ac_env_CXXFLAGS_value=$CXXFLAGS ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} ac_cv_env_CXXFLAGS_value=$CXXFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names X features: --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-shared=PKGS build shared libraries default=yes --enable-static=PKGS build static libraries default=yes --enable-fast-install=PKGS optimize for fast installation default=yes --disable-libtool-lock avoid locking (might break parallel builds) --enable-debug Disable aggressive optimizations default=yes --disable-sdltest Do not try to compile and run a test SDL program --enable-mmx enable MMX IDCT decoding routines default=no --enable-ati enable ATI Rage128 hardware acceleration default=no --enable-timestamp-sync enable system timestamp sync default=yes --enable-threaded-system enable system thread default=no --enable-threaded-audio enable threaded audio default=yes --enable-gtk-player build a GTk sample SMPEG player default=yes --disable-gtktest Do not try to compile and run a test GTK program --enable-opengl-player build an OpenGL sample SMPEG player default=yes --enable-assertions Enable consistency checks in decoding default=no Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-gnu-ld assume the C compiler uses GNU ld default=no --with-sdl-prefix=PFX Prefix where SDL is installed (optional) --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional) --with-gtk-prefix=PFX Prefix where GTK is installed (optional) --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional) --with-x use the X Window System Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CXX C++ compiler command CXXFLAGS C++ compiler flags CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd "$ac_popdir" done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # # Making releases: # MICRO_VERSION += 1; # INTERFACE_AGE += 1; # BINARY_AGE += 1; # if any functions have been added, set INTERFACE_AGE to 0. # if backwards compatibility has been broken, # set BINARY_AGE and INTERFACE_AGE to 0. # MAJOR_VERSION=0 MINOR_VERSION=4 MICRO_VERSION=5 INTERFACE_AGE=4 BINARY_AGE=5 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION ASFLAGS="" CCASFLAGS="" # libtool versioning LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE` LT_REVISION=$INTERFACE_AGE LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE` ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking target system type" >&5 echo $ECHO_N "checking target system type... $ECHO_C" >&6 if test "${ac_cv_target+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_target_alias=$target_alias test "x$ac_cv_target_alias" = "x" && ac_cv_target_alias=$ac_cv_host_alias ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_target" >&5 echo "${ECHO_T}$ac_cv_target" >&6 target=$ac_cv_target target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- am__api_version="1.4" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 echo timestamp > conftestfile # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftestfile` fi if test "$*" != "X $srcdir/configure conftestfile" \ && test "$*" != "X conftestfile $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftestfile ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest* echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 test "$program_prefix" != NONE && program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$,$program_suffix,;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi PACKAGE=smpeg VERSION=$VERSION if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF missing_dir=`cd $ac_aux_dir && pwd` echo "$as_me:$LINENO: checking for working aclocal-${am__api_version}" >&5 echo $ECHO_N "checking for working aclocal-${am__api_version}... $ECHO_C" >&6 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (aclocal-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then ACLOCAL=aclocal-${am__api_version} echo "$as_me:$LINENO: result: found" >&5 echo "${ECHO_T}found" >&6 else ACLOCAL="$missing_dir/missing aclocal-${am__api_version}" echo "$as_me:$LINENO: result: missing" >&5 echo "${ECHO_T}missing" >&6 fi echo "$as_me:$LINENO: checking for working autoconf" >&5 echo $ECHO_N "checking for working autoconf... $ECHO_C" >&6 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (autoconf --version) < /dev/null > /dev/null 2>&1; then AUTOCONF=autoconf echo "$as_me:$LINENO: result: found" >&5 echo "${ECHO_T}found" >&6 else AUTOCONF="$missing_dir/missing autoconf" echo "$as_me:$LINENO: result: missing" >&5 echo "${ECHO_T}missing" >&6 fi echo "$as_me:$LINENO: checking for working automake-${am__api_version}" >&5 echo $ECHO_N "checking for working automake-${am__api_version}... $ECHO_C" >&6 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (automake-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then AUTOMAKE=automake-${am__api_version} echo "$as_me:$LINENO: result: found" >&5 echo "${ECHO_T}found" >&6 else AUTOMAKE="$missing_dir/missing automake-${am__api_version}" echo "$as_me:$LINENO: result: missing" >&5 echo "${ECHO_T}missing" >&6 fi echo "$as_me:$LINENO: checking for working autoheader" >&5 echo $ECHO_N "checking for working autoheader... $ECHO_C" >&6 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (autoheader --version) < /dev/null > /dev/null 2>&1; then AUTOHEADER=autoheader echo "$as_me:$LINENO: result: found" >&5 echo "${ECHO_T}found" >&6 else AUTOHEADER="$missing_dir/missing autoheader" echo "$as_me:$LINENO: result: missing" >&5 echo "${ECHO_T}missing" >&6 fi echo "$as_me:$LINENO: checking for working makeinfo" >&5 echo $ECHO_N "checking for working makeinfo... $ECHO_C" >&6 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (makeinfo --version) < /dev/null > /dev/null 2>&1; then MAKEINFO=makeinfo echo "$as_me:$LINENO: result: found" >&5 echo "${ECHO_T}found" >&6 else MAKEINFO="$missing_dir/missing makeinfo" echo "$as_me:$LINENO: result: missing" >&5 echo "${ECHO_T}missing" >&6 fi echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then echo "$as_me:$LINENO: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CXX" && break done test -n "$ac_ct_CXX" || ac_ct_CXX="g++" CXX=$ac_ct_CXX fi # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 GXX=`test $ac_compiler_gnu = yes && echo yes` ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS CXXFLAGS="-g" echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cxx_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Check whether --enable-shared or --disable-shared was given. if test "${enable_shared+set}" = set; then enableval="$enable_shared" p=${PACKAGE-default} case "$enableval" in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$ac_save_ifs" ;; esac else enable_shared=yes fi; # Check whether --enable-static or --disable-static was given. if test "${enable_static+set}" = set; then enableval="$enable_static" p=${PACKAGE-default} case "$enableval" in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$ac_save_ifs" ;; esac else enable_static=yes fi; # Check whether --enable-fast-install or --disable-fast-install was given. if test "${enable_fast_install+set}" = set; then enableval="$enable_fast_install" p=${PACKAGE-default} case "$enableval" in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$ac_save_ifs" ;; esac else enable_fast_install=yes fi; if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval="$with_gnu_ld" test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi; ac_prog=ld if test "$ac_cv_c_compiler_gnu" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo "$as_me:$LINENO: checking for ld used by GCC" >&5 echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 ac_prog=`($CC -print-prog-name=ld) 2>&5` case "$ac_prog" in # Accept absolute paths. [\\/]* | [A-Za-z]:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then echo "$as_me:$LINENO: checking for GNU ld" >&5 echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 else echo "$as_me:$LINENO: checking for non-GNU ld" >&5 echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 fi if test "${ac_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then ac_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then test "$with_gnu_ld" != no && break else test "$with_gnu_ld" != yes && break fi fi done IFS="$ac_save_ifs" else ac_cv_path_LD="$LD" # Let the user override the test with a path. fi fi LD="$ac_cv_path_LD" if test -n "$LD"; then echo "$as_me:$LINENO: result: $LD" >&5 echo "${ECHO_T}$LD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 if test "${ac_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LD -v 2>&1 &5; then ac_cv_prog_gnu_ld=yes else ac_cv_prog_gnu_ld=no fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_gnu_ld" >&5 echo "${ECHO_T}$ac_cv_prog_gnu_ld" >&6 echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 if test "${ac_cv_path_NM+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$NM"; then # Let the user override the test. ac_cv_path_NM="$NM" else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then ac_cv_path_NM="$ac_dir/nm -B" break elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then ac_cv_path_NM="$ac_dir/nm -p" break else ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags fi fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm fi fi NM="$ac_cv_path_NM" echo "$as_me:$LINENO: result: $NM" >&5 echo "${ECHO_T}$NM" >&6 echo "$as_me:$LINENO: checking whether ln -s works" >&5 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no, using $LN_S" >&5 echo "${ECHO_T}no, using $LN_S" >&6 fi case "$target" in NONE) lt_target="$host" ;; *) lt_target="$target" ;; esac # Check for any special flags to pass to ltconfig. libtool_flags="--cache-file=$cache_file" test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" test "$ac_cv_c_compiler_gnu" = yes && libtool_flags="$libtool_flags --with-gcc" test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" # Check whether --enable-libtool-lock or --disable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval="$enable_libtool_lock" fi; test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" # Some flags need to be propagated to the compiler or linker for good # libtool support. case "$lt_target" in *-*-irix6*) # Find out which ABI we are using. echo '#line 3216 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case "`/usr/bin/file conftest.o`" in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 if test "${lt_cv_cc_needs_belf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then lt_cv_cc_needs_belf=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 lt_cv_cc_needs_belf=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; esac # Save cache, so that ltconfig can load it cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache # Actually configure libtool. ac_aux_dir is where install-sh is found. CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \ || { { echo "$as_me:$LINENO: error: libtool configure failed" >&5 echo "$as_me: error: libtool configure failed" >&2;} { (exit 1); exit 1; }; } # Reload cache, that may have been modified by ltconfig if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' # Redirect the config.log output again, so that the ltconfig log is not # clobbered by the next message. exec 5>>./config.log # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' AS="$CC" CCAS="$CC" echo "$as_me:$LINENO: checking for socklen_t" >&5 echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6 if test "${ac_cv_type_socklen_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { socklen_t len = 42; return len; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_socklen_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_socklen_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5 echo "${ECHO_T}$ac_cv_type_socklen_t" >&6 if test $ac_cv_type_socklen_t != yes; then cat >>confdefs.h <<\_ACEOF #define socklen_t int _ACEOF fi case "$target" in alpha*-*-linux*) if test x$ac_cv_c_compiler_gnu = xyes; then CFLAGS="$CFLAGS -mcpu=ev4 -Wa,-mall" fi ;; sparc*-*-solaris*) LIBS="$LIBS -lsocket -lnsl" ;; *-*-qnx*) LIBS="$LIBS -lsocket" ;; *-*-beos*) ac_default_prefix=/boot/develop/tools/gnupro ;; *-*-cygwin* | *-*-mingw32*) if test "$build" != "$target"; then # cross-compiling ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc fi ;; esac # Set runtime shared library paths as needed case "$target" in *-*-linux*) SMPEG_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib" ;; *-*-freebsd*) SMPEG_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib" ;; *-*-solaris*) SMPEG_RLD_FLAGS="-R\${exec_prefix}/lib" ;; esac # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" else enable_debug=yes fi; if test x$enable_debug != xyes; then if test x$ac_cv_c_compiler_gnu = xyes; then CFLAGS="$CFLAGS -fexpensive-optimizations -fomit-frame-pointer" fi case "$target" in i486-*-*) # Yeah right. :) if test x$ac_cv_c_compiler_gnu = xyes; then CFLAGS="$CFLAGS -march=486" fi ;; i?86-*-*) if test x$ac_cv_c_compiler_gnu = xyes; then CFLAGS="$CFLAGS -march=pentium -mcpu=pentiumpro" fi ;; esac fi SDL_VERSION=1.2.0 # Check whether --with-sdl-prefix or --without-sdl-prefix was given. if test "${with_sdl_prefix+set}" = set; then withval="$with_sdl_prefix" sdl_prefix="$withval" else sdl_prefix="" fi; # Check whether --with-sdl-exec-prefix or --without-sdl-exec-prefix was given. if test "${with_sdl_exec_prefix+set}" = set; then withval="$with_sdl_exec_prefix" sdl_exec_prefix="$withval" else sdl_exec_prefix="" fi; # Check whether --enable-sdltest or --disable-sdltest was given. if test "${enable_sdltest+set}" = set; then enableval="$enable_sdltest" else enable_sdltest=yes fi; if test x$sdl_exec_prefix != x ; then sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" if test x${SDL_CONFIG+set} != xset ; then SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config fi fi if test x$sdl_prefix != x ; then sdl_args="$sdl_args --prefix=$sdl_prefix" if test x${SDL_CONFIG+set} != xset ; then SDL_CONFIG=$sdl_prefix/bin/sdl-config fi fi # Extract the first word of "sdl-config", so it can be a program name with args. set dummy sdl-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_SDL_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $SDL_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_SDL_CONFIG="$SDL_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_SDL_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_SDL_CONFIG" && ac_cv_path_SDL_CONFIG="no" ;; esac fi SDL_CONFIG=$ac_cv_path_SDL_CONFIG if test -n "$SDL_CONFIG"; then echo "$as_me:$LINENO: result: $SDL_CONFIG" >&5 echo "${ECHO_T}$SDL_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi min_sdl_version=$SDL_VERSION echo "$as_me:$LINENO: checking for SDL - version >= $min_sdl_version" >&5 echo $ECHO_N "checking for SDL - version >= $min_sdl_version... $ECHO_C" >&6 no_sdl="" if test "$SDL_CONFIG" = "no" ; then no_sdl=yes else SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` if test "x$enable_sdltest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" rm -f conf.sdltest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include "SDL.h" char* my_strdup (char *str) { char *new_str; if (str) { new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); strcpy (new_str, str); } else new_str = NULL; return new_str; } int main (int argc, char *argv[]) { int major, minor, micro; char *tmp_version; /* This hangs on some systems (?) system ("touch conf.sdltest"); */ { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = my_strdup("$min_sdl_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_sdl_version"); exit(1); } if (($sdl_major_version > major) || (($sdl_major_version == major) && ($sdl_minor_version > minor)) || (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) { return 0; } else { printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); printf("*** best to upgrade to the required version.\n"); printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); printf("*** to point to the correct copy of sdl-config, and remove the file\n"); printf("*** config.cache before re-running configure\n"); return 1; } } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) no_sdl=yes fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_sdl" = x ; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 : else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 if test "$SDL_CONFIG" = "no" ; then echo "*** The sdl-config script installed by SDL could not be found" echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the SDL_CONFIG environment variable to the" echo "*** full path to sdl-config." else if test -f conf.sdltest ; then : else echo "*** Could not run SDL test program, checking why..." CFLAGS="$CFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include "SDL.h" int main () { return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding SDL or finding the wrong" echo "*** version of SDL. If it is not finding SDL, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means SDL was incorrectly installed" echo "*** or that you have moved SDL since it was installed. In the latter case, you" echo "*** may want to edit the sdl-config script: $SDL_CONFIG" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi SDL_CFLAGS="" SDL_LIBS="" { { echo "$as_me:$LINENO: error: *** SDL version $SDL_VERSION not found!" >&5 echo "$as_me: error: *** SDL version $SDL_VERSION not found!" >&2;} { (exit 1); exit 1; }; } fi rm -f conf.sdltest CFLAGS="$CFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" echo "$as_me:$LINENO: checking for sqrt in -lm" >&5 echo $ECHO_N "checking for sqrt in -lm... $ECHO_C" >&6 if test "${ac_cv_lib_m_sqrt+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char sqrt (); int main () { sqrt (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_m_sqrt=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_m_sqrt=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_m_sqrt" >&5 echo "${ECHO_T}$ac_cv_lib_m_sqrt" >&6 if test $ac_cv_lib_m_sqrt = yes; then LIBS="$LIBS -lm" fi # Check whether --enable-mmx or --disable-mmx was given. if test "${enable_mmx+set}" = set; then enableval="$enable_mmx" else enable_mmx=no fi; if test x$enable_mmx = xyes; then echo "$as_me:$LINENO: checking for MMX optimizations" >&5 echo $ECHO_N "checking for MMX optimizations... $ECHO_C" >&6 use_mmx=no case "$target" in i?86*) use_mmx=yes ;; esac echo "$as_me:$LINENO: result: $use_mmx" >&5 echo "${ECHO_T}$use_mmx" >&6 if test x$use_mmx = xyes; then CFLAGS="$CFLAGS -DUSE_MMX" ASFLAGS="$ASFLAGS -DUSE_MMX" CCASFLAGS="$CCASFLAGS -DUSE_MMX" fi fi # Check whether --enable-ati or --disable-ati was given. if test "${enable_ati+set}" = set; then enableval="$enable_ati" else enable_ati=no fi; if test x$enable_ati = xyes; then use_ati=yes echo "$as_me:$LINENO: checking for ATIHAP_StartCCE in -lr128hap" >&5 echo $ECHO_N "checking for ATIHAP_StartCCE in -lr128hap... $ECHO_C" >&6 if test "${ac_cv_lib_r128hap_ATIHAP_StartCCE+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lr128hap $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char ATIHAP_StartCCE (); int main () { ATIHAP_StartCCE (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_r128hap_ATIHAP_StartCCE=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_r128hap_ATIHAP_StartCCE=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_r128hap_ATIHAP_StartCCE" >&5 echo "${ECHO_T}$ac_cv_lib_r128hap_ATIHAP_StartCCE" >&6 if test $ac_cv_lib_r128hap_ATIHAP_StartCCE = yes; then LIBS="$LIBS -lr128hap" else use_ati=no fi echo "$as_me:$LINENO: checking for VHA_Init in -lr128vha" >&5 echo $ECHO_N "checking for VHA_Init in -lr128vha... $ECHO_C" >&6 if test "${ac_cv_lib_r128vha_VHA_Init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lr128vha $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char VHA_Init (); int main () { VHA_Init (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_r128vha_VHA_Init=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_r128vha_VHA_Init=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_r128vha_VHA_Init" >&5 echo "${ECHO_T}$ac_cv_lib_r128vha_VHA_Init" >&6 if test $ac_cv_lib_r128vha_VHA_Init = yes; then LIBS="$LIBS -lr128vha" else use_ati=no fi echo "$as_me:$LINENO: checking for CreateOVSurface in -lr128ov" >&5 echo $ECHO_N "checking for CreateOVSurface in -lr128ov... $ECHO_C" >&6 if test "${ac_cv_lib_r128ov_CreateOVSurface+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lr128ov $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char CreateOVSurface (); int main () { CreateOVSurface (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_r128ov_CreateOVSurface=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_r128ov_CreateOVSurface=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_r128ov_CreateOVSurface" >&5 echo "${ECHO_T}$ac_cv_lib_r128ov_CreateOVSurface" >&6 if test $ac_cv_lib_r128ov_CreateOVSurface = yes; then LIBS="$LIBS -lr128ov" else use_ati=no fi echo "$as_me:$LINENO: checking for ATI Rage128 hardware acceleration" >&5 echo $ECHO_N "checking for ATI Rage128 hardware acceleration... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $use_ati" >&5 echo "${ECHO_T}$use_ati" >&6 if test x$use_ati = xyes; then CFLAGS="$CFLAGS -DUSE_ATI" fi fi # Check whether --enable-timestamp-sync or --disable-timestamp-sync was given. if test "${enable_timestamp_sync+set}" = set; then enableval="$enable_timestamp_sync" else enable_timestamp_sync=no fi; if test x$enable_timestamp_sync = xyes; then CFLAGS="$CFLAGS -DUSE_TIMESTAMP_SYNC" fi # Check whether --enable-threaded-system or --disable-threaded-system was given. if test "${enable_threaded_system+set}" = set; then enableval="$enable_threaded_system" else enable_threaded_system=no fi; if test x$enable_threaded_system = xyes; then CFLAGS="$CFLAGS -DUSE_SYSTEM_THREAD" fi # Check whether --enable-threaded-audio or --disable-threaded-audio was given. if test "${enable_threaded_audio+set}" = set; then enableval="$enable_threaded_audio" else enable_threaded_audio=yes fi; if test x$enable_threaded_audio = xyes; then CFLAGS="$CFLAGS -DTHREADED_AUDIO" fi # Check whether --enable-gtk_player or --disable-gtk_player was given. if test "${enable_gtk_player+set}" = set; then enableval="$enable_gtk_player" else enable_gtk_player=yes fi; have_gtk=no if test x$enable_gtk_player = xyes; then # Check whether --with-gtk-prefix or --without-gtk-prefix was given. if test "${with_gtk_prefix+set}" = set; then withval="$with_gtk_prefix" gtk_config_prefix="$withval" else gtk_config_prefix="" fi; # Check whether --with-gtk-exec-prefix or --without-gtk-exec-prefix was given. if test "${with_gtk_exec_prefix+set}" = set; then withval="$with_gtk_exec_prefix" gtk_config_exec_prefix="$withval" else gtk_config_exec_prefix="" fi; # Check whether --enable-gtktest or --disable-gtktest was given. if test "${enable_gtktest+set}" = set; then enableval="$enable_gtktest" else enable_gtktest=yes fi; for module in . do case "$module" in gthread) gtk_config_args="$gtk_config_args gthread" ;; esac done if test x$gtk_config_exec_prefix != x ; then gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" if test x${GTK_CONFIG+set} != xset ; then GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config fi fi if test x$gtk_config_prefix != x ; then gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" if test x${GTK_CONFIG+set} != xset ; then GTK_CONFIG=$gtk_config_prefix/bin/gtk-config fi fi # Extract the first word of "gtk-config", so it can be a program name with args. set dummy gtk-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_GTK_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $GTK_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_GTK_CONFIG="$GTK_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_GTK_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_GTK_CONFIG" && ac_cv_path_GTK_CONFIG="no" ;; esac fi GTK_CONFIG=$ac_cv_path_GTK_CONFIG if test -n "$GTK_CONFIG"; then echo "$as_me:$LINENO: result: $GTK_CONFIG" >&5 echo "${ECHO_T}$GTK_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi min_gtk_version=1.2.1 echo "$as_me:$LINENO: checking for GTK - version >= $min_gtk_version" >&5 echo $ECHO_N "checking for GTK - version >= $min_gtk_version... $ECHO_C" >&6 no_gtk="" if test "$GTK_CONFIG" = "no" ; then no_gtk=yes else GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` if test "x$enable_gtktest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$GTK_LIBS $LIBS" rm -f conf.gtktest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { int major, minor, micro; char *tmp_version; system ("touch conf.gtktest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = g_strdup("$min_gtk_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_gtk_version"); exit(1); } if ((gtk_major_version != $gtk_config_major_version) || (gtk_minor_version != $gtk_config_minor_version) || (gtk_micro_version != $gtk_config_micro_version)) { printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, gtk_major_version, gtk_minor_version, gtk_micro_version); printf ("*** was found! If gtk-config was correct, then it is best\n"); printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); printf("*** before re-running configure\n"); } #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION) else if ((gtk_major_version != GTK_MAJOR_VERSION) || (gtk_minor_version != GTK_MINOR_VERSION) || (gtk_micro_version != GTK_MICRO_VERSION)) { printf("*** GTK+ header files (version %d.%d.%d) do not match\n", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); printf("*** library (version %d.%d.%d)\n", gtk_major_version, gtk_minor_version, gtk_micro_version); } #endif /* defined (GTK_MAJOR_VERSION) ... */ else { if ((gtk_major_version > major) || ((gtk_major_version == major) && (gtk_minor_version > minor)) || ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) { return 0; } else { printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", gtk_major_version, gtk_minor_version, gtk_micro_version); printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", major, minor, micro); printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); printf("*** correct copy of gtk-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } return 1; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) no_gtk=yes fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_gtk" = x ; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 have_gtk=yes else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 if test "$GTK_CONFIG" = "no" ; then echo "*** The gtk-config script installed by GTK could not be found" echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the GTK_CONFIG environment variable to the" echo "*** full path to gtk-config." else if test -f conf.gtktest ; then : else echo "*** Could not run GTK test program, checking why..." CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GTK or finding the wrong" echo "*** version of GTK. If it is not finding GTK, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" echo "***" echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" echo "*** came with the system with the command" echo "***" echo "*** rpm --erase --nodeps gtk gtk-devel" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means GTK was incorrectly installed" echo "*** or that you have moved GTK since it was installed. In the latter case, you" echo "*** may want to edit the gtk-config script: $GTK_CONFIG" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi GTK_CFLAGS="" GTK_LIBS="" : fi rm -f conf.gtktest if test x$have_gtk = xyes; then CFLAGS="$CFLAGS $GTK_CFLAGS" fi fi if test x$have_gtk = xyes; then HAVE_GTK_TRUE= HAVE_GTK_FALSE='#' else HAVE_GTK_TRUE='#' HAVE_GTK_FALSE= fi # Check whether --enable-opengl_player or --disable-opengl_player was given. if test "${enable_opengl_player+set}" = set; then enableval="$enable_opengl_player" else enable_opengl_player=yes fi; have_glu=no if test x$enable_opengl_player = xyes; then case "$target" in *-*-cygwin* | *-*-mingw32*) SYS_GL_LIBS="-lopengl32 -lglu32" ;; *-*-beos*) SYS_GL_LIBS="-lGL" ;; *-*-darwin*) SYS_GL_LIBS="" ;; *) ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for X" >&5 echo $ECHO_N "checking for X... $ECHO_C" >&6 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then withval="$with_x" fi; # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then # Both variables are already set. have_x=yes else if test "${ac_cv_have_x+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # One or both of the vars are not set, and there is no cached value. ac_x_includes=no ac_x_libraries=no rm -fr conftest.dir if mkdir conftest.dir; then cd conftest.dir # Make sure to not put "make" in the Imakefile rules, since we grep it out. cat >Imakefile <<'_ACEOF' acfindx: @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' _ACEOF if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl; do if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && test -f $ac_im_libdir/libX11.$ac_extension; then ac_im_usrlibdir=$ac_im_libdir; break fi done # Screen out bogus values from the imake configuration. They are # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. case $ac_im_incroot in /usr/include) ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac case $ac_im_usrlibdir in /usr/lib | /lib) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi cd .. rm -fr conftest.dir fi # Standard set of common directories for X headers. # Check X11 before X11Rn because it is often a symlink to the current release. ac_x_header_dirs=' /usr/X11/include /usr/X11R6/include /usr/X11R5/include /usr/X11R4/include /usr/include/X11 /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 /usr/local/X11/include /usr/local/X11R6/include /usr/local/X11R5/include /usr/local/X11R4/include /usr/local/include/X11 /usr/local/include/X11R6 /usr/local/include/X11R5 /usr/local/include/X11R4 /usr/X386/include /usr/x386/include /usr/XFree86/include/X11 /usr/include /usr/local/include /usr/unsupported/include /usr/athena/include /usr/local/x11r5/include /usr/lpp/Xamples/include /usr/openwin/include /usr/openwin/share/include' if test "$ac_x_includes" = no; then # Guess where to find include files, by looking for Intrinsic.h. # First, try using that file with no special directory specified. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # We can compile using X headers with no special include directory. ac_x_includes= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Intrinsic.h"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest.err conftest.$ac_ext fi # $ac_x_includes = no if test "$ac_x_libraries" = no; then # Check for the libraries. # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS=$LIBS LIBS="-lXt $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { XtMalloc (0) ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS=$ac_save_LIBS for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl; do if test -r $ac_dir/libXt.$ac_extension; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then # Didn't find X anywhere. Cache the known absence of X. ac_cv_have_x="have_x=no" else # Record where we found X for the cache. ac_cv_have_x="have_x=yes \ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" fi fi fi eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then echo "$as_me:$LINENO: result: $have_x" >&5 echo "${ECHO_T}$have_x" >&6 no_x=yes else # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes \ ac_x_includes=$x_includes ac_x_libraries=$x_libraries" echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5 echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6 fi if test "$no_x" = yes; then # Not all programs may use this symbol, but it does not hurt to define it. cat >>confdefs.h <<\_ACEOF #define X_DISPLAY_MISSING 1 _ACEOF X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= else if test -n "$x_includes"; then X_CFLAGS="$X_CFLAGS -I$x_includes" fi # It would also be nice to do this for all -L options, not just this one. if test -n "$x_libraries"; then X_LIBS="$X_LIBS -L$x_libraries" # For Solaris; some versions of Sun CC require a space after -R and # others require no space. Words are not sufficient . . . . case `(uname -sr) 2>/dev/null` in "SunOS 5"*) echo "$as_me:$LINENO: checking whether -R must be followed by a space" >&5 echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6 ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_R_nospace=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_R_nospace=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext if test $ac_R_nospace = yes; then echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 X_LIBS="$X_LIBS -R$x_libraries" else LIBS="$ac_xsave_LIBS -R $x_libraries" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_R_space=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_R_space=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext if test $ac_R_space = yes; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 X_LIBS="$X_LIBS -R $x_libraries" else echo "$as_me:$LINENO: result: neither works" >&5 echo "${ECHO_T}neither works" >&6 fi fi LIBS=$ac_xsave_LIBS esac fi # Check for system-dependent libraries X programs must link with. # Do this before checking for the system-independent R6 libraries # (-lICE), since we may need -lsocket or whatever for X linking. if test "$ISC" = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" else # Martyn Johnson says this is needed for Ultrix, if the X # libraries were built with DECnet support. And Karl Berry says # the Alpha needs dnet_stub (dnet does not exist). ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char XOpenDisplay (); int main () { XOpenDisplay (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet" >&5 echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dnet_ntoa (); int main () { dnet_ntoa (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_dnet_ntoa=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dnet_dnet_ntoa=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6 if test $ac_cv_lib_dnet_dnet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet_stub" >&5 echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet_stub $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dnet_ntoa (); int main () { dnet_ntoa (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_stub_dnet_ntoa=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dnet_stub_dnet_ntoa=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6 if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" fi fi fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS="$ac_xsave_LIBS" # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, # to get the SysV transport functions. # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4) # needs -lnsl. # The nsl library prevents programs from opening the X display # on Irix 5.2, according to T.E. Dickey. # The functions gethostbyname, getservbyname, and inet_addr are # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. echo "$as_me:$LINENO: checking for gethostbyname" >&5 echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 if test "${ac_cv_func_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gethostbyname (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) choke me #else char (*f) () = gethostbyname; #endif #ifdef __cplusplus } #endif int main () { return f != gethostbyname; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_gethostbyname=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 if test $ac_cv_func_gethostbyname = no; then echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); int main () { gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_nsl_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_nsl_gethostbyname=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 if test $ac_cv_lib_nsl_gethostbyname = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" fi if test $ac_cv_lib_nsl_gethostbyname = no; then echo "$as_me:$LINENO: checking for gethostbyname in -lbsd" >&5 echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6 if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); int main () { gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_bsd_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_bsd_gethostbyname=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6 if test $ac_cv_lib_bsd_gethostbyname = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" fi fi fi # lieder@skyler.mavd.honeywell.com says without -lsocket, # socket/setsockopt and other routines are undefined under SCO ODT # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary # on later versions), says Simon Leinen: it contains gethostby* # variants that don't use the name server (or something). -lsocket # must be given before -lnsl if both are needed. We assume that # if connect needs -lnsl, so does gethostbyname. echo "$as_me:$LINENO: checking for connect" >&5 echo $ECHO_N "checking for connect... $ECHO_C" >&6 if test "${ac_cv_func_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, which can conflict with char connect (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_connect) || defined (__stub___connect) choke me #else char (*f) () = connect; #endif #ifdef __cplusplus } #endif int main () { return f != connect; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_connect=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_connect=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 echo "${ECHO_T}$ac_cv_func_connect" >&6 if test $ac_cv_func_connect = no; then echo "$as_me:$LINENO: checking for connect in -lsocket" >&5 echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6 if test "${ac_cv_lib_socket_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); int main () { connect (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_socket_connect=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_connect=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5 echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6 if test $ac_cv_lib_socket_connect = yes; then X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" fi fi # Guillermo Gomez says -lposix is necessary on A/UX. echo "$as_me:$LINENO: checking for remove" >&5 echo $ECHO_N "checking for remove... $ECHO_C" >&6 if test "${ac_cv_func_remove+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, which can conflict with char remove (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char remove (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_remove) || defined (__stub___remove) choke me #else char (*f) () = remove; #endif #ifdef __cplusplus } #endif int main () { return f != remove; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_remove=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_remove=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_remove" >&5 echo "${ECHO_T}$ac_cv_func_remove" >&6 if test $ac_cv_func_remove = no; then echo "$as_me:$LINENO: checking for remove in -lposix" >&5 echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6 if test "${ac_cv_lib_posix_remove+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lposix $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char remove (); int main () { remove (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_posix_remove=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_posix_remove=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_posix_remove" >&5 echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6 if test $ac_cv_lib_posix_remove = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" fi fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo "$as_me:$LINENO: checking for shmat" >&5 echo $ECHO_N "checking for shmat... $ECHO_C" >&6 if test "${ac_cv_func_shmat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shmat (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shmat (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_shmat) || defined (__stub___shmat) choke me #else char (*f) () = shmat; #endif #ifdef __cplusplus } #endif int main () { return f != shmat; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_shmat=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shmat=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_shmat" >&5 echo "${ECHO_T}$ac_cv_func_shmat" >&6 if test $ac_cv_func_shmat = no; then echo "$as_me:$LINENO: checking for shmat in -lipc" >&5 echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6 if test "${ac_cv_lib_ipc_shmat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lipc $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shmat (); int main () { shmat (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ipc_shmat=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ipc_shmat=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_ipc_shmat" >&5 echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6 if test $ac_cv_lib_ipc_shmat = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" fi fi fi # Check for libraries that X11R6 Xt/Xaw programs need. ac_save_LDFLAGS=$LDFLAGS test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to # check for ICE first), but we must link in the order -lSM -lICE or # we get undefined symbols. So assume we have SM if we have ICE. # These have to be linked with before -lX11, unlike the other # libraries we check for below, so use a different variable. # John Interrante, Karl Berry echo "$as_me:$LINENO: checking for IceConnectionNumber in -lICE" >&5 echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6 if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char IceConnectionNumber (); int main () { IceConnectionNumber (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ICE_IceConnectionNumber=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ICE_IceConnectionNumber=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6 if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" fi LDFLAGS=$ac_save_LDFLAGS fi if test x$have_x = xyes; then CFLAGS="$CFLAGS $X_CFLAGS" SYS_GL_LIBS="$X_LIBS -lGL -lGLU" else SYS_GL_LIBS="-lGL -lGLU" fi ;; esac echo "$as_me:$LINENO: checking for OpenGL support" >&5 echo $ECHO_N "checking for OpenGL support... $ECHO_C" >&6 have_opengl=no cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then have_opengl=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $have_opengl" >&5 echo "${ECHO_T}$have_opengl" >&6 if test x$have_opengl = xyes; then GL_LIBS="$SYS_GL_LIBS" else echo "*** The OpenGL movie player will not be built (missing GL or GLU)" fi fi if test x$have_opengl = xyes; then HAVE_OPENGL_TRUE= HAVE_OPENGL_FALSE='#' else HAVE_OPENGL_TRUE='#' HAVE_OPENGL_FALSE= fi # Check whether --enable-assertions or --disable-assertions was given. if test "${enable_assertions+set}" = set; then enableval="$enable_assertions" else enable_assertions=no fi; if test x$enable_assertions != xyes; then CFLAGS="$CFLAGS -DNDEBUG" fi CFLAGS="$CFLAGS -I.. -DNOCONTROLS" CFLAGS="$CFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/audio -I\$(top_srcdir)/video" CXXFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" if test x$GCC = xyes; then # Check to see if options -fno-rtti -fno-exceptions are supported echo "$as_me:$LINENO: checking if $CXX supports -fno-rtti -fno-exceptions" >&5 echo $ECHO_N "checking if $CXX supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 use_fnoexceptions=no save_CFLAGS="$CFLAGS" save_CC="$CC" CFLAGS="-fno-rtti -fno-exceptions" CC="$CXX" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then use_fnoexceptions=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $use_fnoexceptions" >&5 echo "${ECHO_T}$use_fnoexceptions" >&6 if test x$use_fnoexceptions = xyes; then CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-rtti" fi CC="$save_CC" CFLAGS="$save_CFLAGS" fi # Finally create all the generated files ac_config_files="$ac_config_files Makefile audio/Makefile video/Makefile smpeg-config smpeg.spec" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then we branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. cat >confdef2opt.sed <<\_ACEOF t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g t quote s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g t quote d : quote s,[ `~#$^&*(){}\\|;'"<>?],\\&,g s,\[,\\&,g s,\],\\&,g s,\$,$$,g p _ACEOF # We use echo to avoid assuming a particular line-breaking character. # The extra dot is to prevent the shell from consuming trailing # line-breaks from the sub-command output. A line-break within # single-quotes doesn't work because, if this script is created in a # platform that uses two characters for line-breaks (e.g., DOS), tr # would break. ac_LF_and_DOT=`echo; echo .` DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` rm -f confdef2opt.sed ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by $as_me, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "audio/Makefile" ) CONFIG_FILES="$CONFIG_FILES audio/Makefile" ;; "video/Makefile" ) CONFIG_FILES="$CONFIG_FILES video/Makefile" ;; "smpeg-config" ) CONFIG_FILES="$CONFIG_FILES smpeg-config" ;; "smpeg.spec" ) CONFIG_FILES="$CONFIG_FILES smpeg.spec" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@MAJOR_VERSION@,$MAJOR_VERSION,;t t s,@MINOR_VERSION@,$MINOR_VERSION,;t t s,@MICRO_VERSION@,$MICRO_VERSION,;t t s,@INTERFACE_AGE@,$INTERFACE_AGE,;t t s,@BINARY_AGE@,$BINARY_AGE,;t t s,@VERSION@,$VERSION,;t t s,@ASFLAGS@,$ASFLAGS,;t t s,@CCASFLAGS@,$CCASFLAGS,;t t s,@LT_RELEASE@,$LT_RELEASE,;t t s,@LT_CURRENT@,$LT_CURRENT,;t t s,@LT_REVISION@,$LT_REVISION,;t t s,@LT_AGE@,$LT_AGE,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@target@,$target,;t t s,@target_cpu@,$target_cpu,;t t s,@target_vendor@,$target_vendor,;t t s,@target_os@,$target_os,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@PACKAGE@,$PACKAGE,;t t s,@ACLOCAL@,$ACLOCAL,;t t s,@AUTOCONF@,$AUTOCONF,;t t s,@AUTOMAKE@,$AUTOMAKE,;t t s,@AUTOHEADER@,$AUTOHEADER,;t t s,@MAKEINFO@,$MAKEINFO,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@CXX@,$CXX,;t t s,@CXXFLAGS@,$CXXFLAGS,;t t s,@ac_ct_CXX@,$ac_ct_CXX,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@LN_S@,$LN_S,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@AS@,$AS,;t t s,@CCAS@,$CCAS,;t t s,@SMPEG_RLD_FLAGS@,$SMPEG_RLD_FLAGS,;t t s,@SDL_CONFIG@,$SDL_CONFIG,;t t s,@SDL_CFLAGS@,$SDL_CFLAGS,;t t s,@SDL_LIBS@,$SDL_LIBS,;t t s,@GTK_CONFIG@,$GTK_CONFIG,;t t s,@GTK_CFLAGS@,$GTK_CFLAGS,;t t s,@GTK_LIBS@,$GTK_LIBS,;t t s,@HAVE_GTK_TRUE@,$HAVE_GTK_TRUE,;t t s,@HAVE_GTK_FALSE@,$HAVE_GTK_FALSE,;t t s,@CPP@,$CPP,;t t s,@X_CFLAGS@,$X_CFLAGS,;t t s,@X_PRE_LIBS@,$X_PRE_LIBS,;t t s,@X_LIBS@,$X_LIBS,;t t s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t s,@GL_LIBS@,$GL_LIBS,;t t s,@HAVE_OPENGL_TRUE@,$HAVE_OPENGL_TRUE,;t t s,@HAVE_OPENGL_FALSE@,$HAVE_OPENGL_FALSE,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi smpeg-0.4.5+cvs20030824.orig/configure.in0100644000175000017500000001753207574267144017670 0ustar hoseheadhosehead dnl Process this file with autoconf to produce a configure script. AC_INIT(README) dnl Set various version strings - taken gratefully from the GTk sources # # Making releases: # MICRO_VERSION += 1; # INTERFACE_AGE += 1; # BINARY_AGE += 1; # if any functions have been added, set INTERFACE_AGE to 0. # if backwards compatibility has been broken, # set BINARY_AGE and INTERFACE_AGE to 0. # MAJOR_VERSION=0 MINOR_VERSION=4 MICRO_VERSION=5 INTERFACE_AGE=4 BINARY_AGE=5 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION AC_SUBST(MAJOR_VERSION) AC_SUBST(MINOR_VERSION) AC_SUBST(MICRO_VERSION) AC_SUBST(INTERFACE_AGE) AC_SUBST(BINARY_AGE) AC_SUBST(VERSION) ASFLAGS="" CCASFLAGS="" AC_SUBST(ASFLAGS) AC_SUBST(CCASFLAGS) # libtool versioning LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE` LT_REVISION=$INTERFACE_AGE LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE` AC_SUBST(LT_RELEASE) AC_SUBST(LT_CURRENT) AC_SUBST(LT_REVISION) AC_SUBST(LT_AGE) dnl Detect the canonical host and target build environment AC_CANONICAL_HOST AC_CANONICAL_TARGET dnl Setup for automake AM_INIT_AUTOMAKE(smpeg, $VERSION) dnl Check for tools AC_PROG_MAKE_SET AC_PROG_CC AC_PROG_CXX AC_LIBTOOL_WIN32_DLL AM_PROG_LIBTOOL AC_PROG_INSTALL dnl Ugh. AS="$CC" CCAS="$CC" AC_SUBST(AS) AC_SUBST(CCAS) dnl Work around the lack of certain typedefs. AC_TYPE_SOCKLEN_T dnl The alpha architecture needs special flags for binary portability case "$target" in alpha*-*-linux*) if test x$ac_cv_prog_gcc = xyes; then CFLAGS="$CFLAGS -mcpu=ev4 -Wa,-mall" fi ;; sparc*-*-solaris*) LIBS="$LIBS -lsocket -lnsl" ;; *-*-qnx*) LIBS="$LIBS -lsocket" ;; *-*-beos*) ac_default_prefix=/boot/develop/tools/gnupro ;; *-*-cygwin* | *-*-mingw32*) if test "$build" != "$target"; then # cross-compiling ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc fi ;; esac # Set runtime shared library paths as needed case "$target" in *-*-linux*) SMPEG_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib" ;; *-*-freebsd*) SMPEG_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib" ;; *-*-solaris*) SMPEG_RLD_FLAGS="-R\${exec_prefix}/lib" ;; esac AC_SUBST(SMPEG_RLD_FLAGS) dnl Add compiler-specific optimization flags AC_ARG_ENABLE(debug, [ --enable-debug Disable aggressive optimizations [default=yes]], , enable_debug=yes) if test x$enable_debug != xyes; then if test x$ac_cv_prog_gcc = xyes; then CFLAGS="$CFLAGS -fexpensive-optimizations -fomit-frame-pointer" fi case "$target" in i486-*-*) # Yeah right. :) if test x$ac_cv_prog_gcc = xyes; then CFLAGS="$CFLAGS -march=486" fi ;; i?86-*-*) if test x$ac_cv_prog_gcc = xyes; then CFLAGS="$CFLAGS -march=pentium -mcpu=pentiumpro" fi ;; esac fi dnl Check for SDL SDL_VERSION=1.2.0 AM_PATH_SDL($SDL_VERSION, :, AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) ) CFLAGS="$CFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" dnl See if we need to pass -lm for the math library AC_CHECK_LIB(m, sqrt, LIBS="$LIBS -lm") dnl Check for MMX support AC_ARG_ENABLE(mmx, [ --enable-mmx enable MMX IDCT decoding routines [default=no]], , enable_mmx=no) if test x$enable_mmx = xyes; then AC_MSG_CHECKING(for MMX optimizations) use_mmx=no case "$target" in i?86*) use_mmx=yes ;; esac AC_MSG_RESULT($use_mmx) if test x$use_mmx = xyes; then CFLAGS="$CFLAGS -DUSE_MMX" ASFLAGS="$ASFLAGS -DUSE_MMX" CCASFLAGS="$CCASFLAGS -DUSE_MMX" fi fi dnl Check for ATI vha support AC_ARG_ENABLE(ati, [ --enable-ati enable ATI Rage128 hardware acceleration [default=no]], , enable_ati=no) if test x$enable_ati = xyes; then use_ati=yes AC_CHECK_LIB(r128hap, ATIHAP_StartCCE, LIBS="$LIBS -lr128hap", use_ati=no) AC_CHECK_LIB(r128vha, VHA_Init, LIBS="$LIBS -lr128vha", use_ati=no) AC_CHECK_LIB(r128ov, CreateOVSurface, LIBS="$LIBS -lr128ov", use_ati=no) AC_MSG_CHECKING(for ATI Rage128 hardware acceleration) AC_MSG_RESULT($use_ati) if test x$use_ati = xyes; then CFLAGS="$CFLAGS -DUSE_ATI" fi fi dnl Check for system timestamp sync AC_ARG_ENABLE(timestamp-sync, [ --enable-timestamp-sync enable system timestamp sync [default=yes]], , enable_timestamp_sync=no) if test x$enable_timestamp_sync = xyes; then CFLAGS="$CFLAGS -DUSE_TIMESTAMP_SYNC" fi dnl Enable the use of the system thread AC_ARG_ENABLE(threaded-system, [ --enable-threaded-system enable system thread [default=no]], , enable_threaded_system=no) if test x$enable_threaded_system = xyes; then CFLAGS="$CFLAGS -DUSE_SYSTEM_THREAD" fi dnl Enable threaded audio AC_ARG_ENABLE(threaded-audio, [ --enable-threaded-audio enable threaded audio [default=yes]], , enable_threaded_audio=yes) if test x$enable_threaded_audio = xyes; then CFLAGS="$CFLAGS -DTHREADED_AUDIO" fi dnl See if we can build the GTk player AC_ARG_ENABLE(gtk_player, [ --enable-gtk-player build a GTk sample SMPEG player [default=yes]], , enable_gtk_player=yes) have_gtk=no if test x$enable_gtk_player = xyes; then AM_PATH_GTK(1.2.1, have_gtk=yes) if test x$have_gtk = xyes; then CFLAGS="$CFLAGS $GTK_CFLAGS" fi AC_SUBST(GTK_LIBS) fi AM_CONDITIONAL(HAVE_GTK, test x$have_gtk = xyes) dnl See if we can build the Mesa player AC_ARG_ENABLE(opengl_player, [ --enable-opengl-player build an OpenGL sample SMPEG player [default=yes]], , enable_opengl_player=yes) have_glu=no if test x$enable_opengl_player = xyes; then case "$target" in *-*-cygwin* | *-*-mingw32*) SYS_GL_LIBS="-lopengl32 -lglu32" ;; *-*-beos*) SYS_GL_LIBS="-lGL" ;; *-*-darwin*) SYS_GL_LIBS="" ;; *) AC_PATH_X AC_PATH_XTRA if test x$have_x = xyes; then CFLAGS="$CFLAGS $X_CFLAGS" SYS_GL_LIBS="$X_LIBS -lGL -lGLU" else SYS_GL_LIBS="-lGL -lGLU" fi ;; esac AC_MSG_CHECKING(for OpenGL support) have_opengl=no AC_TRY_COMPILE([ #include #include ],[ ],[ have_opengl=yes ]) AC_MSG_RESULT($have_opengl) if test x$have_opengl = xyes; then GL_LIBS="$SYS_GL_LIBS" else echo "*** The OpenGL movie player will not be built (missing GL or GLU)" fi fi AC_SUBST(GL_LIBS) AM_CONDITIONAL(HAVE_OPENGL, test x$have_opengl = xyes) dnl Disable assertions in release builds AC_ARG_ENABLE(assertions, [ --enable-assertions Enable consistency checks in decoding [default=no]], , enable_assertions=no) if test x$enable_assertions != xyes; then CFLAGS="$CFLAGS -DNDEBUG" fi dnl Add the source include directories CFLAGS="$CFLAGS -I.. -DNOCONTROLS" CFLAGS="$CFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/audio -I\$(top_srcdir)/video" CXXFLAGS="$CFLAGS" dnl C++ flags are the same as the C flags CXXFLAGS="$CFLAGS" if test x$GCC = xyes; then # Check to see if options -fno-rtti -fno-exceptions are supported AC_MSG_CHECKING(if $CXX supports -fno-rtti -fno-exceptions) use_fnoexceptions=no save_CFLAGS="$CFLAGS" save_CC="$CC" CFLAGS="-fno-rtti -fno-exceptions" CC="$CXX" AC_TRY_COMPILE([ ],[ ],[ use_fnoexceptions=yes ]) AC_MSG_RESULT($use_fnoexceptions) if test x$use_fnoexceptions = xyes; then CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-rtti" fi CC="$save_CC" CFLAGS="$save_CFLAGS" fi # Finally create all the generated files AC_OUTPUT([ Makefile audio/Makefile video/Makefile smpeg-config smpeg.spec ]) smpeg-0.4.5+cvs20030824.orig/install-sh0100644000175000017500000001273607003633512017340 0ustar hoseheadhosehead#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 smpeg-0.4.5+cvs20030824.orig/ltconfig0100644000175000017500000030670007476543760017107 0ustar hoseheadhosehead#! /bin/sh # ltconfig - Create a system-specific libtool. # Copyright (C) 1996-1999 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # A lot of this script is taken from autoconf-2.10. # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} echo=echo if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell. exec "$SHELL" "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null`} case X$UNAME in *-DOS) PATH_SEPARATOR=';' ;; *) PATH_SEPARATOR=':' ;; esac fi # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi if test "X${echo_test_string+set}" != Xset; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... if (echo_test_string="`eval $cmd`") 2>/dev/null && echo_test_string="`eval $cmd`" && (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then break fi done fi if test "X`($echo '\t') 2>/dev/null`" != 'X\t' || test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" for dir in $PATH /usr/ucb; do if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then echo="$dir/echo" break fi done IFS="$save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then # This shell has a builtin print -r that does the trick. echo='print -r' elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running ltconfig again with it. ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}" export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"} else # Try using printf. echo='printf "%s\n"' if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then # Cool, printf works : elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL" export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL echo="$CONFIG_SHELL $0 --fallback-echo" elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then echo="$CONFIG_SHELL $0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then break fi prev="$cmd" done if test "$prev" != 'sed 50q "$0"'; then echo_test_string=`eval $prev` export echo_test_string exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"} else # Oops. We lost completely, so just stick with echo. echo=echo fi fi fi fi fi # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='sed -e s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # The name of this program. progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'` # Constants: PROGRAM=ltconfig PACKAGE=libtool VERSION=1.3.5 TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)" ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' rm="rm -f" help="Try \`$progname --help' for more information." # Global variables: default_ofile=libtool can_build_shared=yes enable_shared=yes # All known linkers require a `.a' archive for static linking (except M$VC, # which needs '.lib'). enable_static=yes enable_fast_install=yes enable_dlopen=unknown enable_win32_dll=no ltmain= silent= srcdir= ac_config_guess= ac_config_sub= host= nonopt= ofile="$default_ofile" verify_host=yes with_gcc=no with_gnu_ld=no need_locks=yes ac_ext=c objext=o libext=a exeext= cache_file= old_AR="$AR" old_CC="$CC" old_CFLAGS="$CFLAGS" old_CPPFLAGS="$CPPFLAGS" old_LDFLAGS="$LDFLAGS" old_LD="$LD" old_LN_S="$LN_S" old_LIBS="$LIBS" old_NM="$NM" old_RANLIB="$RANLIB" old_DLLTOOL="$DLLTOOL" old_OBJDUMP="$OBJDUMP" old_AS="$AS" # Parse the command line options. args= prev= for option do case "$option" in -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then eval "$prev=\$option" prev= continue fi case "$option" in --help) cat <&2 echo "$help" 1>&2 exit 1 ;; *) if test -z "$ltmain"; then ltmain="$option" elif test -z "$host"; then # This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1 # if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then # echo "$progname: warning \`$option' is not a valid host type" 1>&2 # fi host="$option" else echo "$progname: too many arguments" 1>&2 echo "$help" 1>&2 exit 1 fi ;; esac done if test -z "$ltmain"; then echo "$progname: you must specify a LTMAIN file" 1>&2 echo "$help" 1>&2 exit 1 fi if test ! -f "$ltmain"; then echo "$progname: \`$ltmain' does not exist" 1>&2 echo "$help" 1>&2 exit 1 fi # Quote any args containing shell metacharacters. ltconfig_args= for arg do case "$arg" in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) ltconfig_args="$ltconfig_args '$arg'" ;; *) ltconfig_args="$ltconfig_args $arg" ;; esac done # A relevant subset of AC_INIT. # File descriptor usage: # 0 standard input # 1 file creation # 2 errors and warnings # 3 some systems may open it to /dev/tty # 4 used on the Kubota Titan # 5 compiler messages saved in config.log # 6 checking for... messages and results if test "$silent" = yes; then exec 6>/dev/null else exec 6>&1 fi exec 5>>./config.log # NLS nuisances. # Only set LANG and LC_ALL to C if already set. # These must not be set unconditionally because not all systems understand # e.g. LANG=C (notably SCO). if test "X${LC_ALL+set}" = Xset; then LC_ALL=C; export LC_ALL; fi if test "X${LANG+set}" = Xset; then LANG=C; export LANG; fi if test -n "$cache_file" && test -r "$cache_file"; then echo "loading cache $cache_file within ltconfig" . $cache_file fi if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then ac_n= ac_c=' ' ac_t=' ' else ac_n=-n ac_c= ac_t= fi else ac_n= ac_c='\c' ac_t= fi if test -z "$srcdir"; then # Assume the source directory is the same one as the path to LTMAIN. srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'` test "$srcdir" = "$ltmain" && srcdir=. fi trap "$rm conftest*; exit 1" 1 2 15 if test "$verify_host" = yes; then # Check for config.guess and config.sub. ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/config.guess; then ac_aux_dir=$ac_dir break fi done if test -z "$ac_aux_dir"; then echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2 echo "$help" 1>&2 exit 1 fi ac_config_guess=$ac_aux_dir/config.guess ac_config_sub=$ac_aux_dir/config.sub # Make sure we can run config.sub. if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then : else echo "$progname: cannot run $ac_config_sub" 1>&2 echo "$help" 1>&2 exit 1 fi echo $ac_n "checking host system type""... $ac_c" 1>&6 host_alias=$host case "$host_alias" in "") if host_alias=`$SHELL $ac_config_guess`; then : else echo "$progname: cannot guess host type; you must specify one" 1>&2 echo "$help" 1>&2 exit 1 fi ;; esac host=`$SHELL $ac_config_sub $host_alias` echo "$ac_t$host" 1>&6 # Make sure the host verified. test -z "$host" && exit 1 elif test -z "$host"; then echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2 echo "$help" 1>&2 exit 1 else host_alias=$host fi # Transform linux* to *-*-linux-gnu*, to support old configure scripts. case "$host_os" in linux-gnu*) ;; linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` esac host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` case "$host_os" in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Determine commands to create old-style static archives. old_archive_cmds='$AR cru $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= # Set a sane default for `AR'. test -z "$AR" && AR=ar # Set a sane default for `OBJDUMP'. test -z "$OBJDUMP" && OBJDUMP=objdump # If RANLIB is not set, then run the test. if test "${RANLIB+set}" != "set"; then result=no echo $ac_n "checking for ranlib... $ac_c" 1>&6 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" for dir in $PATH; do test -z "$dir" && dir=. if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then RANLIB="ranlib" result="ranlib" break fi done IFS="$save_ifs" echo "$ac_t$result" 1>&6 fi if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" fi # Set sane defaults for `DLLTOOL', `OBJDUMP', and `AS', used on cygwin. test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$AS" && AS=as # Check to see if we are using GCC. if test "$with_gcc" != yes || test -z "$CC"; then # If CC is not set, then try to find GCC or a usable CC. if test -z "$CC"; then echo $ac_n "checking for gcc... $ac_c" 1>&6 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" for dir in $PATH; do test -z "$dir" && dir=. if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then CC="gcc" break fi done IFS="$save_ifs" if test -n "$CC"; then echo "$ac_t$CC" 1>&6 else echo "$ac_t"no 1>&6 fi fi # Not "gcc", so try "cc", rejecting "/usr/ucb/cc". if test -z "$CC"; then echo $ac_n "checking for cc... $ac_c" 1>&6 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" cc_rejected=no for dir in $PATH; do test -z "$dir" && dir=. if test -f $dir/cc || test -f $dir/cc$ac_exeext; then if test "$dir/cc" = "/usr/ucb/cc"; then cc_rejected=yes continue fi CC="cc" break fi done IFS="$save_ifs" if test $cc_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $CC shift if test $# -gt 0; then # We chose a different compiler from the bogus one. # However, it has the same name, so the bogon will be chosen # first if we set CC to just the name; use the full file name. shift set dummy "$dir/cc" "$@" shift CC="$@" fi fi if test -n "$CC"; then echo "$ac_t$CC" 1>&6 else echo "$ac_t"no 1>&6 fi if test -z "$CC"; then echo "$progname: error: no acceptable cc found in \$PATH" 1>&2 exit 1 fi fi # Now see if the compiler is really GCC. with_gcc=no echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6 echo "$progname:581: checking whether we are using GNU C" >&5 $rm conftest.c cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then with_gcc=yes fi $rm conftest.c echo "$ac_t$with_gcc" 1>&6 fi # Allow CC to be a program name with arguments. set dummy $CC compiler="$2" echo $ac_n "checking for object suffix... $ac_c" 1>&6 $rm conftest* echo 'int i = 1;' > conftest.c echo "$progname:603: checking for object suffix" >& 5 if { (eval echo $progname:604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then # Append any warnings to the config.log. cat conftest.err 1>&5 for ac_file in conftest.*; do case $ac_file in *.c) ;; *) objext=`echo $ac_file | sed -e s/conftest.//` ;; esac done else cat conftest.err 1>&5 echo "$progname: failed program was:" >&5 cat conftest.c >&5 fi $rm conftest* echo "$ac_t$objext" 1>&6 echo $ac_n "checking for executable suffix... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_exeext="no" $rm conftest* echo 'main () { return 0; }' > conftest.c echo "$progname:629: checking for executable suffix" >& 5 if { (eval echo $progname:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>conftest.err; }; then # Append any warnings to the config.log. cat conftest.err 1>&5 for ac_file in conftest.*; do case $ac_file in *.c | *.err | *.$objext ) ;; *) ac_cv_exeext=.`echo $ac_file | sed -e s/conftest.//` ;; esac done else cat conftest.err 1>&5 echo "$progname: failed program was:" >&5 cat conftest.c >&5 fi $rm conftest* fi if test "X$ac_cv_exeext" = Xno; then exeext="" else exeext="$ac_cv_exeext" fi echo "$ac_t$ac_cv_exeext" 1>&6 echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6 pic_flag= special_shlib_compile_flags= wl= link_static_flag= no_builtin_flag= if test "$with_gcc" = yes; then wl='-Wl,' link_static_flag='-static' case "$host_os" in beos* | irix5* | irix6* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; aix*) # Below there is a dirty hack to force normal static linking with -ldl # The problem is because libdl dynamically linked with both libc and # libC (AIX C++ library), which obviously doesn't included in libraries # list by gcc. This cause undefined symbols with -static flags. # This hack allows C programs to be linked with "-static -ldl", but # we not sure about C++ programs. link_static_flag="$link_static_flag ${wl}-lC" ;; cygwin* | mingw* | os2*) # We can build DLLs from non-PIC. ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. pic_flag='-m68020 -resident32 -malways-restore-a4' ;; sysv4*MP*) if test -d /usr/nec; then pic_flag=-Kconform_pic fi ;; *) pic_flag='-fPIC' ;; esac else # PORTME Check for PIC flags for the system compiler. case "$host_os" in aix3* | aix4*) # All AIX code is PIC. link_static_flag='-bnso -bI:/lib/syscalls.exp' ;; hpux9* | hpux10* | hpux11*) # Is there a better link_static_flag that works with the bundled CC? wl='-Wl,' link_static_flag="${wl}-a ${wl}archive" pic_flag='+Z' ;; irix5* | irix6*) wl='-Wl,' link_static_flag='-non_shared' # PIC (with -KPIC) is the default. ;; cygwin* | mingw* | os2*) # We can build DLLs from non-PIC. ;; osf3* | osf4* | osf5*) # All OSF/1 code is PIC. wl='-Wl,' link_static_flag='-non_shared' ;; sco3.2v5*) pic_flag='-Kpic' link_static_flag='-dn' special_shlib_compile_flags='-belf' ;; solaris*) pic_flag='-KPIC' link_static_flag='-Bstatic' wl='-Wl,' ;; sunos4*) pic_flag='-PIC' link_static_flag='-Bstatic' wl='-Qoption ld ' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) pic_flag='-KPIC' link_static_flag='-Bstatic' wl='-Wl,' ;; uts4*) pic_flag='-pic' link_static_flag='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then pic_flag='-Kconform_pic' link_static_flag='-Bstatic' fi ;; *) can_build_shared=no ;; esac fi if test -n "$pic_flag"; then echo "$ac_t$pic_flag" 1>&6 # Check to make sure the pic_flag actually works. echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6 $rm conftest* echo "int some_variable = 0;" > conftest.c save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $pic_flag -DPIC" echo "$progname:776: checking if $compiler PIC flag $pic_flag works" >&5 if { (eval echo $progname:777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then # Append any warnings to the config.log. cat conftest.err 1>&5 case "$host_os" in hpux9* | hpux10* | hpux11*) # On HP-UX, both CC and GCC only warn that PIC is supported... then they # create non-PIC objects. So, if there were any warnings, we assume that # PIC is not supported. if test -s conftest.err; then echo "$ac_t"no 1>&6 can_build_shared=no pic_flag= else echo "$ac_t"yes 1>&6 pic_flag=" $pic_flag" fi ;; *) echo "$ac_t"yes 1>&6 pic_flag=" $pic_flag" ;; esac else # Append any errors to the config.log. cat conftest.err 1>&5 can_build_shared=no pic_flag= echo "$ac_t"no 1>&6 fi CFLAGS="$save_CFLAGS" $rm conftest* else echo "$ac_t"none 1>&6 fi # Check to see if options -o and -c are simultaneously supported by compiler echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6 $rm -r conftest 2>/dev/null mkdir conftest cd conftest $rm conftest* echo "int some_variable = 0;" > conftest.c mkdir out # According to Tom Tromey, Ian Lance Taylor reported there are C compilers # that will create temporary files in the current directory regardless of # the output directory. Thus, making CWD read-only will cause this test # to fail, enabling locking or at least warning the user not to do parallel # builds. chmod -w . save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -o out/conftest2.o" echo "$progname:829: checking if $compiler supports -c -o file.o" >&5 if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.o; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s out/conftest.err; then echo "$ac_t"no 1>&6 compiler_c_o=no else echo "$ac_t"yes 1>&6 compiler_c_o=yes fi else # Append any errors to the config.log. cat out/conftest.err 1>&5 compiler_c_o=no echo "$ac_t"no 1>&6 fi CFLAGS="$save_CFLAGS" chmod u+w . $rm conftest* out/* rmdir out cd .. rmdir conftest $rm -r conftest 2>/dev/null if test x"$compiler_c_o" = x"yes"; then # Check to see if we can write to a .lo echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6 $rm conftest* echo "int some_variable = 0;" > conftest.c save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -c -o conftest.lo" echo "$progname:862: checking if $compiler supports -c -o file.lo" >&5 if { (eval echo $progname:863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then echo "$ac_t"no 1>&6 compiler_o_lo=no else echo "$ac_t"yes 1>&6 compiler_o_lo=yes fi else # Append any errors to the config.log. cat conftest.err 1>&5 compiler_o_lo=no echo "$ac_t"no 1>&6 fi CFLAGS="$save_CFLAGS" $rm conftest* else compiler_o_lo=no fi # Check to see if we can do hard links to lock some files if needed hard_links="nottested" if test "$compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$ac_t$hard_links" 1>&6 $rm conftest* if test "$hard_links" = no; then echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2 need_locks=warn fi else need_locks=no fi if test "$with_gcc" = yes; then # Check to see if options -fno-rtti -fno-exceptions are supported by compiler echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6 $rm conftest* echo "int some_variable = 0;" > conftest.c save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c" echo "$progname:914: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 if { (eval echo $progname:915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then echo "$ac_t"no 1>&6 compiler_rtti_exceptions=no else echo "$ac_t"yes 1>&6 compiler_rtti_exceptions=yes fi else # Append any errors to the config.log. cat conftest.err 1>&5 compiler_rtti_exceptions=no echo "$ac_t"no 1>&6 fi CFLAGS="$save_CFLAGS" $rm conftest* if test "$compiler_rtti_exceptions" = "yes"; then no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' else no_builtin_flag=' -fno-builtin' fi fi # Check for any special shared library compilation flags. if test -n "$special_shlib_compile_flags"; then echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2 if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then : else echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2 can_build_shared=no fi fi echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6 $rm conftest* echo 'main(){return(0);}' > conftest.c save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $link_static_flag" echo "$progname:958: checking if $compiler static flag $link_static_flag works" >&5 if { (eval echo $progname:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then echo "$ac_t$link_static_flag" 1>&6 else echo "$ac_t"none 1>&6 link_static_flag= fi LDFLAGS="$save_LDFLAGS" $rm conftest* if test -z "$LN_S"; then # Check to see if we can use ln -s, or we need hard links. echo $ac_n "checking whether ln -s works... $ac_c" 1>&6 $rm conftest.dat if ln -s X conftest.dat 2>/dev/null; then $rm conftest.dat LN_S="ln -s" else LN_S=ln fi if test "$LN_S" = "ln -s"; then echo "$ac_t"yes 1>&6 else echo "$ac_t"no 1>&6 fi fi # Make sure LD is an absolute path. if test -z "$LD"; then ac_prog=ld if test "$with_gcc" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6 echo "$progname:991: checking for ld used by GCC" >&5 ac_prog=`($CC -print-prog-name=ld) 2>&5` case "$ac_prog" in # Accept absolute paths. [\\/]* | [A-Za-z]:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we are not using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then echo $ac_n "checking for GNU ld... $ac_c" 1>&6 echo "$progname:1015: checking for GNU ld" >&5 else echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 echo "$progname:1018: checking for non-GNU ld" >&5 fi if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then test "$with_gnu_ld" != no && break else test "$with_gnu_ld" != yes && break fi fi done IFS="$ac_save_ifs" fi if test -n "$LD"; then echo "$ac_t$LD" 1>&6 else echo "$ac_t"no 1>&6 fi if test -z "$LD"; then echo "$progname: error: no acceptable ld found in \$PATH" 1>&2 exit 1 fi fi # Check to see if it really is or is not GNU ld. echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6 # I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LD -v 2>&1 &5; then with_gnu_ld=yes else with_gnu_ld=no fi echo "$ac_t$with_gnu_ld" 1>&6 # See if the linker supports building shared libraries. echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6 allow_undefined_flag= no_undefined_flag= need_lib_prefix=unknown need_version=unknown # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments archive_cmds= archive_expsym_cmds= old_archive_from_new_cmds= export_dynamic_flag_spec= whole_archive_flag_spec= thread_safe_flag_spec= hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no hardcode_shlibpath_var=unsupported runpath_var= always_export_symbols=no export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an egrep regular expression of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. case "$host_os" in cygwin* | mingw*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$with_gcc" != yes; then with_gnu_ld=no fi ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # See if GNU ld supports shared libraries. case "$host_os" in aix3* | aix4*) # On AIX, the GNU linker is very broken ld_shlibs=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF ;; amigaos*) archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can use # them. ld_shlibs=no ;; beos*) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then #allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw*) # Special flag that tells Cygwin to use the native MSVC runtime case "$host_os" in cygwin*) cygwin_use_msvcrt=true ;; esac # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' # allow_undefined_flag=unsupported always_export_symbols=yes # Extract the symbol export list from an `--export-all' def file, # then regenerate the def file from the symbol export list, so that # the compiled dll only exports the symbol export list. # Be careful not to strip the DATA tag left by newer dlltools. if [ "$cygwin_use_msvcrt" = "true" ]; then export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -U__CYGWIN__ -U__CYGWIN32__ -c $soname-ltdll.c)~ $DLLTOOL --exclude-symbols _DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs $convenience~ sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $objdir/$soname-def > $export_symbols' else export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ $DLLTOOL --exclude-symbols _DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs $convenience~ sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $objdir/$soname-def > $export_symbols' fi # If DATA tags from a recent dlltool are present, honour them! if [ "$cygwin_use_msvcrt" = "true" ]; then archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~ _lt_hint=1; cat $export_symbols | while read symbol; do set dummy \$symbol; case \$# in 2) echo " \$2 @ \$_lt_hint ; " >> $objdir/$soname-def;; *) echo " \$2 @ \$_lt_hint \$3 ; " >> $objdir/$soname-def;; esac; _lt_hint=`expr 1 + \$_lt_hint`; done~ test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -U__CYGWIN__ -U__CYGWIN32__ -c $soname-ltdll.c)~ $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,_DllMain@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts -L/usr/lib/mingw -mno-cygwin~ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols _DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,_DllMain@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts -L/usr/lib/mingw -mno-cygwin~ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols _DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,_DllMain@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts -L/usr/lib/mingw -mno-cygwin~ : strip_is_broken_with_dlls_on_win95B - strip $lib' else archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~ _lt_hint=1; cat $export_symbols | while read symbol; do set dummy \$symbol; case \$# in 2) echo " \$2 @ \$_lt_hint ; " >> $objdir/$soname-def;; *) echo " \$2 @ \$_lt_hint \$3 ; " >> $objdir/$soname-def;; esac; _lt_hint=`expr 1 + \$_lt_hint`; done~ test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,_DllMain@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols _DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,_DllMain@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols _DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,_DllMain@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ : strip_is_broken_with_dlls_on_win95B - strip $lib' fi old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a' ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib' # can we support soname and/or expsyms with a.out? -oliva fi ;; solaris* | sysv5*) if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linkopts' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = yes; then runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' case $host_os in cygwin* | mingw*) # dlltool doesn't understand --whole-archive et. al. whole_archive_flag_spec= ;; netbsd*) whole_archive_flag_spec= ;; *) # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi ;; esac fi else # PORTME fill in a description of your system's linker (not GNU ld) case "$host_os" in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$with_gcc" = yes && test -z "$link_static_flag"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix4*) hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib' hardcode_libdir_separator=':' if test "$with_gcc" = yes; then collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct=yes else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi shared_flag='-shared' else shared_flag='${wl}-bM:SRE' hardcode_direct=yes fi allow_undefined_flag=' ${wl}-berok' archive_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}' archive_expsym_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}' case "$host_os" in aix4.[01]|aix4.[01].*) # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on always_export_symbols=yes ;; esac ;; amigaos*) archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # see comment about different semantics on the GNU ld section ld_shlibs=no ;; cygwin* | mingw*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' # allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib /OUT:$oldlib$oldobjs' fix_srcfile_path='`cygpath -w $srcfile`' ;; freebsd1*) ld_shlibs=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd*) archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9* | hpux10* | hpux11*) case "$host_os" in hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;; *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linkopts' ;; esac hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_minus_L=yes # Not in the search PATH, but as the default # location of the library. export_dynamic_flag_spec='${wl}-E' ;; irix5* | irix6*) if test "$with_gcc" = yes; then archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF fi hardcode_libdir_flag_spec='${wl}-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; openbsd*) hardcode_direct=yes hardcode_shlibpath_var=no case "$host_os" in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' if test "`echo __ELF__ | $CC -E - | grep __ELF__`" = "" -o "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then export_dynamic_flag_spec='${wl}-E' fi ;; esac ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def' old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def' ;; osf3*) if test "$with_gcc" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # As osf3* with the addition of the -msym flag if test "$with_gcc" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; rhapsody*) archive_cmds='$CC -bundle -undefined suppress -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flags_spec='-L$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; sco3.2v5*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ;; solaris*) no_undefined_flag=' -z text' # $CC -shared without GNU ld will not create a library from C++ # object files and a static libstdc++, better avoid it by now archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case "$host_os" in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $linkopts' else archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' fi runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv5*) no_undefined_flag=' -z text' # $CC -shared without GNU ld will not create a library from C++ # object files and a static libstdc++, better avoid it by now archive_cmds='$LD -G${allow_undefined_flag} -h $rpath/$soname -o $lib $libobjs $deplibs $linkopts' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' hardcode_libdir_flag_spec= hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4.2uw2*) archive_cmds='$LD -G -o $lib $libobjs $deplibs $linkopts' hardcode_direct=yes hardcode_minus_L=no hardcode_shlibpath_var=no hardcode_runpath_var=yes runpath_var=LD_RUN_PATH ;; unixware7*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac fi echo "$ac_t$ld_shlibs" 1>&6 test "$ld_shlibs" = no && can_build_shared=no if test -z "$NM"; then echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6 case "$NM" in [\\/]* | [A-Za-z]:[\\/]*) ;; # Let the user override the test with a path. *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then NM="$ac_dir/nm -B" break elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then NM="$ac_dir/nm -p" break else NM=${NM="$ac_dir/nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags fi fi done IFS="$ac_save_ifs" test -z "$NM" && NM=nm ;; esac echo "$ac_t$NM" 1>&6 fi # Check for command to grab the raw symbol name followed by C symbol from nm. echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6 # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Transform the above into a raw symbol and a C symbol. symxfrm='\1 \2\3 \3' # Transform an extracted symbol line into a proper C declaration global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" # Define system-specific variables. case "$host_os" in aix*) symcode='[BCDT]' ;; cygwin* | mingw*) symcode='[ABCDGISTW]' ;; hpux*) # Its linker distinguishes data from code symbols global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'" ;; irix*) symcode='[BCDEGRST]' ;; solaris*) symcode='[BDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then symcode='[ABCDGISTW]' fi # Try without a prefix undercore, then with it. for ac_symprfx in "" "_"; do # Write the raw and C identifiers. global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'" # Check to see that the pipe works correctly. pipe_works=no $rm conftest* cat > conftest.c <&5 if { (eval echo $progname:1654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then # Now try to grab the symbols. nlist=conftest.nm if { echo "$progname:1657: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if egrep ' nm_test_var$' "$nlist" >/dev/null; then if egrep ' nm_test_func$' "$nlist" >/dev/null; then cat < conftest.c #ifdef __cplusplus extern "C" { #endif EOF # Now generate the symbol file. eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c' cat <> conftest.c #if defined (__STDC__) && __STDC__ # define lt_ptr_t void * #else # define lt_ptr_t char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr_t address; } lt_preloaded_symbols[] = { EOF sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c cat <<\EOF >> conftest.c {0, (lt_ptr_t) 0} }; #ifdef __cplusplus } #endif EOF # Now try linking the two files. mv conftest.$objext conftstm.$objext save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="conftstm.$objext" CFLAGS="$CFLAGS$no_builtin_flag" if { (eval echo $progname:1709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then pipe_works=yes else echo "$progname: failed program was:" >&5 cat conftest.c >&5 fi LIBS="$save_LIBS" else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.c >&5 fi $rm conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else global_symbol_pipe= fi done if test "$pipe_works" = yes; then echo "${ac_t}ok" 1>&6 else echo "${ac_t}failed" 1>&6 fi if test -z "$global_symbol_pipe"; then global_symbol_to_cdecl= fi # Check hardcoding attributes. echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 hardcode_action= if test -n "$hardcode_libdir_flag_spec" || \ test -n "$runpath_var"; then # We can hardcode non-existant directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$hardcode_shlibpath_var" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi echo "$ac_t$hardcode_action" 1>&6 reload_flag= reload_cmds='$LD$reload_flag -o $output$reload_objs' echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6 # PORTME Some linkers may need a different reload flag. reload_flag='-r' echo "$ac_t$reload_flag" 1>&6 test -n "$reload_flag" && reload_flag=" $reload_flag" # PORTME Fill in your ld.so characteristics library_names_spec= libname_spec='lib$name' soname_spec= postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" file_magic_cmd= file_magic_test_file= deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [regex]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given egrep regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 case "$host_os" in aix3*) version_type=linux library_names_spec='${libname}${release}.so$versuffix $libname.a' shlibpath_var=LIBPATH # AIX has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}.so$major' ;; aix4*) version_type=linux # AIX has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. # We preserve .a as extension for shared libraries though AIX4.2 # and later linker supports .so library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a' shlibpath_var=LIBPATH deplibs_check_method=pass_all ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' ;; beos*) library_names_spec='${libname}.so' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH deplibs_check_method=pass_all lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; bsdi4*) version_type=linux need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' file_magic_cmd=/usr/bin/file file_magic_test_file=/shlib/libc.so sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" export_dynamic_flag_spec=-rdynamic # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw*) version_type=windows need_version=no need_lib_prefix=no if test "$with_gcc" = yes; then library_names_spec='`echo ${libname} | sed -e 's/^lib//g'`.dll $libname.a' else library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' fi dynamic_linker='Win32 ld.exe' deplibs_check_method='file_magic file format pe-i386(.*architecture: i386)?' file_magic_cmd='${OBJDUMP} -f' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH if test "$with_gcc" = yes; then # See where the system libraries really are - /usr/lib won't cut it libuser32=`$CC --print-file-name=libuser32.a` win32libs=`expr $libuser32 : '\(.*\)/.*'` sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api $win32libs" fi lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; freebsd1*) dynamic_linker=no ;; freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case "$version_type" in freebsd-elf*) deplibs_check_method='pass_all' file_magic_cmd=/usr/bin/file file_magic_test_file=`echo /usr/lib/libc.so*` library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' need_version=no need_lib_prefix=no ;; freebsd-*) deplibs_check_method=unknown library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case "$host_os" in freebsd2* | freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes ;; *) # from 3.2 on shlibpath_overrides_runpath=no ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. dynamic_linker="$host_os dld.sl" version_type=sunos need_lib_prefix=no need_version=no shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' soname_spec='${libname}${release}.sl$major' # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' case "$host_os" in hpux10.20*) # TODO: Does this work for hpux-11 too? # deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' deplibs_check_method="unknown" file_magic_cmd=/usr/bin/file file_magic_test_file=/usr/lib/libc.sl ;; esac ;; irix5* | irix6*) version_type=irix need_lib_prefix=no need_version=no soname_spec='${libname}${release}.so.$major' library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}${release}.so $libname.so' case "$host_os" in irix5*) libsuff= shlibsuff= # this will be overridden with pass_all, but let us keep it just in case deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" ;; *) case "$LD" in # libtool.m4 will add one of these switches to LD *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" file_magic_cmd=/usr/bin/file file_magic_test_file=`echo /lib${libsuff}/libc.so*` deplibs_check_method='pass_all' ;; # No shared lib support for Linux oldld, aout, or coff. linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) dynamic_linker=no ;; # This must be Linux ELF. linux-gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no deplibs_check_method=pass_all if test -f /lib/ld.so.1; then dynamic_linker='GNU ld.so' else # Only the GNU ld.so supports shared libraries on MkLinux. case "$host_cpu" in powerpc*) dynamic_linker=no ;; *) dynamic_linker='Linux ld.so' ;; esac fi ;; netbsd*) version_type=sunos if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' soname_spec='${libname}${release}.so$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH deplibs_check_method='pass_all' ;; openbsd*) version_type=sunos need_lib_prefix=no need_version=no file_magic_cmd=/usr/bin/file file_magic_test_file=`echo /usr/lib/libc.so.*` if test "`echo __ELF__ | $CC -E - | grep __ELF__`" = "" -o "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' shlibpath_overrides_runpath=no else deplibs_check_method='file_magic OpenBSD.* shared library' shlibpath_overrides_runpath=yes fi library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH deplibs_check_method='pass_all' ;; os2*) libname_spec='$name' need_lib_prefix=no library_names_spec='$libname.dll $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_version=no soname_spec='${libname}${release}.so' library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' shlibpath_var=LD_LIBRARY_PATH # this will be overridden with pass_all, but let us keep it just in case deplibs_check_method='file_magic COFF format alpha shared library' file_magic_cmd=/usr/bin/file file_magic_test_file=/shlib/libc.so deplibs_check_method='pass_all' sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rhapsody*) version_type=sunos library_names_spec='${libname}.so' soname_spec='${libname}.so' shlibpath_var=DYLD_LIBRARY_PATH deplibs_check_method=pass_all ;; sco3.2v5*) version_type=osf soname_spec='${libname}${release}.so$major' library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib" file_magic_cmd=/usr/bin/file file_magic_test_file=/lib/libc.so ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH case "$host_vendor" in sequent) file_magic_cmd='/bin/file' deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; ncr) deplibs_check_method='pass_all' ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' file_magic_cmd=/usr/bin/file file_magic_test_file=`echo /usr/lib/libc.so*` ;; esac ;; uts4*) version_type=linux library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' soname_spec='$libname.so.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; *) dynamic_linker=no ;; nto-qnx) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes deplibs_check_method='pass_all' ;; esac echo "$ac_t$dynamic_linker" 1>&6 test "$dynamic_linker" = no && can_build_shared=no # Report the final consequences. echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 # Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in # configure.in, otherwise build static only libraries. case "$host_os" in cygwin* | mingw* | os2*) if test x$can_build_shared = xyes; then test x$enable_win32_dll = xno && can_build_shared=no echo "checking if package supports dlls... $can_build_shared" 1>&6 fi ;; esac if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then case "$deplibs_check_method" in "file_magic "*) file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | egrep "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6 test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case "$host_os" in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4*) test "$enable_shared" = yes && enable_static=no ;; esac echo "$ac_t$enable_shared" 1>&6 # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes echo "checking whether to build static libraries... $enable_static" 1>&6 if test "$hardcode_action" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi echo $ac_n "checking for objdir... $ac_c" 1>&6 rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. objdir=_libs fi rmdir .libs 2>/dev/null echo "$ac_t$objdir" 1>&6 if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then lt_cv_dlopen=no lt_cv_dlopen_libs= echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 echo "$progname:2248: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dlopen""... $ac_c" 1>&6 echo "$progname:2288: checking for dlopen" >&5 if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_dlopen) || defined (__stub___dlopen) choke me #else dlopen(); #endif ; return 0; } EOF if { (eval echo $progname:2318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_dlopen=yes" else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_dlopen=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="dlopen" else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6 echo "$progname:2335: checking for dld_link in -ldld" >&5 ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldld $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" else echo "$ac_t""no" 1>&6 echo $ac_n "checking for shl_load""... $ac_c" 1>&6 echo "$progname:2375: checking for shl_load" >&5 if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_shl_load) || defined (__stub___shl_load) choke me #else shl_load(); #endif ; return 0; } EOF if { (eval echo $progname:2405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shl_load=yes" else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_shl_load=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="shl_load" else echo "$ac_t""no" 1>&6 echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 echo "$progname:2423: checking for shl_load in -ldld" >&5 ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldld $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else echo "$ac_t""no" 1>&6 fi fi fi fi fi fi if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes fi case "$lt_cv_dlopen" in dlopen) for ac_hdr in dlfcn.h; do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo "$progname:2488: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int fnord = 0; EOF ac_try="$ac_compile >/dev/null 2>conftest.out" { (eval echo $progname:2498: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 else echo "$ac_t""no" 1>&6 fi done if test "x$ac_cv_header_dlfcn_h" = xyes; then CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" fi eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" LIBS="$lt_cv_dlopen_libs $LIBS" echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6 echo "$progname:2526: checking whether a program can dlopen itself" >&5 if test "${lt_cv_dlopen_self+set}" = set; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then lt_cv_dlopen_self=cross else cat > conftest.c < #endif #include #ifdef RTLD_GLOBAL # define LTDL_GLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LTDL_GLOBAL DL_GLOBAL # else # define LTDL_GLOBAL 0 # endif #endif /* We may have to define LTDL_LAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LTDL_LAZY_OR_NOW # ifdef RTLD_LAZY # define LTDL_LAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LTDL_LAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LTDL_LAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LTDL_LAZY_OR_NOW DL_NOW # else # define LTDL_LAZY_OR_NOW 0 # endif # endif # endif # endif #endif fnord() { int i=42;} main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } EOF if { (eval echo $progname:2580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then lt_cv_dlopen_self=yes else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* lt_cv_dlopen_self=no fi rm -fr conftest* fi fi echo "$ac_t""$lt_cv_dlopen_self" 1>&6 if test "$lt_cv_dlopen_self" = yes; then LDFLAGS="$LDFLAGS $link_static_flag" echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6 echo "$progname:2599: checking whether a statically linked program can dlopen itself" >&5 if test "${lt_cv_dlopen_self_static+set}" = set; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then lt_cv_dlopen_self_static=cross else cat > conftest.c < #endif #include #ifdef RTLD_GLOBAL # define LTDL_GLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LTDL_GLOBAL DL_GLOBAL # else # define LTDL_GLOBAL 0 # endif #endif /* We may have to define LTDL_LAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LTDL_LAZY_OR_NOW # ifdef RTLD_LAZY # define LTDL_LAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LTDL_LAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LTDL_LAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LTDL_LAZY_OR_NOW DL_NOW # else # define LTDL_LAZY_OR_NOW 0 # endif # endif # endif # endif #endif fnord() { int i=42;} main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } EOF if { (eval echo $progname:2653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then lt_cv_dlopen_self_static=yes else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* lt_cv_dlopen_self_static=no fi rm -fr conftest* fi fi echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6 fi ;; esac case "$lt_cv_dlopen_self" in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case "$lt_cv_dlopen_self_static" in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi # Copy echo and quote the copy, instead of the original, because it is # used later. ltecho="$echo" if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then ltecho="$CONFIG_SHELL \$0 --fallback-echo" fi LTSHELL="$SHELL" LTCONFIG_VERSION="$VERSION" # Only quote variables if we're using ltmain.sh. case "$ltmain" in *.sh) # Now quote all the things that may contain metacharacters. for var in ltecho old_CC old_CFLAGS old_CPPFLAGS \ old_LD old_LDFLAGS old_LIBS \ old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS \ AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \ reload_flag reload_cmds wl \ pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ thread_safe_flag_spec whole_archive_flag_spec libname_spec \ library_names_spec soname_spec \ RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \ file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \ finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ hardcode_libdir_flag_spec hardcode_libdir_separator \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do case "$var" in reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ postinstall_cmds | postuninstall_cmds | \ finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case "$ltecho" in *'\$0 --fallback-echo"') ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac trap "$rm \"$ofile\"; exit 1" 1 2 15 echo "creating $ofile" $rm "$ofile" cat < "$ofile" #! $SHELL # `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh. # # Copyright (C) 1996-1999 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="sed -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi ### BEGIN LIBTOOL CONFIG EOF cfgfile="$ofile" ;; *) # Double-quote the variables that need it (for aesthetics). for var in old_CC old_CFLAGS old_CPPFLAGS \ old_LD old_LDFLAGS old_LIBS \ old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS; do eval "$var=\\\"\$var\\\"" done # Just create a config file. cfgfile="$ofile.cfg" trap "$rm \"$cfgfile\"; exit 1" 1 2 15 echo "creating $cfgfile" $rm "$cfgfile" cat < "$cfgfile" # `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) EOF ;; esac cat <> "$cfgfile" # Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # # CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\ # LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\ # NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\ # DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP AS=$old_AS \\ # $0$ltconfig_args # # Compiler and other test output produced by $progname, useful for # debugging $progname, is in ./config.log if it exists. # The version of $progname that generated this script. LTCONFIG_VERSION=$LTCONFIG_VERSION # Shell to use when invoking shell scripts. SHELL=$LTSHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host # An echo program that does not interpret backslashes. echo=$ltecho # The archiver. AR=$AR # The default C compiler. CC=$CC # The linker used to build libraries. LD=$LD # Whether we need hard or soft links. LN_S=$LN_S # A BSD-compatible nm program. NM=$NM # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$reload_flag reload_cmds=$reload_cmds # How to pass a linker flag through the compiler. wl=$wl # Object file suffix (normally "o"). objext="$objext" # Old archive suffix (normally "a"). libext="$libext" # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$pic_flag # Does compiler simultaneously support -c and -o options? compiler_c_o=$compiler_c_o # Can we write directly to a .lo ? compiler_o_lo=$compiler_o_lo # Must we lock files when doing compilation ? need_locks=$need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$link_static_flag # Compiler flag to turn off builtin functions. no_builtin_flag=$no_builtin_flag # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$whole_archive_flag_spec # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$thread_safe_flag_spec # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$library_names_spec # The coded name of the library, if different from the real name. soname_spec=$soname_spec # Commands used to build and install an old-style archive. RANLIB=$RANLIB old_archive_cmds=$old_archive_cmds old_postinstall_cmds=$old_postinstall_cmds old_postuninstall_cmds=$old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$old_archive_from_new_cmds # Commands used to build and install a shared archive. archive_cmds=$archive_cmds archive_expsym_cmds=$archive_expsym_cmds postinstall_cmds=$postinstall_cmds postuninstall_cmds=$postuninstall_cmds # Method to check whether dependent libraries are shared objects. deplibs_check_method=$deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$allow_undefined_flag # Flag that forces no undefined symbols. no_undefined_flag=$no_undefined_flag # Commands used to finish a libtool library installation in a directory. finish_cmds=$finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$global_symbol_to_cdecl # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$hardcode_libdir_separator # Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Compile-time system search path for libraries sys_lib_search_path_spec=$sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$exclude_expsyms # Symbols that must always be exported. include_expsyms=$include_expsyms EOF case "$ltmain" in *.sh) echo '### END LIBTOOL CONFIG' >> "$ofile" echo >> "$ofile" case "$host_os" in aix3*) cat <<\EOF >> "$ofile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi EOF ;; esac # Append the ltmain.sh script. sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1) # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? chmod +x "$ofile" ;; *) # Compile the libtool program. echo "FIXME: would compile $ltmain" ;; esac test -n "$cache_file" || exit 0 # AC_CACHE_SAVE trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs. It is not useful on other systems. # If it contains results you don't want to keep, you may remove or edit it. # # By default, configure uses ./config.cache as the cache file, # creating it if it does not exist already. You can give configure # the --cache-file=FILE option to use a different cache file; that is # what configure does when it calls configure scripts in # subdirectories, so they share the cache. # Giving --cache-file=/dev/null disables caching, for debugging configure. # config.status only pays attention to the cache file if you give it the # --recheck option to rerun configure. # EOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). sed -n \ -e "s/'/'\\\\''/g" \ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' ;; esac >> confcache if cmp -s $cache_file confcache; then : else if test -w $cache_file; then echo "updating cache $cache_file" cat confcache > $cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache exit 0 # Local Variables: # mode:shell-script # sh-indentation:2 # End: smpeg-0.4.5+cvs20030824.orig/ltmain.sh0100644000175000017500000033124107302556553017165 0ustar hoseheadhosehead# ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun ltconfig. # # Copyright (C) 1996-1999 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 fi if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then echo "$modename: not configured to build any kind of library" 1>&2 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 fi # Global variables. mode=$default_mode nonopt= prev= prevopt= run= show="$echo" show_help= execute_dlfiles= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" # Parse our command line options once, thoroughly. while test $# -gt 0 do arg="$1" shift case "$arg" in -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then case "$prev" in execute_dlfiles) eval "$prev=\"\$$prev \$arg\"" ;; *) eval "$prev=\$arg" ;; esac prev= prevopt= continue fi # Have we seen a non-optional argument yet? case "$arg" in --help) show_help=yes ;; --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" exit 0 ;; --config) sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0 exit 0 ;; --debug) echo "$progname: enabling shell trace mode" set -x ;; --dry-run | -n) run=: ;; --features) echo "host: $host" if test "$build_libtool_libs" = yes; then echo "enable shared libraries" else echo "disable shared libraries" fi if test "$build_old_libs" = yes; then echo "enable static libraries" else echo "disable static libraries" fi exit 0 ;; --finish) mode="finish" ;; --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; --quiet | --silent) show=: ;; -dlopen) prevopt="-dlopen" prev=execute_dlfiles ;; -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 exit 1 ;; *) nonopt="$arg" break ;; esac done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 exit 1 fi if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then case "$nonopt" in *cc | *++ | gcc* | *-gcc*) mode=link for arg do case "$arg" in -c) mode=compile break ;; esac done ;; *db | *dbx | *strace | *truss) mode=execute ;; *install*|cp|mv) mode=install ;; *rm) mode=uninstall ;; *) # If we have no mode, but dlfiles were specified, then do execute mode. test -n "$execute_dlfiles" && mode=execute # Just use the default operation mode. if test -z "$mode"; then if test -n "$nonopt"; then $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 fi fi ;; esac fi # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 exit 1 fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$modename --help --mode=$mode' for more information." # These modes are in order of execution frequency so that they run quickly. case "$mode" in # libtool compile mode compile) modename="$modename: compile" # Get the compilation command and the source file. base_compile= lastarg= srcfile="$nonopt" suppress_output= user_target=no for arg do # Accept any command-line options. case "$arg" in -o) if test "$user_target" != "no"; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 exit 1 fi user_target=next ;; -static) build_old_libs=yes continue ;; esac case "$user_target" in next) # The next one is the -o target name user_target=yes continue ;; yes) # We got the output file user_target=set libobj="$arg" continue ;; esac # Accept the current argument as the source file. lastarg="$srcfile" srcfile="$arg" # Aesthetically quote the previous argument. # Backslashify any backslashes, double quotes, and dollar signs. # These are the only characters that are still specially # interpreted inside of double-quoted scrings. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly in scan # sets, so we specify it separately. case "$lastarg" in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) lastarg="\"$lastarg\"" ;; esac # Add the previous argument to base_compile. if test -z "$base_compile"; then base_compile="$lastarg" else base_compile="$base_compile $lastarg" fi done case "$user_target" in set) ;; no) # Get the name of the library object. libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; *) $echo "$modename: you must specify a target with \`-o'" 1>&2 exit 1 ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSfmso]' case "$libobj" in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case "$libobj" in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 exit 1 ;; esac if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 exit 1 fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $libobj" else removelist="$libobj" fi $run $rm $removelist trap "$run $rm $removelist; exit 1" 1 2 15 # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit 1" 1 2 15 else need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until ln "$0" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit 1 fi echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile # All platforms use -DPIC, to notify preprocessed assembler code. command="$base_compile $srcfile $pic_flag -DPIC" if test "$build_old_libs" = yes; then lo_libobj="$libobj" dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$libobj"; then dir="$objdir" else dir="$dir/$objdir" fi libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` if test -d "$dir"; then $show "$rm $libobj" $run $rm $libobj else $show "$mkdir $dir" $run $mkdir $dir status=$? if test $status -ne 0 && test ! -d $dir; then exit $status fi fi fi if test "$compiler_o_lo" = yes; then output_obj="$libobj" command="$command -o $output_obj" elif test "$compiler_c_o" = yes; then output_obj="$obj" command="$command -o $output_obj" fi $run $rm "$output_obj" $show "$command" if $run eval "$command"; then : else test -n "$output_obj" && $run $rm $removelist exit 1 fi if test "$need_locks" = warn && test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit 1 fi # Just move the object if needed, then go on to compile the next one if test x"$output_obj" != x"$libobj"; then $show "$mv $output_obj $libobj" if $run $mv $output_obj $libobj; then : else error=$? $run $rm $removelist exit $error fi fi # If we have no pic_flag, then copy the object into place and finish. if test -z "$pic_flag" && test "$build_old_libs" = yes; then # Rename the .lo from within objdir to obj if test -f $obj; then $show $rm $obj $run $rm $obj fi $show "$mv $libobj $obj" if $run $mv $libobj $obj; then : else error=$? $run $rm $removelist exit $error fi xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir="." else xdir="$xdir" fi baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` # Now arrange that obj and lo_libobj become the same file $show "(cd $xdir && $LN_S $baseobj $libobj)" if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then exit 0 else error=$? $run $rm $removelist exit $error fi fi # Allow error messages only from the first compilation. suppress_output=' >/dev/null 2>&1' fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then command="$base_compile $srcfile" if test "$compiler_c_o" = yes; then command="$command -o $obj" output_obj="$obj" fi # Suppress compiler output if we already did a PIC compilation. command="$command$suppress_output" $run $rm "$output_obj" $show "$command" if $run eval "$command"; then : else $run $rm $removelist exit 1 fi if test "$need_locks" = warn && test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit 1 fi # Just move the object if needed if test x"$output_obj" != x"$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Create an invalid libtool object if no PIC, so that we do not # accidentally link it into a program. if test "$build_libtool_libs" != yes; then $show "echo timestamp > $libobj" $run eval "echo timestamp > \$libobj" || exit $? else # Move the .lo from within objdir $show "$mv $libobj $lo_libobj" if $run $mv $libobj $lo_libobj; then : else error=$? $run $rm $removelist exit $error fi fi fi # Unlock the critical section if it was locked if test "$need_locks" != no; then $rm "$lockfile" fi exit 0 ;; # libtool link mode link) modename="$modename: link" case "$host" in *-*-cygwin* | *-*-mingw* | *-*-os2*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invokation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes # This is a source program that is used to create dlls on Windows # Don't remove nor modify the starting and closing comments # /* ltdll.c starts here */ # #define WIN32_LEAN_AND_MEAN # #include # #undef WIN32_LEAN_AND_MEAN # #include # # #ifndef __CYGWIN__ # # ifdef __CYGWIN32__ # # define __CYGWIN__ __CYGWIN32__ # # endif # #endif # # #ifdef __cplusplus # extern "C" { # #endif # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); # #ifdef __cplusplus # } # #endif # # #ifdef __CYGWIN__ # #include # DECLARE_CYGWIN_DLL( DllMain ); # #endif # HINSTANCE __hDllInstance_base; # # BOOL APIENTRY # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) # { # __hDllInstance_base = hInst; # return TRUE; # } # /* ltdll.c ends here */ # This is a source program that is used to create import libraries # on Windows for dlls which lack them. Don't remove nor modify the # starting and closing comments # /* impgen.c starts here */ # /* Copyright (C) 1999 Free Software Foundation, Inc. # # This file is part of GNU libtool. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # */ # # #include /* for printf() */ # #include /* for open(), lseek(), read() */ # #include /* for O_RDONLY, O_BINARY */ # #include /* for strdup() */ # # static unsigned int # pe_get16 (fd, offset) # int fd; # int offset; # { # unsigned char b[2]; # lseek (fd, offset, SEEK_SET); # read (fd, b, 2); # return b[0] + (b[1]<<8); # } # # static unsigned int # pe_get32 (fd, offset) # int fd; # int offset; # { # unsigned char b[4]; # lseek (fd, offset, SEEK_SET); # read (fd, b, 4); # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); # } # # static unsigned int # pe_as32 (ptr) # void *ptr; # { # unsigned char *b = ptr; # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); # } # # int # main (argc, argv) # int argc; # char *argv[]; # { # int dll; # unsigned long pe_header_offset, opthdr_ofs, num_entries, i; # unsigned long export_rva, export_size, nsections, secptr, expptr; # unsigned long name_rvas, nexp; # unsigned char *expdata, *erva; # char *filename, *dll_name; # # filename = argv[1]; # # dll = open(filename, O_RDONLY|O_BINARY); # if (!dll) # return 1; # # dll_name = filename; # # for (i=0; filename[i]; i++) # if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') # dll_name = filename + i +1; # # pe_header_offset = pe_get32 (dll, 0x3c); # opthdr_ofs = pe_header_offset + 4 + 20; # num_entries = pe_get32 (dll, opthdr_ofs + 92); # # if (num_entries < 1) /* no exports */ # return 1; # # export_rva = pe_get32 (dll, opthdr_ofs + 96); # export_size = pe_get32 (dll, opthdr_ofs + 100); # nsections = pe_get16 (dll, pe_header_offset + 4 +2); # secptr = (pe_header_offset + 4 + 20 + # pe_get16 (dll, pe_header_offset + 4 + 16)); # # expptr = 0; # for (i = 0; i < nsections; i++) # { # char sname[8]; # unsigned long secptr1 = secptr + 40 * i; # unsigned long vaddr = pe_get32 (dll, secptr1 + 12); # unsigned long vsize = pe_get32 (dll, secptr1 + 16); # unsigned long fptr = pe_get32 (dll, secptr1 + 20); # lseek(dll, secptr1, SEEK_SET); # read(dll, sname, 8); # if (vaddr <= export_rva && vaddr+vsize > export_rva) # { # expptr = fptr + (export_rva - vaddr); # if (export_rva + export_size > vaddr + vsize) # export_size = vsize - (export_rva - vaddr); # break; # } # } # # expdata = (unsigned char*)malloc(export_size); # lseek (dll, expptr, SEEK_SET); # read (dll, expdata, export_size); # erva = expdata - export_rva; # # nexp = pe_as32 (expdata+24); # name_rvas = pe_as32 (expdata+32); # # printf ("EXPORTS\n"); # for (i = 0; i&2 fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi fi build_libtool_libs=no build_old_libs=yes prefer_static_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test $# -gt 0; do arg="$1" shift # If the previous option needs an argument, assign it. if test -n "$prev"; then case "$prev" in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case "$prev" in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case "$arg" in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= ;; esac ;; expsyms) export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" exit 1 fi prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case "$arg" in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit 1 ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi prevarg="$arg" case "$arg" in -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 continue ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: not more than one -exported-symbols argument allowed" exit 1 fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case "$dir" in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 absdir="$dir" fi dir="$absdir" ;; esac case " $deplibs " in *" $arg "*) ;; *) deplibs="$deplibs $arg";; esac case " $lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir";; esac case "$host" in *-*-cygwin* | *-*-mingw* | *-*-os2*) dllsearchdir=`cd "$dir" && pwd || echo "$dir"` case ":$dllsearchpath:" in ::) dllsearchpath="$dllsearchdir";; *":$dllsearchdir:"*) ;; *) dllsearchpath="$dllsearchpath:$dllsearchdir";; esac ;; esac ;; -l*) if test "$arg" = "-lc"; then case "$host" in *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* |*-*-freebsd* ) # These systems don't actually have c library (as such) continue ;; *-*-openbsd*) # Do not include libc due to us having libc/libc_r. continue ;; esac elif test "$arg" = "-lc_r"; then case "$host" in *-*-openbsd*) # Do not include libc_r directly, use -pthread flag. continue ;; esac elif test "$arg" = "-lm"; then case "$host" in *-*-cygwin* | *-*-beos*) # These systems don't actually have math library (as such) continue ;; esac fi deplibs="$deplibs $arg" ;; -?thread) deplibs="$deplibs $arg" ;; -module) module=yes continue ;; -no-undefined) allow_undefined=no continue ;; -o) prev=output ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case "$dir" in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit 1 ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -static) # If we have no pic_flag, then this is the same as -all-static. if test -z "$pic_flag" && test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case "$arg" in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac ;; *.o | *.obj | *.a | *.lib) # A standard object. objs="$objs $arg" ;; *.lo) # A library object. if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` prev= fi libobjs="$libobjs $arg" ;; *.la) # A libtool-controlled library. dlname= libdir= library_names= old_library= # Check to see that this really is a libtool archive. if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2 exit 1 fi # If the library was installed with an old release of libtool, # it will not redefine variable installed. installed=yes # Read the .la file # If there is no directory component, then add one. case "$arg" in */* | *\\*) . $arg ;; *) . ./$arg ;; esac # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$arg'" 1>&2 exit 1 fi # Find the relevant object directory and library name. name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'` if test "X$installed" = Xyes; then dir="$libdir" else dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$arg"; then dir="$objdir" else dir="$dir/$objdir" fi fi if test -n "$dependency_libs"; then # Extract -R and -L from dependency_libs temp_deplibs= for deplib in $dependency_libs; do case "$deplib" in -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'` case " $rpath $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; -L*) case "$compile_command $temp_deplibs " in *" $deplib "*) ;; *) temp_deplibs="$temp_deplibs $deplib";; esac temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'` case " $lib_search_path " in *" $temp_dir "*) ;; *) lib_search_path="$lib_search_path $temp_dir";; esac ;; *) temp_deplibs="$temp_deplibs $deplib";; esac done dependency_libs="$temp_deplibs" fi if test -z "$libdir"; then # It is a libtool convenience library, so add in its objects. convenience="$convenience $dir/$old_library" old_convenience="$old_convenience $dir/$old_library" deplibs="$deplibs$dependency_libs" compile_command="$compile_command $dir/$old_library$dependency_libs" finalize_command="$finalize_command $dir/$old_library$dependency_libs" continue fi # This library was specified with -dlopen. if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking statically, # we need to preload. prev=dlprefiles else # We should not create a dependency on this library, but we # may need any libraries it requires. compile_command="$compile_command$dependency_libs" finalize_command="$finalize_command$dependency_libs" prev= continue fi fi # The library was specified with -dlpreopen. if test "$prev" = dlprefiles; then # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then dlprefiles="$dlprefiles $dir/$old_library" else dlprefiles="$dlprefiles $dir/$linklib" fi prev= fi if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then link_against_libtool_libs="$link_against_libtool_libs $arg" if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *) temp_rpath="$temp_rpath $dir" ;; esac fi # We need an absolute path. case "$dir" in [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 absdir="$dir" fi ;; esac # This is the magic to use -rpath. # Skip directories that are in the system default run-time # search path, unless they have been requested with -R. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac lib_linked=yes case "$hardcode_action" in immediate | unsupported) if test "$hardcode_direct" = no; then compile_command="$compile_command $dir/$linklib" deplibs="$deplibs $dir/$linklib" case "$host" in *-*-cygwin* | *-*-mingw* | *-*-os2*) dllsearchdir=`cd "$dir" && pwd || echo "$dir"` if test -n "$dllsearchpath"; then dllsearchpath="$dllsearchpath:$dllsearchdir" else dllsearchpath="$dllsearchdir" fi ;; esac elif test "$hardcode_minus_L" = no; then case "$host" in *-*-sunos*) compile_shlibpath="$compile_shlibpath$dir:" ;; esac case "$compile_command " in *" -L$dir "*) ;; *) compile_command="$compile_command -L$dir";; esac compile_command="$compile_command -l$name" deplibs="$deplibs -L$dir -l$name" elif test "$hardcode_shlibpath_var" = no; then case ":$compile_shlibpath:" in *":$dir:"*) ;; *) compile_shlibpath="$compile_shlibpath$dir:";; esac compile_command="$compile_command -l$name" deplibs="$deplibs -l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then compile_command="$compile_command $absdir/$linklib" deplibs="$deplibs $absdir/$linklib" elif test "$hardcode_minus_L" = yes; then case "$compile_command " in *" -L$absdir "*) ;; *) compile_command="$compile_command -L$absdir";; esac compile_command="$compile_command -l$name" deplibs="$deplibs -L$absdir -l$name" elif test "$hardcode_shlibpath_var" = yes; then case ":$compile_shlibpath:" in *":$absdir:"*) ;; *) compile_shlibpath="$compile_shlibpath$absdir:";; esac compile_command="$compile_command -l$name" deplibs="$deplibs -l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" exit 1 fi # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then finalize_command="$finalize_command $libdir/$linklib" elif test "$hardcode_minus_L" = yes; then case "$finalize_command " in *" -L$libdir "*) ;; *) finalize_command="$finalize_command -L$libdir";; esac finalize_command="$finalize_command -l$name" elif test "$hardcode_shlibpath_var" = yes; then case ":$finalize_shlibpath:" in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:";; esac finalize_command="$finalize_command -l$name" else # We cannot seem to hardcode it, guess we'll fake it. case "$finalize_command " in *" -L$dir "*) ;; *) finalize_command="$finalize_command -L$libdir";; esac finalize_command="$finalize_command -l$name" fi else # Transform directly to old archives if we don't build new libraries. if test -n "$pic_flag" && test -z "$old_library"; then $echo "$modename: cannot find static library for \`$arg'" 1>&2 exit 1 fi # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_command="$compile_command $dir/$linklib" finalize_command="$finalize_command $dir/$linklib" else case "$compile_command " in *" -L$dir "*) ;; *) compile_command="$compile_command -L$dir";; esac compile_command="$compile_command -l$name" case "$finalize_command " in *" -L$dir "*) ;; *) finalize_command="$finalize_command -L$dir";; esac finalize_command="$finalize_command -l$name" fi fi # Add in any libraries that this one depends upon. compile_command="$compile_command$dependency_libs" finalize_command="$finalize_command$dependency_libs" continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case "$arg" in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac ;; esac # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 exit 1 fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" case "$output" in "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 exit 1 ;; *.a | *.lib) if test -n "$link_against_libtool_libs"; then $echo "$modename: error: cannot link libtool libraries into archives" 1>&2 exit 1 fi if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" ;; *.la) # Make sure we only generate libraries of the form `libNAME.la'. case "$outputname" in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 exit 1 fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi if test -n "$objs"; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 exit 1 fi # How the heck are we supposed to write a wrapper for a shared library? if test -n "$link_against_libtool_libs"; then $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2 exit 1 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2 fi set dummy $rpath if test $# -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. libext=al oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi dependency_libs="$deplibs" if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 fi else # Parse the version information argument. IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 exit 1 fi current="$2" revision="$3" age="$4" # Check that each of the things are valid numbers. case "$current" in 0 | [1-9] | [1-9][0-9]*) ;; *) $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac case "$revision" in 0 | [1-9] | [1-9][0-9]*) ;; *) $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac case "$age" in 0 | [1-9] | [1-9][0-9]*) ;; *) $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac if test $age -gt $current; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 fi # Calculate the version variables. major= versuffix= verstring= case "$version_type" in none) ;; irix) major=`expr $current - $age + 1` versuffix="$major.$revision" verstring="sgi$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test $loop != 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="sgi$major.$iface:$verstring" done ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test $loop != 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current"; ;; windows) # Like Linux, but with '-' rather than '.', since we only # want one extension on Windows 95. major=`expr $current - $age` versuffix="-$major-$age-$revision" ;; *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= verstring="0.0" if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi dependency_libs="$deplibs" case "$host" in *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* | *-*-freebsd* ) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody*) # rhapsody is a little odd... deplibs="$deplibs -framework System" ;; *-*-openbsd*) # do not include libc due to us having libc/libc_r. ;; *) # Add libc to deplibs on all other systems. deplibs="$deplibs -lc" ;; esac fi # Create the output directory, or remove our outputs if we need to. if test -d $output_objdir; then $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* else $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test $status -ne 0 && test ! -d $output_objdir; then exit $status fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi if test "$build_libtool_libs" = yes; then # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case "$deplibs_check_method" in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behaviour. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | sed 's/.* -> //'` case "$potliblink" in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | sed 10q \ | egrep "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done if test -n "$a_deplib" ; then droppeddeps=yes echo echo "*** Warning: This library needs some functionality provided by $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | grep . >/dev/null; then echo if test "X$deplibs_check_method" = "Xnone"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save if test "$droppeddeps" = yes; then if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" echo "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." fi fi # Done checking deplibs! deplibs=$newdeplibs fi # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then # Get the real and link names of the library. eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi lib="$output_objdir/$realname" for link do linknames="$linknames $link" done # Ensure that we have .o objects for linkers which dislike .lo # (e.g. aix) in case we are running --disable-static for obj in $libobjs; do xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir="." else xdir="$xdir" fi baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` if test ! -f $xdir/$oldobj; then $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? fi done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols eval cmds=\"$export_symbols_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "mkdir $gentop" $run mkdir "$gentop" status=$? if test $status -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" for xlib in $convenience; do # Extract the objects. case "$xlib" in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "mkdir $xdir" $run mkdir "$xdir" status=$? if test $status -ne 0 && test ! -d "$xdir"; then exit $status fi $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` done fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linkopts="$linkopts $flag" fi # Do each of the archive commands. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval cmds=\"$archive_expsym_cmds\" else eval cmds=\"$archive_cmds\" fi IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; *.lo | *.o | *.obj) if test -n "$link_against_libtool_libs"; then $echo "$modename: error: cannot link libtool libraries into objects" 1>&2 exit 1 fi if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 fi case "$output" in *.lo) if test -n "$objs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit 1 fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "mkdir $gentop" $run mkdir "$gentop" status=$? if test $status -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" for xlib in $convenience; do # Extract the objects. case "$xlib" in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "mkdir $xdir" $run mkdir "$xdir" status=$? if test $status -ne 0 && test ! -d "$xdir"; then exit $status fi $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` done fi fi # Create the old-style object. reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" output="$obj" eval cmds=\"$reload_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit 0 fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. $show "echo timestamp > $libobj" $run eval "echo timestamp > $libobj" || exit $? exit 0 fi if test -n "$pic_flag"; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" eval cmds=\"$reload_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" else # Just create a symlink. $show $rm $libobj $run $rm $libobj xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$libobj"; then xdir="." else xdir="$xdir" fi baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` $show "(cd $xdir && $LN_S $oldobj $baseobj)" $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit 0 ;; # Anything else should be a program. *) if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 fi if test "$preload" = yes; then if test "$dlopen" = unknown && test "$dlopen_self" = unknown && test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." fi fi if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$compile_rpath " in *" $libdir "*) ;; *) compile_rpath="$compile_rpath $libdir" ;; esac case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the binary in the object directory, then wrap it. if test ! -d $output_objdir; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test $status -ne 0 && test ! -d $output_objdir; then exit $status fi fi if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 fi fi if test -n "$dlsyms"; then case "$dlsyms" in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$dlsyms" test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for arg in $progfiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" name=`echo "$arg" | sed -e 's%^.*/%%'` $run eval 'echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr_t void * #else # define lt_ptr_t char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr_t address; } lt_preloaded_symbols[] = {\ " sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ {0, (lt_ptr_t) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case "$host" in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DPIC";; esac esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 exit 1 ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" status=$? # Delete the generated files. if test -n "$dlsyms"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case "$dir" in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $0 --fallback-echo"; then case "$0" in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; *) qecho="$SHELL `pwd`/$0 --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`echo $output|sed 's,.exe$,,'` ;; esac $rm $output trap "$rm $output; exit 1" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='sed -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: link_against_libtool_libs='$link_against_libtool_libs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then echo >> $output "\ program=lt-'$outputname' progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if (cd \"\$thisdir\" && eval \$relink_command); then : else $rm \"\$progdir/\$file\" exit 1 fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # win32 systems need to use the prog path for dll # lookup to work *-*-cygwin*) $echo >> $output "\ exec \$progdir/\$program \${1+\"\$@\"} " ;; # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \$progdir\\\\\$program \${1+\"\$@\"} " ;; *) $echo >> $output "\ # Export the path to the program. PATH=\"\$progdir:\$PATH\" export PATH exec \$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit 1 fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " chmod +x $output fi exit 0 ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "mkdir $gentop" $run mkdir "$gentop" status=$? if test $status -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" # Add in members from convenience archives. for xlib in $addlibs; do # Extract the objects. case "$xlib" in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "mkdir $xdir" $run mkdir "$xdir" status=$? if test $status -ne 0 && test ! -d "$xdir"; then exit $status fi $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` done fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then eval cmds=\"$old_archive_from_new_cmds\" else # Ensure that we have .o objects in place in case we decided # not to build a shared library, and have fallen back to building # static libs even though --disable-static was passed! for oldobj in $oldobjs; do if test ! -f $oldobj; then xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$oldobj"; then xdir="." else xdir="$xdir" fi baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` $show "(cd $xdir && ${LN_S} $obj $baseobj)" $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? fi done eval cmds=\"$old_archive_cmds\" fi IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case "$output" in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" if test -n "$xrpath"; then temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" done dependency_libs="$temp_xrpath $dependency_libs" fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i fi $rm $output $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$dlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Directory that this library needs to be installed in: libdir='$install_libdir'\ " done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $? ;; esac exit 0 ;; # libtool install mode install) modename="$modename: install" # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case "$arg" in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg="$nonopt" fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case "$arg" in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest="$arg" continue fi case "$arg" in -d) isdir=yes ;; -f) prev="-f" ;; -g) prev="-g" ;; -m) prev="-m" ;; -o) prev="-o" ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest="$arg" continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case "$arg" in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 exit 1 fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 exit 1 fi if test -z "$files"; then if test -z "$dest"; then $echo "$modename: no file or destination specified" 1>&2 else $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 exit 1 fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files if test $# -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit 1 fi fi case "$destdir" in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case "$file" in *.lo) ;; *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case "$file" in *.a | *.lib) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit 1 fi library_names= old_library= # If there is no directory component, then add one. case "$file" in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/" test "X$dir" = "X$file/" && dir= dir="$dir$objdir" # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift # Install the shared library and build the symlinks. $show "$install_prog $dir/$realname $destdir/$realname" $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $? if test $# -gt 0; then # Delete the old symlinks, and create new ones. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" eval cmds=\"$postinstall_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case "$destfile" in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.o | *.obj) staticdest="$destfile" destfile= ;; *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit 0 ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Do a test to see if this is really a libtool program. if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then link_against_libtool_libs= relink_command= # If there is no directory component, then add one. case "$file" in */* | *\\*) . $file ;; *) . ./$file ;; esac # Check the variables that should have been set. if test -z "$link_against_libtool_libs"; then $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 exit 1 fi finalize=yes for lib in $link_against_libtool_libs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case "$lib" in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`" if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" tmpdir="$tmpdir/libtool-$$" if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : else $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 continue fi outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 ${rm}r "$tmpdir" continue fi file="$outputname" else $echo "$modename: warning: cannot relink \`$file'" 1>&2 fi else # Install the binary that we compiled earlier. file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? # Do each command in the postinstall commands. eval cmds=\"$old_postinstall_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$future_libdirs"; then $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec $SHELL $0 --finish$current_libdirs exit 1 fi exit 0 ;; # libtool finish mode finish) modename="$modename: finish" libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. eval cmds=\"$finish_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit 0 echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do echo " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use \`-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the \`$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the \`$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" echo "more information, such as the ld(1) and ld.so(8) manual pages." echo "----------------------------------------------------------------------" exit 0 ;; # libtool execute mode execute) modename="$modename: execute" # The first argument is the command name. cmd="$nonopt" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" exit 1 fi # Handle -dlopen flags immediately. for file in $execute_dlfiles; do if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 exit 1 fi dir= case "$file" in *.la) # Check to see that this really is a libtool archive. if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit 1 fi # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case "$file" in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 exit 1 fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case "$file" in -*) ;; *) # Do a test to see if this is really a libtool program. if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case "$file" in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved enviroment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now actually exec the command. eval "exec \$cmd$args" $echo "$modename: cannot exec \$cmd$args" exit 1 else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit 0 fi ;; # libtool uninstall mode uninstall) modename="$modename: uninstall" rm="$nonopt" files= for arg do case "$arg" in -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 exit 1 fi for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` rmfiles="$file" case "$name" in *.la) # Possibly a libtool archive, so verify it. if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $dir/$n" done test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library" $show "$rm $rmfiles" $run $rm $rmfiles if test -n "$library_names"; then # Do each command in the postuninstall commands. eval cmds=\"$postuninstall_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. eval cmds=\"$old_postuninstall_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. fi ;; *.lo) if test "$build_old_libs" = yes; then oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` rmfiles="$rmfiles $dir/$oldobj" fi $show "$rm $rmfiles" $run $rm $rmfiles ;; *) $show "$rm $rmfiles" $run $rm $rmfiles ;; esac done exit 0 ;; "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 exit 1 ;; esac $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 exit 1 fi # test -z "$show_help" # We need to display help for each of the modes. case "$mode" in "") $echo \ "Usage: $modename [OPTION]... [MODE-ARG]... Provide generalized library-building support services. --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages --version print version information MODE must be one of the following: compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for a more detailed description of MODE." exit 0 ;; compile) $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac echo $echo "Try \`$modename --help' for more information about other modes." exit 0 # Local Variables: # mode:shell-script # sh-indentation:2 # End: smpeg-0.4.5+cvs20030824.orig/missing0100755000175000017500000002123107476543760016747 0ustar hoseheadhosehead#! /bin/sh # Common stub for a few missing GNU programs while installing. # Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing 0.3 - GNU automake" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then # We have makeinfo, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; tar) shift if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 fi # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar ${1+"$@"} && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar ${1+"$@"} && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" ${1+"$@"} && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" ${1+"$@"} && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequirements for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 smpeg-0.4.5+cvs20030824.orig/mkinstalldirs0100644000175000017500000000132607003633512020133 0ustar hoseheadhosehead#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain # $Id: mkinstalldirs,v 1.1 1999/10/21 15:54:50 hercules Exp $ errstatus=0 for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr fi fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here smpeg-0.4.5+cvs20030824.orig/smpeg-config.in0100644000175000017500000000226007215230524020235 0ustar hoseheadhosehead#!/bin/sh prefix=@prefix@ exec_prefix=@exec_prefix@ exec_prefix_set=no usage="\ Usage: @PACKAGE@-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--libs] [--cflags]" if test $# -eq 0; then echo "${usage}" 1>&2 exit 1 fi while test $# -gt 0; do case "$1" in -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac case $1 in --prefix=*) prefix=$optarg if test $exec_prefix_set = no ; then exec_prefix=$optarg fi ;; --prefix) echo $prefix ;; --exec-prefix=*) exec_prefix=$optarg exec_prefix_set=yes ;; --exec-prefix) echo $exec_prefix ;; --version) echo @VERSION@ ;; --cflags) if test @includedir@ != /usr/include ; then includes=-I@includedir@ fi echo $includes -I@includedir@/smpeg `@SDL_CONFIG@ --cflags` ;; --libs) if [ "`uname`" = "SunOS" ]; then libdirs="-L@libdir@ -R@libdir@" else libdirs="-L@libdir@ @SMPEG_RLD_FLAGS@" fi echo $libdirs -lsmpeg `@SDL_CONFIG@ --libs` ;; *) echo "${usage}" 1>&2 exit 1 ;; esac shift done smpeg-0.4.5+cvs20030824.orig/smpeg.spec.in0100644000175000017500000000431007122001106017706 0ustar hoseheadhosehead# Note that this is NOT a relocatable package %define ver @VERSION@ %define rel 1 %define prefix /usr Summary: SDL MPEG Library Name: smpeg Version: %ver Release: %rel Copyright: LGPL Group: System Environment/Libraries Source0: @PACKAGE@-%{PACKAGE_VERSION}.tar.gz URL: http://www.lokigames.com/development/smpeg.php3 BuildRoot: /tmp/@PACKAGE@-%{PACKAGE_VERSION}-root Packager: Sam Lantinga Docdir: %{prefix}/doc %description SMPEG is based on UC Berkeley's mpeg_play software MPEG decoder and SPLAY, an mpeg audio decoder created by Woo-jae Jung. We have completed the initial work to wed these two projects in order to create a general purpose MPEG video/audio player for the Linux OS. %package devel Summary: Libraries, includes and more to develop SMPEG applications. Group: Development/Libraries Requires: %{name} %description devel SMPEG is based on UC Berkeley's mpeg_play software MPEG decoder and SPLAY, an mpeg audio decoder created by Woo-jae Jung. We have completed the initial work to wed these two projects in order to create a general purpose MPEG video/audio player for the Linux OS. This is the libraries, include files and other resources you can use to develop SMPEG applications. %prep rm -rf ${RPM_BUILD_ROOT} %setup -q %build # Needed for snapshot releases. if [ ! -f configure ]; then CFLAGS="$RPM_OPT_FLAGS" ./autogen.sh --prefix=%prefix --disable-debug --disable-opengl-player else CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix --disable-debug --disable-opengl-player fi if [ "$SMP" != "" ]; then (make "MAKE=make -k -j $SMP"; exit 0) make else make fi %install rm -rf $RPM_BUILD_ROOT make prefix=$RPM_BUILD_ROOT%{prefix} install %clean rm -rf $RPM_BUILD_ROOT %post /sbin/ldconfig %postun /sbin/ldconfig %files %defattr(-, root, root) %doc CHANGES COPYING README %{prefix}/lib/lib*.so.* %{prefix}/bin/plaympeg %{prefix}/bin/gtv %{prefix}/man/* %files devel %defattr(-, root, root) %doc CHANGES COPYING README %{prefix}/bin/@PACKAGE@-config %{prefix}/include/* %{prefix}/lib/lib*.a %{prefix}/lib/lib*.so %changelog * Fri Mar 3 2000 Sam Lantinga - Split package into development and runtime packages smpeg-0.4.5+cvs20030824.orig/MPEG.cpp0100644000175000017500000002533007614625025016575 0ustar hoseheadhosehead#include "SDL.h" #include "MPEG.h" #ifdef WIN32 #include #else #include #endif #include #include #include #ifndef O_BINARY #define O_BINARY 0 #endif MPEG::MPEG(const char * name, bool SDLaudio) : MPEGerror() { SDL_RWops *source; mpeg_mem = 0; source = SDL_RWFromFile(name, "rb"); if (!source) { InitErrorState(); SetError(SDL_GetError()); return; } Init(source, SDLaudio); } MPEG::MPEG(int Mpeg_FD, bool SDLaudio) : MPEGerror() { SDL_RWops *source; mpeg_mem = 0; // *** FIXME we're leaking a bit of memory for the FILE * // best solution would be to have SDL_RWFromFD FILE *file = fdopen(Mpeg_FD, "rb"); if (!file) { InitErrorState(); SetError(strerror(errno)); return; } source = SDL_RWFromFP(file,false); if (!source) { InitErrorState(); SetError(SDL_GetError()); return; } Init(source, SDLaudio); } MPEG::MPEG(void *data, int size, bool SDLaudio) : MPEGerror() { SDL_RWops *source; // The semantics are that the data passed in should be copied // (?) mpeg_mem = new char[size]; memcpy(mpeg_mem, data, size); source = SDL_RWFromMem(mpeg_mem, size); if (!source) { InitErrorState(); SetError(SDL_GetError()); return; } Init(source, SDLaudio); } MPEG::MPEG(SDL_RWops *mpeg_source, bool SDLaudio) : MPEGerror() { mpeg_mem = 0; Init(mpeg_source, SDLaudio); } void MPEG::Init(SDL_RWops *mpeg_source, bool SDLaudio) { source = mpeg_source; sdlaudio = SDLaudio; /* Create the system that will parse the MPEG stream */ system = new MPEGsystem(source); /* Initialize everything to invalid values for cleanup */ error = NULL; audiostream = videostream = NULL; audioaction = NULL; videoaction = NULL; audio = NULL; video = NULL; audioaction_enabled = SDLaudio; videoaction_enabled = false; loop = false; pause = false; parse_stream_list(); EnableAudio(audioaction_enabled); EnableVideo(videoaction_enabled); if ( ! audiostream && ! videostream ) { SetError("No audio/video stream found in MPEG"); } if ( system && system->WasError() ) { SetError(system->TheError()); } if ( audio && audio->WasError() ) { SetError(audio->TheError()); } if ( video && video->WasError() ) { SetError(video->TheError()); } if ( WasError() ) { SetError(TheError()); } } void MPEG::InitErrorState() { audio = NULL; video = NULL; system = NULL; error = NULL; source = NULL; audiostream = videostream = NULL; audioaction = NULL; videoaction = NULL; audio = NULL; video = NULL; audioaction_enabled = videoaction_enabled = false; loop = false; pause = false; } MPEG::~MPEG() { Stop(); if(video) delete video; if(audio) delete audio; if(system) delete system; if(source) SDL_RWclose(source); if ( mpeg_mem ) delete[] mpeg_mem; } bool MPEG::AudioEnabled(void) { return(audioaction_enabled); } void MPEG::EnableAudio(bool enabled) { if ( enabled && ! audioaction ) { enabled = false; } audioaction_enabled = enabled; /* Stop currently playing stream, if necessary */ if ( audioaction && ! audioaction_enabled ) { audioaction->Stop(); } /* Set the video time source */ if ( videoaction ) { if ( audioaction_enabled ) { videoaction->SetTimeSource(audioaction); } else { videoaction->SetTimeSource(NULL); } } if(audiostream) audiostream->enable(enabled); } bool MPEG::VideoEnabled(void) { return(videoaction_enabled); } void MPEG::EnableVideo(bool enabled) { if ( enabled && ! videoaction ) { enabled = false; } videoaction_enabled = enabled; /* Stop currently playing stream, if necessary */ if ( videoaction && ! videoaction_enabled ) { videoaction->Stop(); } if(videostream) videostream->enable(enabled); } /* MPEG actions */ void MPEG::Loop(bool toggle) { loop = toggle; } void MPEG::Play(void) { if ( AudioEnabled() ) { audioaction->Play(); } if ( VideoEnabled() ) { videoaction->Play(); } } void MPEG::Stop(void) { if ( VideoEnabled() ) { videoaction->Stop(); } if ( AudioEnabled() ) { audioaction->Stop(); } } void MPEG::Rewind(void) { seekIntoStream(0); } void MPEG::Pause(void) { pause = !pause; if ( VideoEnabled() ) { videoaction->Pause(); } if ( AudioEnabled() ) { audioaction->Pause(); } } /* Michel Darricau from eProcess conflict name with popcorn */ MPEGstatus MPEG::GetStatus(void) { MPEGstatus status; status = MPEG_STOPPED; if ( VideoEnabled() ) { /* Michel Darricau from eProcess conflict name with popcorn */ switch (videoaction->GetStatus()) { case MPEG_PLAYING: status = MPEG_PLAYING; break; default: break; } } if ( AudioEnabled() ) { /* Michel Darricau from eProcess conflict name with popcorn */ switch (audioaction->GetStatus()) { case MPEG_PLAYING: status = MPEG_PLAYING; break; default: break; } } if(status == MPEG_STOPPED && loop && !pause) { /* Here we go again */ Rewind(); Play(); if ( VideoEnabled() ) { /* Michel Darricau from eProcess conflict name with popcorn */ switch (videoaction->GetStatus()) { case MPEG_PLAYING: status = MPEG_PLAYING; break; default: break; } } if ( AudioEnabled() ) { /* Michel Darricau from eProcess conflict name with popcorn */ switch (audioaction->GetStatus()) { case MPEG_PLAYING: status = MPEG_PLAYING; break; default: break; } } } return(status); } /* MPEG audio actions */ bool MPEG::GetAudioInfo(MPEG_AudioInfo *info) { if ( AudioEnabled() ) { return(audioaction->GetAudioInfo(info)); } return(false); } void MPEG::Volume(int vol) { if ( AudioEnabled() ) { audioaction->Volume(vol); } } bool MPEG::WantedSpec(SDL_AudioSpec *wanted) { if( audiostream ) { return(GetAudio()->WantedSpec(wanted)); } return(false); } void MPEG::ActualSpec(const SDL_AudioSpec *actual) { if( audiostream ) { GetAudio()->ActualSpec(actual); } } MPEGaudio *MPEG::GetAudio(void) { // Simple accessor used in the C interface return audio; } /* MPEG video actions */ bool MPEG::GetVideoInfo(MPEG_VideoInfo *info) { if ( VideoEnabled() ) { return(videoaction->GetVideoInfo(info)); } return(false); } bool MPEG::SetDisplay(SDL_Surface *dst, SDL_mutex *lock, MPEG_DisplayCallback callback) { if ( VideoEnabled() ) { return(videoaction->SetDisplay(dst, lock, callback)); } return(false); } void MPEG::MoveDisplay(int x, int y) { if ( VideoEnabled() ) { videoaction->MoveDisplay(x, y); } } void MPEG::ScaleDisplayXY(int w, int h) { if ( VideoEnabled() ) { videoaction->ScaleDisplayXY(w, h); } } void MPEG::SetDisplayRegion(int x, int y, int w, int h) { if ( VideoEnabled() ) { videoaction->SetDisplayRegion(x, y, w, h); } } void MPEG::RenderFrame(int frame) { if ( VideoEnabled() ) { videoaction->RenderFrame(frame); } } void MPEG::RenderFinal(SDL_Surface *dst, int x, int y) { Stop(); if ( VideoEnabled() ) { videoaction->RenderFinal(dst, x, y); } Rewind(); } SMPEG_Filter * MPEG::Filter(SMPEG_Filter * filter) { if ( VideoEnabled() ) { return(videoaction->Filter(filter)); } return 0; } void MPEG::Seek(int position) { int was_playing = 0; /* Cannot seek past end of file */ if((Uint32)position > system->TotalSize()) return; /* Michel Darricau from eProcess conflict name with popcorn */ /* get info whrether we need to restart playing at the end */ if( GetStatus() == MPEG_PLAYING ) was_playing = 1; if(!seekIntoStream(position)) return; /* If we were playing and not rewind then play again */ if (was_playing) Play(); if (VideoEnabled() && !was_playing) videoaction->RenderFrame(0); if ( pause && VideoEnabled() ) { videoaction->Pause(); } if ( pause && AudioEnabled() ) { audioaction->Pause(); } } bool MPEG::seekIntoStream(int position) { /* First we stop everything */ Stop(); /* Go to the desired position into file */ if(!system->Seek(position)) return(false); /* Seek first aligned data */ if(audiostream && audioaction_enabled) while(audiostream->time() == -1) if ( ! audiostream->next_packet() ) return false; if(videostream && videoaction_enabled) while(videostream->time() == -1) if ( ! videostream->next_packet() ) return false; /* Calculating current play time on audio only makes sense when there is no video */ if ( audioaction && !videoaction) { audioaction->Rewind(); audioaction->ResetSynchro(system->TimeElapsedAudio(position)); } /* And forget what we previouly buffered */ else if ( audioaction ) { audioaction->Rewind(); audioaction->ResetSynchro(audiostream->time()); } if ( videoaction ) { videoaction->Rewind(); videoaction->ResetSynchro(videostream->time()); } return(true); } void MPEG::Skip(float seconds) { if(system->get_stream(SYSTEM_STREAMID)) { system->Skip(seconds); } else { /* No system information in MPEG */ if( VideoEnabled() ) videoaction->Skip(seconds); if( AudioEnabled() ) audioaction->Skip(seconds); } } void MPEG::GetSystemInfo(MPEG_SystemInfo * sinfo) { sinfo->total_size = system->TotalSize(); sinfo->current_offset = system->Tell(); sinfo->total_time = system->TotalTime(); /* Get current time from audio or video decoder */ /* TODO: move timing reference in MPEGsystem */ sinfo->current_time = 0; if( videoaction ) sinfo->current_time = videoaction->Time(); if( audioaction ) sinfo->current_time = audioaction->Time(); } void MPEG::parse_stream_list() { MPEGstream ** stream_list; register int i; /* A new thread is created for each video and audio */ /* stream */ /* TODO: support MPEG systems containing more than */ /* one audio or video stream */ i = 0; do { /* Retreive the list of streams */ stream_list = system->GetStreamList(); switch(stream_list[i]->streamid) { case SYSTEM_STREAMID: break; case AUDIO_STREAMID: audiostream = stream_list[i]; audioaction_enabled = true; audiostream->next_packet(); audio = new MPEGaudio(audiostream, sdlaudio); audioaction = audio; break; case VIDEO_STREAMID: videostream = stream_list[i]; videoaction_enabled = true; videostream->next_packet(); video = new MPEGvideo(videostream); videoaction = video; break; } i++; } while(stream_list[i]); } smpeg-0.4.5+cvs20030824.orig/MPEGring.cpp0100644000175000017500000001474607167203024017460 0ustar hoseheadhosehead/* SMPEG - SDL MPEG Player Library Copyright (C) 1999 Loki Entertainment Software This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include "SDL_timer.h" #include "MPEGring.h" MPEG_ring:: MPEG_ring( Uint32 size, Uint32 count ) { Uint32 tSize; /* Set up the 'ring' pointer for all the old C code */ ring = this; tSize = (size + sizeof(Uint32)) * count; if( tSize ) { ring->begin = (Uint8 *) malloc( tSize ); ring->timestamps = (double *) malloc( sizeof(double)*count ); } else ring->begin = 0; if( ring->begin && count ) { ring->end = ring->begin + tSize; ring->read = ring->begin; ring->write = ring->begin; ring->timestamp_read = timestamps; ring->timestamp_write = timestamps; ring->bufSize = size; ring->readwait = SDL_CreateSemaphore(0); ring->writewait = SDL_CreateSemaphore(count); } else { ring->end = 0; ring->read = 0; ring->write = 0; ring->bufSize = 0; ring->readwait = 0; } if ( ring->begin && ring->readwait && ring->writewait ) { ring->active = 1; } } /* Release any waiting threads on the ring so they can be cleaned up. The ring isn't valid after this call, so when threads are done you should call MPRing_sdelete() on the ring. */ void MPEG_ring:: ReleaseThreads( void ) { /* Let the threads know that the ring is now inactive */ ring->active = 0; if ( ring->readwait ) { while ( SDL_SemValue(ring->readwait) == 0 ) { SDL_SemPost(ring->readwait); } } if ( ring->writewait ) { while ( SDL_SemValue(ring->writewait) == 0 ) { SDL_SemPost(ring->writewait); } } } MPEG_ring:: ~MPEG_ring( void ) { if( ring ) { /* Free up the semaphores */ ReleaseThreads(); /* Destroy the semaphores */ if( ring->readwait ) { SDL_DestroySemaphore( ring->readwait ); ring->readwait = 0; } if( ring->writewait ) { SDL_DestroySemaphore( ring->writewait ); ring->writewait = 0; } /* Free data buffer */ if ( ring->begin ) { free( ring->begin ); free( ring->timestamps ); ring->begin = 0; ring->timestamps = 0; } } } /* Returns free buffer of ring->bufSize to be filled with data. Zero is returned if there is no free buffer. */ Uint8 * MPEG_ring:: NextWriteBuffer( void ) { Uint8 *buffer; buffer = 0; if ( ring->active ) { //printf("Waiting for write buffer (%d available)\n", SDL_SemValue(ring->writewait)); SDL_SemWait(ring->writewait); //printf("Finished waiting for write buffer\n"); if ( ring->active ) { buffer = ring->write + sizeof(Uint32); } } return buffer; } /* Call this when the buffer returned from MPRing_nextWriteBuffer() has been filled. The passed length must not be larger than ring->bufSize. */ void MPEG_ring:: WriteDone( Uint32 len, double timestamp) { if ( ring->active ) { #ifdef NO_GRIFF_MODS assert(len <= ring->bufSize); #else if ( len > ring->bufSize ) len = ring->bufSize; #endif *((Uint32*) ring->write) = len; ring->write += ring->bufSize + sizeof(Uint32); *(ring->timestamp_write++) = timestamp; if( ring->write >= ring->end ) { ring->write = ring->begin; ring->timestamp_write = ring->timestamps; } //printf("Finished write buffer of %u bytes, making available for reads (%d+1 available for reads)\n", len, SDL_SemValue(ring->readwait)); SDL_SemPost(ring->readwait); } } /* Returns the number of bytes in the next ring buffer and sets the buffer pointer to this buffer. If there is no buffer ready then the buffer pointer is not changed and zero is returned. */ Uint32 MPEG_ring:: NextReadBuffer( Uint8** buffer ) { Uint32 size; size = 0; if ( ring->active ) { /* Wait for a buffer to become available */ //printf("Waiting for read buffer (%d available)\n", SDL_SemValue(ring->readwait)); SDL_SemWait(ring->readwait); //printf("Finished waiting for read buffer\n"); if ( ring->active ) { size = *((Uint32*) ring->read); *buffer = ring->read + sizeof(Uint32); } } return size; } /* Call this when you have used some of the buffer previously returned by MPRing_nextReadBuffer(), and want to update it so the rest of the data is returned with the next call to MPRing_nextReadBuffer(). */ double MPEG_ring:: ReadTimeStamp(void) { if(ring->active) return *ring->timestamp_read; return(0); } void MPEG_ring:: ReadSome( Uint32 used ) { Uint8 *data; Uint32 oldlen; Uint32 newlen; if ( ring->active ) { data = ring->read + sizeof(Uint32); oldlen = *((Uint32*) ring->read); newlen = oldlen - used; memmove(data, data+used, newlen); *((Uint32*) ring->read) = newlen; //printf("Reusing read buffer (%d+1 available)\n", SDL_SemValue(ring->readwait)); SDL_SemPost(ring->readwait); } } /* Call this when the buffer returned from MPRing_nextReadBuffer() is no longer needed. This assumes there is only one read thread and one write thread for a particular ring buffer. */ void MPEG_ring:: ReadDone( void ) { if ( ring->active ) { ring->read += ring->bufSize + sizeof(Uint32); ring->timestamp_read++; if( ring->read >= ring->end ) { ring->read = ring->begin; ring->timestamp_read = ring->timestamps; } //printf("Finished read buffer, making available for writes (%d+1 available for writes)\n", SDL_SemValue(ring->writewait)); SDL_SemPost(ring->writewait); } } /* EOF */ smpeg-0.4.5+cvs20030824.orig/MPEGlist.cpp0100644000175000017500000000156007614625025017470 0ustar hoseheadhosehead#include "MPEGlist.h" MPEGlist::MPEGlist() { size = 0; data = 0; lock = 0; next = 0; prev = 0; TimeStamp = -1; } MPEGlist::~MPEGlist() { if(next) next->prev = prev; if(prev) prev->next = next; if(data) { delete[] data; data = 0; } } /* Return the next free buffer or allocate a new one if none is empty */ MPEGlist * MPEGlist::Alloc(Uint32 Buffer_Size) { MPEGlist * tmp; tmp = next; next = new MPEGlist; next->next = tmp; if ( Buffer_Size ) { next->data = new Uint8[Buffer_Size]; if(!next->data) { fprintf(stderr, "Alloc : Not enough memory\n"); return(0); } } else { next->data = 0; } next->size = Buffer_Size; next->prev = this; return(next); } /* Lock current buffer */ void MPEGlist::Lock() { lock++; } /* Unlock current buffer */ void MPEGlist::Unlock() { if(lock != 0) lock--; } smpeg-0.4.5+cvs20030824.orig/MPEGstream.cpp0100644000175000017500000001564507303261555020020 0ustar hoseheadhosehead/* SMPEG - SDL MPEG Player Library Copyright (C) 1999 Loki Entertainment Software This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* The generic MPEG stream class */ #include #include "MPEG.h" #include "MPEGstream.h" #include "video/video.h" /* This is the limit of the quantity of pre-read data */ #define MAX_QUEUE (256 * 1024) MPEGstream::MPEGstream(MPEGsystem * System, Uint8 Streamid) { system = System; streamid = Streamid; br = new MPEGlist(); cleareof = true; data = 0; stop = 0; pos = 0; preread_size = 0; enabled = true; mutex = SDL_CreateMutex(); } MPEGstream::~MPEGstream() { MPEGlist * newbr; SDL_DestroyMutex(mutex); /* Free the list */ for(newbr = br; newbr->Prev(); newbr = newbr->Prev()); while(newbr->Next()) { newbr = newbr->Next(); delete newbr->Prev(); } delete newbr; } void MPEGstream::reset_stream() { MPEGlist * newbr; SDL_mutexP(mutex); /* Seek the first buffer */ for(newbr = br; newbr->Prev(); newbr = newbr->Prev()); /* Free buffers */ while(newbr->Next()) { newbr = newbr->Next(); delete newbr->Prev(); } delete newbr; br = new MPEGlist(); cleareof = true; data = 0; stop = 0; pos = 0; preread_size = 0; SDL_mutexV(mutex); } void MPEGstream::rewind_stream() { /* Note that this will rewind all streams, and other streams than this one */ /* will finish reading their prebuffured data (they are not reseted) */ /* This should works because there are always sequence start codes or */ /* audio start codes at the beginning of the streams */ /* Of course, this won't work on network streams */ /* Restart the system */ system->Rewind(); } bool MPEGstream:: next_system_buffer(void) { bool has_data = true; /* No more buffer ? */ while(has_data && !br->Next()) { SDL_mutexV(mutex); system->RequestBuffer(); has_data = system->Wait(); SDL_mutexP(mutex); } if ( has_data && (br->Size() || cleareof) ) { cleareof = false; br = br->Next(); preread_size -= br->Size(); } return(has_data); } bool MPEGstream:: next_packet(bool recurse, bool update_timestamp) { SDL_mutexP(mutex); /* Unlock current buffer */ br->Unlock(); /* Check for the end of stream mark */ next_system_buffer(); if(eof()) { /* Report eof */ SDL_mutexV(mutex); return(false); } /* Lock the buffer */ br->Lock(); /* Make sure that we have read buffers in advance if possible */ if(preread_size < MAX_QUEUE) system->RequestBuffer(); /* Update stream datas */ data = (Uint8 *) br->Buffer(); stop = data + br->Size(); if(update_timestamp){ timestamp = br->TimeStamp; timestamp_pos = pos; } SDL_mutexV(mutex); return(true); } MPEGstream_marker * MPEGstream:: new_marker(int offset) { MPEGstream_marker * marker; SDL_mutexP(mutex); /* We can't mark past the end of the stream */ if ( eof() ) { SDL_mutexV(mutex); return(0); } /* It may be possible to seek in the data stream, but punt for now */ if ( ((data+offset) < br->Buffer()) || ((data+offset) > stop) ) { SDL_mutexV(mutex); return(0); } /* Set up the mark */ marker = new MPEGstream_marker; marker->marked_buffer = br; marker->marked_data = data+offset; marker->marked_stop = stop; /* Lock the new buffer */ marker->marked_buffer->Lock(); SDL_mutexV(mutex); return(marker); } bool MPEGstream:: seek_marker(MPEGstream_marker const * marker) { SDL_mutexP(mutex); if ( marker ) { /* Release current buffer */ if(br->IsLocked()) { br->Unlock(); marker->marked_buffer->Lock(); } /* Reset the data positions */ br = marker->marked_buffer; data = marker->marked_data; stop = marker->marked_stop; } SDL_mutexV(mutex); return(marker != 0); } void MPEGstream:: delete_marker(MPEGstream_marker *marker) { if( marker && marker->marked_buffer) { marker->marked_buffer->Unlock(); delete marker; } } Uint32 MPEGstream:: copy_data(Uint8 *area, Sint32 size, bool short_read) { Uint32 copied = 0; bool timestamped = false; while ( (size > 0) && !eof()) { Uint32 len; /* Get new data if necessary */ if ( data == stop ) { /* try to use the timestamp of the first packet */ if ( ! next_packet(true, (timestamp == -1) || !timestamped) ) { break; } timestamped = true; } SDL_mutexP(mutex); /* Copy as much as we need */ if ( size <= (Sint32)(stop-data) ) { len = size; } else { len = (stop-data); } memcpy(area, data, len); area += len; data += len; size -= len; copied += len; pos += len; /* Allow 32-bit aligned short reads? */ if ( ((copied%4) == 0) && short_read ) { break; } SDL_mutexV(mutex); } return(copied); } int MPEGstream::copy_byte(void) { /* Get new data if necessary */ if ( data == stop ) { if ( ! next_packet() ) { return (-1); } } pos ++; return(*data++); } bool MPEGstream::eof() const { return(!br->Size()); } void MPEGstream::insert_packet(Uint8 * Data, Uint32 Size, double timestamp) { MPEGlist * newbr; /* Discard all packets if not enabled */ if(!enabled) return; SDL_mutexP(mutex); preread_size += Size; /* Seek the last buffer */ for(newbr = br; newbr->Next(); newbr = newbr->Next()); /* Position ourselves at the end of the stream */ newbr = newbr->Alloc(Size); if ( Size ) { memcpy(newbr->Buffer(), Data, Size); } newbr->TimeStamp = timestamp; SDL_mutexV(mutex); garbage_collect(); } /* - Check for unused buffers and free them - */ void MPEGstream::garbage_collect(void) { MPEGlist * newbr; SDL_mutexP(mutex); br->Lock(); /* First of all seek the first buffer */ for(newbr = br; newbr->Prev(); newbr = newbr->Prev()); /* Now free buffers until we find a locked buffer */ while(newbr->Next() && !newbr->IsLocked()) { newbr = newbr->Next(); delete newbr->Prev(); } br->Unlock(); SDL_mutexV(mutex); } void MPEGstream::enable(bool toggle) { enabled = toggle; } double MPEGstream::time() { return(br->TimeStamp); } smpeg-0.4.5+cvs20030824.orig/MPEGsystem.cpp0100644000175000017500000011012307614625025020035 0ustar hoseheadhosehead#include /* for realloc() */ #include /* for memmove() */ #include #include #ifdef WIN32 #include #include #include #else #include #include #include #include #ifndef __BEOS__ #include #endif #endif #include "MPEGsystem.h" #include "MPEGstream.h" /* Define this if you want to debug the system stream parsing */ //#define DEBUG_SYSTEM /* Define this if you want to use a separate thread for stream decoding */ //#define USE_SYSTEM_THREAD Uint8 const PACKET_CODE[] = { 0x00, 0x00, 0x01, 0xba }; Uint8 const PACKET_MASK[] = { 0xff, 0xff, 0xff, 0xff }; Uint8 const END_CODE[] = { 0x00, 0x00, 0x01, 0xb9 }; Uint8 const END_MASK[] = { 0xff, 0xff, 0xff, 0xff }; Uint8 const END2_CODE[] = { 0x00, 0x00, 0x01, 0xb7 }; Uint8 const END2_MASK[] = { 0xff, 0xff, 0xff, 0xff }; Uint8 const VIDEOSTREAM_CODE[] = { 0x00, 0x00, 0x01, 0xe0 }; Uint8 const VIDEOSTREAM_MASK[] = { 0xff, 0xff, 0xff, 0xe0 }; Uint8 const AUDIOSTREAM_CODE[] = { 0x00, 0x00, 0x01, 0xc0 }; Uint8 const AUDIOSTREAM_MASK[] = { 0xff, 0xff, 0xff, 0xc0 }; Uint8 const PADSTREAM_CODE[] = { 0x00, 0x00, 0x01, 0xbe }; Uint8 const PADSTREAM_MASK[] = { 0xff, 0xff, 0xff, 0xff }; Uint8 const SYSTEMSTREAM_CODE[] = { 0x00, 0x00, 0x01, 0xbb }; Uint8 const SYSTEMSTREAM_MASK[] = { 0xff, 0xff, 0xff, 0xff }; Uint8 const USERSTREAM_CODE[] = { 0x00, 0x00, 0x01, 0xb2 }; Uint8 const USERSTREAM_MASK[] = { 0xff, 0xff, 0xff, 0xff }; Uint8 const VIDEO_CODE[] = { 0x00, 0x00, 0x01, 0xb3 }; Uint8 const VIDEO_MASK[] = { 0xff, 0xff, 0xff, 0xff }; Uint8 const AUDIO_CODE[] = { 0xff, 0xf0, 0x00, 0x00 }; Uint8 const AUDIO_MASK[] = { 0xff, 0xf0, 0x00, 0x00 }; Uint8 const GOP_CODE[] = { 0x00, 0x00, 0x01, 0xb8 }; Uint8 const GOP_MASK[] = { 0xff, 0xff, 0xff, 0xff }; Uint8 const PICTURE_CODE[] = { 0x00, 0x00, 0x01, 0x00 }; Uint8 const PICTURE_MASK[] = { 0xff, 0xff, 0xff, 0xff }; Uint8 const SLICE_CODE[] = { 0x00, 0x00, 0x01, 0x01 }; Uint8 const SLICE_MASK[] = { 0xff, 0xff, 0xff, 0x00 }; Uint8 const ZERO_CODE[] = { 0x00, 0x00, 0x00, 0x00 }; Uint8 const FULL_MASK[] = { 0xff, 0xff, 0xff, 0xff }; /* The size is arbitrary but should be sufficient to contain */ /* two MPEG packets and reduce disk (or network) access. */ // Hiroshi Yamashita notes that the original size was too large #define MPEG_BUFFER_SIZE (16 * 1024) /* The granularity (2^LG2_GRANULARITY) determine what length of read data */ /* will be a multiple of, e.g. setting LG2_GRANULARITY to 12 will make */ /* read size (when calling the read function in Read method) to be a */ /* multiple of 4096 */ #define LG2_GRANULARITY 12 #define READ_ALIGN(x) (((x) >> LG2_GRANULARITY) << LG2_GRANULARITY) /* This defines the maximum number of buffers that can be preread */ /* It is to prevent filling the whole memory with buffers on systems */ /* where read is immediate such as in the case of files */ #define MPEG_BUFFER_MAX 16 /* Timeout before read fails */ #define READ_TIME_OUT 1000000 /* timestamping */ #define FLOAT_0x10000 (double)((Uint32)1 << 16) #define STD_SYSTEM_CLOCK_FREQ 90000L /* This work only on little endian systems */ /* #define REV(x) ((((x)&0x000000FF)<<24)| \ (((x)&0x0000FF00)<< 8)| \ (((x)&0x00FF0000)>> 8)| \ (((x)&0xFF000000)>>24)) #define MATCH4(x, y, m) (((x) & REV(m)) == REV(y)) */ const int audio_frequencies[2][3]= { {44100,48000,32000}, // MPEG 1 {22050,24000,16000} // MPEG 2 }; const int audio_bitrate[2][3][15]= { // MPEG 1 {{0,32,64,96,128,160,192,224,256,288,320,352,384,416,448}, {0,32,48,56,64,80,96,112,128,160,192,224,256,320,384}, {0,32,40,48,56,64,80,96,112,128,160,192,224,256,320}}, // MPEG 2 {{0,32,48,56,64,80,96,112,128,144,160,176,192,224,256}, {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160}, {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160}} }; /* Match two 4-byte codes */ static inline bool Match4(Uint8 const code1[4], Uint8 const code2[4], Uint8 const mask[4]) { return( ((code1[0] & mask[0]) == (code2[0] & mask[0])) && ((code1[1] & mask[1]) == (code2[1] & mask[1])) && ((code1[2] & mask[2]) == (code2[2] & mask[2])) && ((code1[3] & mask[3]) == (code2[3] & mask[3])) ); } static inline double read_time_code(Uint8 *pointer) { double timestamp; Uint8 hibit; Uint32 lowbytes; hibit = (pointer[0]>>3)&0x01; lowbytes = (((Uint32)pointer[0] >> 1) & 0x03) << 30; lowbytes |= (Uint32)pointer[1] << 22; lowbytes |= ((Uint32)pointer[2] >> 1) << 15; lowbytes |= (Uint32)pointer[3] << 7; lowbytes |= ((Uint32)pointer[4]) >> 1; timestamp = (double)hibit*FLOAT_0x10000*FLOAT_0x10000+(double)lowbytes; timestamp /= STD_SYSTEM_CLOCK_FREQ; return timestamp; } /* Return true if there is a valid audio header at the beginning of pointer */ static inline Uint32 audio_header(Uint8 * pointer, Uint32 * framesize, double * frametime) { Uint32 layer, version, frequency, bitrate, mode, padding, size; if(((pointer[0] & 0xff) != 0xff) || // No sync bits ((pointer[1] & 0xf0) != 0xf0) || // ((pointer[2] & 0xf0) == 0x00) || // Bitrate is 0 ((pointer[2] & 0xf0) == 0xf0) || // Bitrate is 15 ((pointer[2] & 0x0c) == 0x0c) || // Frequency is 3 ((pointer[1] & 0x06) == 0x00)) // Layer is 4 return(0); layer = 4 - (((pointer)[1] >> 1) & 3); version = (((pointer)[1] >> 3) & 1) ^ 1; padding = ((pointer)[2] >> 1) & 1; frequency = audio_frequencies[version][(((pointer)[2] >> 2) & 3)]; bitrate = audio_bitrate[version][layer-1][(((pointer)[2] >> 4) & 15)]; mode = ((pointer)[3] >> 6) & 3; if(layer==1) { size = 12000 * bitrate / frequency; if(frequency==0 && padding) size++; size <<= 2; } else { size = 144000 * bitrate / (frequency<= size) return(0); if(!Match4(pointer, VIDEO_CODE, VIDEO_MASK)) return(0); /* Not a sequence start code */ /* Parse the sequence header information */ if((header_size+=8) >= size) return(0); switch(pointer[7]&0xF) /* 4 bits of fps */ { case 1: frametime = 1.0/23.97; break; case 2: frametime = 1.0/24.00; break; case 3: frametime = 1.0/25.00; break; case 4: frametime = 1.0/29.97; break; case 5: frametime = 1.0/30.00; break; case 6: frametime = 1.0/50.00; break; case 7: frametime = 1.0/59.94; break; case 8: frametime = 1.0/60.00; break; case 9: frametime = 1.0/15.00; break; default: frametime = 1.0/30.00; break; } if(_frametime) *_frametime = frametime; return(header_size); /* sequence header size */ } /* Return true if there is a valid gop header at the beginning of pointer */ static inline Uint32 gop_header(Uint8 * pointer, Uint32 size, double * timestamp) { Uint32 header_size; Uint32 hour, min, sec, frame; header_size = 0; if((header_size+=4) >= size) return(0); if(!Match4(pointer, GOP_CODE, GOP_MASK)) return(0); /* Not a gop start code */ /* Parse the gop header information */ hour = (pointer[4] >> 2) & 31; min = ((pointer[4] & 3) << 4) | ((pointer[5] >> 4) & 15); sec = ((pointer[5] & 7) << 3) | ((pointer[6] >> 5) & 7); frame = ((pointer[6] & 31) << 1) | ((pointer[7] >> 7) & 1); if((header_size+=4) >= size) return(0); if(timestamp) *timestamp = sec + 60.*min + 3600.*hour; return(header_size); /* gop header size */ } /* Return true if there is a valid picture header at the beginning of pointer */ static inline Uint32 picture_header(Uint8 * pointer, Uint32 size) { Uint32 header_size; header_size = 0; if((header_size+=4) >= size) return(0); if(!Match4(pointer, PICTURE_CODE, PICTURE_MASK)) return(0); /* Not a picture start code */ /* Parse the picture header information */ if((header_size+=4) >= size) return(0); return(header_size); /* picture header size */ } /* Return true if there is a valid slice header at the beginning of pointer */ static inline Uint32 slice_header(Uint8 * pointer, Uint32 size) { Uint32 header_size; header_size = 0; if((header_size+=4) >= size) return(0); if(!(Match4(pointer, SLICE_CODE, SLICE_MASK) && pointer[3] >= 0x01 && pointer[3] <= 0xaf)) return(0); /* Not a slice start code */ return(header_size); /* slice header size */ } /* Return true if there is a valid packet header at the beginning of pointer */ static inline Uint32 packet_header(Uint8 * pointer, Uint32 size, double * _timestamp) { double timestamp; Uint32 header_size; header_size = 0; if((header_size+=4) >= size) return(0); if(!Match4(pointer, PACKET_CODE, PACKET_MASK)) return(0); /* Not a packet start code */ /* Parse the packet information */ if((header_size+=8) >= size) return(0); timestamp = read_time_code(pointer+4); if(_timestamp) *_timestamp = timestamp; return(header_size); /* packet header size */ } /* Return true if there is a valid stream header at the beginning of pointer */ static inline Uint32 stream_header(Uint8 * pointer, Uint32 size, Uint32 * _packet_size, Uint8 * _stream_id, double * _stream_timestamp, double timestamp) { Uint32 header_size, packet_size; Uint8 stream_id; double stream_timestamp; header_size = 0; if((header_size += 4) >= size) return(0); if(!Match4(pointer, SYSTEMSTREAM_CODE, SYSTEMSTREAM_MASK) && !Match4(pointer, AUDIOSTREAM_CODE, AUDIOSTREAM_MASK) && !Match4(pointer, VIDEOSTREAM_CODE, VIDEOSTREAM_MASK) && !Match4(pointer, PADSTREAM_CODE, PADSTREAM_MASK) && !Match4(pointer, USERSTREAM_CODE, USERSTREAM_MASK)) return(0); /* Unknown encapsulated stream */ /* Parse the stream packet */ /* Get the stream id, and packet length */ stream_id = pointer[3]; pointer += 4; if((header_size += 2) >= size) return(0); packet_size = (((unsigned short) pointer[0] << 8) | pointer[1]); pointer += 2; /* Skip stuffing bytes */ while ( pointer[0] == 0xff ) { ++pointer; if((++header_size) >= size) return(0); --packet_size; } if ( (pointer[0] & 0x40) == 0x40 ) { pointer += 2; if((header_size += 2) >= size) return(0); packet_size -= 2; } if ( (pointer[0] & 0x20) == 0x20 ) { /* get the PTS */ stream_timestamp = read_time_code(pointer); /* we don't care about DTS */ if ( (pointer[0] & 0x30) == 0x30 ){ pointer += 5; if((header_size += 5) >= size) return(0); packet_size -= 5; } pointer += 4; if((header_size += 4) >= size) return(0); packet_size -= 4; } else if ( pointer[0] != 0x0f && pointer[0] != 0x80) return(0); /* not a valid header */ else stream_timestamp = timestamp; if((++header_size) >= size) return(0); --packet_size; if(_packet_size) *_packet_size = packet_size; if(_stream_id) *_stream_id = stream_id; if(_stream_timestamp) *_stream_timestamp = stream_timestamp; return(header_size); } /* Search the next valid audio header */ static inline bool system_aligned(Uint8 *pointer, Uint32 size) { Uint32 i, s; /* Check that packet contains at least one stream */ i = 0; while((s = packet_header(pointer+i, size-i, 0)) != 0) if((i+=s) >= size) return(true); if((s = stream_header(pointer+i, size-i, 0, 0, 0, 0)) != 0) return(true); else return(false); } /* Skip possible zeros at the beggining of the packet */ Uint32 skip_zeros(Uint8 * pointer, Uint32 size) { Uint32 header_size; Uint8 const one[4] = {0x00,0x00,0x00,0x01}; if(!size) return(0); header_size = 0; while(Match4(pointer, ZERO_CODE, FULL_MASK)) { pointer++; if((++header_size) >= size - 4) return(0); if(Match4(pointer, one, FULL_MASK)) { pointer++; if((++header_size) >= size - 4) return(0); } } return(header_size); } MPEGsystem::MPEGsystem(SDL_RWops *mpeg_source) { source = mpeg_source; /* Create a new buffer for reading */ read_buffer = new Uint8[MPEG_BUFFER_SIZE]; /* Create a mutex to avoid concurrent access to the stream */ system_mutex = SDL_CreateMutex(); request_wait = SDL_CreateSemaphore(0); /* Invalidate the read buffer */ pointer = read_buffer; read_size = 0; read_total = 0; packet_total = 0; endofstream = errorstream = false; frametime = 0.0; stream_timestamp = 0.0; /* Create an empty stream list */ stream_list = (MPEGstream **) malloc(sizeof(MPEGstream *)); stream_list[0] = 0; /* Create the system stream and add it to the list */ if(!get_stream(SYSTEM_STREAMID)) add_stream(new MPEGstream(this, SYSTEM_STREAMID)); timestamp = 0.0; timedrift = 0.0; skip_timestamp = -1; system_thread_running = false; system_thread = 0; /* Search the MPEG for the first header */ if(!seek_first_header()) { errorstream = true; SetError("Could not find the beginning of MPEG data\n"); return; } #ifdef USE_SYSTEM_THREAD /* Start the system thread */ system_thread = SDL_CreateThread(SystemThread, this); /* Wait for the thread to start */ while(!system_thread_running && !Eof()) SDL_Delay(1); #else system_thread_running = true; #endif /* Look for streams */ int tries = 0; do { RequestBuffer(); Wait(); if ( tries++ < 20 ) { // Adjust this to catch more streams if ( exist_stream(VIDEO_STREAMID, 0xF0) && exist_stream(AUDIO_STREAMID, 0xF0) ) { break; } } else { if ( exist_stream(VIDEO_STREAMID, 0xF0) || exist_stream(AUDIO_STREAMID, 0xF0) ) { break; } } } while(!Eof()); } MPEGsystem::~MPEGsystem() { MPEGstream ** list; /* Kill the system thread */ Stop(); SDL_DestroySemaphore(request_wait); SDL_DestroyMutex(system_mutex); /* Delete the streams */ for(list = stream_list; *list; list ++) delete *list; free(stream_list); /* Delete the read buffer */ delete[] read_buffer; } MPEGstream ** MPEGsystem::GetStreamList() { return(stream_list); } void MPEGsystem::Read() { int remaining; int timeout; /* Lock to prevent concurrent access to the stream */ SDL_mutexP(system_mutex); timeout = READ_TIME_OUT; remaining = read_buffer + read_size - pointer; /* Only read data if buffer is rather empty */ if(remaining < MPEG_BUFFER_SIZE / 2) { if(remaining < 0) { /* Hum.. we'd better stop if we have already read past the buffer size */ errorstream = true; SDL_mutexV(system_mutex); return; } /* Replace unread data at the beginning of the stream */ memmove(read_buffer, pointer, remaining); #ifdef NO_GRIFF_MODS read_size = SDL_RWread(source, read_buffer + remaining, READ_ALIGN(MPEG_BUFFER_SIZE - remaining)); if(read_size < 0) { perror("Read"); errorstream = true; SDL_mutexV(system_mutex); return; } #else /* Read new data */ int bytes_read = 0; int buffer_offset = remaining; int bytes_to_read = READ_ALIGN(MPEG_BUFFER_SIZE - remaining); int read_at_once = 0; read_size = 0; do { read_at_once = SDL_RWread(source, read_buffer + buffer_offset, 1, bytes_to_read ); if(read_at_once < 0) { perror("Read"); errorstream = true; SDL_mutexV(system_mutex); return; } else { bytes_read += read_at_once; buffer_offset += read_at_once; read_size += read_at_once; bytes_to_read -= read_at_once; } } while( read_at_once>0 && bytes_to_read>0 ); #endif read_total += read_size; packet_total ++; if((MPEG_BUFFER_SIZE - remaining) != 0 && read_size <= 0) { if(read_size != 0) { errorstream = true; SDL_mutexV(system_mutex); return; } } read_size += remaining; /* Move the pointer */ pointer = read_buffer; if(read_size == 0) { /* There is no more data */ endofstream = true; SDL_mutexV(system_mutex); return; } } SDL_mutexV(system_mutex); } /* ASSUME: stream_list[0] = system stream */ /* packet length < MPEG_BUFFER_SIZE */ Uint8 MPEGsystem::FillBuffer() { Uint8 stream_id; Uint32 packet_size; Uint32 header_size; /* - Read a new packet - */ Read(); if(Eof()) { RequestBuffer(); return(0); } pointer += skip_zeros(pointer, read_buffer + read_size - pointer); if((header_size = packet_header(pointer, read_buffer + read_size - pointer, ×tamp)) != 0) { pointer += header_size; stream_list[0]->pos += header_size; #ifdef DEBUG_SYSTEM fprintf(stderr, "MPEG packet header time: %lf\n", timestamp); #endif } if((header_size = stream_header(pointer, read_buffer + read_size - pointer, &packet_size, &stream_id, &stream_timestamp, timestamp)) != 0) { pointer += header_size; stream_list[0]->pos += header_size; #ifdef DEBUG_SYSTEM fprintf(stderr, "[%d] MPEG stream header [%d|%d] id: %d streamtime: %lf\n", read_total - read_size + (pointer - read_buffer), header_size, packet_size, stream_id, stream_timestamp); #endif } else if(Match4(pointer, END_CODE, END_MASK) || Match4(pointer, END2_CODE, END2_MASK)) { /* End codes belong to video stream */ #ifdef DEBUG_SYSTEM fprintf(stderr, "[%d] MPEG end code\n", read_total - read_size + (pointer - read_buffer)); #endif stream_id = exist_stream(VIDEO_STREAMID, 0xF0); packet_size = 4; } else { stream_id = stream_list[0]->streamid; if(!stream_list[1]) { //Uint8 * packet_end; packet_size = 0; /* There is no system info in the stream */ /* If we're still a system stream, morph to an audio */ /* or video stream */ /* Sequence header -> gives framerate */ while((header_size = sequence_header(pointer+packet_size, read_buffer + read_size - pointer - packet_size, &frametime)) != 0) { stream_id = VIDEO_STREAMID; stream_list[0]->streamid = stream_id; packet_size += header_size; #ifdef DEBUG_SYSTEM fprintf(stderr, "MPEG sequence header frametime: %lf\n", frametime); #endif } /* GOP header */ while((header_size = gop_header(pointer+packet_size, read_buffer + read_size - pointer - packet_size, 0)) != 0) { packet_size += header_size; #ifdef DEBUG_SYSTEM fprintf(stderr, "MPEG gop header\n"); #endif } /* Picture header */ while((header_size = picture_header(pointer+packet_size, read_buffer + read_size - pointer - packet_size)) != 0) { packet_size += header_size; // Warning: header size not quite correct (can be not byte aligned) stream_timestamp += frametime; // but this is compensated by skipping a little more, as we don't need to be header aligned packet_size += 4; // after this, since we then check for the next header to know the slice size. #ifdef DEBUG_SYSTEM fprintf(stderr, "MPEG picture header\n"); #endif } /* Slice header */ while((header_size = slice_header(pointer+packet_size, read_buffer + read_size - pointer - packet_size)) != 0) { packet_size += header_size; #ifdef DEBUG_SYSTEM fprintf(stderr, "MPEG slice header\n"); #endif } /* Audio frame */ if(audio_header(pointer+packet_size, &packet_size, &frametime)) { stream_id = AUDIO_STREAMID; stream_list[0]->streamid = stream_id; stream_timestamp += frametime; #ifdef DEBUG_SYSTEM fprintf(stderr, "MPEG audio header [%d] time: %lf @ %lf\n", packet_size, frametime, stream_timestamp); #endif } else { /* Check for next slice, picture, gop or sequence header */ register Uint8 * p; register Uint8 c; p = pointer + packet_size; state0: c = *p; p++; if(p >= read_buffer + read_size) goto end; if(c != 0) goto state0; /* Not explicitly reached: state1: */ c = *p; p++; if(p >= read_buffer + read_size) goto end; if(c != 0) goto state0; state2: c = *p; p++; if(p >= read_buffer + read_size) goto end; if(c == 0) goto state2; if(c != 1) goto state0; /* Not explicitly reached: state3: */ c = *p; p++; if(p >= read_buffer + read_size) goto end; if(c <= 0xaf) goto end; if(c == 0xb8) goto end; if(c == 0xb3) goto end; goto state0; end: if(p >= read_buffer + read_size) packet_size = (read_buffer + read_size) - pointer; else packet_size = p - pointer - 4; } if(stream_id == SYSTEM_STREAMID) stream_id = 0; } else { #ifdef DEBUG_SYSTEM fprintf(stderr, "Warning: unexpected header %02x%02x%02x%02x at offset %d\n", pointer[0], pointer[1], pointer[2], pointer[3], read_total - read_size + (pointer - read_buffer)); #endif pointer++; stream_list[0]->pos++; seek_next_header(); RequestBuffer(); return(0); } } if(Eof()) { RequestBuffer(); return(0); } assert(packet_size <= MPEG_BUFFER_SIZE); if(skip_timestamp > timestamp){ int cur_seconds=int(timestamp)%60; if (cur_seconds%5==0){ fprintf(stderr, "Skiping to %02d:%02d (%02d:%02d)\r", int(skip_timestamp)/60, int(skip_timestamp)%60, int(timestamp)/60, cur_seconds); } pointer += packet_size; stream_list[0]->pos += packet_size; /* since we skip data, request more */ RequestBuffer(); return (0); } switch(stream_id) { case 0: /* Unknown stream, just get another packet */ pointer += packet_size; stream_list[0]->pos += packet_size; RequestBuffer(); return(0); case SYSTEM_STREAMID: /* System header */ /* This MPEG contain system information */ /* Parse the system header and create MPEG streams */ /* Read the stream table */ pointer += 5; stream_list[0]->pos += 5; while (pointer[0] & 0x80 ) { /* If the stream doesn't already exist */ if(!get_stream(pointer[0])) { /* Create a new stream and add it to the list */ add_stream(new MPEGstream(this, pointer[0])); } pointer += 3; stream_list[0]->pos += 3; } /* Hack to detect video streams that are not advertised */ if ( ! exist_stream(VIDEO_STREAMID, 0xF0) ) { if ( pointer[3] == 0xb3 ) { add_stream(new MPEGstream(this, VIDEO_STREAMID)); } } RequestBuffer(); return(stream_id); default: MPEGstream * stream; /* Look for the stream the data must be given to */ stream = get_stream(stream_id); if(!stream) { /* Hack to detect video or audio streams that are not declared in system header */ if ( ((stream_id & 0xF0) == VIDEO_STREAMID) && !exist_stream(stream_id, 0xFF) ) { #ifdef DEBUG_SYSTEM fprintf(stderr, "Undeclared video packet, creating a new video stream\n"); #endif stream = new MPEGstream(this, stream_id); add_stream(stream); } else if ( ((stream_id & 0xF0) == AUDIO_STREAMID) && !exist_stream(stream_id, 0xFF) ) { #ifdef DEBUG_SYSTEM fprintf(stderr, "Undeclared audio packet, creating a new audio stream\n"); #endif stream = new MPEGstream(this, stream_id); add_stream(stream); } else { /* No stream found for packet, skip it */ pointer += packet_size; stream_list[0]->pos += packet_size; RequestBuffer(); return(stream_id); } } /* Insert the new data at the end of the stream */ if(pointer + packet_size <= read_buffer + read_size) { if(packet_size) stream->insert_packet(pointer, packet_size, stream_timestamp); pointer += packet_size; } else { stream->insert_packet(pointer, 0, stream_timestamp); errorstream = true; pointer = read_buffer + read_size; } return(stream_id); } } void MPEGsystem::Skip(double time) { if (skip_timestamp < timestamp) skip_timestamp = timestamp; skip_timestamp += time; } Uint32 MPEGsystem::Tell() { register Uint32 t; register int i; /* Sum all stream positions */ for(i = 0, t = 0; stream_list[i]; i++) t += stream_list[i]->pos; if(t > TotalSize()) return(TotalSize()); else return(t); } Uint32 MPEGsystem::TotalSize() { off_t size; off_t pos; /* Lock to avoid concurrent access to the stream */ SDL_mutexP(system_mutex); /* I made it this way (instead of fstat) to avoid #ifdef WIN32 everywhere */ /* in case 'in some weird perversion of nature' someone wants to port this to Win32 :-) */ if((pos = SDL_RWtell(source)) < 0) { if(errno != ESPIPE) { errorstream = true; SetError(strerror(errno)); } SDL_mutexV(system_mutex); return(0); } if((size = SDL_RWseek(source, 0, SEEK_END)) < 0) { if(errno != ESPIPE) { errorstream = true; SetError(strerror(errno)); } SDL_mutexV(system_mutex); return(0); } if((pos = SDL_RWseek(source, pos, SEEK_SET)) < 0) { if(errno != ESPIPE) { errorstream = true; SetError(strerror(errno)); } SDL_mutexV(system_mutex); return(0); } SDL_mutexV(system_mutex); return(size); } double MPEGsystem::TotalTime() { off_t size, pos; off_t file_ptr; Uint8 * buffer, * p; double time; /* Lock to avoid concurrent access to the stream */ SDL_mutexP(system_mutex); /* Save current position */ if((pos = SDL_RWtell(source)) < 0) { if(errno != ESPIPE) { errorstream = true; SetError(strerror(errno)); } SDL_mutexV(system_mutex); return(false); } file_ptr = 0; buffer = new Uint8[MPEG_BUFFER_SIZE]; time = 0; /* If audio, compute total time according to bitrate of the first header and total size */ /* Note: this doesn't work on variable bitrate streams */ if(stream_list[0]->streamid == AUDIO_STREAMID) { do { if((size = SDL_RWseek(source, file_ptr, SEEK_SET)) < 0) { if(errno != ESPIPE) { errorstream = true; SetError(strerror(errno)); } SDL_mutexV(system_mutex); return(false); } if(SDL_RWread(source, buffer, 1, MPEG_BUFFER_SIZE) < 0) break; /* Search for a valid audio header */ for(p = buffer; p < buffer + MPEG_BUFFER_SIZE; p++) if(audio_aligned(p, buffer + MPEG_BUFFER_SIZE - p)) break; file_ptr += MPEG_BUFFER_SIZE; } while(p >= MPEG_BUFFER_SIZE + buffer); /* Extract time info from the first header */ Uint32 framesize; double frametime; Uint32 totalsize; audio_header(p, &framesize, &frametime); totalsize = TotalSize(); if(framesize) time = frametime * totalsize / framesize; } else { bool last_chance = false; do { /* Otherwise search the stream backwards for a valid header */ file_ptr -= MPEG_BUFFER_SIZE; if ( file_ptr < -(Sint32)TotalSize() ) { last_chance = true; file_ptr = -(Sint32)TotalSize(); } if((size = SDL_RWseek(source, file_ptr, SEEK_END)) < 0) { if(errno != ESPIPE) { errorstream = true; SetError(strerror(errno)); } SDL_mutexV(system_mutex); return(false); } if(SDL_RWread(source, buffer, 1, MPEG_BUFFER_SIZE) < 0) break; if(stream_list[0]->streamid == SYSTEM_STREAMID) for(p = buffer + MPEG_BUFFER_SIZE - 1; p >= buffer;) { if(*p-- != 0xba) continue; // Packet header if(*p-- != 1) continue; if(*p-- != 0) continue; if(*p-- != 0) continue; ++p; break; } if(stream_list[0]->streamid == VIDEO_STREAMID) for(p = buffer + MPEG_BUFFER_SIZE - 1; p >= buffer;) { if(*p-- != 0xb8) continue; // GOP header if(*p-- != 1) continue; if(*p-- != 0) continue; if(*p-- != 0) continue; ++p; break; } } while( !last_chance && (p < buffer) ); if ( p >= buffer ) { /* Extract time info from the last header */ if(stream_list[0]->streamid == SYSTEM_STREAMID) packet_header(p, buffer + MPEG_BUFFER_SIZE - p, &time); if(stream_list[0]->streamid == VIDEO_STREAMID) gop_header(p, buffer + MPEG_BUFFER_SIZE - p, &time); } } delete[] buffer; /* Get back to saved position */ if((pos = SDL_RWseek(source, pos, SEEK_SET)) < 0) { if(errno != ESPIPE) { errorstream = true; SetError(strerror(errno)); } time = 0; } SDL_mutexV(system_mutex); return(time); } double MPEGsystem::TimeElapsedAudio(int atByte) { off_t size, pos; off_t file_ptr; Uint8 * buffer, * p; double time; if (atByte < 0) { return -1; } /* Lock to avoid concurrent access to the stream */ SDL_mutexP(system_mutex); /* Save current position */ if((pos = SDL_RWtell(source)) < 0) { if(errno != ESPIPE) { errorstream = true; SetError(strerror(errno)); } SDL_mutexV(system_mutex); return(false); } file_ptr = 0; buffer = new Uint8[MPEG_BUFFER_SIZE]; /* If audio, compute total time according to bitrate of the first header and total size */ /* Note: this doesn't work on variable bitrate streams */ if(stream_list[0]->streamid == AUDIO_STREAMID) { do { if((size = SDL_RWseek(source, file_ptr, SEEK_SET)) < 0) { if(errno != ESPIPE) { errorstream = true; SetError(strerror(errno)); } SDL_mutexV(system_mutex); return(false); } if(SDL_RWread(source, buffer, 1, MPEG_BUFFER_SIZE) < 0) break; /* Search for a valid audio header */ for(p = buffer; p < buffer + MPEG_BUFFER_SIZE; p++) if(audio_aligned(p, buffer + MPEG_BUFFER_SIZE - p)) break; file_ptr += MPEG_BUFFER_SIZE; } while(p >= MPEG_BUFFER_SIZE + buffer); /* Extract time info from the first header */ Uint32 framesize; double frametime; Uint32 totalsize; audio_header(p, &framesize, &frametime); totalsize = TotalSize(); if(framesize) //is there a better way to do this? time = (frametime * (atByte ? atByte:totalsize)) / framesize; else time = 0; } else //This is not a purely audio stream. This doesn't make sense! { time = -1; } delete[] buffer; /* Get back to saved position */ if((pos = SDL_RWseek(source, pos, SEEK_SET)) < 0) { if(errno != ESPIPE) { errorstream = true; SetError(strerror(errno)); } SDL_mutexV(system_mutex); return(0); } SDL_mutexV(system_mutex); return(time); } void MPEGsystem::Rewind() { Seek(0); } bool MPEGsystem::Seek(int length) { /* Stop the system thread */ Stop(); /* Lock to avoid concurrent access to the stream */ SDL_mutexP(system_mutex); /* Get into the stream */ if(SDL_RWseek(source, length, SEEK_SET) < 0) { if(errno != ESPIPE) { errorstream = true; SetError(strerror(errno)); } return(false); } /* Reinitialize the read buffer */ pointer = read_buffer; read_size = 0; read_total = length; stream_list[0]->pos += length; packet_total = 0; endofstream = false; errorstream = false; timestamp = 0.0; skip_timestamp = -1; reset_all_streams(); SDL_mutexV(system_mutex); /* Restart the system thread */ Start(); return(true); } void MPEGsystem::RequestBuffer() { SDL_SemPost(request_wait); } void MPEGsystem::Start() { if(system_thread_running) return; /* Get the next header */ if(!seek_next_header()) { if(!Eof()) { errorstream = true; SetError("Could not find the beginning of MPEG data\n"); } } #ifdef USE_SYSTEM_THREAD /* Start the system thread */ system_thread = SDL_CreateThread(SystemThread, this); /* Wait for the thread to start */ while(!system_thread_running && !Eof()) SDL_Delay(1); #else system_thread_running = true; #endif } void MPEGsystem::Stop() { if(!system_thread_running) return; /* Force the system thread to die */ system_thread_running = false; #ifdef USE_SYSTEM_THREAD SDL_SemPost(request_wait); SDL_WaitThread(system_thread, NULL); #endif /* Reset the streams */ reset_all_streams(); } bool MPEGsystem::Wait() { #ifdef USE_SYSTEM_THREAD if ( ! errorstream ) { while(SDL_SemValue(request_wait) != 0) SDL_Delay(1); } #else while(SDL_SemValue(request_wait) != 0) if ( ! SystemLoop(this) ) break; #endif return(!errorstream); } bool MPEGsystem::Eof() const { return(errorstream || endofstream); } bool MPEGsystem::SystemLoop(MPEGsystem *system) { /* Check for end of file */ if(system->Eof()) { /* Set the eof mark on all streams */ system->end_all_streams(); /* Get back to the beginning of the stream if possible */ if(SDL_RWseek(system->source, 0, SEEK_SET) < 0) { if(errno != ESPIPE) { system->errorstream = true; system->SetError(strerror(errno)); } return(false); } /* Reinitialize the read buffer */ system->pointer = system->read_buffer; system->read_size = 0; system->read_total = 0; system->packet_total = 0; system->endofstream = false; system->errorstream = false; /* Get the first header */ if(!system->seek_first_header()) { system->errorstream = true; system->SetError("Could not find the beginning of MPEG data\n"); return(false); } } /* Wait for a buffer request */ SDL_SemWait(system->request_wait); /* Read the buffer */ system->FillBuffer(); return(true); } int MPEGsystem::SystemThread(void * udata) { MPEGsystem * system = (MPEGsystem *) udata; system->system_thread_running = true; while(system->system_thread_running) { if ( ! SystemLoop(system) ) { system->system_thread_running = false; } } return(true); } void MPEGsystem::add_stream(MPEGstream * stream) { register int i; /* Go to the end of the list */ for(i = 0; stream_list[i]; i++); /* Resize list */ stream_list = (MPEGstream **) realloc(stream_list, (i+2)*sizeof(MPEGstream *)); /* Write the stream */ stream_list[i] = stream; /* Put the end marker (null) */ stream_list[i+1] = 0; } MPEGstream * MPEGsystem::get_stream(Uint8 stream_id) { register int i; for(i = 0; stream_list[i]; i++) if(stream_list[i]->streamid == stream_id) break; return(stream_list[i]); } Uint8 MPEGsystem::exist_stream(Uint8 stream_id, Uint8 mask) { register int i; for(i = 0; stream_list[i]; i++) if(((stream_list[i]->streamid) & mask) == (stream_id & mask)) return(stream_list[i]->streamid); return(0); } void MPEGsystem::reset_all_streams() { register int i; /* Reset the streams */ for(i = 0; stream_list[i]; i++) stream_list[i]->reset_stream(); } void MPEGsystem::end_all_streams() { register int i; /* End the streams */ /* We use a null buffer as the end of stream marker */ for(i = 0; stream_list[i]; i++) stream_list[i]->insert_packet(0, 0); } bool MPEGsystem::seek_first_header() { Read(); if(Eof()) return(false); while(!(audio_aligned(pointer, read_buffer + read_size - pointer) || system_aligned(pointer, read_buffer + read_size - pointer) || Match4(pointer, VIDEO_CODE, VIDEO_MASK))) { ++pointer; stream_list[0]->pos++; /* Make sure buffer is always full */ Read(); if(Eof()) return(false); } return(true); } bool MPEGsystem::seek_next_header() { Read(); if(Eof()) return(false); while(!( (stream_list[0]->streamid == AUDIO_STREAMID && audio_aligned(pointer, read_buffer + read_size - pointer)) || (stream_list[0]->streamid == SYSTEM_STREAMID && system_aligned(pointer, read_buffer + read_size - pointer)) || (stream_list[0]->streamid == VIDEO_STREAMID && Match4(pointer, GOP_CODE, GOP_MASK)) ) ) { ++pointer; stream_list[0]->pos++; /* Make sure buffer is always full */ Read(); if(Eof()) return(false); } return(true); } smpeg-0.4.5+cvs20030824.orig/MPEGfilter.c0100644000175000017500000002733007163247461017450 0ustar hoseheadhosehead/* SMPEG - SDL MPEG Player Library Copyright (C) 1999 Loki Entertainment Software This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include "SDL.h" #include "MPEGfilter.h" /* General filter cleanup function */ static void filter_destroy(SMPEG_Filter *filter) { if ( filter ) { if ( filter->data ) { free(filter->data); } free(filter); } } /**************************************************/ /* The null filter. Copies source rect to overlay */ /**************************************************/ static void filter_null_callback(SDL_Overlay * dst, SDL_Overlay * src, SDL_Rect * region, SMPEG_FilterInfo * info, void * data) { register Uint32 y; register Uint8 * s, * d; /* Y component */ s = src->pixels[0]; d = dst->pixels[0]; /* Go to the top left corner of the source rectangle */ s += region->y * src->pitches[0] + region->x; for(y = 0; y < region->h; y++) { /* Copy lines */ memcpy(d, s, region->w); s += src->pitches[0]; d += dst->pitches[0]; } /* V component */ s = src->pixels[1]; d = dst->pixels[1]; s += (region->y >> 1) * src->pitches[1] + (region->x >> 1); for(y = 0; y < region->h; y+=2) { memcpy(d, s, region->w >> 1); s += src->pitches[1]; d += dst->pitches[1]; } /* U component */ s = src->pixels[2]; d = dst->pixels[2]; s += (region->y >> 1) * src->pitches[2] + (region->x >> 1); for(y = 0; y < region->h; y+=2) { memcpy(d, s, region->w >> 1); s += src->pitches[2]; d += dst->pitches[2]; } } SMPEG_Filter *SMPEGfilter_null(void) { SMPEG_Filter *filter; filter = (SMPEG_Filter *)malloc(sizeof(*filter)); if ( filter ) { /* the null filter requires no extra info */ filter->flags = 0; /* no private data */ filter->data = 0; /* set the function pointers to the callback and destroy functions */ filter->callback = filter_null_callback; filter->destroy = filter_destroy; } return filter; } /************************************************************************************/ /* The bilinear filter. A basic low-pass filter that will produce a smoother image. */ /* It uses the following convolution matrix: [0 1 0] */ /* [1 4 1] */ /* [0 1 0] */ /************************************************************************************/ static void filter_bilinear_callback(SDL_Overlay * dst, SDL_Overlay * src, SDL_Rect * region, SMPEG_FilterInfo * info, void * data) { register int x, y; register Uint8 * s, * d; s = src->pixels[0]; d = dst->pixels[0]; s += region->y * src->pitches[0] + region->x; /* Skip first line */ memcpy(d, s, region->w); d += dst->pitches[0]; s += src->pitches[0]; for(y = 1; y < region->h - 1; y++) { /* Skip first pixel */ *d++ = *s++; for(x = 1; x < region->w - 1; x++) { *d++ = (((*s) << 2) + // 4*(x,y) + *(s - src->pitches[0]) + // (x,y-1) + *(s - 1) + // (x-1,y) + *(s + 1) + // (x+1,y) + *(s + src->pitches[0])) // (x,y+1) >> 3; // / 8 s++; } /* Skip last pixel */ *d++ = *s++; /* Go to next line */ d += dst->pitches[0] - region->w; s += src->pitches[0] - region->w; } /* Skip last line */ memcpy(d, s, region->w); d += dst->pitches[0]; s += src->pitches[0]; /* V component (unfiltered) */ s = src->pixels[1]; d = dst->pixels[1]; s += (region->y >> 1) * src->pitches[1] + (region->x >> 1); for(y = 0; y < region->h; y+=2) { memcpy(d, s, region->w >> 1); s += src->pitches[1]; d += dst->pitches[1]; } /* U component (unfiltered) */ s = src->pixels[2]; d = dst->pixels[2]; s += (region->y >> 1) * src->pitches[2] + (region->x >> 1); for(y = 0; y < region->h; y+=2) { memcpy(d, s, region->w >> 1); s += src->pitches[2]; d += dst->pitches[2]; } } SMPEG_Filter *SMPEGfilter_bilinear(void) { SMPEG_Filter *filter; filter = (SMPEG_Filter *)malloc(sizeof(*filter)); if ( filter ) { /* the bilinear filter requires no extra info */ filter->flags = 0; /* no private data */ filter->data = 0; /* set the function pointers to the callback and destroy functions */ filter->callback = filter_bilinear_callback; filter->destroy = filter_destroy; } return filter; } /***************************************************************************************************/ /* The deblocking filter. It filters block borders and non-intra coded blocks to reduce blockiness */ /***************************************************************************************************/ static void filter_deblocking_callback(SDL_Overlay * dst, SDL_Overlay * src, SDL_Rect * region, SMPEG_FilterInfo * info, void * data) { int x, y; Uint32 dL, dU, dR, dD; Uint32 aL, aU, aR, aD; Uint32 Q; Uint16 * coeffs; register Uint8 * s, * d; /* retrieve the coeffs from private data */ coeffs = (Uint16 *) data; /* Y component */ s = src->pixels[0]; d = dst->pixels[0]; s += region->y * src->pitches[0] + region->x; /* Skip first line */ memcpy(d, s, region->w); d += dst->pitches[0]; s += src->pitches[0]; for(y = 1; y < region->h - 1; y++) { /* Skip first pixel */ *d++ = *s++; for(x = 1; x < region->w - 1; x++) { /* get current block quantization error from the info structure provided by the video decoder */ Q = info->yuv_mb_square_error[((region->y + y) >> 4) * (src->w >> 4) + ((region->x + x) >> 4)]; if(!Q) *d++ = *s++; /* block is intra coded, don't filter */ else { /* compute differences with up, left, right and down neighbors */ dL = *s - *(s - 1) + 256; dR = *s - *(s + 1) + 256; dU = *s - *(s - src->pitches[0]) + 256; dD = *s - *(s + src->pitches[0]) + 256; /* get the corresponding filter coefficients from the lookup table */ aU = coeffs[(y & 7) + (Q << 12) + (dU << 3)]; aD = coeffs[(y & 7) + (Q << 12) + (dD << 3)]; aL = coeffs[(x & 7) + (Q << 12) + (dL << 3)]; aR = coeffs[(x & 7) + (Q << 12) + (dR << 3)]; /* apply the filter on current pixel */ *d++ = ((*s)*(4 * 65536 - aL - aR - aU - aD) + // (4-aL-aR-aU-aD)*(x,y) + (*(s - src->pitches[0]))*aU + // aU*(x,y-1) + (*(s - 1))*aL + // aL*(x-1,y) + (*(s + 1))*aR + // aR*(x+1,y) + (*(s + src->pitches[0]))*aD) // aU*(x,y+1) >> 18; // remove fixed point and / 4 s++; } } /* Skip last pixel */ *d++ = *s++; /* Go to next line */ d += dst->pitches[0] - region->w; s += src->pitches[0] - region->w; } /* Skip last line */ memcpy(d, s, region->w); d += dst->pitches[0]; s += src->pitches[0]; /* V component (unfiltered) */ s = src->pixels[1]; d = dst->pixels[1]; s += (region->y >> 1) * src->pitches[1] + (region->x >> 1); for(y = 0; y < region->h; y+=2) { memcpy(d, s, region->w >> 1); s += src->pitches[1]; d += dst->pitches[1]; } /* U component (unfiltered) */ s = src->pixels[2]; d = dst->pixels[2]; s += (region->y >> 1) * src->pitches[2] + (region->x >> 1); for(y = 0; y < region->h; y+=2) { memcpy(d, s, region->w >> 1); s += src->pitches[2]; d += dst->pitches[2]; } } static void *allocate_deblocking_data(void) { void * data; Uint16 * c; Uint32 q, q1, q5, q9, d; /* precalc table is 256Kb long */ data = malloc(sizeof(*c)*8*32*512); c = (Uint16 *)data; /* precalc filter coefficients: */ /* 1 */ /* coeffs(Q,d,x,y) = _____________________ */ /* d(x,y)*d(x,y) */ /* 1 + _____________ */ /* Q*Q*k(x,y) */ /* where */ /* k(x,y) = [ 9 9 9 9 9 9 9 9 ] */ /* [ 9 5 5 5 5 5 5 9 ] */ /* [ 9 5 1 1 1 1 5 9 ] */ /* [ 9 5 1 1 1 1 5 9 ] */ /* [ 9 5 1 1 1 1 5 9 ] */ /* [ 9 5 1 1 1 1 5 9 ] */ /* [ 9 5 5 5 5 5 5 9 ] */ /* [ 9 9 9 9 9 9 9 9 ] */ /* and Q is the quantization error for the block */ /* and d is the difference between current pixel and neighbor pixel */ /* */ /* this is for the math :), now some additional tricks: */ /* */ /* all coeffs are multiplied by 65536 for precision (fixed point) */ /* and d is translated from [-128,127] to [0,255] (array indexation)*/ for(d = 0; d < 512*8; d++) *c++ = 0; for(q = 1; q < 32; q++) { q1 = q*q; q9 = (q1 << 3) + q1; q5 = (q1 << 2) + q1; for(d = 0; d < 256; d++) { *c++ = (Uint16) ((q9 << 16) / ((256 - d)*(256 - d) + q9)); *c++ = (Uint16) ((q5 << 16) / ((256 - d)*(256 - d) + q5)); *c++ = (Uint16) ((q1 << 16) / ((256 - d)*(256 - d) + q1)); *c++ = (Uint16) ((q1 << 16) / ((256 - d)*(256 - d) + q1)); *c++ = (Uint16) ((q1 << 16) / ((256 - d)*(256 - d) + q1)); *c++ = (Uint16) ((q1 << 16) / ((256 - d)*(256 - d) + q1)); *c++ = (Uint16) ((q5 << 16) / ((256 - d)*(256 - d) + q5)); *c++ = (Uint16) ((q9 << 16) / ((256 - d)*(256 - d) + q9)); } for(d = 0; d < 256; d++) { *c++ = (Uint16) ((q9 << 16) / (d*d + q9)); *c++ = (Uint16) ((q5 << 16) / (d*d + q5)); *c++ = (Uint16) ((q1 << 16) / (d*d + q1)); *c++ = (Uint16) ((q1 << 16) / (d*d + q1)); *c++ = (Uint16) ((q1 << 16) / (d*d + q1)); *c++ = (Uint16) ((q1 << 16) / (d*d + q1)); *c++ = (Uint16) ((q5 << 16) / (d*d + q5)); *c++ = (Uint16) ((q9 << 16) / (d*d + q9)); } } return data; } SMPEG_Filter *SMPEGfilter_deblocking(void) { SMPEG_Filter *filter; filter = (SMPEG_Filter *)malloc(sizeof(*filter)); if ( filter ) { /* Ask the video decoder to provide per-block quantization error */ filter->flags = SMPEG_FILTER_INFO_MB_ERROR; /* allocate private data */ filter->data = allocate_deblocking_data(); if ( ! filter->data ) { free(filter); return (SMPEG_Filter *)0; } /* set the function pointers to the callback and destroy functions */ filter->callback = filter_deblocking_callback; filter->destroy = filter_destroy; } return filter; } smpeg-0.4.5+cvs20030824.orig/smpeg.cpp0100644000175000017500000002154507262714372017167 0ustar hoseheadhosehead/* SMPEG - SDL MPEG Player Library Copyright (C) 1999 Loki Entertainment Software - Modified by Michel Darricau from eProcess for popcorn - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* This is the C interface to the SMPEG library */ #include "MPEG.h" #include "MPEGfilter.h" #include "smpeg.h" extern "C" { /* This is the actual SMPEG object */ struct _SMPEG { MPEG *obj; }; /* Create a new SMPEG object from an MPEG file. On return, if 'info' is not NULL, it will be filled with information about the MPEG object. This function returns a new SMPEG object. Use SMPEG_error() to find out whether or not there was a problem building the MPEG stream. The sdl_audio parameter indicates if SMPEG should initialize the SDL audio subsystem. If not, you will have to use the SMPEG_playaudio() function below to extract the decoded data. */ SMPEG* SMPEG_new(const char *file, SMPEG_Info* info, int sdl_audio) { SMPEG *mpeg; /* Create a new SMPEG object! */ mpeg = new SMPEG; mpeg->obj = new MPEG(file, sdl_audio ? true : false); /* Find out the details of the stream, if requested */ SMPEG_getinfo(mpeg, info); /* We're done! */ return(mpeg); } /* The same as above except for file descriptors */ SMPEG* SMPEG_new_descr(int file, SMPEG_Info* info, int sdl_audio) { SMPEG *mpeg; /* Create a new SMPEG object! */ mpeg = new SMPEG; mpeg->obj = new MPEG(file, sdl_audio ? true : false); /* Find out the details of the stream, if requested */ SMPEG_getinfo(mpeg, info); /* We're done! */ return(mpeg); } /* The same as above but for a raw chunk of data. SMPEG makes a copy of the data, so the application is free to delete after a successful call to this function. */ SMPEG* SMPEG_new_data(void *data, int size, SMPEG_Info* info, int sdl_audio) { SMPEG *mpeg; /* Create a new SMPEG object! */ mpeg = new SMPEG; mpeg->obj = new MPEG(data, size, sdl_audio ? true : false); /* Find out the details of the stream, if requested */ SMPEG_getinfo(mpeg, info); /* We're done! */ return(mpeg); } SMPEG* SMPEG_new_rwops(SDL_RWops *src, SMPEG_Info* info, int sdl_audio) { SMPEG *mpeg; /* Create a new SMPEG object! */ mpeg = new SMPEG; mpeg->obj = new MPEG(src, sdl_audio ? true : false); /* Find out the details of the stream, if requested */ SMPEG_getinfo(mpeg, info); /* We're done! */ return(mpeg); } /* Get current information about an SMPEG object */ void SMPEG_getinfo( SMPEG* mpeg, SMPEG_Info* info ) { if ( info ) { MPEG_AudioInfo ainfo; MPEG_VideoInfo vinfo; MPEG_SystemInfo sinfo; memset(info, 0, (sizeof *info)); if ( mpeg->obj ) { info->has_audio = (mpeg->obj->audiostream != NULL); if ( info->has_audio ) { mpeg->obj->GetAudioInfo(&ainfo); info->audio_current_frame = ainfo.current_frame; sprintf(info->audio_string, "MPEG-%d Layer %d %dkbit/s %dHz %s", ainfo.mpegversion+1, ainfo.layer, ainfo.bitrate, ainfo.frequency, (ainfo.mode == 3) ? "mono" : "stereo"); } info->has_video = (mpeg->obj->videostream != NULL); if ( info->has_video ) { mpeg->obj->GetVideoInfo(&vinfo); info->width = vinfo.width; info->height = vinfo.height; info->current_frame = vinfo.current_frame; info->current_fps = vinfo.current_fps; } if(mpeg->obj->system != NULL) { mpeg->obj->GetSystemInfo(&sinfo); info->total_size = sinfo.total_size; info->current_offset = sinfo.current_offset; info->total_time = sinfo.total_time; info->current_time = sinfo.current_time; } else { info->total_size = 0; info->current_offset = 0; } } } } /* Enable or disable audio playback in MPEG stream */ void SMPEG_enableaudio( SMPEG* mpeg, int enable ) { mpeg->obj->EnableAudio(enable ? true : false); } /* Enable or disable video playback in MPEG stream */ void SMPEG_enablevideo( SMPEG* mpeg, int enable ) { mpeg->obj->EnableVideo(enable ? true : false); } /* Delete an SMPEG object */ void SMPEG_delete( SMPEG* mpeg ) { delete mpeg->obj; delete mpeg; } /* Get the current status of an SMPEG object */ SMPEGstatus SMPEG_status( SMPEG* mpeg ) { SMPEGstatus status; status = SMPEG_ERROR; /* Michel Darricau from eProcess conflict name in popcorn */ switch (mpeg->obj->GetStatus()) { case MPEG_STOPPED: if ( ! mpeg->obj->WasError() ) { status = SMPEG_STOPPED; } break; case MPEG_PLAYING: status = SMPEG_PLAYING; break; case MPEG_ERROR: status = SMPEG_ERROR; break; } return(status); } /* Set the audio volume of an MPEG stream */ void SMPEG_setvolume( SMPEG* mpeg, int volume ) { mpeg->obj->Volume(volume); } /* Set the destination surface for MPEG video playback */ void SMPEG_setdisplay( SMPEG* mpeg, SDL_Surface* dst, SDL_mutex* surfLock, SMPEG_DisplayCallback callback) { mpeg->obj->SetDisplay(dst, surfLock, callback); } /* Set or clear looping play on an SMPEG object */ void SMPEG_loop( SMPEG* mpeg, int repeat ) { mpeg->obj->Loop(repeat ? true : false); } /* Scale pixel display on an SMPEG object */ void SMPEG_scale( SMPEG* mpeg, int scale ) { MPEG_VideoInfo vinfo; if ( mpeg->obj->videostream != NULL ) { mpeg->obj->GetVideoInfo(&vinfo); mpeg->obj->ScaleDisplayXY(vinfo.width*scale, vinfo.height*scale); } } void SMPEG_scaleXY( SMPEG* mpeg, int w, int h ) { mpeg->obj->ScaleDisplayXY(w, h); } /* Move the video display area within the destination surface */ void SMPEG_move( SMPEG* mpeg, int x, int y ) { mpeg->obj->MoveDisplay(x, y); } /* Set the region of the video to be shown */ void SMPEG_setdisplayregion(SMPEG* mpeg, int x, int y, int w, int h) { mpeg->obj->SetDisplayRegion(x, y, w, h); } /* Play an SMPEG object */ void SMPEG_play( SMPEG* mpeg ) { mpeg->obj->Play(); } /* Pause/Resume playback of an SMPEG object */ void SMPEG_pause( SMPEG* mpeg ) { mpeg->obj->Pause(); } /* Stop playback of an SMPEG object */ void SMPEG_stop( SMPEG* mpeg ) { mpeg->obj->Stop(); } /* Rewind the play position of an SMPEG object to the beginning of the MPEG */ void SMPEG_rewind( SMPEG* mpeg ) { mpeg->obj->Rewind(); } /* Seek 'bytes' bytes of the MPEG */ void SMPEG_seek( SMPEG* mpeg, int bytes ) { mpeg->obj->Seek(bytes); } /* Skip 'seconds' seconds of the MPEG */ void SMPEG_skip( SMPEG* mpeg, float seconds ) { mpeg->obj->Skip(seconds); } /* Render a particular frame in the MPEG video */ void SMPEG_renderFrame( SMPEG* mpeg, int framenum ) { mpeg->obj->RenderFrame(framenum); } /* Render the last frame of an MPEG video */ void SMPEG_renderFinal( SMPEG* mpeg, SDL_Surface* dst, int x, int y ) { mpeg->obj->RenderFinal(dst, x, y); } /* Set video filter */ SMPEG_Filter * SMPEG_filter( SMPEG* mpeg, SMPEG_Filter * filter ) { return((SMPEG_Filter *) mpeg->obj->Filter((SMPEG_Filter *) filter)); } /* Exported function for general audio playback */ int SMPEG_playAudio( SMPEG* mpeg, Uint8 *stream, int len) { MPEGaudio *audio = mpeg->obj->GetAudio(); return Play_MPEGaudio(audio, stream, len); } void SMPEG_playAudioSDL( void* mpeg, Uint8 *stream, int len) { MPEGaudio *audio = ((SMPEG *)mpeg)->obj->GetAudio(); Play_MPEGaudio(audio, stream, len); } /* Get the best SDL audio spec for the audio stream */ int SMPEG_wantedSpec( SMPEG *mpeg, SDL_AudioSpec *wanted ) { return (int)mpeg->obj->WantedSpec(wanted); } /* Inform SMPEG of the actual SDL audio spec used for sound playback */ void SMPEG_actualSpec( SMPEG *mpeg, SDL_AudioSpec *spec ) { mpeg->obj->ActualSpec(spec); } /* Return NULL if there is no error in the MPEG stream, or an error message if there was a fatal error in the MPEG stream for the SMPEG object. */ char *SMPEG_error( SMPEG* mpeg ) { char *error; error = NULL; if ( mpeg->obj->WasError() ) { error = mpeg->obj->TheError(); } return(error); } /* Extern "C" */ }; smpeg-0.4.5+cvs20030824.orig/plaympeg.c0100644000175000017500000006035107272325063017324 0ustar hoseheadhosehead/* plaympeg - Sample MPEG player using the SMPEG library Copyright (C) 1999 Loki Entertainment Software This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #ifdef unix #include #include #include #include #include #include #define NET_SUPPORT /* General network support */ #define RAW_SUPPORT /* Raw data transport support */ #define HTTP_SUPPORT /* HTTP support */ #define FTP_SUPPORT /* FTP support */ #ifdef linux #define VCD_SUPPORT /* Video CD support */ #endif #endif #ifdef NET_SUPPORT #include #include #include #include #endif #ifdef VCD_SUPPORT #include #include #include #include #endif #include "smpeg.h" void usage(char *argv0) { printf( "Usage: %s [options] file ...\n" "Where the options are one of:\n" " --noaudio Don't play audio stream\n" " --novideo Don't play video stream\n" " --fullscreen Play MPEG in fullscreen mode\n" " --double or -2 Play MPEG at double size\n" " --loop or -l Play MPEG over and over\n" " --bilinear Use software bilinear filtering\n" " --volume N or -v N Set audio volume to N (0-100)\n" " --scale wxh or -s wxh Play MPEG at given resolution\n" " --seek N or -S N Skip N bytes\n" #ifdef USE_SYSTEM_TIMESTAMP " --skip N or -k N Skip N seconds\n" #endif " --help or -h\n" " --version or -V\n" "Specifying - as filename will use stdin for input\n", argv0); } #ifdef NET_SUPPORT int is_address_multicast(unsigned long address) { if((address & 255) >= 224 && (address & 255) <= 239) return(1); return(0); } int tcp_open(char * address, int port) { struct sockaddr_in stAddr; struct hostent * host; int sock; struct linger l; memset(&stAddr,0,sizeof(stAddr)); stAddr.sin_family = AF_INET ; stAddr.sin_port = htons(port); if((host = gethostbyname(address)) == NULL) return(0); stAddr.sin_addr = *((struct in_addr *) host->h_addr_list[0]) ; if((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) return(0); l.l_onoff = 1; l.l_linger = 5; if(setsockopt(sock, SOL_SOCKET, SO_LINGER, (char*) &l, sizeof(l)) < 0) return(0); if(connect(sock, (struct sockaddr *) &stAddr, sizeof(stAddr)) < 0) return(0); return(sock); } int udp_open(char * address, int port) { int enable = 1L; struct sockaddr_in stAddr; struct sockaddr_in stLclAddr; struct ip_mreq stMreq; struct hostent * host; int sock; stAddr.sin_family = AF_INET; stAddr.sin_port = htons(port); if((host = gethostbyname(address)) == NULL) return(0); stAddr.sin_addr = *((struct in_addr *) host->h_addr_list[0]) ; /* Create a UDP socket */ if((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) return(0); /* Allow multiple instance of the client to share the same address and port */ if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *) &enable, sizeof(unsigned long int)) < 0) return(0); /* If the address is multicast, register to the multicast group */ if(is_address_multicast(stAddr.sin_addr.s_addr)) { /* Bind the socket to port */ stLclAddr.sin_family = AF_INET; stLclAddr.sin_addr.s_addr = htonl(INADDR_ANY); stLclAddr.sin_port = stAddr.sin_port; if(bind(sock, (struct sockaddr*) & stLclAddr, sizeof(stLclAddr)) < 0) return(0); /* Register to a multicast address */ stMreq.imr_multiaddr.s_addr = stAddr.sin_addr.s_addr; stMreq.imr_interface.s_addr = INADDR_ANY; if(setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *) & stMreq, sizeof(stMreq)) < 0) return(0); } else { /* Bind the socket to port */ stLclAddr.sin_family = AF_INET; stLclAddr.sin_addr.s_addr = htonl(INADDR_ANY); stLclAddr.sin_port = htons(0); if(bind(sock, (struct sockaddr*) & stLclAddr, sizeof(stLclAddr)) < 0) return(0); } return(sock); } #ifdef RAW_SUPPORT int raw_open(char * arg) { char * host; int port; int sock; /* Check for URL syntax */ if(strncmp(arg, "raw://", strlen("raw://"))) return(0); /* Parse URL */ port = 0; host = arg + strlen("raw://"); if(strchr(host, ':') != NULL) /* port is specified */ { port = atoi(strchr(host, ':') + 1); *strchr(host, ':') = 0; } /* Open a UDP socket */ if(!(sock = udp_open(host, port))) perror("raw_open"); return(sock); } #endif #ifdef HTTP_SUPPORT int http_open(char * arg) { char * host; int port; char * request; int tcp_sock; char http_request[1024]; char c; /* Check for URL syntax */ if(strncmp(arg, "http://", strlen("http://"))) return(0); /* Parse URL */ port = 80; host = arg + strlen("http://"); if((request = strchr(host, '/')) == NULL) return(0); *request++ = 0; if(strchr(host, ':') != NULL) /* port is specified */ { port = atoi(strchr(host, ':') + 1); *strchr(host, ':') = 0; } /* Open a TCP socket */ if(!(tcp_sock = tcp_open(host, port))) { perror("http_open"); return(0); } /* Send HTTP GET request */ sprintf(http_request, "GET /%s HTTP/1.0\r\n" "User-Agent: Mozilla/2.0 (Win95; I)\r\n" "Pragma: no-cache\r\n" "Host: %s\r\n" "Accept: */*\r\n" "\r\n", request, host); send(tcp_sock, http_request, strlen(http_request), 0); /* Parse server reply */ do read(tcp_sock, &c, sizeof(char)); while(c != ' '); read(tcp_sock, http_request, 4*sizeof(char)); http_request[4] = 0; if(strcmp(http_request, "200 ")) { fprintf(stderr, "http_open: "); do { read(tcp_sock, &c, sizeof(char)); fprintf(stderr, "%c", c); } while(c != '\r'); fprintf(stderr, "\n"); return(0); } return(tcp_sock); } #endif #ifdef FTP_SUPPORT int ftp_get_reply(int tcp_sock) { int i; char c; char answer[1024]; do { /* Read a line */ for(i = 0, c = 0; i < 1024 && c != '\n'; i++) { read(tcp_sock, &c, sizeof(char)); answer[i] = c; } answer[i] = 0; fprintf(stderr, answer + 4); } while(answer[3] == '-'); answer[3] = 0; return(atoi(answer)); } int ftp_open(char * arg) { char * host; int port; char * dir; char * file; int tcp_sock; int data_sock; char ftp_request[1024]; struct sockaddr_in stLclAddr; socklen_t namelen; int i; /* Check for URL syntax */ if(strncmp(arg, "ftp://", strlen("ftp://"))) return(0); /* Parse URL */ port = 21; host = arg + strlen("ftp://"); if((dir = strchr(host, '/')) == NULL) return(0); *dir++ = 0; if((file = strrchr(dir, '/')) == NULL) { file = dir; dir = NULL; } else *file++ = 0; if(strchr(host, ':') != NULL) /* port is specified */ { port = atoi(strchr(host, ':') + 1); *strchr(host, ':') = 0; } /* Open a TCP socket */ if(!(tcp_sock = tcp_open(host, port))) { perror("ftp_open"); return(0); } /* Send FTP USER and PASS request */ ftp_get_reply(tcp_sock); sprintf(ftp_request, "USER anonymous\r\n"); send(tcp_sock, ftp_request, strlen(ftp_request), 0); if(ftp_get_reply(tcp_sock) != 331) return(0); sprintf(ftp_request, "PASS smpeguser@\r\n"); send(tcp_sock, ftp_request, strlen(ftp_request), 0); if(ftp_get_reply(tcp_sock) != 230) return(0); sprintf(ftp_request, "TYPE I\r\n"); send(tcp_sock, ftp_request, strlen(ftp_request), 0); if(ftp_get_reply(tcp_sock) != 200) return(0); if(dir != NULL) { sprintf(ftp_request, "CWD %s\r\n", dir); send(tcp_sock, ftp_request, strlen(ftp_request), 0); if(ftp_get_reply(tcp_sock) != 250) return(0); } /* Get interface address */ namelen = sizeof(stLclAddr); if(getsockname(tcp_sock, (struct sockaddr *) &stLclAddr, &namelen) < 0) return(0); /* Open data socket */ if ((data_sock = socket(PF_INET, SOCK_STREAM, 0)) < 0) return(0); stLclAddr.sin_family = AF_INET; /* Get the first free port */ for(i = 0; i < 0xC000; i++) { stLclAddr.sin_port = htons(0x4000 + i); if(bind(data_sock, (struct sockaddr *) &stLclAddr, sizeof(stLclAddr)) >= 0) break; } port = 0x4000 + i; if(listen(data_sock, 1) < 0) return(0); i = ntohl(stLclAddr.sin_addr.s_addr); sprintf(ftp_request, "PORT %d,%d,%d,%d,%d,%d\r\n", (i >> 24) & 0xFF, (i >> 16) & 0xFF, (i >> 8) & 0xFF, i & 0xFF, (port >> 8) & 0xFF, port & 0xFF); send(tcp_sock, ftp_request, strlen(ftp_request), 0); if(ftp_get_reply(tcp_sock) != 200) return(0); sprintf(ftp_request, "RETR %s\r\n", file); send(tcp_sock, ftp_request, strlen(ftp_request), 0); if(ftp_get_reply(tcp_sock) != 150) return(0); return(accept(data_sock, NULL, NULL)); } #endif #endif #ifdef VCD_SUPPORT int vcd_read(int fd, int lba, unsigned char *buf) { struct cdrom_msf *msf; msf = (struct cdrom_msf*) buf; msf->cdmsf_min0 = (lba + CD_MSF_OFFSET) / CD_FRAMES / CD_SECS; msf->cdmsf_sec0 = (lba + CD_MSF_OFFSET) / CD_FRAMES % CD_SECS; msf->cdmsf_frame0 = (lba + CD_MSF_OFFSET) % CD_FRAMES; return(ioctl(fd, CDROMREADMODE2, buf)); } int vcd_open(char * arg) { struct stat buf; struct cdrom_tocentry toc; char *pip; int track; int pipe_fd[2]; int fd; int pid, parent; unsigned char * buffer; /* Track defaults to 02, unless requested otherwise */ track = 02; pip = strrchr(arg, ':'); if ( pip ) { *pip = '\0'; track = atoi(pip+1) + 1; } /* See if the CD-ROM device file exists */ if ( (stat(arg, &buf) < 0) || !S_ISBLK(buf.st_mode) ) { if ( pip ) { *pip = ':'; } return(0); } fd = open(arg, O_RDONLY, 0); if ( fd < 0 ) { if ( pip ) { *pip = ':'; } return(0); } /* Track 02 (changed to 'track') contains MPEG data */ if ( track < 2 ) { printf("Warning: VCD data normally starts on track 2\n"); } toc.cdte_track = track; toc.cdte_format = CDROM_LBA; if(ioctl(fd, CDROMREADTOCENTRY, &toc) < 0) return(0); if(pipe(pipe_fd) < 0) return(0); parent = getpid(); pid = fork(); if(pid < 0) return(0); if(!pid) { /* Child process fills the pipe */ int pos; struct timeval timeout; fd_set fdset; buffer = (unsigned char *) malloc(CD_FRAMESIZE_RAW0); for(pos = toc.cdte_addr.lba; vcd_read(fd, pos, buffer) >= 0; pos ++) { if(kill(parent, 0) < 0) break; FD_ZERO(&fdset); FD_SET(pipe_fd[1], &fdset); timeout.tv_sec = 10; timeout.tv_usec = 0; if(select(pipe_fd[1]+1, NULL, &fdset, NULL, &timeout) <= 0) break; if(write(pipe_fd[1], buffer, CD_FRAMESIZE_RAW0) < 0) break; } free(buffer); exit(0); } return(pipe_fd[0]); } #endif void update(SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h) { if ( screen->flags & SDL_DOUBLEBUF ) { SDL_Flip(screen); } } /* Flag telling the UI that the movie or song should be skipped */ int done; void next_movie(int sig) { done = 1; } int main(int argc, char *argv[]) { int use_audio, use_video; int fullscreen; int scalesize; int scale_width, scale_height; int loop_play; int i, pause; int volume; Uint32 seek; float skip; int bilinear_filtering; SDL_Surface *screen; SMPEG *mpeg; SMPEG_Info info; char *basefile; SDL_version sdlver; SMPEG_version smpegver; int fd; char buf[32]; int status; /* Get the command line options */ use_audio = 1; use_video = 1; fullscreen = 0; scalesize = 1; scale_width = 0; scale_height = 0; loop_play = 0; volume = 100; seek = 0; skip = 0; bilinear_filtering = 0; fd = 0; for ( i=1; argv[i] && (argv[i][0] == '-') && (argv[i][1] != 0); ++i ) { if ( (strcmp(argv[i], "--noaudio") == 0) || (strcmp(argv[i], "--nosound") == 0) ) { use_audio = 0; } else if ( strcmp(argv[i], "--novideo") == 0 ) { use_video = 0; } else if ( strcmp(argv[i], "--fullscreen") == 0 ) { fullscreen = 1; } else if ((strcmp(argv[i], "--double") == 0)||(strcmp(argv[i], "-2") == 0)) { scalesize = 2; } else if ((strcmp(argv[i], "--loop") == 0) || (strcmp(argv[i], "-l") == 0)) { loop_play = 1; } else if ( strcmp(argv[i], "--bilinear") == 0 ) { bilinear_filtering = 1; } else if ((strcmp(argv[i], "--seek") == 0)||(strcmp(argv[i], "-S") == 0)) { ++i; if ( argv[i] ) { seek = atol(argv[i]); } } else if ((strcmp(argv[i], "--skip") == 0)||(strcmp(argv[i], "-k") == 0)) { ++i; if ( argv[i] ) { skip = (float)atof(argv[i]); } } else if ((strcmp(argv[i], "--volume") == 0)||(strcmp(argv[i], "-v") == 0)) { ++i; if (i >= argc) { fprintf(stderr, "Please specify volume when using --volume or -v\n"); return(1); } if ( argv[i] ) { volume = atoi(argv[i]); } if ( ( volume < 0 ) || ( volume > 100 ) ) { fprintf(stderr, "Volume must be between 0 and 100\n"); volume = 100; } } else if ((strcmp(argv[i], "--version") == 0) || (strcmp(argv[i], "-V") == 0)) { sdlver = *SDL_Linked_Version(); SMPEG_VERSION(&smpegver); printf("SDL version: %d.%d.%d\n" "SMPEG version: %d.%d.%d\n", sdlver.major, sdlver.minor, sdlver.patch, smpegver.major, smpegver.minor, smpegver.patch); return(0); } else if ((strcmp(argv[i], "--scale") == 0)||(strcmp(argv[i], "-s") == 0)) { ++i; if ( argv[i] ) { sscanf(argv[i], "%dx%d", &scale_width, &scale_height); } } else if ((strcmp(argv[i], "--help") == 0) || (strcmp(argv[i], "-h") == 0)) { usage(argv[0]); return(0); } else { fprintf(stderr, "Warning: Unknown option: %s\n", argv[i]); } } /* If there were no arguments just print the usage */ if (argc == 1) { usage(argv[0]); return(0); } #if defined(linux) || defined(__FreeBSD__) /* Plaympeg doesn't need a mouse */ putenv("SDL_NOMOUSE=1"); #endif /* Play the mpeg files! */ status = 0; for ( ; argv[i]; ++i ) { /* Initialize SDL */ if ( use_video ) { if ((SDL_Init(SDL_INIT_VIDEO) < 0) || !SDL_VideoDriverName(buf, 1)) { fprintf(stderr, "Warning: Couldn't init SDL video: %s\n", SDL_GetError()); fprintf(stderr, "Will ignore video stream\n"); use_video = 0; } } if ( use_audio ) { if ((SDL_Init(SDL_INIT_AUDIO) < 0) || !SDL_AudioDriverName(buf, 1)) { fprintf(stderr, "Warning: Couldn't init SDL audio: %s\n", SDL_GetError()); fprintf(stderr, "Will ignore audio stream\n"); use_audio = 0; } } /* Allow Ctrl-C when there's no video output */ signal(SIGINT, next_movie); /* Create the MPEG stream */ #ifdef NET_SUPPORT #ifdef RAW_SUPPORT /* Check if source is an IP address and port*/ if((fd = raw_open(argv[i])) != 0) mpeg = SMPEG_new_descr(fd, &info, use_audio); else #endif #ifdef HTTP_SUPPORT /* Check if source is an http URL */ if((fd = http_open(argv[i])) != 0) mpeg = SMPEG_new_descr(fd, &info, use_audio); else #endif #ifdef FTP_SUPPORT /* Check if source is an http URL */ if((fd = ftp_open(argv[i])) != 0) mpeg = SMPEG_new_descr(fd, &info, use_audio); else #endif #endif #ifdef VCD_SUPPORT /* Check if source is a CDROM device */ if((fd = vcd_open(argv[i])) != 0) mpeg = SMPEG_new_descr(fd, &info, use_audio); else #endif { if(strcmp(argv[i], "-") == 0) /* Use stdin for input */ mpeg = SMPEG_new_descr(0, &info, use_audio); else mpeg = SMPEG_new(argv[i], &info, use_audio); } if ( SMPEG_error(mpeg) ) { fprintf(stderr, "%s: %s\n", argv[i], SMPEG_error(mpeg)); SMPEG_delete(mpeg); status = -1; continue; } SMPEG_enableaudio(mpeg, use_audio); SMPEG_enablevideo(mpeg, use_video); SMPEG_setvolume(mpeg, volume); /* Enable software bilinear filtering, if desired */ if ( bilinear_filtering ) { SMPEG_Filter *filter; filter = SMPEGfilter_bilinear(); filter = SMPEG_filter( mpeg, filter ); filter->destroy(filter); } /* Print information about the video */ basefile = strrchr(argv[i], '/'); if ( basefile ) { ++basefile; } else { basefile = argv[i]; } if ( info.has_audio && info.has_video ) { printf("%s: MPEG system stream (audio/video)\n", basefile); } else if ( info.has_audio ) { printf("%s: MPEG audio stream\n", basefile); } else if ( info.has_video ) { printf("%s: MPEG video stream\n", basefile); } if ( info.has_video ) { printf("\tVideo %dx%d resolution\n", info.width, info.height); } if ( info.has_audio ) { printf("\tAudio %s\n", info.audio_string); } if ( info.total_size ) { printf("\tSize: %d\n", info.total_size); } if ( info.total_time ) { printf("\tTotal time: %f\n", info.total_time); } /* Set up video display if needed */ if ( info.has_video && use_video ) { const SDL_VideoInfo *video_info; Uint32 video_flags; int video_bpp; int width, height; /* Get the "native" video mode */ video_info = SDL_GetVideoInfo(); switch (video_info->vfmt->BitsPerPixel) { case 16: case 24: case 32: video_bpp = video_info->vfmt->BitsPerPixel; break; default: video_bpp = 16; break; } if ( scale_width ) { width = scale_width; } else { width = info.width; } width *= scalesize; if ( scale_height ) { height = scale_height; } else { height = info.height; } height *= scalesize; video_flags = SDL_SWSURFACE; if ( fullscreen ) { video_flags = SDL_FULLSCREEN|SDL_DOUBLEBUF|SDL_HWSURFACE; } video_flags |= SDL_ASYNCBLIT; video_flags |= SDL_RESIZABLE; screen = SDL_SetVideoMode(width, height, video_bpp, video_flags); if ( screen == NULL ) { fprintf(stderr, "Unable to set %dx%d video mode: %s\n", width, height, SDL_GetError()); continue; } SDL_WM_SetCaption(argv[i], "plaympeg"); if ( screen->flags & SDL_FULLSCREEN ) { SDL_ShowCursor(0); } SMPEG_setdisplay(mpeg, screen, NULL, update); SMPEG_scaleXY(mpeg, screen->w, screen->h); } else { SDL_QuitSubSystem(SDL_INIT_VIDEO); } /* Set any special playback parameters */ if ( loop_play ) { SMPEG_loop(mpeg, 1); } /* Seek starting position */ if(seek) SMPEG_seek(mpeg, seek); /* Skip seconds to starting position */ if(skip) SMPEG_skip(mpeg, skip); /* Play it, and wait for playback to complete */ SMPEG_play(mpeg); done = 0; pause = 0; while ( ! done && ( pause || (SMPEG_status(mpeg) == SMPEG_PLAYING) ) ) { SDL_Event event; while ( use_video && SDL_PollEvent(&event) ) { switch (event.type) { case SDL_VIDEORESIZE: { SDL_Surface *old_screen = screen; SMPEG_pause(mpeg); screen = SDL_SetVideoMode(event.resize.w, event.resize.h, screen->format->BitsPerPixel, screen->flags); if ( old_screen != screen ) { SMPEG_setdisplay(mpeg, screen, NULL, update); } SMPEG_scaleXY(mpeg, screen->w, screen->h); SMPEG_pause(mpeg); } break; case SDL_KEYDOWN: if ( (event.key.keysym.sym == SDLK_ESCAPE) || (event.key.keysym.sym == SDLK_q) ) { // Quit done = 1; } else if ( event.key.keysym.sym == SDLK_RETURN ) { // toggle fullscreen if ( event.key.keysym.mod & KMOD_ALT ) { SDL_WM_ToggleFullScreen(screen); fullscreen = (screen->flags & SDL_FULLSCREEN); SDL_ShowCursor(!fullscreen); } } else if ( event.key.keysym.sym == SDLK_UP ) { // Volume up if ( volume < 100 ) { if ( event.key.keysym.mod & KMOD_SHIFT ) { // 10+ volume += 10; } else if ( event.key.keysym.mod & KMOD_CTRL ) { // 100+ volume = 100; } else { // 1+ volume++; } if ( volume > 100 ) volume = 100; SMPEG_setvolume(mpeg, volume); } } else if ( event.key.keysym.sym == SDLK_DOWN ) { // Volume down if ( volume > 0 ) { if ( event.key.keysym.mod & KMOD_SHIFT ) { volume -= 10; } else if ( event.key.keysym.mod & KMOD_CTRL ) { volume = 0; } else { volume--; } if ( volume < 0 ) volume = 0; SMPEG_setvolume(mpeg, volume); } } else if ( event.key.keysym.sym == SDLK_PAGEUP ) { // Full volume volume = 100; SMPEG_setvolume(mpeg, volume); } else if ( event.key.keysym.sym == SDLK_PAGEDOWN ) { // Volume off volume = 0; SMPEG_setvolume(mpeg, volume); } else if ( event.key.keysym.sym == SDLK_SPACE ) { // Toggle play / pause if ( SMPEG_status(mpeg) == SMPEG_PLAYING ) { SMPEG_pause(mpeg); pause = 1; } else { SMPEG_play(mpeg); pause = 0; } } else if ( event.key.keysym.sym == SDLK_RIGHT ) { // Forward if ( event.key.keysym.mod & KMOD_SHIFT ) { SMPEG_skip(mpeg, 100); } else if ( event.key.keysym.mod & KMOD_CTRL ) { SMPEG_skip(mpeg, 50); } else { SMPEG_skip(mpeg, 5); } } else if ( event.key.keysym.sym == SDLK_LEFT ) { // Reverse if ( event.key.keysym.mod & KMOD_SHIFT ) { } else if ( event.key.keysym.mod & KMOD_CTRL ) { } else { } } else if ( event.key.keysym.sym == SDLK_KP_MINUS ) { // Scale minus if ( scalesize > 1 ) { scalesize--; } } else if ( event.key.keysym.sym == SDLK_KP_PLUS ) { // Scale plus scalesize++; } else if ( event.key.keysym.sym == SDLK_f ) { // Toggle filtering on/off if ( bilinear_filtering ) { SMPEG_Filter *filter = SMPEGfilter_null(); filter = SMPEG_filter( mpeg, filter ); filter->destroy(filter); bilinear_filtering = 0; } else { SMPEG_Filter *filter = SMPEGfilter_bilinear(); filter = SMPEG_filter( mpeg, filter ); filter->destroy(filter); bilinear_filtering = 1; } } break; case SDL_QUIT: done = 1; break; default: break; } } SDL_Delay(1000/2); } SMPEG_delete(mpeg); } SDL_Quit(); #if defined(RAW_SUPPORT) || defined(HTTP_SUPPORT) || defined(FTP_SUPPORT) || \ defined(VCD_SUPPORT) if(fd) close(fd); #endif return(status); } smpeg-0.4.5+cvs20030824.orig/gtv.c0100644000175000017500000012776207266641534016327 0ustar hoseheadhosehead/* * gtv - a Gtk+ based SMPEG player * (c) Michael Vance, 1999 * briareos@lokigames.com * * TODO * - SMPEG returns an incorrect current_frame after a * call to SMPEG_renderFinal(). * - SMPEG loops audio incorrectly when audio stream is * shorter than a video stream, etc. */ #include "gtv.h" #include "SDL_syswm.h" #define TIMER_TIMEOUT 100 static GtkWidget* create_gtv_window( void ); static void gtv_connect( gpointer, gchar*, gchar*, GtkSignalFunc ); static void gtv_set_frame( gpointer, int ); static void gtv_set_fps( gpointer, float ); static void gtv_set_trackbar( gpointer, int ); static void gtv_set_sensitive( gpointer, gchar*, gboolean ); static void gtv_clear_screen( gpointer ); static void gtv_fix_toggle_state( gpointer ); static void gtv_double( GtkWidget*, gpointer ); static void gtv_loop( GtkWidget*, gpointer ); static void gtv_audio( GtkWidget*, gpointer ); static void gtv_filter( GtkWidget*, gpointer ); static void gtv_open( GtkWidget*, gpointer ); static void gtv_open_file( gchar*, gpointer ); static void gtv_close( GtkWidget*, gpointer ); static void gtv_info( GtkWidget*, gpointer ); static void gtv_quit( GtkWidget*, gpointer ); static void gtv_about( GtkWidget*, gpointer ); static void gtv_play( GtkWidget*, gpointer ); static void gtv_pause( GtkWidget*, gpointer ); static void gtv_stop( GtkWidget*, gpointer ); static void gtv_step( GtkWidget*, gpointer ); static void gtv_to_end( GtkWidget*, gpointer ); static void gtv_seek( GtkAdjustment*, gpointer ); static void gtv_drag_data_received(GtkWidget * widget, GdkDragContext * context, gint x, gint y, GtkSelectionData * selection_data, guint info, guint time); static int gtv_trackbar_dragging; static gchar * gtv_default_directory = 0; static void gtv_fix_toggle_state( gpointer raw ) { SMPEG* mpeg = NULL; assert( raw ); mpeg = (SMPEG*) gtk_object_get_data( GTK_OBJECT( raw ), "mpeg" ); /* If no mpeg is loaded, pop all the buttons. */ if( !mpeg ) { GtkWidget* twotimes = NULL; GtkWidget* loop = NULL; GtkWidget* audio = NULL; GtkWidget* filter = NULL; twotimes = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( raw ), "twotimes" ) ); loop = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( raw ), "loop" ) ); audio = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( raw ), "audio" ) ); filter = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( raw ), "filter" ) ); #if 1 /* Sam 5/31/2000 - Default to doubled video and audio on */ gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( twotimes ), FALSE ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( loop ), FALSE ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( audio ), TRUE ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( filter ), FALSE ); #else gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( twotimes ), FALSE ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( loop ), FALSE ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( audio ), FALSE ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( filter ), FALSE ); #endif } } static void gtv_set_sensitive( gpointer raw, gchar* name, gboolean sensitive ) { GtkWidget* item = NULL; assert( raw ); assert( name ); item = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( raw ), name ) ); assert( item ); gtk_widget_set_sensitive( item, sensitive ); } static void gtv_set_buttons_sensitive( gpointer raw, gboolean sensitive ) { SMPEG_Info* info = NULL; /* HACK If no MPEG is loaded, info has been memset()'ed to 0. */ info = (SMPEG_Info*) gtk_object_get_data( GTK_OBJECT( raw ), "info" ); gtv_set_sensitive( raw, "play", sensitive ); gtv_set_sensitive( raw, "pause", sensitive ); gtv_set_sensitive( raw, "stop", sensitive ); gtv_set_sensitive( raw, "step", sensitive && info->has_video ); gtv_set_sensitive( raw, "to_end", sensitive && info->has_video ); gtv_set_sensitive( raw, "loop", sensitive ); gtv_set_sensitive( raw, "close", sensitive ); gtv_set_sensitive( raw, "file_info", sensitive ); gtv_set_sensitive( raw, "twotimes", sensitive && info->has_video ); gtv_set_sensitive( raw, "audio", sensitive && info->has_audio && info->has_video); gtv_set_sensitive( raw, "filter", sensitive && info->has_video ); gtv_fix_toggle_state( raw ); } static void gtv_dialog_cleanup( gpointer raw ) { GtkWidget* dialog = NULL; dialog = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( raw ), "dialog" ) ); gtk_grab_remove( dialog ); gtk_widget_destroy( dialog ); gtk_object_set_data( GTK_OBJECT( raw ), "dialog", NULL ); } static void gtv_dialog_cancel( GtkWidget* item, gpointer raw ) { gtv_dialog_cleanup( raw ); } static void gtv_open_ok( GtkWidget* item, gpointer raw ) { GtkWidget* file_sel = NULL; gchar* filename = NULL; /* HACK HACK HACK */ file_sel = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( raw ), "dialog" ) ); filename = gtk_file_selection_get_filename( GTK_FILE_SELECTION( file_sel ) ); if( filename ) { gtv_open_file( filename, raw ); if( strrchr( filename, '/') ) { if( gtv_default_directory ) free( gtv_default_directory ); gtv_default_directory = (gchar *) malloc( (strlen(filename) + 1) * sizeof(gchar) ); strcpy( gtv_default_directory, filename); *(strrchr( gtv_default_directory, '/' ) + 1) = 0; } } gtv_dialog_cleanup( raw ); } static void gtv_open( GtkWidget* item, gpointer raw ) { GtkWidget* file_sel = NULL; file_sel = gtk_file_selection_new( "Select an MPEG" ); gtk_signal_connect( GTK_OBJECT( GTK_FILE_SELECTION( file_sel )->ok_button ), "clicked", GTK_SIGNAL_FUNC( gtv_open_ok ), raw ); gtk_signal_connect( GTK_OBJECT( GTK_FILE_SELECTION( file_sel )->cancel_button ), "clicked", GTK_SIGNAL_FUNC( gtv_dialog_cancel ), raw ); if( gtv_default_directory ) gtk_file_selection_complete( GTK_FILE_SELECTION( file_sel ), gtv_default_directory ); gtk_file_selection_hide_fileop_buttons( GTK_FILE_SELECTION( file_sel ) ); /* HACK HACK HACK */ gtk_object_set_data( GTK_OBJECT( raw ), "dialog", file_sel ); gtk_grab_add( file_sel ); gtk_widget_show( file_sel ); } static void gtv_center_window(SDL_Surface *screen) { SDL_SysWMinfo info; SDL_VERSION(&info.version); if ( SDL_GetWMInfo(&info) > 0 ) { int x, y; int w, h; #ifdef unix if ( info.subsystem == SDL_SYSWM_X11 ) { info.info.x11.lock_func(); w = DisplayWidth(info.info.x11.display, DefaultScreen(info.info.x11.display)); h = DisplayHeight(info.info.x11.display, DefaultScreen(info.info.x11.display)); x = (w - screen->w)/2; y = (h - screen->h)/2; XMoveWindow(info.info.x11.display, info.info.x11.wmwindow, x, y); info.info.x11.unlock_func(); } #else #ifdef WIN32 /* FIXME: implement centering code for Windows */ #else #warning Need to implement these functions for other systems #endif // WIN32 #endif // unix } } static void gtv_open_file( gchar* name, gpointer raw ) { SMPEG_Info* info = NULL; SMPEG* mpeg = NULL; gchar buffer[FILENAME_BUFFER_SIZE]; assert( name ); assert( raw ); gtv_close( NULL, raw ); if( SDL_Init( SDL_INIT_AUDIO | SDL_INIT_VIDEO ) < 0 ) { fprintf( stderr, "gtv: couldn't initialize SDL: %s\n", SDL_GetError( ) ); exit( 1 ); } info = (SMPEG_Info*) gtk_object_get_data( GTK_OBJECT( raw ), "info" ); assert( info ); mpeg = SMPEG_new( name, info, 1 ); if( SMPEG_error( mpeg ) ) { fprintf( stderr, "gtv: %s\n", SMPEG_error( mpeg ) ); SMPEG_delete( mpeg ); gtk_object_set_data( GTK_OBJECT( raw ), "mpeg", NULL ); return; } gtk_object_set_data( GTK_OBJECT( raw ), "mpeg", mpeg ); strncpy( (char*) gtk_object_get_data( GTK_OBJECT( raw ), "filename_buffer" ), name, FILENAME_BUFFER_SIZE ); gtv_set_frame( raw, 0 ); gtv_set_fps( raw, 0.0 ); g_snprintf( buffer, FILENAME_BUFFER_SIZE, "gtv - %s", name ); gtk_window_set_title( GTK_WINDOW( raw ), buffer ); if( info->has_video ) { SDL_Surface* sdl_screen = NULL; const SDL_VideoInfo *video_info; int video_bpp; /* Get the "native" video mode */ video_info = SDL_GetVideoInfo(); switch (video_info->vfmt->BitsPerPixel) { case 16: case 32: video_bpp = video_info->vfmt->BitsPerPixel; break; default: video_bpp = 16; break; } #ifdef linux putenv("SDL_VIDEO_CENTERED=1"); #endif sdl_screen = SDL_SetVideoMode( info->width , info->height , video_bpp, SDL_ASYNCBLIT); SDL_WM_SetCaption(name, "gtv movie"); gtv_center_window(sdl_screen); SMPEG_setdisplay( mpeg, sdl_screen, NULL, NULL ); gtk_object_set_data( GTK_OBJECT( raw ), "sdl_screen", sdl_screen ); gtv_double( NULL, raw ); } gtv_loop( NULL, raw ); gtv_audio( NULL, raw ); gtv_filter( NULL, raw ); gtv_set_buttons_sensitive( raw, TRUE ); } static void gtv_close( GtkWidget* item, gpointer raw ) { SMPEG* mpeg = NULL; SMPEG_Info* info = NULL; assert( raw != NULL ); gtv_stop( NULL, raw ); mpeg = (SMPEG*) gtk_object_get_data( GTK_OBJECT( raw ), "mpeg" ); if( mpeg ) { SDL_Surface* sdl_screen = NULL; SMPEG_delete( mpeg ); gtk_object_set_data( GTK_OBJECT( raw ), "mpeg", NULL ); info = (SMPEG_Info*) gtk_object_get_data( GTK_OBJECT( raw ), "info" ); memset( info, 0, sizeof( SMPEG_Info ) ); sdl_screen = (SDL_Surface*) gtk_object_get_data( GTK_OBJECT( raw ), "sdl_screen" ); SDL_FreeSurface( sdl_screen ); gtk_object_set_data( GTK_OBJECT( raw ), "sdl_screen", NULL ); SDL_Quit( ); } /* Reset title. */ gtk_window_set_title( GTK_WINDOW( raw ), "gtv" ); gtv_set_frame( raw, 0 ); gtv_set_fps( raw, 0.0 ); gtv_set_buttons_sensitive( raw, FALSE ); } static GtkWidget* create_file_info_dialog( void ) { GtkWidget *file_info_dialog; GtkWidget *dialog_vbox1; GtkWidget *vbox2; GtkWidget *label5; GtkWidget *scrolledwindow1; GtkWidget *viewport1; GtkWidget *text; GtkWidget *dialog_action_area1; GtkWidget *ok; file_info_dialog = gtk_dialog_new (); gtk_object_set_data (GTK_OBJECT (file_info_dialog), "file_info_dialog", file_info_dialog); gtk_window_set_title (GTK_WINDOW (file_info_dialog), "File Info"); gtk_window_set_default_size (GTK_WINDOW (file_info_dialog), 256, 192); dialog_vbox1 = GTK_DIALOG (file_info_dialog)->vbox; gtk_object_set_data (GTK_OBJECT (file_info_dialog), "dialog_vbox1", dialog_vbox1); gtk_widget_show (dialog_vbox1); vbox2 = gtk_vbox_new (FALSE, 5); gtk_widget_ref (vbox2); gtk_object_set_data_full (GTK_OBJECT (file_info_dialog), "vbox2", vbox2, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (vbox2); gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox2, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (vbox2), 5); label5 = gtk_label_new ("File info:"); gtk_widget_ref (label5); gtk_object_set_data_full (GTK_OBJECT (file_info_dialog), "label5", label5, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label5); gtk_box_pack_start (GTK_BOX (vbox2), label5, FALSE, FALSE, 0); gtk_misc_set_alignment (GTK_MISC (label5), 0, 0.5); scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); gtk_widget_ref (scrolledwindow1); gtk_object_set_data_full (GTK_OBJECT (file_info_dialog), "scrolledwindow1", scrolledwindow1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (scrolledwindow1); gtk_box_pack_start (GTK_BOX (vbox2), scrolledwindow1, TRUE, TRUE, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); viewport1 = gtk_viewport_new (NULL, NULL); gtk_widget_ref (viewport1); gtk_object_set_data_full (GTK_OBJECT (file_info_dialog), "viewport1", viewport1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (viewport1); gtk_container_add (GTK_CONTAINER (scrolledwindow1), viewport1); text = gtk_text_new (NULL, NULL); gtk_widget_ref (text); gtk_object_set_data_full (GTK_OBJECT (file_info_dialog), "text", text, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (text); gtk_container_add (GTK_CONTAINER (viewport1), text); dialog_action_area1 = GTK_DIALOG (file_info_dialog)->action_area; gtk_object_set_data (GTK_OBJECT (file_info_dialog), "dialog_action_area1", dialog_action_area1); gtk_widget_show (dialog_action_area1); gtk_container_set_border_width (GTK_CONTAINER (dialog_action_area1), 10); ok = gtk_button_new_with_label (" OK "); gtk_widget_ref (ok); gtk_object_set_data_full (GTK_OBJECT (file_info_dialog), "ok", ok, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (ok); gtk_box_pack_start (GTK_BOX (dialog_action_area1), ok, FALSE, FALSE, 0); return file_info_dialog; } static void gtv_info( GtkWidget* item, gpointer raw ) { GtkWidget* dialog = NULL; GtkWidget* ok = NULL; gchar buffer[1024]; gint ignored = 0; GtkWidget* text = NULL; SMPEG_Info* info = NULL; int hh,mm,ss; dialog = create_file_info_dialog( ); ok = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( dialog ), "ok" ) ); gtk_signal_connect( GTK_OBJECT( ok ), "clicked", GTK_SIGNAL_FUNC( gtv_dialog_cancel ), raw ); /* HACK HACK HACK */ gtk_object_set_data( GTK_OBJECT( raw ), "dialog", dialog ); /* Actually stuff some data in there. */ info = (SMPEG_Info*) gtk_object_get_data( GTK_OBJECT( raw ), "info" ); hh = info->total_time / 3600; mm = (info->total_time - hh * 3600)/60; ss = ((int)info->total_time % 60); g_snprintf( buffer, 1024, "Filename: %s\nStream: %s\nVideo: %dx%d resolution\nAudio: %s\nSize: %d\nTime %d:%02d:%02d\n", (gchar*) gtk_object_get_data( GTK_OBJECT( raw ), "filename_buffer" ), ( info->has_audio && info->has_video ) ? "system" : ( info->has_video ? "video" : ( info->has_audio ? "audio" : "not MPEG" ) ), info->width, info->height, ( info->has_audio ? info->audio_string : "none" ), info->total_size , hh,mm,ss); text = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( dialog ), "text" ) ); gtk_editable_insert_text( GTK_EDITABLE( text ), buffer, strlen( buffer ), &ignored ); gtk_grab_add( dialog ); gtk_widget_show( dialog ); } static GtkWidget* create_about_dialog( void ) { GtkWidget *about_dialog; GtkWidget *dialog_vbox2; GtkWidget *scrolledwindow2; GtkWidget *viewport2; GtkWidget *text; GtkWidget *dialog_action_area2; GtkWidget *ok; about_dialog = gtk_dialog_new (); gtk_object_set_data (GTK_OBJECT (about_dialog), "about_dialog", about_dialog); gtk_window_set_title (GTK_WINDOW (about_dialog), "About gtv"); gtk_window_set_default_size (GTK_WINDOW (about_dialog), 384, 256); gtk_window_set_policy (GTK_WINDOW (about_dialog), TRUE, TRUE, FALSE); dialog_vbox2 = GTK_DIALOG (about_dialog)->vbox; gtk_object_set_data (GTK_OBJECT (about_dialog), "dialog_vbox2", dialog_vbox2); gtk_widget_show (dialog_vbox2); scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL); gtk_widget_ref (scrolledwindow2); gtk_object_set_data_full (GTK_OBJECT (about_dialog), "scrolledwindow2", scrolledwindow2, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (scrolledwindow2); gtk_box_pack_start (GTK_BOX (dialog_vbox2), scrolledwindow2, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (scrolledwindow2), 5); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); viewport2 = gtk_viewport_new (NULL, NULL); gtk_widget_ref (viewport2); gtk_object_set_data_full (GTK_OBJECT (about_dialog), "viewport2", viewport2, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (viewport2); gtk_container_add (GTK_CONTAINER (scrolledwindow2), viewport2); text = gtk_text_new (NULL, NULL); gtk_widget_ref (text); gtk_object_set_data_full (GTK_OBJECT (about_dialog), "text", text, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (text); gtk_container_add (GTK_CONTAINER (viewport2), text); dialog_action_area2 = GTK_DIALOG (about_dialog)->action_area; gtk_object_set_data (GTK_OBJECT (about_dialog), "dialog_action_area2", dialog_action_area2); gtk_widget_show (dialog_action_area2); gtk_container_set_border_width (GTK_CONTAINER (dialog_action_area2), 10); ok = gtk_button_new_with_label (" OK "); gtk_widget_ref (ok); gtk_object_set_data_full (GTK_OBJECT (about_dialog), "ok", ok, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (ok); gtk_box_pack_start (GTK_BOX (dialog_action_area2), ok, FALSE, FALSE, 0); return about_dialog; } static void gtv_about( GtkWidget* item, gpointer raw ) { static const char* msg = "gtv - Gtk+ MPEG Player\n" \ "(c) Michael Vance, 1999\n" \ " briareos@lokigames.com\n" \ "\n" \ "Built using:\n" \ "SMPEG - http://www.lokigames.com/development\n" \ "Gtk+ - http://www.gtk.org\n" \ "Glade - http://glade.pn.org\n" \ "\n" \ "Distributed under the GPL.\n"; GtkWidget* dialog = NULL; GtkWidget* ok = NULL; GtkWidget* text = NULL; gint ignored = 0; dialog = create_about_dialog( ); ok = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( dialog ), "ok" ) ); gtk_signal_connect( GTK_OBJECT( ok ), "clicked", GTK_SIGNAL_FUNC( gtv_dialog_cancel ), raw ); text = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( dialog ), "text" ) ); gtk_editable_insert_text( GTK_EDITABLE( text ), msg, strlen( msg ), &ignored ); /* HACK HACK HACK */ gtk_object_set_data( GTK_OBJECT( raw ), "dialog", dialog ); gtk_grab_add( dialog ); gtk_widget_show( dialog ); } static void gtv_rewind( gpointer raw ) { SMPEG* mpeg = NULL; assert( raw ); mpeg = (SMPEG*) gtk_object_get_data( GTK_OBJECT( raw ), "mpeg" ); if( mpeg ) { SMPEG_Info* info = NULL; SMPEG_rewind( mpeg ); gtv_clear_screen( raw ); info = (SMPEG_Info*) gtk_object_get_data( GTK_OBJECT( raw ), "info" ); SMPEG_getinfo( mpeg, info ); gtv_set_frame( raw, info->current_frame ); } } static void gtv_double( GtkWidget* item, gpointer raw ) { SMPEG* mpeg = NULL; SDL_Surface* sdl_screen = NULL; SMPEG_Info* info = NULL; int stopped=0; int width,height; assert( raw ); mpeg = (SMPEG*) gtk_object_get_data( GTK_OBJECT( raw ), "mpeg" ); sdl_screen = (SDL_Surface*) gtk_object_get_data( GTK_OBJECT( raw ), "sdl_screen" ); if( mpeg && sdl_screen ) { GtkWidget* twotimes = NULL; gboolean active = FALSE; twotimes = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( raw ), "twotimes" ) ); active = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( twotimes ) ); info = (SMPEG_Info*) gtk_object_get_data( GTK_OBJECT( raw ), "info" ); assert( info ); if (SMPEG_status(mpeg)==SMPEG_PLAYING) { SMPEG_pause(mpeg); stopped=1; } if( active ) { width = info->width * 2; height = info->height * 2; } else { width = info->width; height = info->height; } sdl_screen = SDL_SetVideoMode(width, height, sdl_screen->format->BitsPerPixel,sdl_screen->flags); gtv_center_window(sdl_screen); SMPEG_setdisplay( mpeg, sdl_screen, NULL, NULL ); gtk_object_set_data( GTK_OBJECT( raw ), "sdl_screen", sdl_screen ); SMPEG_scaleXY( mpeg, sdl_screen->w, sdl_screen->h ); gtv_center_window(sdl_screen); if (stopped) SMPEG_pause(mpeg); } } static void gtv_loop( GtkWidget* item, gpointer raw ) { SMPEG* mpeg = NULL; assert( raw ); mpeg = (SMPEG*) gtk_object_get_data( GTK_OBJECT( raw ), "mpeg" ); if( mpeg ) { GtkWidget* loop = NULL; gboolean active = FALSE; loop = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( raw ), "loop" ) ); active = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( loop ) ); SMPEG_loop( mpeg, active ); } } static void gtv_audio( GtkWidget* item, gpointer raw ) { SMPEG* mpeg = NULL; assert( raw ); mpeg = (SMPEG*) gtk_object_get_data( GTK_OBJECT( raw ), "mpeg" ); if( mpeg ) { GtkWidget* audio = NULL; gboolean active = FALSE; SMPEG_Info* info = NULL; audio = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( raw ), "audio" ) ); info = (SMPEG_Info*) gtk_object_get_data( GTK_OBJECT( raw ), "info" ); active = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( audio ) ); SMPEG_enableaudio( mpeg, active && info->has_audio ); } } static void gtv_filter( GtkWidget* item, gpointer raw ) { SMPEG* mpeg = NULL; SMPEG_Info* info = NULL; assert( raw ); mpeg = (SMPEG*) gtk_object_get_data( GTK_OBJECT( raw ), "mpeg" ); info = (SMPEG_Info*) gtk_object_get_data( GTK_OBJECT( raw ), "info" ); if( mpeg && info->has_video ) { GtkWidget* filter = NULL; gboolean active = FALSE; filter = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( raw ), "filter" ) ); active = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( filter ) ); if(active) { SMPEG_Filter * filter; /* Activate the bilinear filter */ filter = SMPEGfilter_bilinear(); filter = SMPEG_filter( mpeg, filter ); filter->destroy(filter); } else { SMPEG_Filter * filter; /* Reset to default (null) filter */ filter = SMPEGfilter_null(); filter = SMPEG_filter( mpeg, filter ); filter->destroy(filter); } } } static void gtv_play( GtkWidget* item, gpointer raw ) { SMPEG* mpeg = NULL; assert( raw ); mpeg = (SMPEG*) gtk_object_get_data( GTK_OBJECT( raw ), "mpeg" ); if( mpeg ) { // gtv_rewind( raw ); SMPEG_play( mpeg ); } } static void gtv_pause( GtkWidget* item, gpointer raw ) { SMPEG* mpeg = NULL; assert( raw ); mpeg = (SMPEG*) gtk_object_get_data( GTK_OBJECT( raw ), "mpeg" ); if( mpeg ) { SMPEG_pause( mpeg ); } } static void gtv_stop( GtkWidget* item, gpointer raw ) { SMPEG* mpeg = NULL; SMPEG_Info* info = NULL; assert( raw ); mpeg = (SMPEG*) gtk_object_get_data( GTK_OBJECT( raw ), "mpeg" ); info = (SMPEG_Info*) gtk_object_get_data( GTK_OBJECT( raw ), "info" ); if( mpeg ) { SMPEG_stop( mpeg ); gtv_rewind( raw ); SMPEG_getinfo( mpeg, info ); gtv_set_trackbar( raw, info->current_offset ); } } static void gtv_step( GtkWidget* item, gpointer raw ) { SMPEG* mpeg = NULL; SMPEG_Info* info = NULL; assert( raw ); mpeg = (SMPEG*) gtk_object_get_data( GTK_OBJECT( raw ), "mpeg" ); info = (SMPEG_Info*) gtk_object_get_data( GTK_OBJECT( raw ), "info" ); if( mpeg && info && info->has_video && ( SMPEG_status( mpeg ) != SMPEG_PLAYING ) ) { int next_frame = 0; GtkWidget* twotimes = NULL; gboolean active = FALSE; SDL_Surface* sdl_screen = NULL; SMPEG_getinfo( mpeg, info ); next_frame = info->current_frame + 1; twotimes = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( raw ), "twotimes" ) ); active = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( twotimes ) ); sdl_screen = (SDL_Surface*) gtk_object_get_data( GTK_OBJECT( raw ), "sdl_screen" ); SMPEG_renderFrame( mpeg, next_frame ); SMPEG_getinfo( mpeg, info ); if( info->current_frame != next_frame ) { GtkWidget *looping; /* Sam 5/31/2000 - Only loop if the looping toggle is set */ looping = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(raw), "loop")); if ( ! gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(looping)) ) { return; } gtv_rewind( raw ); gtv_step( NULL, raw ); } gtv_set_frame( raw, info->current_frame ); } } static void gtv_to_end( GtkWidget* item, gpointer raw ) { SMPEG* mpeg = NULL; SMPEG_Info* info = NULL; assert( raw ); mpeg = (SMPEG*) gtk_object_get_data( GTK_OBJECT( raw ), "mpeg" ); info = (SMPEG_Info*) gtk_object_get_data( GTK_OBJECT( raw ), "info" ); if( mpeg && info->has_video ) { GtkWidget* twotimes = NULL; gboolean active = FALSE; SDL_Surface* sdl_screen = NULL; SMPEG_stop( mpeg ); twotimes = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( raw ), "twotimes" ) ); active = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( twotimes ) ); sdl_screen = (SDL_Surface*) gtk_object_get_data( GTK_OBJECT( raw ), "sdl_screen" ); if( active ) { SMPEG_renderFinal( mpeg, sdl_screen, 0, 0 ); } else { SMPEG_renderFinal( mpeg, sdl_screen, ( sdl_screen->w - info->width ) / 2, ( sdl_screen->h - info->height ) / 2 ); } SMPEG_getinfo( mpeg, info ); gtv_set_frame( raw, info->current_frame ); } } static void gtv_seek( GtkAdjustment* adjust, gpointer raw ) { SMPEG* mpeg = NULL; SMPEG_Info* info = NULL; assert( raw ); if(gtv_trackbar_dragging) return; mpeg = (SMPEG*) gtk_object_get_data( GTK_OBJECT( raw ), "mpeg" ); info = (SMPEG_Info*) gtk_object_get_data( GTK_OBJECT( raw ), "info" ); if( mpeg && info && info->total_size ) { /* In case file is growing while we're playing */ SMPEG_getinfo( mpeg, info ); SMPEG_seek(mpeg, (int)((info->total_size*adjust->value)/100)); SMPEG_getinfo( mpeg, info ); gtv_set_frame( raw, info->current_frame ); } } static void gtv_trackbar_drag_on(GtkWidget *widget, gpointer raw) { gtv_trackbar_dragging = 1; } static void gtv_trackbar_drag_off(GtkWidget *widget, gpointer raw) { gtv_trackbar_dragging = 0; } static void gtv_set_frame( gpointer raw, int value ) { GtkWidget* frame = NULL; gchar buffer[32]; assert( raw ); assert( value >= 0 ); frame = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( raw ), "frame" ) ); g_snprintf( buffer, 32, "%d", value ); gtk_label_set_text( GTK_LABEL( frame ), buffer ); } static void gtv_set_fps( gpointer raw, float value ) { GtkWidget* fps = NULL; gchar buffer[32]; assert( raw ); assert( value >= 0.0 ); fps = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( raw ), "fps" ) ); g_snprintf( buffer, 32, "%2.2f", value ); gtk_label_set_text( GTK_LABEL( fps ), buffer ); } static void gtv_set_trackbar( gpointer raw, int value ) { SMPEG* mpeg = NULL; SMPEG_Info* info = NULL; GtkWidget* scale = NULL; GtkAdjustment* seek = NULL; assert( raw ); assert( value >= 0 ); if(gtv_trackbar_dragging) return; mpeg = (SMPEG*) gtk_object_get_data( GTK_OBJECT( raw ), "mpeg" ); info = (SMPEG_Info*) gtk_object_get_data( GTK_OBJECT( raw ), "info" ); if( mpeg && info && info->total_size ) { scale = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( raw ), "scale" ) ); seek = gtk_range_get_adjustment ( GTK_RANGE( scale ) ); seek->value = 100. * value / info->total_size; gtk_range_set_adjustment ( GTK_RANGE( scale ), seek ); gtk_range_slider_update ( GTK_RANGE( scale ) ); gtk_range_clear_background ( GTK_RANGE( scale ) ); gtk_range_draw_background ( GTK_RANGE( scale ) ); } } /* Drag-N-Drop support, contributed by */ static void gtv_drag_data_received(GtkWidget * widget, GdkDragContext * context, gint x, gint y, GtkSelectionData * selection_data, guint info, guint time) { gchar *temp, *string; string = (gchar *)selection_data->data; /* remove newline at end of line, and the file:// url header at the begining, copied this code from the xmms source */ temp = strchr(string, '\n'); if (temp) { if (*(temp - 1) == '\r') *(temp - 1) = '\0'; *temp = '\0'; } if (!strncmp(string, "file:", 5)) string = string + 5; gtv_open_file(string, widget); gtv_play(NULL, widget); } static gint gtv_timer( gpointer raw ) { SMPEG* mpeg = NULL; SMPEG_Info* info = NULL; mpeg = (SMPEG*) gtk_object_get_data( GTK_OBJECT( raw ), "mpeg" ); info = (SMPEG_Info*) gtk_object_get_data( GTK_OBJECT( raw ), "info" ); if( mpeg && info ) { if( SMPEG_status( mpeg ) == SMPEG_PLAYING ) { SMPEG_getinfo( mpeg, info ); gtv_set_frame( raw, info->current_frame ); gtv_set_fps( raw, info->current_fps ); gtv_set_trackbar( raw, info->current_offset ); } } return 1; } static void gtv_clear_screen( gpointer raw ) { SDL_Surface* sdl_screen = NULL; sdl_screen = (SDL_Surface*) gtk_object_get_data( GTK_OBJECT( raw ), "sdl_screen" ); if( sdl_screen ) { SDL_FillRect( sdl_screen, NULL, SDL_MapRGB( sdl_screen->format, 0, 0, 0 ) ); SDL_UpdateRect( sdl_screen, 0, 0, 0, 0 ); } } static void gtv_quit( GtkWidget* item, gpointer raw ) { gtv_close( NULL, raw ); gtk_exit( 0 ); } static void gtv_connect( gpointer raw, gchar* name, gchar* signal, GtkSignalFunc func ) { GtkObject* item = NULL; assert( raw ); item = GTK_OBJECT( gtk_object_get_data( GTK_OBJECT( raw ), name ) ); assert( item ); gtk_signal_connect(item, signal, func, raw ); } int main( int argc, char* argv[] ) { static GtkTargetEntry drop_types[] = { { "text/plain", 0, 1 } }; /* These are always on the stack until program exit. */ SMPEG_Info info; gchar filename_buffer[FILENAME_BUFFER_SIZE]; GtkWidget* window = NULL; memset( &info, 0, sizeof( info ) ); memset( &filename_buffer, 0, sizeof( gchar ) * FILENAME_BUFFER_SIZE ); gtk_set_locale(); gtk_init( &argc, &argv ); window = create_gtv_window( ); gtk_drag_dest_set(window, GTK_DEST_DEFAULT_ALL, drop_types, 1, GDK_ACTION_COPY); gtk_signal_connect( GTK_OBJECT( window ), "drag_data_received", GTK_SIGNAL_FUNC( gtv_drag_data_received ), window ); gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtv_quit ), window ); gtk_object_set_data( GTK_OBJECT( window ), "info", &info ); gtk_object_set_data( GTK_OBJECT( window ), "mpeg", NULL ); gtk_object_set_data( GTK_OBJECT( window ), "sdl_screen", NULL ); gtk_object_set_data( GTK_OBJECT( window ), "filename_buffer", filename_buffer ); gtk_widget_show( window ); gtv_connect( window, "open", "activate", GTK_SIGNAL_FUNC( gtv_open ) ); gtv_connect( window, "close", "activate", GTK_SIGNAL_FUNC( gtv_close ) ); gtv_connect( window, "file_info", "activate", GTK_SIGNAL_FUNC( gtv_info ) ); gtv_connect( window, "quit", "activate", GTK_SIGNAL_FUNC( gtv_quit ) ); gtv_connect( window, "about", "activate", GTK_SIGNAL_FUNC( gtv_about ) ); gtv_connect( window, "play", "clicked", GTK_SIGNAL_FUNC( gtv_play ) ); gtv_connect( window, "pause", "clicked", GTK_SIGNAL_FUNC( gtv_pause ) ); gtv_connect( window, "stop", "clicked", GTK_SIGNAL_FUNC( gtv_stop ) ); gtv_connect( window, "step", "clicked", GTK_SIGNAL_FUNC( gtv_step ) ); gtv_connect( window, "to_end", "clicked", GTK_SIGNAL_FUNC( gtv_to_end ) ); gtv_connect( window, "twotimes", "toggled", GTK_SIGNAL_FUNC( gtv_double ) ); gtv_connect( window, "loop", "toggled", GTK_SIGNAL_FUNC( gtv_loop ) ); gtv_connect( window, "audio", "toggled", GTK_SIGNAL_FUNC( gtv_audio ) ); gtv_connect( window, "filter", "toggled", GTK_SIGNAL_FUNC( gtv_filter ) ); gtv_connect( window, "seek", "value_changed", GTK_SIGNAL_FUNC( gtv_seek ) ); gtv_connect( window, "scale", "button_press_event", GTK_SIGNAL_FUNC( gtv_trackbar_drag_on ) ); gtv_connect( window, "scale", "button_release_event", GTK_SIGNAL_FUNC( gtv_trackbar_drag_off ) ); /* gtk_idle_add_priority( G_PRIORITY_LOW, gtv_timer, window );*/ gtk_timeout_add( TIMER_TIMEOUT, gtv_timer, window ); gtv_set_frame( window, 0 ); gtv_set_fps( window, 0.0 ); gtv_set_buttons_sensitive( window, FALSE ); if( argc > 1 ) { gtv_open_file( argv[1], window ); } gtk_main( ); return 0; } static GtkWidget* create_gtv_window( void ) { GtkWidget *gtv_window; GtkWidget *vbox1; GtkWidget *menubar1; GtkWidget *file; GtkWidget *file_menu; GtkAccelGroup *file_menu_accels; GtkWidget *open; GtkWidget *close; GtkWidget *separator1; GtkWidget *file_info; GtkWidget *separator2; GtkWidget *quit; GtkWidget *help; GtkWidget *help_menu; GtkAccelGroup *help_menu_accels; GtkWidget *about; GtkWidget *table1; GtkObject *seek; GtkWidget *scale; GtkWidget *play; GtkWidget *pause; GtkWidget *stop; GtkWidget *step; GtkWidget *to_end; GtkWidget *twotimes; GtkWidget *loop; GtkWidget *audio; GtkWidget *filter; GtkWidget *label3; GtkWidget *fps; GtkWidget *label2; GtkWidget *frame; GtkAccelGroup *accel_group; accel_group = gtk_accel_group_new (); gtv_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_object_set_data (GTK_OBJECT (gtv_window), "gtv_window", gtv_window); gtk_window_set_title (GTK_WINDOW (gtv_window), "gtv"); gtk_widget_set_uposition (GTK_WIDGET (gtv_window), 0, 0); vbox1 = gtk_vbox_new (FALSE, 0); gtk_widget_ref (vbox1); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "vbox1", vbox1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (vbox1); gtk_container_add (GTK_CONTAINER (gtv_window), vbox1); menubar1 = gtk_menu_bar_new (); gtk_widget_ref (menubar1); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "menubar1", menubar1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (menubar1); gtk_box_pack_start (GTK_BOX (vbox1), menubar1, FALSE, FALSE, 0); file = gtk_menu_item_new_with_label ("File"); gtk_widget_ref (file); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "file", file, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (file); gtk_container_add (GTK_CONTAINER (menubar1), file); file_menu = gtk_menu_new (); gtk_widget_ref (file_menu); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "file_menu", file_menu, (GtkDestroyNotify) gtk_widget_unref); gtk_menu_item_set_submenu (GTK_MENU_ITEM (file), file_menu); file_menu_accels = gtk_menu_ensure_uline_accel_group (GTK_MENU (file_menu)); open = gtk_menu_item_new_with_label ("Open"); gtk_widget_ref (open); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "open", open, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (open); gtk_container_add (GTK_CONTAINER (file_menu), open); gtk_widget_add_accelerator (open, "activate", accel_group, GDK_O, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); close = gtk_menu_item_new_with_label ("Close"); gtk_widget_ref (close); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "close", close, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (close); gtk_container_add (GTK_CONTAINER (file_menu), close); gtk_widget_add_accelerator (close, "activate", accel_group, GDK_W, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); separator1 = gtk_menu_item_new (); gtk_widget_ref (separator1); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "separator1", separator1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (separator1); gtk_container_add (GTK_CONTAINER (file_menu), separator1); gtk_widget_set_sensitive (separator1, FALSE); file_info = gtk_menu_item_new_with_label ("Info"); gtk_widget_ref (file_info); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "file_info", file_info, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (file_info); gtk_container_add (GTK_CONTAINER (file_menu), file_info); gtk_widget_add_accelerator (file_info, "activate", accel_group, GDK_I, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); separator2 = gtk_menu_item_new (); gtk_widget_ref (separator2); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "separator2", separator2, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (separator2); gtk_container_add (GTK_CONTAINER (file_menu), separator2); gtk_widget_set_sensitive (separator2, FALSE); quit = gtk_menu_item_new_with_label ("Quit"); gtk_widget_ref (quit); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "quit", quit, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (quit); gtk_container_add (GTK_CONTAINER (file_menu), quit); gtk_widget_add_accelerator (quit, "activate", accel_group, GDK_Q, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); help = gtk_menu_item_new_with_label ("Help"); gtk_widget_ref (help); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "help", help, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (help); gtk_container_add (GTK_CONTAINER (menubar1), help); gtk_menu_item_right_justify (GTK_MENU_ITEM (help)); help_menu = gtk_menu_new (); gtk_widget_ref (help_menu); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "help_menu", help_menu, (GtkDestroyNotify) gtk_widget_unref); gtk_menu_item_set_submenu (GTK_MENU_ITEM (help), help_menu); help_menu_accels = gtk_menu_ensure_uline_accel_group (GTK_MENU (help_menu)); about = gtk_menu_item_new_with_label ("About"); gtk_widget_ref (about); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "about", about, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (about); gtk_container_add (GTK_CONTAINER (help_menu), about); gtk_widget_add_accelerator (about, "activate", accel_group, GDK_F1, 0, GTK_ACCEL_VISIBLE); table1 = gtk_table_new (4, 5, FALSE); gtk_widget_ref (table1); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "table1", table1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (table1); gtk_box_pack_start (GTK_BOX (vbox1), table1, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (table1), 5); gtk_table_set_row_spacings (GTK_TABLE (table1), 5); gtk_table_set_col_spacings (GTK_TABLE (table1), 5); seek = gtk_adjustment_new(0.0, 0.0, 100.0, 1.0, 0.0, 0.0); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "seek", seek, (GtkDestroyNotify) (0)); scale = gtk_hscale_new(GTK_ADJUSTMENT(seek)); gtv_trackbar_dragging = 0; gtk_widget_ref (scale); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "scale", scale, (GtkDestroyNotify) gtk_widget_unref); gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED); gtk_widget_show (scale); gtk_table_attach (GTK_TABLE (table1), scale, 0, 5, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); play = gtk_button_new_with_label (" Play "); gtk_widget_ref (play); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "play", play, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (play); gtk_table_attach (GTK_TABLE (table1), play, 0, 1, 1, 2, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); pause = gtk_button_new_with_label (" Pause "); gtk_widget_ref (pause); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "pause", pause, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (pause); gtk_table_attach (GTK_TABLE (table1), pause, 1, 2, 1, 2, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); stop = gtk_button_new_with_label (" Stop "); gtk_widget_ref (stop); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "stop", stop, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (stop); gtk_table_attach (GTK_TABLE (table1), stop, 2, 3, 1, 2, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); step = gtk_button_new_with_label (" Step "); gtk_widget_ref (step); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "step", step, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (step); gtk_table_attach (GTK_TABLE (table1), step, 3, 4, 1, 2, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); to_end = gtk_button_new_with_label (" To End "); gtk_widget_ref (to_end); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "to_end", to_end, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (to_end); gtk_table_attach (GTK_TABLE (table1), to_end, 4, 5, 1, 2, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); twotimes = gtk_check_button_new_with_label ("Double"); gtk_widget_ref (twotimes); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "twotimes", twotimes, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (twotimes); gtk_table_attach (GTK_TABLE (table1), twotimes, 0, 1, 2, 3, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); loop = gtk_check_button_new_with_label ("Loop"); gtk_widget_ref (loop); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "loop", loop, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (loop); gtk_table_attach (GTK_TABLE (table1), loop, 1, 2, 2, 3, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); audio = gtk_check_button_new_with_label ("Audio"); gtk_widget_ref (audio); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "audio", audio, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (audio); gtk_table_attach (GTK_TABLE (table1), audio, 2, 3, 2, 3, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); filter = gtk_check_button_new_with_label ("Filter"); gtk_widget_ref (filter); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "filter", filter, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (filter); gtk_table_attach (GTK_TABLE (table1), filter, 3, 4, 2, 3, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); label3 = gtk_label_new ("Current frame:"); gtk_widget_ref (label3); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "label3", label3, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label3); gtk_table_attach (GTK_TABLE (table1), label3, 0, 2, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label3), 1, 0.5); fps = gtk_label_new (""); gtk_widget_ref (fps); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "fps", fps, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (fps); gtk_table_attach (GTK_TABLE (table1), fps, 3, 4, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (fps), 1, 0.5); label2 = gtk_label_new ("fps"); gtk_widget_ref (label2); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "label2", label2, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label2); gtk_table_attach (GTK_TABLE (table1), label2, 4, 5, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5); frame = gtk_label_new (""); gtk_widget_ref (frame); gtk_object_set_data_full (GTK_OBJECT (gtv_window), "frame", frame, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (frame); gtk_table_attach (GTK_TABLE (table1), frame, 2, 3, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (frame), 0, 0.5); gtk_window_add_accel_group (GTK_WINDOW (gtv_window), accel_group); return gtv_window; } smpeg-0.4.5+cvs20030824.orig/gtv.h0100644000175000017500000000052507106434646016314 0ustar hoseheadhosehead#ifndef GTV_H #define GTV_H #include #include #include #include #include #include #include #include "smpeg.h" #define FILENAME_BUFFER_SIZE 256 #ifdef __cplusplus extern "C" { #endif /* Nothing here presently. */ #ifdef __cplusplus } #endif #endif smpeg-0.4.5+cvs20030824.orig/glmovie-tile.c0100644000175000017500000002205107203032642020066 0ustar hoseheadhosehead/* * MODIFIED by Bruce Merry (bmerry@iafrica.com) on 10/11/2000 * - fixed to handle arbitrary tile dimensions, not just 1x2 * - max_texture_size renamed to texture_size and used as a variable * (to change the max texture size, edit the assigned value in the decl) * - hardcoded 256's changed to texture_size to allow small texture sizes * (e.g. for very low-res movies) * - all pieces of movie copied into the top left corner of texture tiles, * instead of being offset * - mechanism for keeping tiles aligned changed: a one texel border is * included in the tiles, which I think is used by the filtering even though * it is not explicitly selected for rendering (I think - I don't know much * about OpenGL, I've just fiddled until it looked right) * - removed glmovie_is_power_of_2: it was not needed and * it only went up to 2048 anyway. */ #include "glmovie.h" #include #include /* Some data is redundant at this stage. */ typedef struct glmovie_texture_t { GLuint id; /* OpenGL texture id. */ GLuint poly_width; /* Quad width for tile. */ GLuint poly_height; /* Quad height for tile. */ GLuint movie_width; /* Width of movie inside tile. */ GLuint movie_height; /* Height of movie inside tile. */ GLuint skip_rows; /* Number of rows of movie to skip */ GLuint skip_pixels; /* Number of columns of movie to skip */ GLuint row; /* Row number of tile in scheme. */ GLuint col; /* Column number of tile in scheme. */ } glmovie_texture; /* Boy, is this not thread safe. */ /* Our evil maximum texture size. Boo 3Dfx! */ static GLuint texture_size = 256; /* Keep this around for easy freeing later. */ static GLuint* texture_ids = NULL; /* Our main data. */ static glmovie_texture* textures = NULL; static GLuint num_texture_rows = 0; static GLuint num_texture_cols = 0; /* Width and height of all tiling. */ static GLuint tiled_width = 0; static GLuint tiled_height = 0; /* Width and height of entire movie. */ static GLuint movie_width = 0; static GLuint movie_height = 0; /* * Draw the frame data. * * Parameters: * frame: Actual RGBA frame data */ void glmovie_draw( GLubyte* frame ) { GLuint i; GLdouble shift; glClear( GL_COLOR_BUFFER_BIT ); glMatrixMode( GL_MODELVIEW ); glLoadIdentity( ); shift = 1 / ((double) texture_size); for (i = 0; i < num_texture_rows * num_texture_cols; i++) { glBindTexture( GL_TEXTURE_2D, textures[i].id ); glPixelStorei( GL_UNPACK_ROW_LENGTH, movie_width ); glPixelStorei( GL_UNPACK_SKIP_ROWS, textures[i].skip_rows ); glPixelStorei( GL_UNPACK_SKIP_PIXELS, textures[i].skip_pixels ); glTexSubImage2D( GL_TEXTURE_2D, 0, 0, /* offset_x */ 0, /* offset_y */ textures[i].movie_width + 2, textures[i].movie_height + 2, GL_RGBA, GL_UNSIGNED_BYTE, frame ); glBegin( GL_QUADS ); glTexCoord2f( shift, shift ); glVertex2i( textures[i].col * texture_size, textures[i].row * texture_size ); glTexCoord2f( shift, shift + (textures[i].movie_height)/((double) texture_size) ); glVertex2i( textures[i].col * texture_size, (textures[i].row + 1) * texture_size); glTexCoord2f( shift + (textures[i].movie_width)/((double) texture_size), shift + (textures[i].movie_height)/((double) texture_size) ); glVertex2i( (textures[i].col + 1) * texture_size, (textures[i].row + 1) * texture_size); glTexCoord2f( shift + (textures[i].movie_width)/((double) texture_size), shift ); glVertex2i( (textures[i].col + 1) * texture_size, textures[i].row * texture_size ); glEnd( ); } } /* * Here we need to center the OpenGL viewport within the * window size that we are given. * * Parameters: * width: Width of the window in pixels * height: Height of the window in pixels */ void glmovie_resize( GLuint width, GLuint height ) { glViewport( 0, 0, width, height ); glMatrixMode( GL_PROJECTION ); glLoadIdentity( ); gluOrtho2D( 0, tiled_width, tiled_height, 0 ); } /* * Calculates the next power of 2 given a particular value. * Useful for calculating proper texture sizes for non power-of-2 * aligned texures. * * Parameters: * seed: Value to begin from * Returns: * Next power of 2 beginning from 'seed' */ GLuint glmovie_next_power_of_2( GLuint seed ) { GLuint i; for( i = 1; i < seed; i *= 2 ) { }; return i; } /* * Initialize the movie player subsystem with the width and height * of the *movie data* (as opposed to the window). * * Parameters: * width: Width of movie in pixels * height: Height of movie in pixels * Returns: * GL_NO_ERROR on success * Any of the enumerated GL errors on failure */ GLenum glmovie_init( GLuint width, GLuint height ) { /* Initial black texels. */ GLubyte* pixels; /* Absolute offsets from within tiled frame. */ GLuint offset_x = 0; GLuint offset_y = 0; GLuint skip_rows = 0; GLuint skip_pixels = 0; GLuint i, j, current; /* Save original movie dimensions. */ movie_width = width; movie_height = height; /* Get the power of 2 dimensions. */ tiled_width = glmovie_next_power_of_2( width ); tiled_height = glmovie_next_power_of_2( height ); while ( texture_size > tiled_width || texture_size > tiled_height ) texture_size /= 2; /* Now break it up into quads. */ num_texture_rows = tiled_height / texture_size; num_texture_cols = tiled_width / texture_size; /* Time for fun with data structures. */ glPixelStorei( GL_UNPACK_ALIGNMENT, 1 ); glEnable( GL_TEXTURE_2D ); glEnable( GL_DITHER ); texture_ids = (GLuint*) malloc( sizeof( GLuint ) * num_texture_rows * num_texture_cols ); if( !texture_ids ) { return GL_OUT_OF_MEMORY; } glGenTextures( num_texture_rows * num_texture_cols, texture_ids ); textures = (glmovie_texture*) malloc( sizeof( glmovie_texture ) * num_texture_rows * num_texture_cols ); if( !textures ) { glDeleteTextures( num_texture_rows * num_texture_cols, texture_ids ); free( texture_ids ); return GL_OUT_OF_MEMORY; } for ( i = 0; i < num_texture_rows; i++ ) { skip_pixels = 0; for ( j = 0; j < num_texture_cols; j++ ) { current = i * num_texture_cols + j; /* Setup texture. */ textures[current].id = texture_ids[current]; textures[current].poly_width = texture_size; textures[current].poly_height = texture_size; textures[current].movie_width = (movie_width - 2) * (j + 1) / num_texture_cols - skip_pixels; textures[current].movie_height = (movie_height - 2) * (i + 1) / num_texture_rows - skip_rows; textures[current].row = i; textures[current].col = j; textures[current].skip_pixels = skip_pixels; textures[current].skip_rows = skip_rows; skip_pixels += textures[current].movie_width; pixels = (GLubyte*) malloc( textures[current].poly_width * textures[current].poly_height * 4 ); memset( pixels, 0, textures[current].poly_width * textures[current].poly_height * 4 ); if( !pixels ) { glDeleteTextures( num_texture_rows * num_texture_cols, texture_ids ); free( texture_ids ); free( textures ); return GL_OUT_OF_MEMORY; } /* Do all of our useful binding. */ glBindTexture( GL_TEXTURE_2D, textures[current].id ); glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); /* Specify our 256x256 black texture. */ glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, textures[current].poly_width, textures[current].poly_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels ); free( pixels ); } skip_rows += textures[current].movie_height; } /* Simple state setup at the end. */ glClearColor( 0.0, 0.0, 0.0, 0.0 ); return glGetError( ); } /* * Free any resources associated with the movie player. */ void glmovie_quit( void ) { glDeleteTextures( num_texture_rows * num_texture_cols, texture_ids ); free( texture_ids ); free( textures ); } smpeg-0.4.5+cvs20030824.orig/glmovie.c0100644000175000017500000000556107512717070017152 0ustar hoseheadhosehead/* HACK * If you stick glx.h before MPEG.h, the preprocessor * will start replacing the MPEG methods Status with an * X11 variable type... blech. */ #include "smpeg.h" #include "SDL.h" #include #include #include /*#include */ #include "glmovie.h" static void glmpeg_update( SDL_Surface*, Sint32, Sint32, Uint32, Uint32 ); int main( int argc, char* argv[] ) { SMPEG* mpeg; SMPEG_Info mpeg_info; SDL_Surface* screen; SDL_Surface* surface; if( argc < 2 ) { fprintf( stderr, "Usage: %s file.mpg\n", argv[0]); return 1; } if( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_AUDIO ) < 0 ) { fprintf( stderr, "glmovie: I couldn't initizlize SDL (shrug)\n" ); return 1; } mpeg = SMPEG_new( argv[1], &mpeg_info, 1 ); if( !mpeg ) { fprintf( stderr, "glmovie: I'm not so sure about this %s file...\n", argv[1] ); SDL_Quit(); return 1; } /* Grab the mouse and input and set the video mode */ SDL_ShowCursor(0); SDL_WM_GrabInput(SDL_GRAB_ON); screen = SDL_SetVideoMode(640, 480, 0, SDL_OPENGL|SDL_FULLSCREEN); if ( !screen ) { fprintf( stderr, "glmovie: Couldn't set 640x480 GL vide mode: %s\n", SDL_GetError()); SDL_Quit(); return 1; } /* Everything needs to be in RGB for GL, but needs to be 32-bit for SMPEG. */ surface = SDL_AllocSurface( SDL_SWSURFACE, mpeg_info.width, mpeg_info.height, 32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 ); if( !surface ) { fprintf( stderr, "glmovie: I couldn't make a surface (boo hoo)\n" ); SDL_Quit(); exit( 1 ); } /* *Initialize* with mpeg size. */ if ( glmovie_init( mpeg_info.width, mpeg_info.height ) != GL_NO_ERROR ) { fprintf( stderr, "glmovie: glmovie_init() failed!\n" ); SDL_Quit(); exit( 1 ); } /* *Resize* with window size. */ glmovie_resize( screen->w, screen->h ); SMPEG_setdisplay( mpeg, surface, NULL, glmpeg_update ); SMPEG_play( mpeg ); while( SMPEG_status( mpeg ) == SMPEG_PLAYING ) { SDL_Event event; while ( SDL_PollEvent(&event) ) { switch (event.type) { case SDL_KEYDOWN: if ( event.key.keysym.sym == SDLK_ESCAPE ) { SMPEG_stop( mpeg ); } break; case SDL_MOUSEBUTTONDOWN: case SDL_QUIT: SMPEG_stop( mpeg ); break; } } SDL_Delay(100); } glmovie_quit( ); SDL_Quit(); return 0; } static void glmpeg_update( SDL_Surface* surface, Sint32 x, Sint32 y, Uint32 w, Uint32 h ) { GLenum error; glmovie_draw( (GLubyte*) surface->pixels ); error = glGetError( ); if( error != GL_NO_ERROR ) { fprintf( stderr, "glmovie: GL error: %s\n", gluErrorString( error ) ); exit( 1 ); } SDL_GL_SwapBuffers(); } smpeg-0.4.5+cvs20030824.orig/glmovie.h0100644000175000017500000000063107003633512017141 0ustar hoseheadhosehead#ifndef _GLMOVIE_H_ #define _GLMOVIE_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif GLenum glmovie_init( GLuint, GLuint ); void glmovie_quit( void ); void glmovie_draw( GLubyte* ); void glmovie_resize( GLuint, GLuint ); GLuint glmovie_next_power_of_2( GLuint seed ); GLboolean glmovie_is_power_of_2( GLuint value ); #ifdef __cplusplus } #endif #endif smpeg-0.4.5+cvs20030824.orig/MPEG.h0100644000175000017500000001042707263152504016240 0ustar hoseheadhosehead/* SMPEG - SDL MPEG Player Library Copyright (C) 1999 Loki Entertainment Software - Modified by Michel Darricau from eProcess for popcorn - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* A class used to parse and play MPEG streams */ #ifndef _MPEG_H_ #define _MPEG_H_ #include #include #include #include "SDL.h" #include "MPEGerror.h" #include "MPEGstream.h" #include "MPEGaction.h" #include "MPEGaudio.h" #include "MPEGvideo.h" #include "MPEGsystem.h" #include "MPEGfilter.h" #define LENGTH_TO_CHECK_FOR_SYSTEM 0x50000 // Added by HanishKVC /* The main MPEG class - parses system streams and creates other streams A few design notes: Making this derived from MPEGstream allows us to do system stream parsing. We create an additional MPEG object for each type of stream in the MPEG file because each needs a separate pointer to the MPEG data. The MPEG stream then creates an accessor object to do all the data parsing for that stream type. It's a little odd, but seemed like the best way to implement stream parsing. */ class MPEG : public MPEGerror { public: /* Michel Darricau from eProcess need for override in popcorn */ MPEG():MPEGerror(){} MPEG(bool Sdlaudio, char *addresse,char *asset,long buffersize){} MPEG(const char * name, bool SDLaudio = true); MPEG(int Mpeg_FD, bool SDLaudio = true); MPEG(void *data, int size, bool SDLaudio = true); MPEG(SDL_RWops *mpeg_source,bool SDLaudio = true); virtual ~MPEG(); /* Initialize the MPEG */ void Init(SDL_RWops *mpeg_source, bool SDLaudio); void InitErrorState(); /* Enable/Disable audio and video */ bool AudioEnabled(void); void EnableAudio(bool enabled); bool VideoEnabled(void); void EnableVideo(bool enabled); /* MPEG actions */ void Loop(bool toggle); /* Michel Darricau from eProcess need for override in popcorn */ virtual void Play(void); void Stop(void); void Rewind(void); /* Michel Darricau from eProcess need for override in popcorn */ virtual void Pause(void); virtual void Seek(int bytes); void Skip(float seconds); /* Michel Darricau from eProcess need for override in popcorn */ MPEGstatus GetStatus(void); void GetSystemInfo(MPEG_SystemInfo *info); /* MPEG audio actions */ bool GetAudioInfo(MPEG_AudioInfo *info); void Volume(int vol); bool WantedSpec(SDL_AudioSpec *wanted); void ActualSpec(const SDL_AudioSpec *actual); MPEGaudio *GetAudio(void); /* MPEG video actions */ bool GetVideoInfo(MPEG_VideoInfo *info); bool SetDisplay(SDL_Surface *dst, SDL_mutex *lock, MPEG_DisplayCallback callback); void MoveDisplay(int x, int y); void ScaleDisplayXY(int w, int h); void SetDisplayRegion(int x, int y, int w, int h); void RenderFrame(int frame); void RenderFinal(SDL_Surface *dst, int x, int y); SMPEG_Filter * Filter(SMPEG_Filter * filter); public: /* We need to have separate audio and video streams */ MPEGstream * audiostream; MPEGstream * videostream; MPEGsystem * system; protected: char *mpeg_mem; // Used to copy MPEG passed in as memory SDL_RWops *source; MPEGaudioaction *audioaction; MPEGvideoaction *videoaction; MPEGaudio *audio; MPEGvideo *video; bool audioaction_enabled; bool videoaction_enabled; bool sdlaudio; bool loop; bool pause; void parse_stream_list(); bool seekIntoStream(int position); }; #endif /* _MPEG_H_ */ smpeg-0.4.5+cvs20030824.orig/MPEGaction.h0100644000175000017500000000757107262703500017441 0ustar hoseheadhosehead/* SMPEG - SDL MPEG Player Library Copyright (C) 1999 Loki Entertainment Software - Modified by Michel Darricau from eProcess for popcorn - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* A virtual class to provide basic MPEG playback actions */ #ifndef _MPEGACTION_H_ #define _MPEGACTION_H_ #include "SDL.h" #include "MPEGfilter.h" typedef enum { MPEG_ERROR = -1, MPEG_STOPPED, MPEG_PLAYING } MPEGstatus; class MPEGaction { public: MPEGaction() { playing = false; paused = false; looping = false; play_time = 0.0; } virtual void Loop(bool toggle) { looping = toggle; } virtual double Time(void) { /* Returns the time in seconds since start */ return play_time; } virtual void Play(void) = 0; virtual void Stop(void) = 0; virtual void Rewind(void) = 0; virtual void ResetSynchro(double) = 0; virtual void Skip(float seconds) = 0; virtual void Pause(void) { /* A toggle action */ if ( paused ) { paused = false; Play(); } else { Stop(); paused = true; } } /* Michel Darricau from eProcess conflict name in popcorn */ virtual MPEGstatus GetStatus(void) = 0; protected: bool playing; bool paused; bool looping; double play_time; void ResetPause(void) { paused = false; } }; /* For getting info about the audio portion of the stream */ typedef struct MPEG_AudioInfo { int mpegversion; int mode; int frequency; int layer; int bitrate; int current_frame; } MPEG_AudioInfo; /* Audio action class */ class MPEGaudioaction : public MPEGaction { public: virtual bool GetAudioInfo(MPEG_AudioInfo *info) { return(true); } virtual void Volume(int vol) = 0; }; /* Matches the declaration of SDL_UpdateRect() */ typedef void(*MPEG_DisplayCallback)(SDL_Surface* dst, int x, int y, unsigned int w, unsigned int h); /* For getting info about the video portion of the stream */ typedef struct MPEG_VideoInfo { int width; int height; int current_frame; double current_fps; } MPEG_VideoInfo; /* Video action class */ class MPEGvideoaction : public MPEGaction { public: virtual void SetTimeSource(MPEGaudioaction *source) { time_source = source; } virtual bool GetVideoInfo(MPEG_VideoInfo *info) { return(false); } virtual bool SetDisplay(SDL_Surface *dst, SDL_mutex *lock, MPEG_DisplayCallback callback) = 0; virtual void MoveDisplay(int x, int y) = 0; virtual void ScaleDisplayXY(int w, int h) = 0; virtual void SetDisplayRegion(int x, int y, int w, int h) = 0; virtual void RenderFrame(int frame) = 0; virtual void RenderFinal(SDL_Surface *dst, int x, int y) = 0; virtual SMPEG_Filter * Filter(SMPEG_Filter * filter) = 0; protected: MPEGaudioaction *time_source; }; /* For getting info about the system portion of the stream */ typedef struct MPEG_SystemInfo { int total_size; int current_offset; double total_time; double current_time; } MPEG_SystemInfo; #endif /* _MPEGACTION_H_ */ smpeg-0.4.5+cvs20030824.orig/MPEGaudio.h0100644000175000017500000002336407325113570017265 0ustar hoseheadhosehead/* SMPEG - SDL MPEG Player Library Copyright (C) 1999 Loki Entertainment Software - Modified by Michel Darricau from eProcess for popcorn - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* A class based on the MPEG stream class, used to parse and play audio */ #ifndef _MPEGAUDIO_H_ #define _MPEGAUDIO_H_ #include "SDL.h" #include "MPEGerror.h" #include "MPEGaction.h" #ifdef THREADED_AUDIO #include "MPEGring.h" #endif class MPEGstream; /* MPEG/WAVE Sound library (C) 1997 by Woo-jae Jung */ /**************************/ /* Define values for MPEG */ /**************************/ #define SCALEBLOCK 12 #define CALCBUFFERSIZE 512 #define MAXSUBBAND 32 #define MAXCHANNEL 2 #define MAXTABLE 2 #define SCALE 32768 #define MAXSCALE (SCALE-1) #define MINSCALE (-SCALE) #define RAWDATASIZE (2*2*32*SSLIMIT) #define LS 0 #define RS 1 #define SSLIMIT 18 #define SBLIMIT 32 #define WINDOWSIZE 4096 // Huffmancode #define HTN 34 /********************/ /* Type definitions */ /********************/ typedef float REAL; typedef struct { bool generalflag; unsigned int part2_3_length; unsigned int big_values; unsigned int global_gain; unsigned int scalefac_compress; unsigned int window_switching_flag; unsigned int block_type; unsigned int mixed_block_flag; unsigned int table_select[3]; unsigned int subblock_gain[3]; unsigned int region0_count; unsigned int region1_count; unsigned int preflag; unsigned int scalefac_scale; unsigned int count1table_select; }layer3grinfo; typedef struct { unsigned main_data_begin; unsigned private_bits; struct { unsigned scfsi[4]; layer3grinfo gr[2]; }ch[2]; }layer3sideinfo; typedef struct { int l[23]; /* [cb] */ int s[3][13]; /* [window][cb] */ }layer3scalefactor; /* [ch] */ typedef struct { int tablename; unsigned int xlen,ylen; unsigned int linbits; unsigned int treelen; const unsigned int (*val)[2]; }HUFFMANCODETABLE; // Class for Mpeg layer3 class Mpegbitwindow { public: Mpegbitwindow(){bitindex=point=0;}; void initialize(void) {bitindex=point=0;}; int gettotalbit(void) const {return bitindex;}; void putbyte(int c) {buffer[point&(WINDOWSIZE-1)]=c;point++;}; void wrap(void); void rewind(int bits) {bitindex-=bits;}; void forward(int bits) {bitindex+=bits;}; int getbit(void) { register int r=(buffer[bitindex>>3]>>(7-(bitindex&7)))&1; bitindex++; return r; } int getbits9(int bits) { register unsigned short a; { int offset=bitindex>>3; a=(((unsigned char)buffer[offset])<<8) | ((unsigned char)buffer[offset+1]); } a<<=(bitindex&7); bitindex+=bits; return (int)((unsigned int)(a>>(16-bits))); } int getbits(int bits); private: int point,bitindex; char buffer[2*WINDOWSIZE]; }; /* The actual MPEG audio class */ class MPEGaudio : public MPEGerror, public MPEGaudioaction { friend void Play_MPEGaudioSDL(void *udata, Uint8 *stream, int len); friend int Play_MPEGaudio(MPEGaudio *audio, Uint8 *stream, int len); #ifdef THREADED_AUDIO friend int Decode_MPEGaudio(void *udata); #endif public: MPEGaudio(MPEGstream *stream, bool initSDL = true); virtual ~MPEGaudio(); /* MPEG actions */ bool GetAudioInfo(MPEG_AudioInfo *info); double Time(void); void Play(void); void Stop(void); void Rewind(void); void ResetSynchro(double time); void Skip(float seconds); void Volume(int vol); /* Michel Darricau from eProcess conflict name in popcorn */ MPEGstatus GetStatus(void); /* Returns the desired SDL audio spec for this stream */ bool WantedSpec(SDL_AudioSpec *wanted); /* Inform SMPEG of the actual audio format if configuring SDL outside of this class */ void ActualSpec(const SDL_AudioSpec *actual); protected: bool sdl_audio; MPEGstream *mpeg; int valid_stream; bool stereo; double rate_in_s; Uint32 frags_playing; Uint32 frag_time; #ifdef THREADED_AUDIO bool decoding; SDL_Thread *decode_thread; void StartDecoding(void); void StopDecoding(void); #endif /* Code from splay 1.8.2 */ /*****************************/ /* Constant tables for layer */ /*****************************/ private: static const int bitrate[2][3][15],frequencies[2][3]; static const REAL scalefactorstable[64]; static const HUFFMANCODETABLE ht[HTN]; static const REAL filter[512]; static REAL hcos_64[16],hcos_32[8],hcos_16[4],hcos_8[2],hcos_4; /*************************/ /* MPEG header variables */ /*************************/ private: int last_speed; int layer,protection,bitrateindex,padding,extendedmode; enum _mpegversion {mpeg1,mpeg2} version; enum _mode {fullstereo,joint,dual,single} mode; enum _frequency {frequency44100,frequency48000,frequency32000} frequency; /***************************************/ /* Interface for setting music quality */ /***************************************/ private: bool forcetomonoflag; bool forcetostereoflag; int downfrequency; public: void setforcetomono(bool flag); void setdownfrequency(int value); /******************************/ /* Frame management variables */ /******************************/ private: int decodedframe,currentframe,totalframe; /***************************************/ /* Variables made by MPEG-Audio header */ /***************************************/ private: int tableindex,channelbitrate; int stereobound,subbandnumber,inputstereo,outputstereo; REAL scalefactor; int framesize; /*******************/ /* Mpegtoraw class */ /*******************/ public: void initialize(); bool run(int frames, double *timestamp = NULL); void clearbuffer(void); /*****************************/ /* Loading MPEG-Audio stream */ /*****************************/ private: Uint8 _buffer[4096]; Uint32 _buffer_pos; int bitindex; bool fillbuffer(int size); void sync(void); bool issync(void); int getbyte(void); int getbit(void); int getbits8(void); int getbits9(int bits); int getbits(int bits); /********************/ /* Global variables */ /********************/ private: int lastfrequency,laststereo; // for Layer3 int layer3slots,layer3framestart,layer3part2start; REAL prevblck[2][2][SBLIMIT][SSLIMIT]; int currentprevblock; layer3sideinfo sideinfo; layer3scalefactor scalefactors[2]; Mpegbitwindow bitwindow; int wgetbit (void) {return bitwindow.getbit (); } int wgetbits9(int bits){return bitwindow.getbits9(bits);} int wgetbits (int bits){return bitwindow.getbits (bits);} /*************************************/ /* Decoding functions for each layer */ /*************************************/ private: bool loadheader(void); // // Subbandsynthesis // REAL calcbufferL[2][CALCBUFFERSIZE],calcbufferR[2][CALCBUFFERSIZE]; int currentcalcbuffer,calcbufferoffset; void computebuffer(REAL *fraction,REAL buffer[2][CALCBUFFERSIZE]); void generatesingle(void); void generate(void); void subbandsynthesis(REAL *fractionL,REAL *fractionR); void computebuffer_2(REAL *fraction,REAL buffer[2][CALCBUFFERSIZE]); void generatesingle_2(void); void generate_2(void); void subbandsynthesis_2(REAL *fractionL,REAL *fractionR); // Extarctor void extractlayer1(void); // MPEG-1 void extractlayer2(void); void extractlayer3(void); void extractlayer3_2(void); // MPEG-2 // Functions for layer 3 void layer3initialize(void); bool layer3getsideinfo(void); bool layer3getsideinfo_2(void); void layer3getscalefactors(int ch,int gr); void layer3getscalefactors_2(int ch); void layer3huffmandecode(int ch,int gr,int out[SBLIMIT][SSLIMIT]); REAL layer3twopow2(int scale,int preflag,int pretab_offset,int l); REAL layer3twopow2_1(int a,int b,int c); void layer3dequantizesample(int ch,int gr,int in[SBLIMIT][SSLIMIT], REAL out[SBLIMIT][SSLIMIT]); void layer3fixtostereo(int gr,REAL in[2][SBLIMIT][SSLIMIT]); void layer3reorderandantialias(int ch,int gr,REAL in[SBLIMIT][SSLIMIT], REAL out[SBLIMIT][SSLIMIT]); void layer3hybrid(int ch,int gr,REAL in[SBLIMIT][SSLIMIT], REAL out[SSLIMIT][SBLIMIT]); void huffmandecoder_1(const HUFFMANCODETABLE *h,int *x,int *y); void huffmandecoder_2(const HUFFMANCODETABLE *h,int *x,int *y,int *v,int *w); /********************/ /* Playing raw data */ /********************/ private: int samplesperframe; int rawdatareadoffset, rawdatawriteoffset; Sint16 *rawdata; #ifdef THREADED_AUDIO MPEG_ring *ring; #else Sint16 spillover[ RAWDATASIZE ]; #endif int volume; void clearrawdata(void) { rawdatareadoffset=0; rawdatawriteoffset=0; rawdata=NULL; } void putraw(short int pcm) {rawdata[rawdatawriteoffset++]=pcm;} /********************/ /* Timestamp sync */ /********************/ public: #define N_TIMESTAMPS 5 double timestamp[N_TIMESTAMPS]; }; #endif /* _MPEGAUDIO_H_ */ smpeg-0.4.5+cvs20030824.orig/MPEGerror.h0100644000175000017500000000304706761142237017316 0ustar hoseheadhosehead/* SMPEG - SDL MPEG Player Library Copyright (C) 1999 Loki Entertainment Software This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* A class used for error reporting in the MPEG classes */ #ifndef _MPEGERROR_H_ #define _MPEGERROR_H_ #include #include class MPEGerror { public: MPEGerror() { ClearError(); } /* Set an error message */ void SetError(char *fmt, ...) { va_list ap; va_start(ap, fmt); vsprintf(errbuf, fmt, ap); va_end(ap); error = errbuf; } /* Find out if an error occurred */ bool WasError(void) { return(error != NULL); } char *TheError(void) { return(error); } /* Clear any error message */ void ClearError(void) { error = NULL; } protected: char errbuf[512]; char *error; }; #endif /* _MPEGERROR_H_ */ smpeg-0.4.5+cvs20030824.orig/MPEGfilter.h0100644000175000017500000000426307155260604017450 0ustar hoseheadhosehead/* SMPEG - SDL MPEG Player Library Copyright (C) 1999 Loki Entertainment Software This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* MPEG filters */ #ifndef _MPEGFILTER_H_ #define _MPEGFILTER_H_ /* SMPEG filter info flags */ #define SMPEG_FILTER_INFO_MB_ERROR 1 #define SMPEG_FILTER_INFO_PIXEL_ERROR 2 /* Filter info from SMPEG */ typedef struct SMPEG_FilterInfo { Uint16* yuv_mb_square_error; Uint16* yuv_pixel_square_error; } SMPEG_FilterInfo; /* MPEG filter definition */ struct SMPEG_Filter; /* Callback functions for the filter */ typedef void (* SMPEG_FilterCallback)( SDL_Overlay * dest, SDL_Overlay * source, SDL_Rect * region, SMPEG_FilterInfo * filter_info, void * data ); typedef void (* SMPEG_FilterDestroy)( struct SMPEG_Filter * filter ); /* The filter definition itself */ typedef struct SMPEG_Filter { Uint32 flags; void * data; SMPEG_FilterCallback callback; SMPEG_FilterDestroy destroy; } SMPEG_Filter; /* SMPEG built-in filters. */ #ifdef __cplusplus extern "C" { #endif /* The null filter (default). It simply copies the source rectangle to the video overlay. */ extern DECLSPEC SMPEG_Filter * SMPEGfilter_null(void); /* The bilinear filter. A basic low-pass filter that will produce a smoother image. */ extern DECLSPEC SMPEG_Filter * SMPEGfilter_bilinear(void); /* The deblocking filter. It filters block borders and non-intra coded blocks to reduce blockiness */ extern DECLSPEC SMPEG_Filter * SMPEGfilter_deblocking(void); #ifdef __cplusplus }; #endif #endif /* _MPEGFILTER_H_ */ smpeg-0.4.5+cvs20030824.orig/MPEGring.h0100644000175000017500000000530607110636471017121 0ustar hoseheadhosehead/* SMPEG - SDL MPEG Player Library Copyright (C) 1999 Loki Entertainment Software This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* A ring-buffer class for multi-threaded applications. This assumes a single reader and a single writer, with blocking reads. */ #ifndef _MPEGRING_H #define _MPEGRING_H #include "SDL_types.h" #include "SDL_thread.h" class MPEG_ring { public: /* Create a ring with 'count' buffers, each 'size' bytes long */ MPEG_ring(Uint32 size, Uint32 count = 16); /* Release any waiting threads on the ring so they can be cleaned up. The ring isn't valid after this call, so when threads are done you should call MPRing_sdelete() on the ring. */ void ReleaseThreads(void); /* Destroy a ring after all threads are no longer using it */ virtual ~MPEG_ring(); /* Returns the maximum size of each buffer */ Uint32 BufferSize( void ) { return(bufSize); } /* Returns how many buffers have available data */ int BuffersWritten(void) { return(SDL_SemValue(ring->readwait)); } /* Reserve a buffer for writing in the ring */ Uint8 *NextWriteBuffer( void ); /* Release a buffer, written to in the ring */ void WriteDone( Uint32 len, double timestamp=-1 ); /* Reserve a buffer for reading in the ring */ Uint32 NextReadBuffer( Uint8** buffer ); /* Read the timestamp of the current buffer */ double ReadTimeStamp(void); /* Release a buffer having read some of it */ void ReadSome( Uint32 used ); /* Release a buffer having read all of it */ void ReadDone( void ); protected: MPEG_ring *ring; /* Converted from C code, an alias for 'this' */ /* read only */ Uint32 bufSize; /* private */ Uint8 *begin; Uint8 *end; double *timestamps; double *timestamp_read; double *timestamp_write; Uint8 *read; Uint8 *write; /* For read/write synchronization */ int active; SDL_semaphore *readwait; SDL_semaphore *writewait; }; #endif /* _MPEGRING_H */ smpeg-0.4.5+cvs20030824.orig/MPEGlist.h0100644000175000017500000000147707110636471017142 0ustar hoseheadhosehead/* bufferlist.h */ /* A class for buffering the I/O and allow multiple streams to read the data asynchronously */ #ifndef _MPEGLIST_H_ #define _MPEGLIST_H_ #include "SDL.h" class MPEGlist { public: MPEGlist(); ~MPEGlist(); /* Get to the next free buffer or allocate a new one if none is free */ MPEGlist * Alloc(Uint32 Buffer_Size); /* Lock current buffer */ void Lock(); /* Unlock current buffer */ void Unlock(); /* Get the buffer */ inline void * Buffer() { return(data); }; inline Uint32 Size() { return(size); }; inline MPEGlist * Next() { return(next); }; inline MPEGlist * Prev() { return(prev); }; inline Uint32 IsLocked() { return(lock); }; double TimeStamp; private: class MPEGlist * next; class MPEGlist * prev; Uint32 lock; Uint8 * data; Uint32 size; }; #endif smpeg-0.4.5+cvs20030824.orig/MPEGstream.h0100644000175000017500000000561407272376321017463 0ustar hoseheadhosehead/* SMPEG - SDL MPEG Player Library Copyright (C) 1999 Loki Entertainment Software This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* The generic MPEG stream class */ #ifndef _MPEGSTREAM_H_ #define _MPEGSTREAM_H_ #include "SDL_types.h" #include "MPEGerror.h" #include "MPEGvideo.h" #include "MPEGaudio.h" #include "MPEGlist.h" #define AUDIO_STREAMID 0xc0 #define VIDEO_STREAMID 0xe0 #define SYSTEM_STREAMID 0xbb struct MPEGstream_marker { /* Data to mark part of the stream */ MPEGlist * marked_buffer; Uint8 *marked_data; Uint8 *marked_stop; }; class MPEGstream { public: MPEGstream(class MPEGsystem * System, Uint8 Streamid); ~MPEGstream(); /* Cleanup the buffers and reset the stream */ void reset_stream(void); /* Rewind the stream */ void rewind_stream(void); /* Go to the next packet in the stream */ bool next_packet(bool recurse = true, bool update_timestamp = true); /* Mark a position in the data stream */ MPEGstream_marker *new_marker(int offset); /* Jump to the marked position */ bool seek_marker(MPEGstream_marker const * marker); /* Jump to last successfully marked position */ void delete_marker(MPEGstream_marker * marker); /* Copy data from the stream to a local buffer */ Uint32 copy_data(Uint8 *area, Sint32 size, bool short_read = false); /* Copy a byte from the stream */ int copy_byte(void); /* Check for end of file or an error in the stream */ bool eof(void) const; /* Insert a new packet at the end of the stream */ void insert_packet(Uint8 * data, Uint32 size, double timestamp=-1); /* Check for unused buffers and free them */ void garbage_collect(void); /* Enable or disable the stream */ void enable(bool toggle); /* Get stream time */ double time(); Uint32 pos; Uint8 streamid; protected: Uint8 *data; Uint8 *stop; Uint32 preread_size; class MPEGsystem * system; MPEGlist * br; bool cleareof; bool enabled; SDL_mutex * mutex; /* Get a buffer from the stream */ bool next_system_buffer(void); public: /* "pos" where "timestamp" belongs */ Uint32 timestamp_pos; double timestamp; }; #endif /* _MPEGSTREAM_H_ */ smpeg-0.4.5+cvs20030824.orig/MPEGsystem.h0100644000175000017500000000607107272376321017512 0ustar hoseheadhosehead/* A class based on the MPEG stream class, used to parse the system stream */ /* - Modified by Michel Darricau from eProcess for popcorn - */ #ifndef _MPEGSYSTEM_H_ #define _MPEGSYSTEM_H_ #define USE_SYSTEM_TIMESTAMP #include "SDL.h" #include "SDL_thread.h" #include "MPEGerror.h" class MPEGstream; /* MPEG System library by Vivien Chappelier */ /* The system class is necessary for splitting the MPEG stream into */ /* peaces of data that will be sent to the audio or video decoder. */ class MPEGsystem : public MPEGerror { public: /* Michel Darricau from eProcess need for override in popcorn */ MPEGsystem() {} MPEGsystem(SDL_RWops *mpeg_source); virtual ~MPEGsystem(); /* Buffered I/O functions */ void RequestBuffer(); bool Wait(); Uint32 Tell(); void Rewind(); /* Michel Darricau from eProcess need for override in popcorn */ virtual void Start(); void Stop(); bool Eof() const; /* Michel Darricau from eProcess need for override in popcorn */ virtual bool Seek(int length); virtual Uint32 TotalSize(); virtual double TotalTime(); virtual double TimeElapsedAudio(int atByte); /* Skip "seconds" seconds */ void Skip(double seconds); /* Create all the streams present in the MPEG */ MPEGstream ** GetStreamList(); /* Insert a stream in the list */ void add_stream(MPEGstream * stream); /* Search for a stream in the list */ MPEGstream * get_stream(Uint8 stream_id); /* Test if a stream is in the list */ Uint8 exist_stream(Uint8 stream_id, Uint8 mask); /* Reset all the system streams */ void reset_all_streams(); /* Set eof for all streams */ void end_all_streams(); /* Michel Darricau from eProcess need for override in popcorn */ /* Seek the first header */ virtual bool seek_first_header(); /* Michel Darricau from eProcess need for override in popcorn */ /* Seek the next header */ virtual bool seek_next_header(); protected: /* Run the loop to fill the stream buffers */ static bool SystemLoop(MPEGsystem *system); /* Michel Darricau from eProcess need for override in popcorn */ /* Fill a buffer */ virtual Uint8 FillBuffer(); /* Read a new packet */ virtual void Read(); /* The system thread which fills the FIFO */ static int SystemThread(void * udata); SDL_RWops *source; SDL_Thread * system_thread; bool system_thread_running; MPEGstream ** stream_list; Uint8 * read_buffer; Uint8 * pointer; int read_size; Uint32 read_total; Uint32 packet_total; int request; SDL_semaphore * request_wait; SDL_mutex * system_mutex; bool endofstream; bool errorstream; double frametime; double stream_timestamp; #ifdef USE_SYSTEM_TIMESTAMP /* Current timestamp for this stream */ double timestamp; double timedrift; double skip_timestamp; #endif }; #endif smpeg-0.4.5+cvs20030824.orig/MPEGvideo.h0100644000175000017500000000677707262703500017301 0ustar hoseheadhosehead/* SMPEG - SDL MPEG Player Library Copyright (C) 1999 Loki Entertainment Software - Modified by Michel Darricau from eProcess for popcorn - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* A class based on the MPEG stream class, used to parse and play video */ #ifndef _MPEGVIDEO_H_ #define _MPEGVIDEO_H_ #include "SDL.h" #include "SDL_thread.h" #include "MPEGerror.h" #include "MPEGaction.h" class MPEGstream; /* This is the MPEG video stream structure in the mpeg_play code */ struct vid_stream; typedef struct vid_stream VidStream; /* Temporary definition of time stamp structure. */ typedef double TimeStamp; class MPEGvideo : public MPEGerror, public MPEGvideoaction { /* Thread to play the video asynchronously */ friend int Play_MPEGvideo(void *udata); /* Various mpeg_play functions that need our data */ friend VidStream* mpegVidRsrc( TimeStamp time_stamp, VidStream* vid_stream, int first ); friend int get_more_data( VidStream* vid_stream ); public: MPEGvideo(MPEGstream *stream); virtual ~MPEGvideo(); /* MPEG actions */ void Play(void); void Stop(void); void Rewind(void); void ResetSynchro(double time); void Skip(float seconds); /* Michel Darricau from eProcess conflict name in popcorn */ MPEGstatus GetStatus(void); /* MPEG video actions */ bool GetVideoInfo(MPEG_VideoInfo *info); bool SetDisplay(SDL_Surface *dst, SDL_mutex *lock, MPEG_DisplayCallback callback); void MoveDisplay(int x, int y); void ScaleDisplayXY(int w, int h); void SetDisplayRegion(int x, int y, int w, int h); void RenderFrame(int frame); void RenderFinal(SDL_Surface *dst, int x, int y); SMPEG_Filter * Filter(SMPEG_Filter * filter); /* Display and sync functions */ void DisplayFrame( VidStream* vid_stream ); void ExecuteDisplay( VidStream* vid_stream ); int timeSync( VidStream* vid_stream ); /* Yes, it's a hack.. */ MPEGaudioaction *TimeSource(void ) { return time_source; } protected: MPEGstream *mpeg; VidStream* _stream; SDL_Surface* _dst; SDL_mutex* _mutex; SDL_Thread* _thread; MPEG_DisplayCallback _callback; int _ow; // original width of the movie int _oh; // original height of the movie int _w; // mb aligned width of the movie int _h; // mb aligned height of the movie SDL_Rect _srcrect; // source area SDL_Rect _dstrect; // display area SDL_Overlay *_image;// source image float _fps; // frames per second SMPEG_Filter * _filter; // pointer to the current filter used SDL_mutex* _filter_mutex; // make sure the filter is not changed while being used void RewindStream(void); }; #endif /* _MPEGVIDEO_H_ */ smpeg-0.4.5+cvs20030824.orig/smpeg.h0100644000175000017500000001651707325113570016630 0ustar hoseheadhosehead/* SMPEG - SDL MPEG Player Library Copyright (C) 1999 Loki Entertainment Software This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* This is the C interface to the SMPEG library */ #ifndef _SMPEG_H_ #define _SMPEG_H_ #include "SDL.h" #include "SDL_mutex.h" #include "SDL_audio.h" #include "MPEGfilter.h" #ifdef __cplusplus extern "C" { #endif #define SMPEG_MAJOR_VERSION 0 #define SMPEG_MINOR_VERSION 4 #define SMPEG_PATCHLEVEL 5 typedef struct { Uint8 major; Uint8 minor; Uint8 patch; } SMPEG_version; /* This macro can be used to fill a version structure with the compile-time * version of the SDL library. */ #define SMPEG_VERSION(X) \ { \ (X)->major = SMPEG_MAJOR_VERSION; \ (X)->minor = SMPEG_MINOR_VERSION; \ (X)->patch = SMPEG_PATCHLEVEL; \ } /* This is the actual SMPEG object */ typedef struct _SMPEG SMPEG; /* Used to get information about the SMPEG object */ typedef struct _SMPEG_Info { int has_audio; int has_video; int width; int height; int current_frame; double current_fps; char audio_string[80]; int audio_current_frame; Uint32 current_offset; Uint32 total_size; double current_time; double total_time; } SMPEG_Info; /* Possible MPEG status codes */ typedef enum { SMPEG_ERROR = -1, SMPEG_STOPPED, SMPEG_PLAYING } SMPEGstatus; /* Matches the declaration of SDL_UpdateRect() */ typedef void(*SMPEG_DisplayCallback)(SDL_Surface* dst, int x, int y, unsigned int w, unsigned int h); /* Create a new SMPEG object from an MPEG file. On return, if 'info' is not NULL, it will be filled with information about the MPEG object. This function returns a new SMPEG object. Use SMPEG_error() to find out whether or not there was a problem building the MPEG stream. The sdl_audio parameter indicates if SMPEG should initialize the SDL audio subsystem. If not, you will have to use the SMPEG_playaudio() function below to extract the decoded data. */ extern DECLSPEC SMPEG* SMPEG_new(const char *file, SMPEG_Info* info, int sdl_audio); /* The same as above for a file descriptor */ extern DECLSPEC SMPEG* SMPEG_new_descr(int file, SMPEG_Info* info, int sdl_audio); /* The same as above but for a raw chunk of data. SMPEG makes a copy of the data, so the application is free to delete after a successful call to this function. */ extern DECLSPEC SMPEG* SMPEG_new_data(void *data, int size, SMPEG_Info* info, int sdl_audio); /* The same for a generic SDL_RWops structure. */ extern DECLSPEC SMPEG* SMPEG_new_rwops(SDL_RWops *src, SMPEG_Info* info, int sdl_audio); /* Get current information about an SMPEG object */ extern DECLSPEC void SMPEG_getinfo( SMPEG* mpeg, SMPEG_Info* info ); /* Enable or disable audio playback in MPEG stream */ extern DECLSPEC void SMPEG_enableaudio( SMPEG* mpeg, int enable ); /* Enable or disable video playback in MPEG stream */ extern DECLSPEC void SMPEG_enablevideo( SMPEG* mpeg, int enable ); /* Delete an SMPEG object */ extern DECLSPEC void SMPEG_delete( SMPEG* mpeg ); /* Get the current status of an SMPEG object */ extern DECLSPEC SMPEGstatus SMPEG_status( SMPEG* mpeg ); /* Set the audio volume of an MPEG stream, in the range 0-100 */ extern DECLSPEC void SMPEG_setvolume( SMPEG* mpeg, int volume ); /* Set the destination surface for MPEG video playback 'surfLock' is a mutex used to synchronize access to 'dst', and can be NULL. 'callback' is a function called when an area of 'dst' needs to be updated. If 'callback' is NULL, the default function (SDL_UpdateRect) will be used. */ extern DECLSPEC void SMPEG_setdisplay(SMPEG* mpeg, SDL_Surface* dst, SDL_mutex* surfLock, SMPEG_DisplayCallback callback); /* Set or clear looping play on an SMPEG object */ extern DECLSPEC void SMPEG_loop( SMPEG* mpeg, int repeat ); /* Scale pixel display on an SMPEG object */ extern DECLSPEC void SMPEG_scaleXY( SMPEG* mpeg, int width, int height ); extern DECLSPEC void SMPEG_scale( SMPEG* mpeg, int scale ); /* */ #define SMPEG_double(mpeg, on) \ SMPEG_scale(mpeg, (on) ? 2 : 1) /* Move the video display area within the destination surface */ extern DECLSPEC void SMPEG_move( SMPEG* mpeg, int x, int y ); /* Set the region of the video to be shown */ extern DECLSPEC void SMPEG_setdisplayregion(SMPEG* mpeg, int x, int y, int w, int h); /* Play an SMPEG object */ extern DECLSPEC void SMPEG_play( SMPEG* mpeg ); /* Pause/Resume playback of an SMPEG object */ extern DECLSPEC void SMPEG_pause( SMPEG* mpeg ); /* Stop playback of an SMPEG object */ extern DECLSPEC void SMPEG_stop( SMPEG* mpeg ); /* Rewind the play position of an SMPEG object to the beginning of the MPEG */ extern DECLSPEC void SMPEG_rewind( SMPEG* mpeg ); /* Seek 'bytes' bytes in the MPEG stream */ extern DECLSPEC void SMPEG_seek( SMPEG* mpeg, int bytes); /* Skip 'seconds' seconds in the MPEG stream */ extern DECLSPEC void SMPEG_skip( SMPEG* mpeg, float seconds ); /* Render a particular frame in the MPEG video API CHANGE: This function no longer takes a target surface and position. Use SMPEG_setdisplay() and SMPEG_move() to set this information. */ extern DECLSPEC void SMPEG_renderFrame( SMPEG* mpeg, int framenum ); /* Render the last frame of an MPEG video */ extern DECLSPEC void SMPEG_renderFinal( SMPEG* mpeg, SDL_Surface* dst, int x, int y ); /* Set video filter */ extern DECLSPEC SMPEG_Filter * SMPEG_filter( SMPEG* mpeg, SMPEG_Filter * filter ); /* Return NULL if there is no error in the MPEG stream, or an error message if there was a fatal error in the MPEG stream for the SMPEG object. */ extern DECLSPEC char *SMPEG_error( SMPEG* mpeg ); /* Exported callback function for audio playback. The function takes a buffer and the amount of data to fill, and returns the amount of data in bytes that was actually written. This will be the amount requested unless the MPEG audio has finished. */ extern DECLSPEC int SMPEG_playAudio( SMPEG *mpeg, Uint8 *stream, int len ); /* Wrapper for SMPEG_playAudio() that can be passed to SDL and SDL_mixer */ extern DECLSPEC void SMPEG_playAudioSDL( void *mpeg, Uint8 *stream, int len ); /* Get the best SDL audio spec for the audio stream */ extern DECLSPEC int SMPEG_wantedSpec( SMPEG *mpeg, SDL_AudioSpec *wanted ); /* Inform SMPEG of the actual SDL audio spec used for sound playback */ extern DECLSPEC void SMPEG_actualSpec( SMPEG *mpeg, SDL_AudioSpec *spec ); #ifdef __cplusplus } #endif #endif /* _SMPEG_H_ */ smpeg-0.4.5+cvs20030824.orig/CHANGES0100644000175000017500000004056207623317665016350 0ustar hoseheadhoseheadcurrent: Ryan C. Gordon - Fri Feb 14 21:02:00 EST 2003 * Memory leak fix that I missed from before (thanks, Pete Shinners). Ryan C. Gordon - Sat Jan 25 19:20:58 EST 2003 * Memory leak fixes from NUNOKAWA Masato and Robert Diel. Ryan C. Gordon - Wed Dec 18 16:47:52 EST 2002 * Apple Project Builder support by Eric Wing. Ryan C. Gordon - Fri Dec 6 14:32:29 EST 2002 * Fixed for newer automakes. Ryan C. Gordon - Wed Dec 4 18:00:33 EST 2002 * Now builds again when --enable-mmx is specified at configure time. Ryan C. Gordon - Thu Sep 26 01:13:58 EDT 2002 * Minor Makefile.am patch for GCC 3.2 Ryan C. Gordon - Tue Jul 9 22:28:21 EDT 2002 * Removed #include from glmovie.c Ryan C. Gordon - Sun Jun 02 20:10:42 EST 2002 * ./autogen.sh accepts aclocal commandlines via the ACLOCAL_FLAGS envr var. Ryan C. Gordon - Sun Jun 02 20:10:42 EST 2002 * ./autogen.sh is now flagged as executable in CVS. Ryan C. Gordon - Sun Jun 02 20:10:42 EST 2002 * ./configure.in tweaked to not complain with newer autoconf. Ryan C. Gordon - Sun Jun 02 20:10:42 EST 2002 * Newer ltconfig and hacks for libtool and .S files. Adam Procter - Sat Jun 8 05:41:30 EDT 2002 * Fixed potential deadlock in MPEGaudio.cpp Sam Lantinga - Sun Jun 9 00:24:10 EDT 2002 * Fix for crash when an MPEG file can't be opened. 0.4.5: Sam Lantinga - Tue Jul 17 12:27:20 PDT 2001 * Skip MPEG audio frames with wildly varying frequencies 0.4.4: Laurent Alacoque - Mon, 18 Jun 2001 15:51:51 * Fixed some hangs that occurred when seeking in MPEG files Sam Lantinga - Fri Apr 27 15:54:30 PDT 2001 * Reworked the looping code - it should work better now Sam Lantinga - Fri Apr 27 13:30:27 PDT 2001 * Fixed memory leak when sound was disabled Sam Lantinga - Fri Apr 27 10:32:04 PDT 2001 * Widened initial search for audio streams in MPEG files Sam Lantinga - Fri Apr 27 10:15:37 PDT 2001 * plaympeg now shows the name of the MPEG file in the caption Sam Lantinga - Wed Apr 18 17:07:40 PDT 2001 * Added a check for the socklen_t type (thanks Michael Pruett) Sam Lantinga - Mon Apr 16 14:20:07 PDT 2001 * Fixed crash with incorrectly encoded macroblock sequences Mo DeJong - Mon Apr 16 12:26:04 PDT 2001 * Fixed crash when the MPEG file can't be opened Joe Drew - Mon Apr 16 12:04:36 PDT 2001 * Fixed crash in gtv when seeking without a file loaded 0.4.3: Sam Lantinga - Thu Apr 5 01:09:43 PDT 2001 * Updated for Simple DirectMedia Layer version 1.2.0 Sam Lantinga - Wed Apr 4 17:18:22 PDT 2001 * Fixed crash in gtv when doubling the video on Windows Sam Lantinga - Wed Apr 4 17:18:14 PDT 2001 * Fixed audio stream detection in non-standard MPEG streams Sam Lantinga - Wed Apr 4 16:42:53 PDT 2001 * Fixed hang on rewind when stream header contains no timestamp Andreas Kloeckner - Wed Apr 4 14:43:49 PDT 2001 * SMPEG now uses the SDL_RWops file abstraction internally Joe Drew - Wed Apr 4 13:40:44 PDT 2001 * Fixed bug where the audio was not updating the current time Michel Darricau - Wed Apr 4 13:31:40 PDT 2001 * Added some changes for the popcorn MPEG library Nicolas Vignal - Wed Apr 4 13:25:28 PDT 2001 * Added smpeg.m4 Sam Lantinga - Wed Feb 21 16:24:46 PST 2001 * SDL 1.2.0 supports 24 bpp displays, allow that in plaympeg Sam Lantinga - Fri Feb 9 23:37:31 PST 2001 * Ported to MacOS X - one line fix. I love portable code! :) It's still unusably slow, but it works! :) Sam Lantinga - Thu Feb 8 17:33:15 PST 2001 * Fixed a hang playing invalid MPEG files Matt Carlson - Fri Feb 2 18:13:08 PST 2001 * Fixed memory leak when used with OpenAL Sam Lantinga - Mon Jan 8 07:49:20 PST 2001 * Return a non-zero status from plaympeg if playback fails James Boucher - Mon Jan 8 06:53:31 PST 2001 * Changes to compile correctly on QNX RTP Sam Lantinga - Thu Dec 21 10:52:28 PST 2000 * Fixed SMPEG_renderFinal() to a different display surface Stephane Peter - Thu, 21 Dec 2000 02:07:07 -0800 (PST) * Fixed plaympeg fullscreen toggling for multiple videos Vivien Chappelier - Thu Dec 14 16:21:32 PST 2000 * Fixed MPEGSystem::TotalTime() hanging on small files * Fixed system header decoding (caused misdetection of system streams) * Added bilinear filter toggling with the 'f' key in plaympeg Maxim Sobolev - Mon Dec 11 11:54:46 PST 2000 * Use the correct SDL configuration script on FreeBSD 0.4.2: Sam Lantinga - Thu Dec 7 18:14:14 PST 2000 * Check for the GLU library when seeing if we can build the OpenGL example Mo DeJong - Mon Dec 4 12:26:18 PST 2000 * Fixed crash when loading files of zero bytes Sam Lantinga - Sat Dec 2 13:51:21 PST 2000 * Added --enable-threaded-system configure option (defaults off) Sam Lantinga - Sat Dec 2 13:40:33 PST 2000 * Fixed end of stream detection Sam Lantinga - Sat Dec 2 11:36:50 PST 2000 * Fixed crashes in gtv when trying to play MP3 files with no video Sam Lantinga - Fri Dec 1 20:39:39 PST 2000 * Disabled the system thread by default. You can re-enable it by looking for USE_SYSTEM_THREAD in MPEGsystem.cpp Sam Lantinga - Fri Dec 1 18:07:50 PST 2000 * Fixed RenderFinal() to a different surface than the original one Vivien Chappelier - Fri Nov 17 13:35:36 PST 2000 * Fixed seeking in MPEG files Joe Valenzuela - Fri Nov 17 13:28:38 PST 2000 * Fixed crash in system data decoding Bruce Merry - Fri Nov 10 09:49:59 PST 2000 * Removed movie size limitations from glmovie, works great! Sam Lantinga - Fri Oct 27 15:11:33 PDT 2000 * Fixed hang when audio data was partially corrupt in the first block Hiroshi Yamashita - Sat, 14 Oct 2000 23:43:33 +0900 * Fixed bug where audio was always mono SiKang - Fri, 6 Oct 2000 15:23:13 +0900 * Fixed UDP port binding for raw:// MPEG support Sam Lantinga - Thu Oct 5 14:07:35 PDT 2000 * Fixed spurious empty audio buffer at start of playback Sam Lantinga - Thu Oct 5 12:58:43 PDT 2000 * SMPEG_playAudio() now returns the amount of audio data mixed * SMPEG_playAudioSDL() wraps SMPEG_playAudio, as a callback hook for SDL. Joe Valenzuela - Wed Oct 4 12:07:51 PDT 2000 * Added a configure option --disable-threaded-audio Sam Lantinga - Wed Oct 4 10:12:58 PDT 2000 * Fixed various compiler warnings Vivien Chappelier - Mon, 25 Sep 2000 20:37:43 +0200 * Added abstraction support for hardware acceleration (no card support yet) Hiroshi Yamashita - Sat, 19 Aug 2000 00:22:25 +0900 * Fixed lseek problem on FreeBSD 0.4.1: Vivien Chappelier - Sat Sep 23 17:48:59 PDT 2000 * Updated for SDL 1.1.5 and ATI hardware accelerated overlays Richard Kim - Thu Sep 21 11:28:31 PDT 2000 * Fixed read buffer memory leak in MPEGsystem class Tim Jansen - Thu Sep 21 11:13:06 PDT 2000 * Fixed potential stack corruption in MPEG level 3 audio decoding Sam Lantinga - Wed Sep 6 03:04:12 PDT 2000 * Various Visual C++ cleanups, DirectX hardware acceleration with SDL Sam Lantinga - Tue Sep 5 18:53:34 PDT 2000 * Added the --bilinear command line option to plaympeg for filtering Tim Janson - Tue Sep 5 18:05:18 PDT 2000 * Fixed potential divide-by-zero with some illegal audio streams Sam Lantinga - Tue Sep 5 14:09:14 PDT 2000 * Changed gtv to perform bilinear filtering instead of deblocking Sam Lantinga - Tue Sep 5 13:39:36 PDT 2000 * Changed the filters to C implementations instead of C++ implementations Vivien Chappelier - Tue Sep 5 12:09:10 PDT 2000 * Fixed crash with MPEG files containing audio frames in multiple layers * Fixed crash when looping system streams * Added video filter code * Implemented a copy filter (default filter) * Implemented a bilinear filter * Implemented a subtle de-blocking filter * Improved the motion detection code, crashes/hangs on fewer MPEG movies Ray Kelm - Fri, 04 Aug 2000 20:58:00 -0400 * Added support for cross-compiling Windows DLL from Linux Joe Valenzuela - Wed Aug 9 12:05:13 PDT 2000 * Added SMPEG_new_data() to play MPEG data already in memory Vivien Chappelier - Sun Jul 23 13:48:33 2000 * Added the total time of an MPEG to the information structure Vivien Chappelier - Sun Jul 23 13:48:33 2000 * Changed stream decoding to use more efficient condition variables Kevin Squire - Thu Aug 3 18:23:01 PDT 2000 * Fixed a bug in the audio layer 2 decoding Sam Lantinga - Thu Aug 3 17:56:09 PDT 2000 * Fixed FD_ZERO compile problem on some systems Sam Lantinga - Thu Aug 3 17:51:35 PDT 2000 * Modified plaympeg to play videos even if audio device isn't available Jens Vaasjo, Sam Lantinga, Nicholas Vining - Thu Aug 3 16:49:40 PDT 2000 * Modified glmovie to do fullscreen hardware accelerated display David Hedbor - Wed Aug 2 14:08:20 PDT 2000 * Minor smpeg-config fixes for Solaris Sam Lantinga - Wed Jun 21 14:58:24 PDT 2000 * The MMX idct code resulted in much less quality, so disabled by default Sam Lantinga - Thu Jun 15 00:07:33 PDT 2000 * Added support for multiple tracks on a VCD disk Vivien Chappelier - Wed Jun 14 12:43:54 PDT 2000 * Added VCD and URL support to plaympeg 0.4.0: Vivien Chappelier - Fri Jun 9 14:20:16 PDT 2000 * Fixed rendering the final frame in a video stream Hiroshi Yamashita - Thu Jun 8 12:03:42 PDT 2000 * Fixed frame counter and FPS calculation after seek * Changed gtv so it actually changes the window size on doubling Vivien Chappelier - Mon Jun 5 18:47:47 PDT 2000 * Fixed audio synchronization when seeking in an MPEG stream Sam Lantinga - Sat Jun 3 20:13:42 PDT 2000 * Ported (easily) to BeOS Sam Lantinga - Sat Jun 3 19:40:41 PDT 2000 * Added aggresive optimizations by default, use --enable-debug to disable Mo DeJong - Sat Jun 3 19:37:00 PDT 2000 * Replaced target check for -lm with a simple library check Sam Lantinga - Wed May 31 15:00:19 PDT 2000 * Various gtv improvements - centered video, audio on by default, etc. Robert Dean - Wed May 31 10:13:02 PDT 2000 * Added drag-n-drop support to gtv (drag movies onto the control window) Mo DeJong - Tue May 30 15:23:19 PDT 2000 * Fixed an audio deadlock when stopping playback Markus Overhumer - Tue May 30 15:16:30 PDT 2000 * Some cleanups for compiling on Win32 with VC++ Vivien Chappelier - Fri May 26 10:53:44 PDT 2000 * Added a movable progress slidebar to gtv Vivien, Manuel - Wed May 17 17:36:39 PDT 2000 * Added support for timestamp synchronization in the MPEG stream Vivien, Damien - Mon May 8 11:06:08 PDT 2000 * Added support for seeking in the MPEG stream Sam Lantinga - Fri Apr 28 15:57:25 PDT 2000 * Added support to plaympeg allowing the user to resize the window Sam Lantinga - Fri Apr 28 14:22:14 PDT 2000 * Added ALT-ENTER fullscreen toggle to plaympeg Sam Lantinga - Thu Apr 27 18:22:04 PDT 2000 * Added support for arbitrary output scaling: new API function SMPEG_scaleXY() * Added -scale wxh option to plaympeg Sam Lantinga - Mon Apr 24 16:11:58 PDT 2000 * A much improved semaphore based ring buffer implementation Sam Lantinga, Ryan Gordon - Mon Apr 24 14:12:59 PDT 2000 * plaympeg can now play files containing colons Sam Lantinga - Tue Apr 18 17:12:16 PDT 2000 * Adjusted the audio startup timing based on experimentation Hiroshi Yamashita - Tue Apr 18 15:48:14 PDT 2000 * Improved audio synchronization with longer movies (double rate_deal) Sam Lantinga - Fri Apr 14 13:21:51 PDT 2000 * Added support for SDL asynchronous blitting * Added support for FPS printing - see TIME_MPEG in video/MPEGvideo.cpp Hiroshi Yamashita - Tue Apr 11 13:00:01 PDT 2000 * Tuned MPEG_BUFFER_SIZE for slower systems. Atsushi Yamagata - Tue Apr 11 12:50:45 PDT 2000 * Added locale setting for gtv. Hiroshi Yamashita - Tue Apr 11 09:59:11 PDT 2000 * Fixed audio popping and floating point exceptions in layer2 audio. Sam Lantinga - Tue Apr 11 06:55:53 PDT 2000 * Ported to Win32. Sam Lantinga - Sun Apr 9 16:42:47 PDT 2000 * Use SDL 1.1.3 for hardware accelerated YUV overlay support. Vivien Chappelier - Thu Apr 6 12:40:36 PDT 2000 * Added MPEG streaming support - now plays many more MPEG streams. 0.3.5: Sam Lantinga - Wed Apr 5 13:50:32 PDT 2000 * MMX code is disabled by default, as it appears to be slower than C code. Sam Lantinga - Thu Mar 9 19:51:13 PST 2000 * Fixed a hang in MP3 playback if track plays all the way to the end. Sam Lantinga - Wed Mar 8 11:01:16 PST 2000 * Added 16-bit MMX dither/IDCT code from the NIST MPEG-2/DVD player. (http://home.germany.net/100-5083/) * Added 32-bit MMX dither code from the kmpg MPEG-1 player. (http://www.rhrk.uni-kl.de/~mvogt/linux/kmpg/) Sam Lantinga - Wed Mar 8 07:25:33 PST 2000 * Added the math library to configure.in Hiroshi Yamashita - Mon Mar 6 07:48:35 PST 2000 * Added audio information to the MPEG info. * Added support for videos starting with Video Start Code 0xe0 0xe2. * Added a fix for FreeBSD to ltmain.sh. Sam Lantinga - Mon Mar 6 08:27:35 PST 2000 * Fixed a potential starting crash in plaympeg. 0.3.4: Sam Lantinga - Fri Mar 3 13:40:43 PST 2000 * Split RPM into runtime and development packages. * Added smpeg-config script to tell where the development runtime is installed. Sam Lantinga - Fri Mar 3 13:25:10 PST 2000 * Fixed MP3 audio on big-endian systems. Sam Lantinga - Wed Mar 1 07:02:17 PST 2000 * The control panel for the gtv player is placed in the upper left. Sam Lantinga - Wed Mar 1 00:26:49 PST 2000 * If the audio couldn't be opened, the error is propogated to the user. Sam Lantinga - Wed Mar 1 00:18:42 PST 2000 * The audio decoder thread now runs while the movie is paused. Sam Lantinga - Tue Feb 29 15:22:52 PST 2000 * Added a hack to seek past raw video data in a system stream. Sam Lantinga - Tue Feb 29 10:57:14 PST 2000 * Fixed pause and loop, with and without audio. Sam Lantinga - Mon Feb 28 20:28:24 PST 2000 * Removed special SDL mixer support - not necessary. See README.SDL_mixer. Sam Lantinga - Mon Feb 28 12:45:59 PST 2000 * Fixed a problem where audio stopped playing before the end of the movie. Sam Lantinga - Thu Feb 10 13:17:29 PST 2000 * Don't crash if a picture block comes before a sequence header block. Sam Lantinga - Sat Feb 5 08:56:25 PST 2000 * Remove autogenerated files from CVS. Bill Kendrick - Thu Feb 03 16:57:27 PST 2000 * Does not init. audio or video unless necessary for the MPEG being played. * If audio or video are unavailable, does not exit, just skips (or plays whichever stream it can). Bill Kendrick - Sat Jan 22 17:32:00 PST 2000 * Added --version to plaympeg and made usage help more complete. Sam Lantinga - Mon Jan 24 12:57:54 PST 2000 * Disabled consistency checks by default, now plays more video streams Laurent Bonnaud - Tue Jan 25 13:46:32 PST 2000 * Speeded up cropping by using an inline function 0.3.3: Sam Lantinga - Mon Jan 17 19:52:32 PST 2000 * Updated for the new SDL mixer library release (1.0.3) Sam Lantinga - Tue Jan 11 16:17:50 PST 2000 * Fixed so SMPEG compiles on stock RedHat 5.2 systems Stephane Peter, Sam Lantinga - Thu Jan 10 15:22:33 PST 2000 * Fixed playing mono MP3 files on stereo audio output Sam Lantinga - Thu Jan 6 13:02:32 PST 2000 * SMPEG now detects MP3 files again (broken by RIFF searching code) * gtv is now included by default when building an RPM Sam Lantinga - Mon Jan 3 20:54:32 PST 2000 * Changelog entries are now Y2K safe. ;-) * SMPEG now handles pad packets in the initial system stream Jim Studt - Mon Jan 3 20:57:52 PST 2000 * Fixed endian detection on unknown Linux systems (ARM) Sam Lantinga - Mon Jan 3 21:09:01 PST 2000 * plaympeg now hides the mouse cursor in fullscreen mode 0.3.2: SOL - Updated autoconf for SDL 1.0 SOL - Fixed audio decoding thread - releases waiting audio threads SOL - Fixed audio playback of MPEG videos when using external mixer KVC - Handle RIFF encoded MPEG streams SOL - Handle system streams that encode packets without a header Stefan Gybas - Contributed a man page for gtv. 0.3.1: SOL - Fixed endlessly looping "mpegVidRsrc ParseMacroBlock" problem SOL - Changed parseblock assertion so it doesn't halt playback SOL - Fixed crashing bug in ParseReconBlock() with corrupt videos SOL - Fixed audio synchronization problem with looping movies 0.3.0: SOL - Added audio synchronization support. SOL - Added autoconf support. MKV - Added GTk mpeg player. MKV - Added OpenGL mpeg player. SP - Exported the audio mixing function for flexible audio setup. Mo DeJong - plaympeg now prints out usage if given no arguments. Stefan Gybas - Contributed a man page for plaympeg. 0.2.7: SOL - Added volume change API 0.2.6: SOL - Fixed possible crash when starting audio playback. SOL - Fixed SMPEG on PPC - may still be buggy, but plays most MPEGs. 0.2.5: SOL - Added --fullscreen command line option to plaympeg. SOL - Added 32-bpp support, fixed fullscreen offset bug. Initial Key: SOL - Sam Lantinga (hercules@lokigames.com) MKV - Michael Vance (briareos@lokigames.com) SP - Stephane Peter (megastep@lokigames.com) smpeg-0.4.5+cvs20030824.orig/README.SDL_mixer0100644000175000017500000000223307167166747020061 0ustar hoseheadhosehead There is no longer explicit support for the SDL_mixer library. You can have the SDL mixer library mix audio from a movie by hooking into the SDL mixer music hooks: #include "smpeg.h" #include "SDL_mixer.h" .. set up the mixer audio ... /* Note the last parameter is zero! */ mpeg = SMPEG_new("file.mpg", &info, 0); /* Play the movie, using SDL_mixer for audio */ SMPEG_enableaudio(mpeg, 0); if ( play_audio ) { SDL_AudioSpec audiofmt; Uint16 format; int freq, channels; /* Tell SMPEG what the audio format is */ Mix_QuerySpec(&freq, &format, &channels); audiofmt.format = format; audiofmt.freq = freq; audiofmt.channels = channels; SMPEG_actualSpec(mpeg, &audiofmt); /* Hook in the MPEG music mixer */ Mix_HookMusic(SMPEG_playAudioSDL, mpeg); SMPEG_enableaudio(mpeg, 1); } SMPEG_play(mpeg); /* Stop the movie and unhook SMPEG from the mixer */ SMPEG_stop(mpeg); Mix_HookMusic(NULL, NULL); smpeg-0.4.5+cvs20030824.orig/plaympeg.10100644000175000017500000000321107046337324017234 0ustar hoseheadhosehead.TH PLAYMPEG 1 .SH NAME plaympeg \- MPEG audio (MP3) and video (MPEG-1) player .SH SYNOPSIS \fBplaympeg\fR [\fIoptions\fR] \fIfile ...\fR .SH DESCRIPTION .I plaympeg is an MPEG audio and video player that uses the SDL MPEG Player Library. It can play back MPEG audio (layer 1, 2 and 3), MPEG video (MPEG-1) and MPEG system (audio and video combined) files. MPEG-2 video files (as found on DVDs) are not supported. .PP The video player works best on a 16 bit color depth X11 display, it works on other color depths with reduced speed as well. You'll need a CPU with 300 MHz or more to play back an MPEG system stream with 25 frames per secons (fps) at full speed. .SH OPTIONS .TP .B \--help Show short usage information .TP .B \--noaudio Don't play the audio stream (if available) .TP .B \--novideo Don't play the video stream (if available) .TP .B \--fullscreen Play the MPEG video stream in fullscreen mode (this requires root privileges or a setuid plaympeg binary) .TP .B \-2, \--double Play the MPEG video stream at double size .TP .B \-l, \--loop Play the stream (audio or video) over and over again .TP .B \-v N, \--volume N Set the volume of the audio stream to N% (N in the range of 0 to 100) .TP .B \-s S, \--scale S Play the MPEG video stream at S size .SH "SEE ALSO" SMPEG home page at http://www.lokigames.com/development/smpeg.php3 .SH AUTHOR The SDL MPEG Player Library was written by Karl Robillard and Sam Lantinga of Loki Entertainment Software. Please report any bugs and/or fixes to smpeg@lokigames.com. .PP This manual page was written by Stefan Gybas for the Debian GNU/Linux system, but may be used elsewhere under the GPL. smpeg-0.4.5+cvs20030824.orig/gtv.10100644000175000017500000000202507034201372016206 0ustar hoseheadhosehead.TH GTV 1 .SH NAME gtv \- MPEG audio (MP3) and video (MPEG-1) player with GTK+ GUI .SH SYNOPSIS \fBgtv\fR \fIfile\fR .SH DESCRIPTION .I gtv is an MPEG audio and video player that uses the SDL MPEG Player Library. It can play back MPEG audio (layer 1, 2 and 3), MPEG video (MPEG-1) and MPEG system (audio and video combined) files. MPEG-2 video files (as found on DVDs) are not supported. .PP The video player works best on a 16 bit color depth X11 display, it works on other color depths with reduced speed as well. You'll need a CPU with 300 MHz or more to play back an MPEG system stream with 25 frames per secons (fps) at full speed. .SH "SEE ALSO" SMPEG home page at http://www.lokigames.com/development/smpeg.php3 .SH AUTHOR The SDL MPEG Player Library was written by Karl Robillard and Sam Lantinga of Loki Entertainment Software. Please report any bugs and/or fixes to smpeg@lokigames.com. .PP This manual page was written by Stefan Gybas for the Debian GNU/Linux system, but may be used elsewhere under the GPL. smpeg-0.4.5+cvs20030824.orig/VisualC.zip0100644000175000017500000001077107263152504017433 0ustar hoseheadhoseheadPK Lk…*VisualC/UT ðÔÌ:ÕÌ:UxõèPK¡&)²l9Rå–VisualC/smpeg.dswUT ζ9àÔÌ:UxõèÕOKÃ@Åï|‡g½ÚP°½„¦P̦k6$Á\¼¬éb·Ýew­HÈw7Q*èɃ=t`˜?~ᄅ´4òÙ"ä.¤â¹}Ý4¥Ô[£XÅ5‚_!’zÇ,¸6ÜcæM&®s‰r™%q²òR$´ ã4CHÖ¤ (nã%ÍîòtyCÅkrá:ýáÿÆð2Õò…WÖǨ¶‡Qà=öeHocÆHYµe5}Ûş‹Ï›¯e0ŸõcÛ¶®ÓuÝaúK8)¸ì}§x=ÐûïæŒ|˜£ sà+!Ÿ˜ðÿÆs}zžPKÝ…*Ø lK÷VisualC/smpeg.dspUT ò"Ì:àÔÌ:UxõèíXmoâ8þ^©ÿa.{ÚÕ(ì­öªã$J‹–7½^OHÈ$&xIâÈIÚòïo'4h+\Ý݇“¨ê—™ÇÏŒÇ6 ÇlÁ#¾ˆÁ¤÷Ôã!0އq þƒÚ1´˜Gáúħu#òCêØ{E\ ƒ‡€ŠúoŸ?=ùðZ›¢‰©× óœõ´¸ðI P1À/¥JEâ|üæúƒ Xfg‚ÝÓ9u*ÀKv"\š!=Mí2{™Ô‹|Þ@¥ã\Й:Ãr…öÆi*î¸?P¸Ç]åÞÊ·5(·ÿ„ò  eK¦Ó¯U´Ù7­ë›¶jÏpÜÜŽ±w‡Æ-ÊvŽ» inCvÀ(•¦Ó]ÄÂBpi4hú“Ñ ›õ'ßFVôÌYãÆì öHÃb{bQ\Ë_ÅëÐcójiqèߠ݃¬±ÜýxÏta¬k({(åŸ+¿BÙÙøçF‡ç¯ÇÍZµ>l)ãê`pÓÙœØff{°ÛéGTÀÕŽ¿šƒõjÕ"…_dM×aY CŠBν´ƒ¢êxn6Cœ{æfÑ’z9÷èS‹$qŸ0'mlÒ%óhÅÔ¿ÂUþa<SKì%ÊöU§öõKÎúß$<6»ÇG³ºcë-Ë¿PŽV²ËÃJ–c¿¬cû¬tTìr¯Š=[åUï¢`N¦7¾Òœ¿ꎳ£0ZRö zKÒfÿ ¤ÍŽ–´·{î—´Ù+’6û_ÒÊŽ,îm€rèÌ1áô*¢aüLç"n¯²UþÛš÷†È¤öMÔÁâ-Ra5¢nއîxûçŸäBáy"lš>Ê$èxp3jZu<‹D>Þ¦s+Þ%; ¥—…ƒ-ŸWî™CùÔ¡6wð±÷n8K-†q,†J ¾îP‹§ˆ2«êæeáq;v¬‹ãÊÔèµL |FÆ_uº„~zÿqù\>$ïñÆ5ö¬7´ÚšÞGÖœô%¶ŒA¯jSÙÒ CAhÄB…àG@ ?m­tJmõÈšŠKÝ3³AÒ‚gH5½=öX¤qì6{,Xàê1H4D± Ä×ãaè°Hoš,†vµkŠzˆ ¢}­‘¥-½ä(­+EHDDçÞ?uc 5É`Á9éoØÇQ‘o1üàeöâ²T-U¦x¥fW[ã8^êçá£3£Üµr’ÄÌÓÝšC‹…f±AñCù3Aõ6?=ÿ PK Rk…*VisualC/plaympeg/UT üÔÌ:ÕÌ:UxõèPKÝ…*pæjÖAVisualC/plaympeg/plaympeg.dspUT ò"Ì:àÔÌ:UxõèåWmoÛ6þ ÿá¦îCRt–cwELlK6Œú –Ó,C’h™³$ ¤”Øÿ¾GÉòKü’—†Lïž{x<>fÞAŸy‚K>MÁ¤÷4ä `§™Ï8Œÿ‡z)´YHá7ˆZ’e”Ð@CˈxsP>ÄT|üóüìÝ)ÀE?’Rš ýø´¹ˆH ߨŒÇð{¥ZU8ï߃9„Áp–ÙàôüL™'qgr7²@»eq½‹ÏŸ.¡‘$!óHŠTÕ«ê•roµ;FIù&u³àüì—¾eÛŽ““€Ÿ˜§@àž„Ì‡ˆÌéÙU`ÂÁÍɦÊ-Y•$“,`Ðo|µ>lAe’¢k‘p‘B…"û þDoEl s4Ч°®qih•ÃÞw<Ä ê±é™{<ž² yàaFc•+^Ý v—à#³|Mñž`µ#•¡$²k€'tA¢$¤×/â® 7-³{Úa¤—’¹ªf3Î<*aŠÉw·FÄ1û©Æ4¤DR .\üòÕþŽ6ÎåI¤‚ôKqЦmÒ€Åå}R†Ñx8ÛóeS 4mÇÞã G$å ­ÑÈð ]Ðó³þ¤gDÌ_ÍÆvË^1Æ´Ý6€öë–ýRÃ8Q‚Xž¯Ù°-¸‘Ôé·[PÝ7ç;wzÌD0<‘G.Ã,M²Ô1™mƒ¾íÑS*"ê3¼û§ü&Dt…´YÚgvšÔI>Ï Ò b.¨SÜa•a {aÃ4 îxD Ç<äý¶zç/Ї5ÐMl”î ^ÓòáÀ´š7bì ÝÞÚ8»Cç¶ ºWbîÀõÍ·€Ìib÷lp·ƒ£yºÄvkULÄapƒ~ªcÊð×G扱QAQ›?V¿€î¯ãK§ãëM»U¯®ô”(¾…›¯–ÄÖ+»Æ^wð!PÌæ{ñÅÌ©ˆiX¯Up#JÆÅjøl5Â-É„ó0Ÿ >úa°Z!þ=IJ79£a‰ÃCº‘,-á3æçƒu9eæÊ¥LitY|þ ±ªÄ›¡ø^wëŸ?•„ÿM®¶Ù+¿#ÂâòGi²z¶õ´<•? ¯§«ãâTbŸ–¦C^?#LW…éQ–'i¼•(E…ŠüÍPIüÇJâü”8½ ôA‘r^-RÏ<,RÎ"åü¿EÊWMº{×AO|kM¯%MÒÿ¢r=cSJÎ&ªÙö󮸆…¥xÒx|uÙÜûÕæ™ðhþ¯’‚¶‡7ã–eT*ßñ³~kç×ÇÂ÷úŽ÷“+:ße‚u9£LåîŠÙú)ûPK ]k…* VisualC/gtv/UT ÕÌ:ÕÌ:UxõèPKÝ…*ü« H" VisualC/gtv/gtv.dspUT ò"Ì:àÔÌ:UxõèåWmoâ8þ^©ÿa.{ÚÝ-PØ]íUÇI”„Ê›º½žÁGG‰Ó—ã„Phmi?Üé$(öxæ™ÇãñÓäô„ËDN˜x‹¾Œ0[¥\HÆòot´„p}`ÝðÔ­A“!sçÌCÜ…×ÿòÇáÁ‡]Xm$?¦Ãy*|ža~†–Œ¦àƉ!|-U*çãG0ÐŒÀ2;#šhó¨qÙÝ -0®EX«ÂÑý÷oÇЈ"_¸L€•ûÊiåT»7[í:q%ª¹³‰NêüÒ³l»Ñ¶`4 Ð'” Ü2_pاD¬# NÆSi·hQˆ4¡ý^ãÂú¼•&H~Ö}$c½ ¸2XÈAã4\‰XfhPž‚®l‰¥ÍŽ72—…DèŠé‘ve8^g{‡»†:M¸ä¸ì<'RÙš¦0:) EjCÁÕ!mŸÎðž‘g/¥­Ñ²öX/¹±9~(“D8ºH3)\L`J)×7ÄâmÉײ\¢,AŽúázC[ûãxHNõµy[ž£'Ââ²hÃðr0Ûu'Ú¦o Æš½+]晚e Íá°îú%¼ÇÃި[_Ì.íf=vó1¥í´Œ_¨ÎÇÔë›ËsÊR7l ®œôZM¨<7g›žt…³XÐ_ƒ9Æ!úµj‰6¢¥;^ =.#ÚRIégFî{‹ÆoYT¸%3ô éã㈥ª€OÏËr&©“<$ ƒ3ÊÂå]BUeîŒT÷¬Sûþ­ üßàJšdumk§.ÿöV¥ÓíªT`ïÖ¤M^oQ¤ÓŠô$ËOit¼PÆ8ÉŸ4úJÖ×(UKË_‚ä…?ŒÉ›ë ô[”ë¥D6*×doåzyäfåšüD¹&ÿoå⺥×EÊw¨Öx–`¤þ rf›Ýâ7`"|MiÝë›${«€ù¥Í-ùCßæÇ³M«ÚcÙ2]Ì^’4 =¸ºlZõõ{æ©ù§q›ÏsÓØãó“ÓRMo/²èa~ æ5Øú=úóÞä©ïªf12þ~¨yiÕ\Þ‚J ôÑ/HgûE/znœzz[`´©èÞ|¶|™ùPK Lk…* íAVisualC/UTðÔÌ:UxPK¡&)²l9Rå– ¤;VisualC/smpeg.dswUTζ9UxPKÝ…*Ø lK÷ ¤dVisualC/smpeg.dspUTò"Ì:UxPK Rk…* íA¾VisualC/plaympeg/UTüÔÌ:UxPKÝ…*pæjÖA ¤VisualC/plaympeg/plaympeg.dspUTò"Ì:UxPK ]k…* íA( VisualC/gtv/UTÕÌ:UxPKÝ…*ü« H"  ¤g VisualC/gtv/gtv.dspUTò"Ì:UxPKÏsmpeg-0.4.5+cvs20030824.orig/smpeg.m40100644000175000017500000001431107721741104016707 0ustar hoseheadhosehead# Configure paths for SMPEG # Nicolas Vignal 11/19/2000 # stolen from Sam Lantinga # stolen from Manish Singh # stolen back from Frank Belew # stolen from Manish Singh # Shamelessly stolen from Owen Taylor dnl AM_PATH_SMPEG([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for SMPEG, and define SMPEG_CFLAGS and SMPEG_LIBS dnl AC_DEFUN(AM_PATH_SMPEG, [dnl dnl Get the cflags and libraries from the smpeg-config script dnl AC_ARG_WITH(smpeg-prefix,[ --with-smpeg-prefix=PFX Prefix where SMPEG is installed (optional)], smpeg_prefix="$withval", smpeg_prefix="") AC_ARG_WITH(smpeg-exec-prefix,[ --with-smpeg-exec-prefix=PFX Exec prefix where SMPEG is installed (optional)], smpeg_exec_prefix="$withval", smpeg_exec_prefix="") AC_ARG_ENABLE(smpegtest, [ --disable-smpegtest Do not try to compile and run a test SMPEG program], , enable_smpegtest=yes) if test x$smpeg_exec_prefix != x ; then smpeg_args="$smpeg_args --exec-prefix=$smpeg_exec_prefix" if test x${SMPEG_CONFIG+set} != xset ; then SMPEG_CONFIG=$smpeg_exec_prefix/bin/smpeg-config fi fi if test x$smpeg_prefix != x ; then smpeg_args="$smpeg_args --prefix=$smpeg_prefix" if test x${SMPEG_CONFIG+set} != xset ; then SMPEG_CONFIG=$smpeg_prefix/bin/smpeg-config fi fi AC_PATH_PROG(SMPEG_CONFIG, smpeg-config, no) min_smpeg_version=ifelse([$1], ,0.2.7,$1) AC_MSG_CHECKING(for SMPEG - version >= $min_smpeg_version) no_smpeg="" if test "$SMPEG_CONFIG" = "no" ; then no_smpeg=yes else SMPEG_CFLAGS=`$SMPEG_CONFIG $smpegconf_args --cflags` SMPEG_LIBS=`$SMPEG_CONFIG $smpegconf_args --libs` smpeg_major_version=`$SMPEG_CONFIG $smpeg_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` smpeg_minor_version=`$SMPEG_CONFIG $smpeg_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` smpeg_micro_version=`$SMPEG_CONFIG $smpeg_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_smpegtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $SMPEG_CFLAGS $SDL_CFLAGS" LIBS="$LIBS $SMPEG_LIBS $SDL_LIBS" dnl dnl Now check if the installed SMPEG is sufficiently new. (Also sanity dnl checks the results of smpeg-config to some extent dnl rm -f conf.smpegtest AC_TRY_RUN([ #include #include #include #include "smpeg.h" char* my_strdup (char *str) { char *new_str; if (str) { new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); strcpy (new_str, str); } else new_str = NULL; return new_str; } int main (int argc, char *argv[]) { int major, minor, micro; char *tmp_version; /* This hangs on some systems (?) system ("touch conf.smpegtest"); */ { FILE *fp = fopen("conf.smpegtest", "a"); if ( fp ) fclose(fp); } /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = my_strdup("$min_smpeg_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_smpeg_version"); exit(1); } if (($smpeg_major_version > major) || (($smpeg_major_version == major) && ($smpeg_minor_version > minor)) || (($smpeg_major_version == major) && ($smpeg_minor_version == minor) && ($smpeg_micro_version >= micro))) { return 0; } else { printf("\n*** 'smpeg-config --version' returned %d.%d.%d, but the minimum version\n", $smpeg_major_version, $smpeg_minor_version, $smpeg_micro_version); printf("*** of SMPEG required is %d.%d.%d. If smpeg-config is correct, then it is\n", major, minor, micro); printf("*** best to upgrade to the required version.\n"); printf("*** If smpeg-config was wrong, set the environment variable SMPEG_CONFIG\n"); printf("*** to point to the correct copy of smpeg-config, and remove the file\n"); printf("*** config.cache before re-running configure\n"); return 1; } } ],, no_smpeg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_smpeg" = x ; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$SMPEG_CONFIG" = "no" ; then echo "*** The smpeg-config script installed by SMPEG could not be found" echo "*** If SMPEG was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the SMPEG_CONFIG environment variable to the" echo "*** full path to smpeg-config." else if test -f conf.smpegtest ; then : else echo "*** Could not run SMPEG test program, checking why..." CFLAGS="$CFLAGS $SMPEG_CFLAGS $SDL_CFLAGS" LIBS="$LIBS $SMPEG_LIBS $SDL_LIBS" AC_TRY_LINK([ #include #include "smpeg.h" ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding SMPEG or finding the wrong" echo "*** version of SMPEG. If it is not finding SMPEG, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means SMPEG was incorrectly installed" echo "*** or that you have moved SMPEG since it was installed. In the latter case, you" echo "*** may want to edit the smpeg-config script: $SMPEG_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi SMPEG_CFLAGS="" SMPEG_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(SMPEG_CFLAGS) AC_SUBST(SMPEG_LIBS) rm -f conf.smpegtest ]) smpeg-0.4.5+cvs20030824.orig/autogen.sh0100755000175000017500000000017407476532725017353 0ustar hoseheadhosehead#!/bin/sh # aclocal $ACLOCAL_FLAGS automake --foreign autoconf #./configure $* echo "Now you are ready to run ./configure" smpeg-0.4.5+cvs20030824.orig/audio/0042755000175000017500000000000007721741434016446 5ustar hoseheadhoseheadsmpeg-0.4.5+cvs20030824.orig/audio/Makefile.in0100644000175000017500000002027207721741434020511 0ustar hoseheadhosehead# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include DESTDIR = pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_alias = @host_alias@ host_triplet = @host@ AS = @AS@ ASFLAGS = @ASFLAGS@ BINARY_AGE = @BINARY_AGE@ CC = @CC@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ CXX = @CXX@ DLLTOOL = @DLLTOOL@ GL_LIBS = @GL_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_CONFIG = @GTK_CONFIG@ GTK_LIBS = @GTK_LIBS@ HAVE_LIB = @HAVE_LIB@ INTERFACE_AGE = @INTERFACE_AGE@ LIB = @LIB@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIB = @LTLIB@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAJOR_VERSION = @MAJOR_VERSION@ MAKEINFO = @MAKEINFO@ MICRO_VERSION = @MICRO_VERSION@ MINOR_VERSION = @MINOR_VERSION@ OBJDUMP = @OBJDUMP@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ SMPEG_RLD_FLAGS = @SMPEG_RLD_FLAGS@ VERSION = @VERSION@ noinst_LTLIBRARIES = libaudio.la libaudio_la_SOURCES = MPEGaudio.cpp bitwindow.cpp filter.cpp filter_2.cpp huffmantable.cpp mpeglayer1.cpp mpeglayer2.cpp mpeglayer3.cpp mpegtable.cpp mpegtoraw.cpp EXTRA_DIST = AUTHORS COPYING.LIB README README.LIB mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) DEFS = @DEFS@ -I. -I$(srcdir) CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ X_CFLAGS = @X_CFLAGS@ X_LIBS = @X_LIBS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ libaudio_la_LDFLAGS = libaudio_la_LIBADD = libaudio_la_OBJECTS = MPEGaudio.lo bitwindow.lo filter.lo filter_2.lo \ huffmantable.lo mpeglayer1.lo mpeglayer2.lo mpeglayer3.lo mpegtable.lo \ mpegtoraw.lo CXXFLAGS = @CXXFLAGS@ CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ DIST_COMMON = README AUTHORS COPYING.LIB Makefile.am Makefile.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar GZIP_ENV = --best SOURCES = $(libaudio_la_SOURCES) OBJECTS = $(libaudio_la_OBJECTS) all: all-redirect .SUFFIXES: .SUFFIXES: .S .c .cpp .lo .o .s $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps audio/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status mostlyclean-noinstLTLIBRARIES: clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) distclean-noinstLTLIBRARIES: maintainer-clean-noinstLTLIBRARIES: .c.o: $(COMPILE) -c $< .s.o: $(COMPILE) -c $< .S.o: $(COMPILE) -c $< mostlyclean-compile: -rm -f *.o core *.core clean-compile: distclean-compile: -rm -f *.tab.c maintainer-clean-compile: .c.lo: $(LIBTOOL) --mode=compile $(COMPILE) -c $< .s.lo: $(LIBTOOL) --mode=compile $(COMPILE) -c $< .S.lo: $(LIBTOOL) --mode=compile $(COMPILE) -c $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: maintainer-clean-libtool: libaudio.la: $(libaudio_la_OBJECTS) $(libaudio_la_DEPENDENCIES) $(CXXLINK) $(libaudio_la_LDFLAGS) $(libaudio_la_OBJECTS) $(libaudio_la_LIBADD) $(LIBS) .cpp.o: $(CXXCOMPILE) -c $< .cpp.lo: $(LTCXXCOMPILE) -c $< tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ awk ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ here=`pwd` && cd $(srcdir) \ && mkid -f$$here/ID $$unique $(LISP) TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ awk ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) mostlyclean-tags: clean-tags: distclean-tags: -rm -f TAGS ID maintainer-clean-tags: distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) subdir = audio distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done info-am: info: info-am dvi-am: dvi: dvi-am check-am: all-am check: check-am installcheck-am: installcheck: installcheck-am install-exec-am: install-exec: install-exec-am install-data-am: install-data: install-data-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am install: install-am uninstall-am: uninstall: uninstall-am all-am: Makefile $(LTLIBRARIES) all-redirect: all-am install-strip: $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install installdirs: mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: mostlyclean-am: mostlyclean-noinstLTLIBRARIES mostlyclean-compile \ mostlyclean-libtool mostlyclean-tags \ mostlyclean-generic mostlyclean: mostlyclean-am clean-am: clean-noinstLTLIBRARIES clean-compile clean-libtool \ clean-tags clean-generic mostlyclean-am clean: clean-am distclean-am: distclean-noinstLTLIBRARIES distclean-compile \ distclean-libtool distclean-tags distclean-generic \ clean-am -rm -f libtool distclean: distclean-am maintainer-clean-am: maintainer-clean-noinstLTLIBRARIES \ maintainer-clean-compile maintainer-clean-libtool \ maintainer-clean-tags maintainer-clean-generic \ distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." maintainer-clean: maintainer-clean-am .PHONY: mostlyclean-noinstLTLIBRARIES distclean-noinstLTLIBRARIES \ clean-noinstLTLIBRARIES maintainer-clean-noinstLTLIBRARIES \ mostlyclean-compile distclean-compile clean-compile \ maintainer-clean-compile mostlyclean-libtool distclean-libtool \ clean-libtool maintainer-clean-libtool tags mostlyclean-tags \ distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ install-exec install-data-am install-data install-am install \ uninstall-am uninstall all-redirect all-am all installdirs \ mostlyclean-generic distclean-generic clean-generic \ maintainer-clean-generic clean mostlyclean distclean maintainer-clean # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: smpeg-0.4.5+cvs20030824.orig/audio/README0100644000175000017500000000012406761142240017307 0ustar hoseheadhosehead This code is based on Splay 0.8.2, available from: http://my.netian.com/~polarb/ smpeg-0.4.5+cvs20030824.orig/audio/AUTHORS0100644000175000017500000000006706761142240017505 0ustar hoseheadhosehead jwj95@eve.kaist.ac.kr jwj95@nownuri.net Woo-jae Jung smpeg-0.4.5+cvs20030824.orig/audio/COPYING.LIB0100644000175000017500000006126106761142240020100 0ustar hoseheadhosehead GNU LIBRARY GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights. Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library. Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license. The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such. Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better. However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library. Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one. GNU LIBRARY GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! smpeg-0.4.5+cvs20030824.orig/audio/Makefile.am0100644000175000017500000000046507003633517020475 0ustar hoseheadhosehead noinst_LTLIBRARIES = libaudio.la libaudio_la_SOURCES = \ MPEGaudio.cpp \ bitwindow.cpp \ filter.cpp \ filter_2.cpp \ huffmantable.cpp \ mpeglayer1.cpp \ mpeglayer2.cpp \ mpeglayer3.cpp \ mpegtable.cpp \ mpegtoraw.cpp EXTRA_DIST = \ AUTHORS \ COPYING.LIB \ README \ README.LIB smpeg-0.4.5+cvs20030824.orig/audio/MPEGaudio.cpp0100644000175000017500000002011707500352057020712 0ustar hoseheadhosehead/* SMPEG - SDL MPEG Player Library Copyright (C) 1999 Loki Entertainment Software - Modified by Michel Darricau from eProcess for popcorn - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* A class based on the MPEG stream class, used to parse and play audio */ #include "MPEGaudio.h" #include "MPEGstream.h" MPEGaudio:: MPEGaudio(MPEGstream *stream, bool initSDL) : sdl_audio(initSDL) { /* Initialize MPEG audio */ mpeg = stream; initialize(); /* Just be paranoid. If all goes well, this will be set to true */ valid_stream = false; /* Analyze the MPEG audio stream */ if ( loadheader() ) { SDL_AudioSpec wanted; WantedSpec(&wanted); /* Calculate the samples per frame */ samplesperframe = 32*wanted.channels; if( layer == 3 ) { samplesperframe *= 18; if ( version == 0 ) { samplesperframe *= 2; } } else { samplesperframe *= SCALEBLOCK; if ( layer == 2 ) { samplesperframe *= 3; } } if ( sdl_audio ) { /* Open the audio, get actual audio hardware format and convert */ bool audio_active; SDL_AudioSpec actual; audio_active = (SDL_OpenAudio(&wanted, &actual) == 0); if ( audio_active ) { ActualSpec(&actual); valid_stream = true; } else { SetError(SDL_GetError()); } SDL_PauseAudio(0); } else { /* The stream is always valid if we don't initialize SDL */ valid_stream = true; } Volume(100); } /* For using system timestamp */ for (int i=0; ifreq = frequencies[version][frequency]; #if SDL_BYTEORDER == SDL_LIL_ENDIAN wanted->format = AUDIO_S16LSB; #else wanted->format = AUDIO_S16MSB; #endif if ( outputstereo ) { wanted->channels = 2; } else { wanted->channels = 1; } wanted->samples = 4096; wanted->callback = Play_MPEGaudioSDL; wanted->userdata = this; return true; } void MPEGaudio:: ActualSpec(const SDL_AudioSpec *actual) { /* Splay can optimize some of the conversion */ if ( actual->channels == 1 && outputstereo ) { forcetomonoflag = true; } if ( actual->channels == 2 && !outputstereo ) { forcetostereoflag = true; samplesperframe *= 2; } /* FIXME: Create an audio conversion block */ if ( (actual->freq/100) == ((frequencies[version][frequency]/2)/100) ) { downfrequency = 1; } else if ( actual->freq != frequencies[version][frequency] ) { #ifdef VERBOSE_WARNINGS fprintf(stderr, "Warning: wrong audio frequency (wanted %d, got %d)\n", frequencies[version][frequency], actual->freq); #else ; #endif } #if SDL_BYTEORDER == SDL_LIL_ENDIAN if ( actual->format != AUDIO_S16LSB) #else if ( actual->format != AUDIO_S16MSB) #endif { fprintf(stderr, "Warning: incorrect audio format\n"); } rate_in_s=((double)((actual->format&0xFF)/8)*actual->channels*actual->freq); stereo=((actual->channels-1) > 0); } #ifdef THREADED_AUDIO void MPEGaudio:: StartDecoding(void) { decoding = true; /* Create the ring buffer to hold audio */ if ( ! ring ) { ring = new MPEG_ring(samplesperframe*2); } if ( ! decode_thread ) { decode_thread = SDL_CreateThread(Decode_MPEGaudio, this); } } void MPEGaudio:: StopDecoding(void) { decoding = false; if ( decode_thread ) { if( ring ) ring->ReleaseThreads(); SDL_WaitThread(decode_thread, NULL); decode_thread = NULL; } if ( ring ) { delete ring; ring = NULL; } } #endif /* MPEG actions */ double MPEGaudio:: Time(void) { double now; if ( frag_time ) { now = (play_time + (double)(SDL_GetTicks() - frag_time)/1000.0); } else { now = play_time; } return now; } void MPEGaudio:: Play(void) { ResetPause(); if ( valid_stream ) { #ifdef THREADED_AUDIO StartDecoding(); #endif playing = true; } } void MPEGaudio:: Stop(void) { if ( valid_stream ) { if ( sdl_audio ) SDL_LockAudio(); playing = false; if ( sdl_audio ) SDL_UnlockAudio(); } ResetPause(); } void MPEGaudio:: Rewind(void) { Stop(); #ifdef THREADED_AUDIO /* Stop the decode thread */ StopDecoding(); #endif clearrawdata(); decodedframe = 0; currentframe = 0; frags_playing = 0; } void MPEGaudio:: ResetSynchro(double time) { play_time = time; frag_time = 0; /* Reinit the timestamp FIFO */ for (int i=0; i 0) { seconds -= (float) samplesperframe / ((float) frequencies[version][frequency]*(1+inputstereo)); if(!loadheader()) break; } } void MPEGaudio:: Volume(int vol) { if ( (vol >= 0) && (vol <= 100) ) { volume = (vol*SDL_MIX_MAXVOLUME)/100; } } /* Michel Darricau from eProcess conflict name in popcorn */ MPEGstatus MPEGaudio:: GetStatus(void) { if ( valid_stream ) { /* Has decoding stopped because of end of stream? */ if ( mpeg->eof() && (decodedframe <= currentframe) ) { return(MPEG_STOPPED); } /* Have we been told to play? */ if ( playing ) { return(MPEG_PLAYING); } else { return(MPEG_STOPPED); } } else { return(MPEG_ERROR); } } bool MPEGaudio:: GetAudioInfo(MPEG_AudioInfo *info) { if ( info ) { info->mpegversion = version; info->mode = mode; info->frequency = frequencies[version][frequency]; info->layer = layer; info->bitrate = bitrate[version][layer-1][bitrateindex]; info->current_frame = currentframe; } return true; } bool MPEGaudio:: fillbuffer(int size) { bitindex=0; _buffer_pos = mpeg->pos; return(mpeg->copy_data(_buffer, size) > 0); }; void MPEGaudio:: sync(void) { bitindex=(bitindex+7)&0xFFFFFFF8; } bool MPEGaudio:: issync(void) { return (bitindex&7) != 0; } int MPEGaudio::getbyte(void) { int r=(unsigned char)_buffer[bitindex>>3]; bitindex+=8; return r; } int MPEGaudio::getbit(void) { register int r=(_buffer[bitindex>>3]>>(7-(bitindex&7)))&1; bitindex++; return r; } int MPEGaudio::getbits8(void) { register unsigned short a; { int offset=bitindex>>3; a=(((unsigned char)_buffer[offset])<<8) | ((unsigned char)_buffer[offset+1]); } a<<=(bitindex&7); bitindex+=8; return (int)((unsigned int)(a>>8)); } int MPEGaudio::getbits9(int bits) { register unsigned short a; { int offset=bitindex>>3; a=(((unsigned char)_buffer[offset])<<8) | ((unsigned char)_buffer[offset+1]); } a<<=(bitindex&7); bitindex+=bits; return (int)((unsigned int)(a>>(16-bits))); } smpeg-0.4.5+cvs20030824.orig/audio/bitwindow.cpp0100644000175000017500000000165706761142240021155 0ustar hoseheadhosehead/* MPEG/WAVE Sound library (C) 1997 by Jung woo-jae */ // Bitwindow.cc // It's bit reservior for MPEG layer 3 #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "MPEGaudio.h" #if SDL_BYTEORDER == SDL_LIL_ENDIAN #define _KEY 0 #else #define _KEY 3 #endif int Mpegbitwindow::getbits(int bits) { union { char store[4]; int current; }u; int bi; if(!bits)return 0; u.current=0; bi=(bitindex&7); // u.store[_KEY]=buffer[(bitindex>>3)&(WINDOWSIZE-1)]<>3]<>3)&(WINDOWSIZE-1)]; u.store[_KEY]=buffer[bitindex>>3]; bitindex+=8; bi=8; } if(bits>=bi) { u.current<<=bi; bits-=bi; bi=0; } else { u.current<<=bits; bi-=bits; bits=0; } } bitindex-=bi; return (u.current>>8); } smpeg-0.4.5+cvs20030824.orig/audio/filter.cpp0100644000175000017500000002344406761142240020432 0ustar hoseheadhosehead/* MPEG/WAVE Sound library (C) 1997 by Jung woo-jae */ // Filter.cc // Subbandsynthesis routines from maplay 1.2 for Linux // I've modified some macros for reducing source code. #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "MPEGaudio.h" void MPEGaudio::computebuffer(REAL *fraction,REAL buffer[2][CALCBUFFERSIZE]) { REAL p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,pa,pb,pc,pd,pe,pf; REAL q0,q1,q2,q3,q4,q5,q6,q7,q8,q9,qa,qb,qc,qd,qe,qf; REAL *out1,*out2; out1=buffer[currentcalcbuffer]+calcbufferoffset; out2=buffer[currentcalcbuffer^1]+calcbufferoffset; #define OUT1(v,t) out1[(32-(v))*16] =(-(out1[(v)*16]=t)) #define OUT2(v) out2[(96-(v)-32)*16]=out2[((v)-32)*16] // compute new values via a fast cosine transform: { register REAL *x=fraction; p0=x[ 0]+x[31];p1=x[ 1]+x[30];p2=x[ 2]+x[29];p3=x[ 3]+x[28]; p4=x[ 4]+x[27];p5=x[ 5]+x[26];p6=x[ 6]+x[25];p7=x[ 7]+x[24]; p8=x[ 8]+x[23];p9=x[ 9]+x[22];pa=x[10]+x[21];pb=x[11]+x[20]; pc=x[12]+x[19];pd=x[13]+x[18];pe=x[14]+x[17];pf=x[15]+x[16]; } q0=p0+pf;q1=p1+pe;q2=p2+pd;q3=p3+pc; q4=p4+pb;q5=p5+pa;q6=p6+p9;q7=p7+p8; q8=hcos_32[0]*(p0-pf);q9=hcos_32[1]*(p1-pe); qa=hcos_32[2]*(p2-pd);qb=hcos_32[3]*(p3-pc); qc=hcos_32[4]*(p4-pb);qd=hcos_32[5]*(p5-pa); qe=hcos_32[6]*(p6-p9);qf=hcos_32[7]*(p7-p8); p0=q0+q7;p1=q1+q6;p2=q2+q5;p3=q3+q4; p4=hcos_16[0]*(q0-q7);p5=hcos_16[1]*(q1-q6); p6=hcos_16[2]*(q2-q5);p7=hcos_16[3]*(q3-q4); p8=q8+qf;p9=q9+qe;pa=qa+qd;pb=qb+qc; pc=hcos_16[0]*(q8-qf);pd=hcos_16[1]*(q9-qe); pe=hcos_16[2]*(qa-qd);pf=hcos_16[3]*(qb-qc); q0=p0+p3;q1=p1+p2;q2=hcos_8[0]*(p0-p3);q3=hcos_8[1]*(p1-p2); q4=p4+p7;q5=p5+p6;q6=hcos_8[0]*(p4-p7);q7=hcos_8[1]*(p5-p6); q8=p8+pb;q9=p9+pa;qa=hcos_8[0]*(p8-pb);qb=hcos_8[1]*(p9-pa); qc=pc+pf;qd=pd+pe;qe=hcos_8[0]*(pc-pf);qf=hcos_8[1]*(pd-pe); p0=q0+q1;p1=hcos_4*(q0-q1);p2=q2+q3;p3=hcos_4*(q2-q3); p4=q4+q5;p5=hcos_4*(q4-q5);p6=q6+q7;p7=hcos_4*(q6-q7); p8=q8+q9;p9=hcos_4*(q8-q9);pa=qa+qb;pb=hcos_4*(qa-qb); pc=qc+qd;pd=hcos_4*(qc-qd);pe=qe+qf;pf=hcos_4*(qe-qf); { register REAL tmp; tmp=p6+p7; OUT2(36)=-(p5+tmp); OUT2(44)=-(p4+tmp); tmp=pb+pf; OUT1(10,tmp); OUT1(6,pd+tmp); tmp=pe+pf; OUT2(46)=-(p8+pc+tmp); OUT2(34)=-(p9+pd+tmp); tmp+=pa+pb; OUT2(38)=-(pd+tmp); OUT2(42)=-(pc+tmp); OUT1(2,p9+pd+pf); OUT1(4,p5+p7); OUT2(48)=-p0; out2[0]=-(out1[0]=p1); OUT1( 8,p3); OUT1(12,p7); OUT1(14,pf); OUT2(40)=-(p2+p3); } { register REAL *x=fraction; p0=hcos_64[ 0]*(x[ 0]-x[31]);p1=hcos_64[ 1]*(x[ 1]-x[30]); p2=hcos_64[ 2]*(x[ 2]-x[29]);p3=hcos_64[ 3]*(x[ 3]-x[28]); p4=hcos_64[ 4]*(x[ 4]-x[27]);p5=hcos_64[ 5]*(x[ 5]-x[26]); p6=hcos_64[ 6]*(x[ 6]-x[25]);p7=hcos_64[ 7]*(x[ 7]-x[24]); p8=hcos_64[ 8]*(x[ 8]-x[23]);p9=hcos_64[ 9]*(x[ 9]-x[22]); pa=hcos_64[10]*(x[10]-x[21]);pb=hcos_64[11]*(x[11]-x[20]); pc=hcos_64[12]*(x[12]-x[19]);pd=hcos_64[13]*(x[13]-x[18]); pe=hcos_64[14]*(x[14]-x[17]);pf=hcos_64[15]*(x[15]-x[16]); } q0=p0+pf;q1=p1+pe;q2=p2+pd;q3=p3+pc; q4=p4+pb;q5=p5+pa;q6=p6+p9;q7=p7+p8; q8=hcos_32[0]*(p0-pf);q9=hcos_32[1]*(p1-pe); qa=hcos_32[2]*(p2-pd);qb=hcos_32[3]*(p3-pc); qc=hcos_32[4]*(p4-pb);qd=hcos_32[5]*(p5-pa); qe=hcos_32[6]*(p6-p9);qf=hcos_32[7]*(p7-p8); p0=q0+q7;p1=q1+q6;p2=q2+q5;p3=q3+q4; p4=hcos_16[0]*(q0-q7);p5=hcos_16[1]*(q1-q6); p6=hcos_16[2]*(q2-q5);p7=hcos_16[3]*(q3-q4); p8=q8+qf;p9=q9+qe;pa=qa+qd;pb=qb+qc; pc=hcos_16[0]*(q8-qf);pd=hcos_16[1]*(q9-qe); pe=hcos_16[2]*(qa-qd);pf=hcos_16[3]*(qb-qc); q0=p0+p3;q1=p1+p2;q2=hcos_8[0]*(p0-p3);q3=hcos_8[1]*(p1-p2); q4=p4+p7;q5=p5+p6;q6=hcos_8[0]*(p4-p7);q7=hcos_8[1]*(p5-p6); q8=p8+pb;q9=p9+pa;qa=hcos_8[0]*(p8-pb);qb=hcos_8[1]*(p9-pa); qc=pc+pf;qd=pd+pe;qe=hcos_8[0]*(pc-pf);qf=hcos_8[1]*(pd-pe); p0=q0+q1;p1=hcos_4*(q0-q1); p2=q2+q3;p3=hcos_4*(q2-q3); p4=q4+q5;p5=hcos_4*(q4-q5); p6=q6+q7;p7=hcos_4*(q6-q7); p8=q8+q9;p9=hcos_4*(q8-q9); pa=qa+qb;pb=hcos_4*(qa-qb); pc=qc+qd;pd=hcos_4*(qc-qd); pe=qe+qf;pf=hcos_4*(qe-qf); { REAL tmp; tmp=pd+pf; OUT1(5,p5+p7+pb+tmp); tmp+=p9; OUT1(1,p1+tmp); OUT2(33)=-(p1+pe+tmp); tmp+=p5+p7; OUT1(3,tmp); OUT2(35)=-(p6+pe+tmp); tmp=pa+pb+pc+pd+pe+pf; OUT2(39)=-(p2+p3+tmp-pc); OUT2(43)=-(p4+p6+p7+tmp-pd); OUT2(37)=-(p5+p6+p7+tmp-pc); OUT2(41)=-(p2+p3+tmp-pd); tmp=p8+pc+pe+pf; OUT2(47)=-(p0+tmp); OUT2(45)=-(p4+p6+p7+tmp); tmp=pb+pf; OUT1(11,p7+tmp); tmp+=p3; OUT1( 9,tmp); OUT1( 7,pd+tmp); OUT1(13,p7+pf); OUT1(15,pf); } } #define SAVE \ raw=(int)(r*scalefactor); \ if(raw>MAXSCALE)raw=MAXSCALE;else if(rawMAXSCALE)raw=MAXSCALE;else if(rawMAXSCALE)raw=MAXSCALE;else if(rawMAXSCALE)raw=MAXSCALE;else if(rawMAXSCALE)raw=MAXSCALE;else if(rawMAXSCALE)raw=MAXSCALE;else if(raw 2184) { //printf("fraction LS OverFlow code %d -> 2184 (1)\n", code); code=2184; } s=group[LS][i]+code; fraction[LS][0][i]=s[0]; fraction[LS][1][i]=s[1]; fraction[LS][2][i]=s[2]; } else { fraction[LS][0][i]= REAL(getbits(codelength[LS][i]))*factor[LS][i]-1.0; fraction[LS][1][i]= REAL(getbits(codelength[LS][i]))*factor[LS][i]-1.0; fraction[LS][2][i]= REAL(getbits(codelength[LS][i]))*factor[LS][i]-1.0; } } else fraction[LS][0][i]=fraction[LS][1][i]=fraction[LS][2][i]=0.0; if(inputstereo && bitalloc[RS][i]) { if(group[RS][i]) { const REAL *s; int code=getbits(codelength[RS][i]); code+=code<<1; if (code > 2184) { //printf("fraction LS OverFlow code %d -> 2184 (2)\n", code); code=2184; } s=group[RS][i]+code; fraction[RS][0][i]=s[0]; fraction[RS][1][i]=s[1]; fraction[RS][2][i]=s[2]; } else { fraction[RS][0][i]= REAL(getbits(codelength[RS][i]))*factor[RS][i]-1.0; fraction[RS][1][i]= REAL(getbits(codelength[RS][i]))*factor[RS][i]-1.0; fraction[RS][2][i]= REAL(getbits(codelength[RS][i]))*factor[RS][i]-1.0; } } else fraction[RS][0][i]=fraction[RS][1][i]=fraction[RS][2][i]=0.0; } for(;i>2][i]; fraction[LS][0][i]*=t; fraction[LS][1][i]*=t; fraction[LS][2][i]*=t; } if(bitalloc[RS][i]) { if(!group[RS][i]) { fraction[RS][0][i]=(fraction[RS][0][i]+d[RS][i])*c[RS][i]; fraction[RS][1][i]=(fraction[RS][1][i]+d[RS][i])*c[RS][i]; fraction[RS][2][i]=(fraction[RS][2][i]+d[RS][i])*c[RS][i]; } register REAL t=scalefactor[RS][l>>2][i]; fraction[RS][0][i]*=t; fraction[RS][1][i]*=t; fraction[RS][2][i]*=t; } } else for(i=0;i>2][i]; fraction[LS][0][i]*=t; fraction[LS][1][i]*=t; fraction[LS][2][i]*=t; } for(;i #include #include "MPEGaudio.h" #if defined(_WIN32) && defined(_MSC_VER) // disable warnings about double to float conversions #pragma warning(disable: 4244 4305) #endif inline void Mpegbitwindow::wrap(void) { int p=bitindex>>3; point&=(WINDOWSIZE-1); if(p>=point) { for(register int i=4;ipart2_3_length =getbits(12); gi->big_values =getbits(9); gi->global_gain =getbits(8); gi->scalefac_compress =getbits(4); gi->window_switching_flag=getbit(); if(gi->window_switching_flag) { gi->block_type =getbits(2); gi->mixed_block_flag=getbit(); gi->table_select[0] =getbits(5); gi->table_select[1] =getbits(5); gi->subblock_gain[0]=getbits(3); gi->subblock_gain[1]=getbits(3); gi->subblock_gain[2]=getbits(3); /* Set region_count parameters since they are implicit in this case. */ if(gi->block_type==0) { /* printf("Side info bad: block_type == 0 in split block.\n"); exit(0); */ return false; } else if (gi->block_type==2 && gi->mixed_block_flag==0) gi->region0_count=8; /* MI 9; */ else gi->region0_count=7; /* MI 8; */ gi->region1_count=20-(gi->region0_count); } else { gi->table_select[0] =getbits(5); gi->table_select[1] =getbits(5); gi->table_select[2] =getbits(5); gi->region0_count =getbits(4); gi->region1_count =getbits(3); gi->block_type =0; } gi->preflag =getbit(); gi->scalefac_scale =getbit(); gi->count1table_select=getbit(); gi->generalflag=gi->window_switching_flag && (gi->block_type==2); if(!inputstereo || ch)break; } return true; } bool MPEGaudio::layer3getsideinfo_2(void) { sideinfo.main_data_begin=getbits(8); if(!inputstereo)sideinfo.private_bits=getbit(); else sideinfo.private_bits=getbits(2); for(int ch=0;;ch++) { layer3grinfo *gi=&(sideinfo.ch[ch].gr[0]); gi->part2_3_length =getbits(12); gi->big_values =getbits(9); gi->global_gain =getbits(8); gi->scalefac_compress =getbits(9); gi->window_switching_flag=getbit(); if(gi->window_switching_flag) { gi->block_type =getbits(2); gi->mixed_block_flag=getbit(); gi->table_select[0] =getbits(5); gi->table_select[1] =getbits(5); gi->subblock_gain[0]=getbits(3); gi->subblock_gain[1]=getbits(3); gi->subblock_gain[2]=getbits(3); /* Set region_count parameters since they are implicit in this case. */ if(gi->block_type==0) { /* printf("Side info bad: block_type == 0 in split block.\n"); exit(0); */ return false; } else if (gi->block_type==2 && gi->mixed_block_flag==0) gi->region0_count=8; /* MI 9; */ else gi->region0_count=7; /* MI 8; */ gi->region1_count=20-(gi->region0_count); } else { gi->table_select[0] =getbits(5); gi->table_select[1] =getbits(5); gi->table_select[2] =getbits(5); gi->region0_count =getbits(4); gi->region1_count =getbits(3); gi->block_type =0; } gi->scalefac_scale =getbit(); gi->count1table_select=getbit(); gi->generalflag=gi->window_switching_flag && (gi->block_type==2); if(!inputstereo || ch)break; } return true; } void MPEGaudio::layer3getscalefactors(int ch,int gr) { static int slen[2][16]={{0, 0, 0, 0, 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4}, {0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 3}}; layer3grinfo *gi=&(sideinfo.ch[ch].gr[gr]); register layer3scalefactor *sf=(&scalefactors[ch]); int l0,l1; { int scale_comp=gi->scalefac_compress; l0=slen[0][scale_comp]; l1=slen[1][scale_comp]; } if(gi->generalflag) { if(gi->mixed_block_flag) { /* MIXED */ /* NEW-ag 11/25 */ sf->l[0]=wgetbits9(l0);sf->l[1]=wgetbits9(l0); sf->l[2]=wgetbits9(l0);sf->l[3]=wgetbits9(l0); sf->l[4]=wgetbits9(l0);sf->l[5]=wgetbits9(l0); sf->l[6]=wgetbits9(l0);sf->l[7]=wgetbits9(l0); sf->s[0][ 3]=wgetbits9(l0);sf->s[1][ 3]=wgetbits9(l0); sf->s[2][ 3]=wgetbits9(l0); sf->s[0][ 4]=wgetbits9(l0);sf->s[1][ 4]=wgetbits9(l0); sf->s[2][ 4]=wgetbits9(l0); sf->s[0][ 5]=wgetbits9(l0);sf->s[1][ 5]=wgetbits9(l0); sf->s[2][ 5]=wgetbits9(l0); sf->s[0][ 6]=wgetbits9(l1);sf->s[1][ 6]=wgetbits9(l1); sf->s[2][ 6]=wgetbits9(l1); sf->s[0][ 7]=wgetbits9(l1);sf->s[1][ 7]=wgetbits9(l1); sf->s[2][ 7]=wgetbits9(l1); sf->s[0][ 8]=wgetbits9(l1);sf->s[1][ 8]=wgetbits9(l1); sf->s[2][ 8]=wgetbits9(l1); sf->s[0][ 9]=wgetbits9(l1);sf->s[1][ 9]=wgetbits9(l1); sf->s[2][ 9]=wgetbits9(l1); sf->s[0][10]=wgetbits9(l1);sf->s[1][10]=wgetbits9(l1); sf->s[2][10]=wgetbits9(l1); sf->s[0][11]=wgetbits9(l1);sf->s[1][11]=wgetbits9(l1); sf->s[2][11]=wgetbits9(l1); sf->s[0][12]=sf->s[1][12]=sf->s[2][12]=0; } else { /* SHORT*/ sf->s[0][ 0]=wgetbits9(l0);sf->s[1][ 0]=wgetbits9(l0); sf->s[2][ 0]=wgetbits9(l0); sf->s[0][ 1]=wgetbits9(l0);sf->s[1][ 1]=wgetbits9(l0); sf->s[2][ 1]=wgetbits9(l0); sf->s[0][ 2]=wgetbits9(l0);sf->s[1][ 2]=wgetbits9(l0); sf->s[2][ 2]=wgetbits9(l0); sf->s[0][ 3]=wgetbits9(l0);sf->s[1][ 3]=wgetbits9(l0); sf->s[2][ 3]=wgetbits9(l0); sf->s[0][ 4]=wgetbits9(l0);sf->s[1][ 4]=wgetbits9(l0); sf->s[2][ 4]=wgetbits9(l0); sf->s[0][ 5]=wgetbits9(l0);sf->s[1][ 5]=wgetbits9(l0); sf->s[2][ 5]=wgetbits9(l0); sf->s[0][ 6]=wgetbits9(l1);sf->s[1][ 6]=wgetbits9(l1); sf->s[2][ 6]=wgetbits9(l1); sf->s[0][ 7]=wgetbits9(l1);sf->s[1][ 7]=wgetbits9(l1); sf->s[2][ 7]=wgetbits9(l1); sf->s[0][ 8]=wgetbits9(l1);sf->s[1][ 8]=wgetbits9(l1); sf->s[2][ 8]=wgetbits9(l1); sf->s[0][ 9]=wgetbits9(l1);sf->s[1][ 9]=wgetbits9(l1); sf->s[2][ 9]=wgetbits9(l1); sf->s[0][10]=wgetbits9(l1);sf->s[1][10]=wgetbits9(l1); sf->s[2][10]=wgetbits9(l1); sf->s[0][11]=wgetbits9(l1);sf->s[1][11]=wgetbits9(l1); sf->s[2][11]=wgetbits9(l1); sf->s[0][12]=sf->s[1][12]=sf->s[2][12]=0; } } else { /* LONG types 0,1,3 */ if(gr==0) { sf->l[ 0]=wgetbits9(l0);sf->l[ 1]=wgetbits9(l0); sf->l[ 2]=wgetbits9(l0);sf->l[ 3]=wgetbits9(l0); sf->l[ 4]=wgetbits9(l0);sf->l[ 5]=wgetbits9(l0); sf->l[ 6]=wgetbits9(l0);sf->l[ 7]=wgetbits9(l0); sf->l[ 8]=wgetbits9(l0);sf->l[ 9]=wgetbits9(l0); sf->l[10]=wgetbits9(l0); sf->l[11]=wgetbits9(l1);sf->l[12]=wgetbits9(l1); sf->l[13]=wgetbits9(l1);sf->l[14]=wgetbits9(l1); sf->l[15]=wgetbits9(l1); sf->l[16]=wgetbits9(l1);sf->l[17]=wgetbits9(l1); sf->l[18]=wgetbits9(l1);sf->l[19]=wgetbits9(l1); sf->l[20]=wgetbits9(l1); } else { if(sideinfo.ch[ch].scfsi[0]==0) { sf->l[ 0]=wgetbits9(l0);sf->l[ 1]=wgetbits9(l0); sf->l[ 2]=wgetbits9(l0);sf->l[ 3]=wgetbits9(l0); sf->l[ 4]=wgetbits9(l0);sf->l[ 5]=wgetbits9(l0); } if(sideinfo.ch[ch].scfsi[1]==0) { sf->l[ 6]=wgetbits9(l0);sf->l[ 7]=wgetbits9(l0); sf->l[ 8]=wgetbits9(l0);sf->l[ 9]=wgetbits9(l0); sf->l[10]=wgetbits9(l0); } if(sideinfo.ch[ch].scfsi[2]==0) { sf->l[11]=wgetbits9(l1);sf->l[12]=wgetbits9(l1); sf->l[13]=wgetbits9(l1);sf->l[14]=wgetbits9(l1); sf->l[15]=wgetbits9(l1); } if(sideinfo.ch[ch].scfsi[3]==0) { sf->l[16]=wgetbits9(l1);sf->l[17]=wgetbits9(l1); sf->l[18]=wgetbits9(l1);sf->l[19]=wgetbits9(l1); sf->l[20]=wgetbits9(l1); } } sf->l[21]=sf->l[22]=0; } } void MPEGaudio::layer3getscalefactors_2(int ch) { static int sfbblockindex[6][3][4]= { {{ 6, 5, 5, 5},{ 9, 9, 9, 9},{ 6, 9, 9, 9}}, {{ 6, 5, 7, 3},{ 9, 9,12, 6},{ 6, 9,12, 6}}, {{11,10, 0, 0},{18,18, 0, 0},{15,18, 0, 0}}, {{ 7, 7, 7, 0},{12,12,12, 0},{ 6,15,12, 0}}, {{ 6, 6, 6, 3},{12, 9, 9, 6},{ 6,12, 9, 6}}, {{ 8, 8, 5, 0},{15,12, 9, 0},{ 6,18, 9, 0}} }; int sb[54]; layer3grinfo *gi=&(sideinfo.ch[ch].gr[0]); register layer3scalefactor *sf=(&scalefactors[ch]); { int blocktypenumber,sc; int blocknumber; int slen[4]; if(gi->block_type==2)blocktypenumber=1+gi->mixed_block_flag; else blocktypenumber=0; sc=gi->scalefac_compress; if(!((extendedmode==1 || extendedmode==3) && (ch==1))) { if(sc<400) { slen[0]=(sc>>4)/5; slen[1]=(sc>>4)%5; slen[2]=(sc%16)>>2; slen[3]=(sc%4); gi->preflag=0; blocknumber=0; } else if(sc<500) { sc-=400; slen[0]=(sc>>2)/5; slen[1]=(sc>>2)%5; slen[2]=sc%4; slen[3]=0; gi->preflag=0; blocknumber=1; } else // if(sc<512) { sc-=500; slen[0]=sc/3; slen[1]=sc%3; slen[2]=0; slen[3]=0; gi->preflag=1; blocknumber=2; } } else { sc>>=1; if(sc<180) { slen[0]=sc/36; slen[1]=(sc%36)/6; slen[2]=(sc%36)%6; slen[3]=0; gi->preflag=0; blocknumber=3; } else if(sc<244) { sc-=180; slen[0]=(sc%64)>>4; slen[1]=(sc%16)>>2; slen[2]=sc%4; slen[3]=0; gi->preflag=0; blocknumber=4; } else // if(sc<255) { sc-=244; slen[0]=sc/3; slen[1]=sc%3; slen[2]= slen[3]=0; gi->preflag=0; blocknumber=5; } } { int i,j,k,*si; si=sfbblockindex[blocknumber][blocktypenumber]; for(i=0;i<45;i++)sb[i]=0; for(k=i=0;i<4;i++) for(j=0;jwindow_switching_flag && (gi->block_type==2)) { if(gi->mixed_block_flag) { for(sfb=0;sfb<8;sfb++)sf->l[sfb]=sb[k++]; sfb=3; } else sfb=0; for(;sfb<12;sfb++) for(window=0;window<3;window++) sf->s[window][sfb]=sb[k++]; sf->s[0][12]=sf->s[1][12]=sf->s[2][12]=0; } else { for(sfb=0;sfb<21;sfb++) sf->l[sfb]=sb[k++]; sf->l[21]=sf->l[22]=0; } } } typedef unsigned int HUFFBITS; #define MXOFF 250 /* do the huffman-decoding */ /* note! for counta,countb -the 4 bit value is returned in y, discard x */ // Huffman decoder for tablename<32 void MPEGaudio::huffmandecoder_1(const HUFFMANCODETABLE *h,int *x,int *y) { HUFFBITS level=(1<<(sizeof(HUFFBITS)*8-1)); int point=0; /* Lookup in Huffman table. */ for(;;) { if(h->val[point][0]==0) { /*end of tree*/ int xx,yy; xx=h->val[point][1]>>4; yy=h->val[point][1]&0xf; if(h->linbits) { if((h->xlen)==(unsigned)xx)xx+=wgetbits(h->linbits); if(xx)if(wgetbit())xx=-xx; if((h->ylen)==(unsigned)yy)yy+=wgetbits(h->linbits); if(yy)if(wgetbit())yy=-yy; } else { if(xx)if(wgetbit())xx=-xx; if(yy)if(wgetbit())yy=-yy; } *x=xx;*y=yy; break; } point+=h->val[point][wgetbit()]; level>>=1; if(!(level || ((unsigned)pointtreelen))) { register int xx,yy; xx=(h->xlen<<1);// set x and y to a medium value as a simple concealment yy=(h->ylen<<1); // h->xlen and h->ylen can't be 1 under tablename 32 // if(xx) if(wgetbit())xx=-xx; // if(yy) if(wgetbit())yy=-yy; *x=xx;*y=yy; break; } } } // Huffman decoder tablenumber>=32 void MPEGaudio::huffmandecoder_2(const HUFFMANCODETABLE *h, int *x,int *y,int *v,int *w) { HUFFBITS level=(1<<(sizeof(HUFFBITS)*8-1)); int point=0; /* Lookup in Huffman table. */ for(;;) { if(h->val[point][0]==0) { /*end of tree*/ register int t=h->val[point][1]; if(t&8)*v=1-(wgetbit()<<1); else *v=0; if(t&4)*w=1-(wgetbit()<<1); else *w=0; if(t&2)*x=1-(wgetbit()<<1); else *x=0; if(t&1)*y=1-(wgetbit()<<1); else *y=0; break; } point+=h->val[point][wgetbit()]; level>>=1; if(!(level || ((unsigned)pointtreelen))) { *v=1-(wgetbit()<<1); *w=1-(wgetbit()<<1); *x=1-(wgetbit()<<1); *y=1-(wgetbit()<<1); break; } } } typedef struct { int l[23]; int s[14]; }SFBANDINDEX; static SFBANDINDEX sfBandIndextable[2][3]= { // MPEG 1 {{{0,4,8,12,16,20,24,30,36,44,52,62,74,90,110,134,162,196,238,288,342,418,576}, {0,4,8,12,16,22,30,40,52,66,84,106,136,192}}, {{0,4,8,12,16,20,24,30,36,42,50,60,72,88,106,128,156,190,230,276,330,384,576}, {0,4,8,12,16,22,28,38,50,64,80,100,126,192}}, {{0,4,8,12,16,20,24,30,36,44,54,66,82,102,126,156,194,240,296,364,448,550,576}, {0,4,8,12,16,22,30,42,58,78,104,138,180,192}}}, // MPEG 2 {{{0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576}, {0,4,8,12,18,24,32,42,56,74,100,132,174,192}}, {{0,6,12,18,24,30,36,44,54,66,80,96,114,136,162,194,232,278,330,394,464,540,576}, {0,4,8,12,18,26,36,48,62,80,104,136,180,192}}, {{0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576}, {0,4,8,12,18,26,36,48,62,80,104,134,174,192}}} }; void MPEGaudio::layer3huffmandecode(int ch,int gr,int out[SBLIMIT][SSLIMIT]) { layer3grinfo *gi=&(sideinfo.ch[ch].gr[gr]); int part2_3_end=layer3part2start+(gi->part2_3_length); int region1Start,region2Start; int i,e=gi->big_values<<1; /* Find region boundary for short block case. */ if(gi->generalflag) { /* Region2. */ region1Start=36; /* sfb[9/3]*3=36 */ region2Start=576;/* No Region2 for short block case. */ } else { /* Find region boundary for long block case. */ region1Start=sfBandIndextable[version][frequency].l[gi->region0_count+1]; region2Start=sfBandIndextable[version][frequency].l[gi->region0_count+ gi->region1_count+2]; } /* Read bigvalues area. */ for(i=0;itable_select[0]]; if(region1Start>e)end=e; else end=region1Start; } else if(itable_select[1]]; if(region2Start>e)end=e; else end=region2Start; } else { h=&ht[gi->table_select[2]]; end=e; } if(h->treelen) while(icount1table_select+32]; while(bitwindow.gettotalbit()=ARRAYSIZE) { bitwindow.rewind(bitwindow.gettotalbit()-part2_3_end); return; } } for(;iglobal_gain]; REAL *TO_FOUR_THIRDS=TO_FOUR_THIRDSTABLE+FOURTHIRDSTABLENUMBER; /* choose correct scalefactor band per block type, initalize boundary */ /* and apply formula per block type */ if(!gi->generalflag) { /* LONG blocks: 0,1,3 */ int next_cb_boundary; int cb=-1,index=0; REAL factor; do { next_cb_boundary=sfBandIndex->l[(++cb)+1]; factor=globalgain* layer3twopow2(gi->scalefac_scale,gi->preflag, pretab[cb],scalefactors[ch].l[cb]); for(;indexmixed_block_flag) { int cb=0,index=0; int cb_width; do { cb_width=(sfBandIndex->s[cb+1]-sfBandIndex->s[cb])>>1; for(register int k=0;k<3;k++) { register REAL factor; register int count=cb_width; factor=globalgain* layer3twopow2_1(gi->subblock_gain[k],gi->scalefac_scale, scalefactors[ch].s[k][cb]); do{ out[0][index]=factor*TO_FOUR_THIRDS[in[0][index]];index++; out[0][index]=factor*TO_FOUR_THIRDS[in[0][index]];index++; }while(--count); } cb++; }while(indexl[1]; /* LONG blocks: 0,1,3 */ int index; /* Compute overall (global) scaling. */ { for(int sb=0;sbl[8]) { next_cb_boundary=sfBandIndex->s[4]; next_cb_boundary=MUL3(next_cb_boundary); cb=3; cb_width=sfBandIndex->s[4]-sfBandIndex->s[3]; cb_begin=sfBandIndex->s[3]; cb_begin=MUL3(cb_begin); } else if(indexl[8]) next_cb_boundary=sfBandIndex->l[(++cb)+1]; else { next_cb_boundary=sfBandIndex->s[(++cb)+1]; next_cb_boundary=MUL3(next_cb_boundary); cb_begin=sfBandIndex->s[cb]; cb_width=sfBandIndex->s[cb+1]-cb_begin; cb_begin=MUL3(cb_begin); } } /* LONG block types 0,1,3 & 1st 2 subbands of switched blocks */ out[0][index]*=layer3twopow2(gi->scalefac_scale,gi->preflag, pretab[cb],scalefactors[ch].l[cb]); } for(;indexl[8]) { next_cb_boundary=sfBandIndex->s[4]; next_cb_boundary=MUL3(next_cb_boundary); cb=3; cb_width=sfBandIndex->s[4]-sfBandIndex->s[3]; cb_begin=sfBandIndex->s[3]; cb_begin=(cb_begin<<2)-cb_begin; } else if(indexl[8]) next_cb_boundary=sfBandIndex->l[(++cb)+1]; else { next_cb_boundary=sfBandIndex->s[(++cb)+1]; next_cb_boundary=MUL3(next_cb_boundary); cb_begin=sfBandIndex->s[cb]; cb_width=sfBandIndex->s[cb+1]-cb_begin; cb_begin=MUL3(cb_begin); } } { int t_index=(index-cb_begin)/cb_width; out[0][index]*=layer3twopow2_1(gi->subblock_gain[t_index], gi->scalefac_scale, scalefactors[ch].s[t_index][cb]); } } } } void MPEGaudio::layer3fixtostereo(int gr,REAL in[2][SBLIMIT][SSLIMIT]) { layer3grinfo *gi=&(sideinfo.ch[0].gr[gr]); SFBANDINDEX *sfBandIndex=&(sfBandIndextable[version][frequency]); int ms_stereo=(mode==joint) && (extendedmode & 0x2); int i_stereo =(mode==joint) && (extendedmode & 0x1); if(!inputstereo) { /* mono , bypass xr[0][][] to lr[0][][]*/ // memcpy(out[0][0],in[0][0],ARRAYSIZE*REALSIZE); return; } if(i_stereo) { int i; int is_pos[ARRAYSIZE]; RATIOS is_ratio[ARRAYSIZE]; RATIOS *ratios; if(version)ratios=rat_2[gi->scalefac_compress%2]; else ratios=rat_1; /* initialization */ for(i=0;igeneralflag) { if(gi->mixed_block_flag) // Part I { int max_sfb=0; for(int j=0;j<3;j++) { int sfb,sfbcnt=2; for(sfb=12;sfb>=3;sfb--) { int lines; i=sfBandIndex->s[sfb]; lines=sfBandIndex->s[sfb+1]-i; i=MUL3(i)+(j+1)*lines-1; for(;lines>0;lines--,i--) if(in[1][0][i]!=0.0f) { sfbcnt=sfb; sfb=0;break; // quit loop } } sfb=sfbcnt+1; if(sfb>max_sfb)max_sfb=sfb; for(;sfb<12;sfb++) { int k,t; t=sfBandIndex->s[sfb]; k=sfBandIndex->s[sfb+1]-t; i=MUL3(t)+j*k; t=scalefactors[1].s[j][sfb]; if(t!=7) { RATIOS r=ratios[t]; for(;k>0;k--,i++){ is_pos[i]=t;is_ratio[i]=r;} } else for(;k>0;k--,i++)is_pos[i]=t; } sfb=sfBandIndex->s[10]; sfb=MUL3(sfb)+j*(sfBandIndex->s[11]-sfb); { int k,t; t=sfBandIndex->s[11]; k=sfBandIndex->s[12]-t; i=MUL3(t)+j*k; t=is_pos[sfb]; if(t!=7) { RATIOS r=is_ratio[sfb]; for(;k>0;k--,i++){ is_pos[i]=t;is_ratio[i]=r;} } else for(;k>0;k--,i++)is_pos[i]=t; } } if(max_sfb<=3) { { REAL temp; int k; temp=in[1][0][0];in[1][0][0]=1.0; for(k=3*SSLIMIT-1;in[1][0][k]==0.0;k--); in[1][0][0]=temp; for(i=0;sfBandIndex->l[i]<=k;i++); } { int sfb=i; i=sfBandIndex->l[i]; for(;sfb<8;sfb++) { int t=scalefactors[1].l[sfb]; int k=sfBandIndex->l[sfb+1]-sfBandIndex->l[sfb]; if(t!=7) { RATIOS r=ratios[t]; for(;k>0;k--,i++){ is_pos[i]=t;is_ratio[i]=r;} } else for(;k>0;k--,i++)is_pos[i]=t; } } } } else // Part II { for(int j=0;j<3;j++) { int sfb; int sfbcnt=-1; for(sfb=12;sfb>=0;sfb--) { int lines; { int t; t=sfBandIndex->s[sfb]; lines=sfBandIndex->s[sfb+1]-t; i=MUL3(t)+(j+1)*lines-1; } for(;lines>0;lines--,i--) if(in[1][0][i]!=0.0f) { sfbcnt=sfb; sfb=0;break; // quit loop } } for(sfb=sfbcnt+1;sfb<12;sfb++) { int k,t; t=sfBandIndex->s[sfb]; k=sfBandIndex->s[sfb+1]-t; i=MUL3(t)+j*k; t=scalefactors[1].s[j][sfb]; if(t!=7) { RATIOS r=ratios[t]; for(;k>0;k--,i++){ is_pos[i]=t;is_ratio[i]=r;} } else for(;k>0;k--,i++)is_pos[i]=t; } { int t1=sfBandIndex->s[10], t2=sfBandIndex->s[11]; int k,tt; tt=MUL3(t1)+j*(t2-t1); k =sfBandIndex->s[12]-t2; if(is_pos[tt]!=7) { RATIOS r=is_ratio[tt]; int t=is_pos[tt]; i =MUL3(t1)+j*k; for(;k>0;k--,i++){ is_pos[i]=t;is_ratio[i]=r;} } else for(;k>0;k--,i++)is_pos[i]=7; } } } } else // ms-stereo (Part III) { { REAL temp; int k; temp=in[1][0][0];in[1][0][0]=1.0; for(k=ARRAYSIZE-1;in[1][0][k]==0.0;k--); in[1][0][0]=temp; for(i=0;sfBandIndex->l[i]<=k;i++); } { int sfb; sfb=i; i=sfBandIndex->l[i]; for(;sfb<21;sfb++) { int k,t; k=sfBandIndex->l[sfb+1]-sfBandIndex->l[sfb]; t=scalefactors[1].l[sfb]; if(t!=7) { RATIOS r=ratios[t]; for(;k>0;k--,i++){ is_pos[i]=t;is_ratio[i]=r;} } else for(;k>0;k--,i++)is_pos[i]=t; } } if (i <= sfBandIndex->l[21]) { int k,t,tt; tt=sfBandIndex->l[20]; k=576-sfBandIndex->l[21]; t=is_pos[tt]; if(t!=7) { RATIOS r=is_ratio[tt]; for(;k>0;k--,i++){ is_pos[i]=t;is_ratio[i]=r;} } else for(;k>0;k--,i++)is_pos[i]=t; } } if(ms_stereo) { i=ARRAYSIZE-1; do{ if(is_pos[i]==7) { register REAL t=in[LS][0][i]; in[LS][0][i]=(t+in[RS][0][i])*0.7071068f; in[RS][0][i]=(t-in[RS][0][i])*0.7071068f; } else { in[RS][0][i]=in[LS][0][i]*is_ratio[i].r; in[LS][0][i]*=is_ratio[i].l; } }while(i--); } else { i=ARRAYSIZE-1; do{ if(is_pos[i]!=7) { in[RS][0][i]=in[LS][0][i]*is_ratio[i].r; in[LS][0][i]*=is_ratio[i].l; } }while(i--); } } else { if(ms_stereo) { int i=ARRAYSIZE-1; do{ register REAL t=in[LS][0][i]; in[LS][0][i]=(t+in[RS][0][i])*0.7071068f; in[RS][0][i]=(t-in[RS][0][i])*0.7071068f; }while(i--); } } // channels==2 } inline void layer3reorder_1(int version,int frequency, REAL in[SBLIMIT][SSLIMIT], REAL out[SBLIMIT][SSLIMIT]) { SFBANDINDEX *sfBandIndex=&(sfBandIndextable[version][frequency]); int sfb,sfb_start,sfb_lines; /* NO REORDER FOR LOW 2 SUBBANDS */ out[0][ 0]=in[0][ 0];out[0][ 1]=in[0][ 1];out[0][ 2]=in[0][ 2]; out[0][ 3]=in[0][ 3];out[0][ 4]=in[0][ 4];out[0][ 5]=in[0][ 5]; out[0][ 6]=in[0][ 6];out[0][ 7]=in[0][ 7];out[0][ 8]=in[0][ 8]; out[0][ 9]=in[0][ 9];out[0][10]=in[0][10];out[0][11]=in[0][11]; out[0][12]=in[0][12];out[0][13]=in[0][13];out[0][14]=in[0][14]; out[0][15]=in[0][15];out[0][16]=in[0][16];out[0][17]=in[0][17]; out[1][ 0]=in[1][ 0];out[1][ 1]=in[1][ 1];out[1][ 2]=in[1][ 2]; out[1][ 3]=in[1][ 3];out[1][ 4]=in[1][ 4];out[1][ 5]=in[1][ 5]; out[1][ 6]=in[1][ 6];out[1][ 7]=in[1][ 7];out[1][ 8]=in[1][ 8]; out[1][ 9]=in[1][ 9];out[1][10]=in[1][10];out[1][11]=in[1][11]; out[1][12]=in[1][12];out[1][13]=in[1][13];out[1][14]=in[1][14]; out[1][15]=in[1][15];out[1][16]=in[1][16];out[1][17]=in[1][17]; /* REORDERING FOR REST SWITCHED SHORT */ for(sfb=3,sfb_start=sfBandIndex->s[3], sfb_lines=sfBandIndex->s[4]-sfb_start; sfb<13; sfb++,sfb_start=sfBandIndex->s[sfb], (sfb_lines=sfBandIndex->s[sfb+1]-sfb_start)) { for(int freq=0;freqs[1]; sfb<13; sfb++,sfb_start=sfBandIndex->s[sfb], (sfb_lines=sfBandIndex->s[sfb+1]-sfb_start)) { for(int freq=0;freqgeneralflag) { if(gi->mixed_block_flag) { fprintf(stderr,"Notchecked!"); layer3reorder_1 (version,frequency,in,out); // Not checked... layer3antialias_1(out); } else layer3reorder_2(version,frequency,in,out); } else layer3antialias_2(in,out); } static void dct36(REAL *inbuf,REAL *prevblk1,REAL *prevblk2,REAL *wi,REAL *out) { #define MACRO0(v) { \ REAL tmp; \ out2[9+(v)]=(tmp=sum0+sum1)*wi[27+(v)]; \ out2[8-(v)]=tmp * wi[26-(v)]; } \ sum0-=sum1; \ ts[SBLIMIT*(8-(v))]=out1[8-(v)]+sum0*wi[8-(v)]; \ ts[SBLIMIT*(9+(v))]=out1[9+(v)]+sum0*wi[9+(v)]; #define MACRO1(v) { \ REAL sum0,sum1; \ sum0=tmp1a+tmp2a; \ sum1=(tmp1b+tmp2b)*hsec_36[(v)]; \ MACRO0(v); } #define MACRO2(v) { \ REAL sum0,sum1; \ sum0=tmp2a-tmp1a; \ sum1=(tmp2b-tmp1b) * hsec_36[(v)]; \ MACRO0(v); } { register REAL *in = inbuf; in[17]+=in[16];in[16]+=in[15];in[15]+=in[14];in[14]+=in[13]; in[13]+=in[12];in[12]+=in[11];in[11]+=in[10];in[10]+=in[ 9]; in[ 9]+=in[ 8];in[ 8]+=in[ 7];in[ 7]+=in[ 6];in[ 6]+=in[ 5]; in[ 5]+=in[ 4];in[ 4]+=in[ 3];in[ 3]+=in[ 2];in[ 2]+=in[ 1]; in[ 1]+=in[ 0]; in[17]+=in[15];in[15]+=in[13];in[13]+=in[11];in[11]+=in[ 9]; in[ 9]+=in[ 7];in[7] +=in[ 5];in[ 5]+=in[ 3];in[ 3]+=in[ 1]; { register REAL *c = cos_18; register REAL *out2 = prevblk2; register REAL *out1 = prevblk1; register REAL *ts = out; REAL ta33,ta66,tb33,tb66; ta33=in[2*3+0]*c[3]; ta66=in[2*6+0]*c[6]; tb33=in[2*3+1]*c[3]; tb66=in[2*6+1]*c[6]; { REAL tmp1a,tmp2a,tmp1b,tmp2b; tmp1a= in[2*1+0]*c[1]+ta33 +in[2*5+0]*c[5]+in[2*7+0]*c[7]; tmp1b= in[2*1+1]*c[1]+tb33 +in[2*5+1]*c[5]+in[2*7+1]*c[7]; tmp2a=in[2*0+0]+in[2*2+0]*c[2]+in[2*4+0]*c[4]+ta66 +in[2*8+0]*c[8]; tmp2b=in[2*0+1]+in[2*2+1]*c[2]+in[2*4+1]*c[4]+tb66 +in[2*8+1]*c[8]; MACRO1(0); MACRO2(8); } { REAL tmp1a,tmp2a,tmp1b,tmp2b; tmp1a=(in[2*1+0]-in[2*5+0]-in[2*7+0])*c[3]; tmp1b=(in[2*1+1]-in[2*5+1]-in[2*7+1])*c[3]; tmp2a=(in[2*2+0]-in[2*4+0]-in[2*8+0])*c[6]-in[2*6+0]+in[2*0+0]; tmp2b=(in[2*2+1]-in[2*4+1]-in[2*8+1])*c[6]-in[2*6+1]+in[2*0+1]; MACRO1(1); MACRO2(7); } { REAL tmp1a,tmp2a,tmp1b,tmp2b; tmp1a= in[2*1+0]*c[5]-ta33 -in[2*5+0]*c[7]+in[2*7+0]*c[1]; tmp1b= in[2*1+1]*c[5]-tb33 -in[2*5+1]*c[7]+in[2*7+1]*c[1]; tmp2a=in[2*0+0]-in[2*2+0]*c[8]-in[2*4+0]*c[2]+ta66 +in[2*8+0]*c[4]; tmp2b=in[2*0+1]-in[2*2+1]*c[8]-in[2*4+1]*c[2]+tb66 +in[2*8+1]*c[4]; MACRO1(2); MACRO2(6); } { REAL tmp1a,tmp2a,tmp1b,tmp2b; tmp1a= in[2*1+0]*c[7]-ta33 +in[2*5+0]*c[1]-in[2*7+0]*c[5]; tmp1b= in[2*1+1]*c[7]-tb33 +in[2*5+1]*c[1]-in[2*7+1]*c[5]; tmp2a=in[2*0+0]-in[2*2+0]*c[4]+in[2*4+0]*c[8]+ta66 -in[2*8+0]*c[2]; tmp2b=in[2*0+1]-in[2*2+1]*c[4]+in[2*4+1]*c[8]+tb66 -in[2*8+1]*c[2]; MACRO1(3); MACRO2(5); } { REAL sum0,sum1; sum0= in[2*0+0]-in[2*2+0]+in[2*4+0]-in[2*6+0]+in[2*8+0]; sum1=(in[2*0+1]-in[2*2+1]+in[2*4+1]-in[2*6+1]+in[2*8+1])*hsec_36[4]; MACRO0(4); } } } } static void dct12(REAL *in,REAL *prevblk1,REAL *prevblk2,register REAL *wi,register REAL *out) { #define DCT12_PART1 \ in5=in[5*3]; \ in5+=(in4=in[4*3]); \ in4+=(in3=in[3*3]); \ in3+=(in2=in[2*3]); \ in2+=(in1=in[1*3]); \ in1+=(in0=in[0*3]); \ \ in5+=in3;in3+=in1; \ \ in2*=cos1_6; \ in3*=cos1_6; #define DCT12_PART2 \ in0+=in4*cos2_6; \ \ in4=in0+in2; \ in0-=in2; \ \ in1+=in5*cos2_6; \ \ in5=(in1+in3)*hsec_12[0]; \ in1=(in1-in3)*hsec_12[2]; \ \ in3=in4+in5; \ in4-=in5; \ \ in2=in0+in1; \ in0-=in1; { REAL in0,in1,in2,in3,in4,in5; register REAL *pb1=prevblk1; out[SBLIMIT*0]=pb1[0];out[SBLIMIT*1]=pb1[1];out[SBLIMIT*2]=pb1[2]; out[SBLIMIT*3]=pb1[3];out[SBLIMIT*4]=pb1[4];out[SBLIMIT*5]=pb1[5]; DCT12_PART1; { REAL tmp0,tmp1=(in0-in4); { register REAL tmp2=(in1-in5)*hsec_12[1]; tmp0=tmp1+tmp2; tmp1-=tmp2; } out[(17-1)*SBLIMIT]=pb1[17-1]+tmp0*wi[11-1]; out[(12+1)*SBLIMIT]=pb1[12+1]+tmp0*wi[ 6+1]; out[(6 +1)*SBLIMIT]=pb1[6 +1]+tmp1*wi[ 1 ]; out[(11-1)*SBLIMIT]=pb1[11-1]+tmp1*wi[ 5-1]; } DCT12_PART2; out[(17-0)*SBLIMIT]=pb1[17-0]+in2*wi[11-0]; out[(12+0)*SBLIMIT]=pb1[12+0]+in2*wi[ 6+0]; out[(12+2)*SBLIMIT]=pb1[12+2]+in3*wi[ 6+2]; out[(17-2)*SBLIMIT]=pb1[17-2]+in3*wi[11-2]; out[( 6+0)*SBLIMIT]=pb1[ 6+0]+in0*wi[0]; out[(11-0)*SBLIMIT]=pb1[11-0]+in0*wi[5-0]; out[( 6+2)*SBLIMIT]=pb1[ 6+2]+in4*wi[2]; out[(11-2)*SBLIMIT]=pb1[11-2]+in4*wi[5-2]; } in++; { REAL in0,in1,in2,in3,in4,in5; register REAL *pb2 = prevblk2; DCT12_PART1; { REAL tmp0,tmp1=(in0-in4); { REAL tmp2=(in1-in5)*hsec_12[1]; tmp0=tmp1+tmp2; tmp1-=tmp2; } pb2[5-1]=tmp0*wi[11-1]; pb2[0+1]=tmp0*wi[6+1]; out[(12+1)*SBLIMIT]+=tmp1*wi[1]; out[(17-1)*SBLIMIT]+=tmp1*wi[5-1]; } DCT12_PART2; pb2[5-0]=in2*wi[11-0]; pb2[0+0]=in2*wi[6+0]; pb2[0+2]=in3*wi[6+2]; pb2[5-2]=in3*wi[11-2]; out[(12+0)*SBLIMIT]+=in0*wi[0]; out[(17-0)*SBLIMIT]+=in0*wi[5-0]; out[(12+2)*SBLIMIT]+=in4*wi[2]; out[(17-2)*SBLIMIT]+=in4*wi[5-2]; } in++; { REAL in0,in1,in2,in3,in4,in5; register REAL *pb2 = prevblk2; pb2[12]=pb2[13]=pb2[14]=pb2[15]=pb2[16]=pb2[17]=0.0; DCT12_PART1; { REAL tmp0,tmp1=(in0-in4); { REAL tmp2=(in1-in5)*hsec_12[1]; tmp0=tmp1+tmp2; tmp1-=tmp2; } pb2[11-1]=tmp0*wi[11-1]; pb2[ 6+1]=tmp0*wi[6+1]; pb2[ 0+1]+=tmp1*wi[1]; pb2[ 5-1]+=tmp1*wi[5-1]; } DCT12_PART2; pb2[11-0]=in2*wi[11-0]; pb2[ 6+0]=in2*wi[ 6+0]; pb2[ 6+2]=in3*wi[ 6+2]; pb2[11-2]=in3*wi[11-2]; pb2[ 0+0]+=in0*wi[0 ]; pb2[ 5-0]+=in0*wi[5-0]; pb2[ 0+2]+=in4*wi[2 ]; pb2[ 5-2]+=in4*wi[5-2]; } } void MPEGaudio::layer3hybrid(int ch,int gr,REAL in[SBLIMIT][SSLIMIT], REAL out[SSLIMIT][SBLIMIT]) { layer3grinfo *gi=&(sideinfo.ch[ch].gr[gr]); int bt1,bt2; REAL *prev1,*prev2; prev1=prevblck[ch][currentprevblock][0]; prev2=prevblck[ch][currentprevblock^1][0]; bt1 = gi->mixed_block_flag ? 0 : gi->block_type; bt2 = gi->block_type; { REAL *ci=(REAL *)in, *co=(REAL *)out; int i; if(downfrequency)i=(SBLIMIT/2)-2; else i=SBLIMIT-2; if(bt2==2) { if(!bt1) { dct36(ci,prev1,prev2,win[0],co); ci+=SSLIMIT;prev1+=SSLIMIT;prev2+=SSLIMIT;co++; dct36(ci,prev1,prev2,win[0],co); } else { dct12(ci,prev1,prev2,win[2],co); ci+=SSLIMIT;prev1+=SSLIMIT;prev2+=SSLIMIT;co++; dct12(ci,prev1,prev2,win[2],co); } do{ ci+=SSLIMIT;prev1+=SSLIMIT;prev2+=SSLIMIT;co++; dct12(ci,prev1,prev2,win[2],co); }while(--i); } else { dct36(ci,prev1,prev2,win[bt1],co); ci+=SSLIMIT;prev1+=SSLIMIT;prev2+=SSLIMIT;co++; dct36(ci,prev1,prev2,win[bt1],co); do { ci+=SSLIMIT;prev1+=SSLIMIT;prev2+=SSLIMIT;co++; dct36(ci,prev1,prev2,win[bt2],co); }while(--i); } } } #define NEG(a) (a)=-(a) void MPEGaudio::extractlayer3(void) { if(version) { extractlayer3_2(); return; } { int main_data_end,flush_main; int bytes_to_discard; layer3getsideinfo(); if(issync()) { for(register int i=layer3slots;i>0;i--) // read main data. bitwindow.putbyte(getbyte()); } else { for(register int i=layer3slots;i>0;i--) // read main data. bitwindow.putbyte(getbits8()); } main_data_end=bitwindow.gettotalbit()>>3;// of previous frame if (main_data_end < 0) // Fix from Michael Vogt { return; } if((flush_main=(bitwindow.gettotalbit() & 0x7))) { bitwindow.forward(8-flush_main); main_data_end++; } bytes_to_discard=layer3framestart-(main_data_end+sideinfo.main_data_begin); if(main_data_end>WINDOWSIZE) { layer3framestart-=WINDOWSIZE; bitwindow.rewind(WINDOWSIZE*8); } layer3framestart+=layer3slots; bitwindow.wrap(); if(bytes_to_discard<0)return; bitwindow.forward(bytes_to_discard<<3); } for(int gr=0;gr<2;gr++) { union { int is [SBLIMIT][SSLIMIT]; REAL hin [2][SBLIMIT][SSLIMIT]; }b1; union { REAL ro [2][SBLIMIT][SSLIMIT]; REAL lr [2][SBLIMIT][SSLIMIT]; REAL hout [2][SSLIMIT][SBLIMIT]; }b2; layer3part2start=bitwindow.gettotalbit(); layer3getscalefactors (LS,gr); layer3huffmandecode (LS,gr ,b1.is); layer3dequantizesample(LS,gr,b1.is,b2.ro[LS]); if(inputstereo) { layer3part2start=bitwindow.gettotalbit(); layer3getscalefactors (RS,gr); layer3huffmandecode (RS,gr ,b1.is); layer3dequantizesample(RS,gr,b1.is,b2.ro[RS]); } layer3fixtostereo(gr,b2.ro); // b2.ro -> b2.lr currentprevblock^=1; layer3reorderandantialias(LS,gr,b2.lr[LS],b1.hin[LS]); layer3hybrid (LS,gr,b1.hin[LS],b2.hout[LS]); if(outputstereo) { layer3reorderandantialias(RS,gr,b2.lr[RS],b1.hin[RS]); layer3hybrid (RS,gr,b1.hin[RS],b2.hout[RS]); register int i=2*SSLIMIT*SBLIMIT-1; do{ NEG(b2.hout[0][0][i ]);NEG(b2.hout[0][0][i- 2]); NEG(b2.hout[0][0][i- 4]);NEG(b2.hout[0][0][i- 6]); NEG(b2.hout[0][0][i- 8]);NEG(b2.hout[0][0][i-10]); NEG(b2.hout[0][0][i-12]);NEG(b2.hout[0][0][i-14]); NEG(b2.hout[0][0][i-16]);NEG(b2.hout[0][0][i-18]); NEG(b2.hout[0][0][i-20]);NEG(b2.hout[0][0][i-22]); NEG(b2.hout[0][0][i-24]);NEG(b2.hout[0][0][i-26]); NEG(b2.hout[0][0][i-28]);NEG(b2.hout[0][0][i-30]); }while((i-=2*SBLIMIT)>0); } else { register int i=SSLIMIT*SBLIMIT-1; do{ NEG(b2.hout[0][0][i ]);NEG(b2.hout[0][0][i- 2]); NEG(b2.hout[0][0][i- 4]);NEG(b2.hout[0][0][i- 6]); NEG(b2.hout[0][0][i- 8]);NEG(b2.hout[0][0][i-10]); NEG(b2.hout[0][0][i-12]);NEG(b2.hout[0][0][i-14]); NEG(b2.hout[0][0][i-16]);NEG(b2.hout[0][0][i-18]); NEG(b2.hout[0][0][i-20]);NEG(b2.hout[0][0][i-22]); NEG(b2.hout[0][0][i-24]);NEG(b2.hout[0][0][i-26]); NEG(b2.hout[0][0][i-28]);NEG(b2.hout[0][0][i-30]); }while((i-=2*SBLIMIT)>0); } for(int ss=0;ss0;i--) // read main data. bitwindow.putbyte(getbyte()); } else { for(register int i=layer3slots;i>0;i--) // read main data. bitwindow.putbyte(getbits8()); } bitwindow.wrap(); main_data_end=bitwindow.gettotalbit()>>3;// of previous frame if((flush_main=(bitwindow.gettotalbit() & 0x7))) { bitwindow.forward(8-flush_main); main_data_end++; } bytes_to_discard=layer3framestart-main_data_end-sideinfo.main_data_begin; if(main_data_end>WINDOWSIZE) { layer3framestart-=WINDOWSIZE; bitwindow.rewind(WINDOWSIZE*8); } layer3framestart+=layer3slots; if(bytes_to_discard<0) return; bitwindow.forward(bytes_to_discard<<3); } // for(int gr=0;gr<2;gr++) { union { int is [SBLIMIT][SSLIMIT]; REAL hin [2][SBLIMIT][SSLIMIT]; }b1; union { REAL ro [2][SBLIMIT][SSLIMIT]; REAL lr [2][SBLIMIT][SSLIMIT]; REAL hout [2][SSLIMIT][SBLIMIT]; }b2; layer3part2start=bitwindow.gettotalbit(); layer3getscalefactors_2(LS); layer3huffmandecode (LS,0 ,b1.is); layer3dequantizesample (LS,0,b1.is,b2.ro[LS]); if(inputstereo) { layer3part2start=bitwindow.gettotalbit(); layer3getscalefactors_2(RS); layer3huffmandecode (RS,0 ,b1.is); layer3dequantizesample (RS,0,b1.is,b2.ro[RS]); } layer3fixtostereo(0,b2.ro); // b2.ro -> b2.lr currentprevblock^=1; layer3reorderandantialias(LS,0,b2.lr[LS],b1.hin[LS]); layer3hybrid (LS,0,b1.hin[LS],b2.hout[LS]); if(outputstereo) { layer3reorderandantialias(RS,0,b2.lr[RS],b1.hin[RS]); layer3hybrid (RS,0,b1.hin[RS],b2.hout[RS]); register int i=2*SSLIMIT*SBLIMIT-1; do{ NEG(b2.hout[0][0][i-16]);NEG(b2.hout[0][0][i-18]); NEG(b2.hout[0][0][i-20]);NEG(b2.hout[0][0][i-22]); NEG(b2.hout[0][0][i-24]);NEG(b2.hout[0][0][i-26]); NEG(b2.hout[0][0][i-28]);NEG(b2.hout[0][0][i-30]); }while((i-=2*SBLIMIT)>0); } else { register int i=SSLIMIT*SBLIMIT-1; do{ NEG(b2.hout[0][0][i-16]);NEG(b2.hout[0][0][i-18]); NEG(b2.hout[0][0][i-20]);NEG(b2.hout[0][0][i-22]); NEG(b2.hout[0][0][i-24]);NEG(b2.hout[0][0][i-26]); NEG(b2.hout[0][0][i-28]);NEG(b2.hout[0][0][i-30]); }while((i-=2*SBLIMIT)>0); } for(int ss=0;ss #include #include #include #include "MPEGaudio.h" #include "MPEGstream.h" #if defined(_WIN32) #include #endif #define MY_PI 3.14159265358979323846 #if SDL_BYTEORDER == SDL_LIL_ENDIAN #define _KEY 0 #else #define _KEY 3 #endif int MPEGaudio::getbits( int bits ) { union { char store[4]; int current; } u; int bi; if( ! bits ) return 0; u.current = 0; bi = (bitindex & 7); u.store[ _KEY ] = _buffer[ bitindex >> 3 ] << bi; bi = 8 - bi; bitindex += bi; while( bits ) { if( ! bi ) { u.store[ _KEY ] = _buffer[ bitindex >> 3 ]; bitindex += 8; bi = 8; } if( bits >= bi ) { u.current <<= bi; bits -= bi; bi = 0; } else { u.current <<= bits; bi -= bits; bits = 0; } } bitindex -= bi; return( u.current >> 8 ); } // Convert mpeg to raw // Mpeg headder class void MPEGaudio::initialize() { static bool initialized = false; register int i; register REAL *s1,*s2; REAL *s3,*s4; last_speed = 0; stereo = true; forcetomonoflag = false; forcetostereoflag = false; downfrequency = 0; scalefactor=SCALE; calcbufferoffset=15; currentcalcbuffer=0; s1 = calcbufferL[0]; s2 = calcbufferR[0]; s3 = calcbufferL[1]; s4 = calcbufferR[1]; for(i=CALCBUFFERSIZE-1;i>=0;i--) { calcbufferL[0][i]=calcbufferL[1][i]= calcbufferR[0][i]=calcbufferR[1][i]=0.0; } if( ! initialized ) { for(i=0;i<16;i++) hcos_64[i] = (float) (1.0/(2.0*cos(MY_PI*double(i*2+1)/64.0))); for(i=0;i< 8;i++) hcos_32[i] = (float) (1.0/(2.0*cos(MY_PI*double(i*2+1)/32.0))); for(i=0;i< 4;i++) hcos_16[i] = (float) (1.0/(2.0*cos(MY_PI*double(i*2+1)/16.0))); for(i=0;i< 2;i++) hcos_8 [i] = (float) (1.0/(2.0*cos(MY_PI*double(i*2+1)/ 8.0))); hcos_4 = (float)(1.0f / (2.0f * cos( MY_PI * 1.0 / 4.0 ))); initialized = true; } layer3initialize(); #ifdef THREADED_AUDIO decode_thread = NULL; ring = NULL; #endif Rewind(); ResetSynchro(0); }; bool MPEGaudio::loadheader() { register int c; bool flag; flag = false; do { if( (c = mpeg->copy_byte()) < 0 ) break; if( c == 0xff ) { while( ! flag ) { if( (c = mpeg->copy_byte()) < 0 ) { flag = true; break; } if( (c & 0xf0) == 0xf0 ) { flag = true; break; } else if( c != 0xff ) { break; } } } } while( ! flag ); if( c < 0 ) return false; // Analyzing c &= 0xf; protection = c & 1; layer = 4 - ((c >> 1) & 3); version = (_mpegversion) ((c >> 3) ^ 1); c = mpeg->copy_byte() >> 1; padding = (c & 1); c >>= 1; frequency = (_frequency) (c&3); if (frequency == 3) return false; c >>= 2; bitrateindex = (int) c; if( bitrateindex == 15 ) return false; c = ((unsigned int)mpeg->copy_byte()) >> 4; extendedmode = c & 3; mode = (_mode) (c >> 2); // Making information inputstereo = (mode == single) ? 0 : 1; forcetomonoflag = (!stereo && inputstereo); forcetostereoflag = (stereo && !inputstereo); if(forcetomonoflag) outputstereo=0; else outputstereo=inputstereo; channelbitrate=bitrateindex; if(inputstereo) { if(channelbitrate==4) channelbitrate=1; else channelbitrate-=4; } if(channelbitrate==1 || channelbitrate==2) tableindex=0; else tableindex=1; if(layer==1) subbandnumber=MAXSUBBAND; else { if(!tableindex) if(frequency==frequency32000)subbandnumber=12; else subbandnumber=8; else if(frequency==frequency48000|| (channelbitrate>=3 && channelbitrate<=5)) subbandnumber=27; else subbandnumber=30; } if(mode==single)stereobound=0; else if(mode==joint)stereobound=(extendedmode+1)<<2; else stereobound=subbandnumber; if(stereobound>subbandnumber)stereobound=subbandnumber; // framesize & slots if(layer==1) { framesize=(12000*bitrate[version][0][bitrateindex])/ frequencies[version][frequency]; if(frequency==frequency44100 && padding)framesize++; framesize<<=2; } else { framesize=(144000*bitrate[version][layer-1][bitrateindex])/ (frequencies[version][frequency]<timestamp){ if (mpeg->timestamp_pos <= _buffer_pos) last_timestamp = *timestamp = mpeg->timestamp; } else *timestamp = -1; if ( layer == 3 ) extractlayer3(); else if( layer == 2 ) extractlayer2(); else if( layer == 1 ) extractlayer1(); /* Handle expanding to stereo output */ if ( forcetostereoflag ) { Sint16 *in, *out; in = rawdata+rawdatawriteoffset; rawdatawriteoffset *= 2; out = rawdata+rawdatawriteoffset; while ( in > rawdata ) { --in; *(--out) = *in; *(--out) = *in; } } // Sam 10/5 - If there is no data, don't increment frames if ( rawdatawriteoffset ) { ++decodedframe; #ifndef THREADED_AUDIO ++currentframe; #endif } } return(true); } #ifdef THREADED_AUDIO int Decode_MPEGaudio(void *udata) { MPEGaudio *audio = (MPEGaudio *)udata; double timestamp; #if defined(_WIN32) SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST); #endif while ( audio->decoding && ! audio->mpeg->eof() ) { audio->rawdata = (Sint16 *)audio->ring->NextWriteBuffer(); if ( audio->rawdata ) { audio->rawdatawriteoffset = 0; /* Sam 10/5/2000 - Added while to prevent empty buffer in ring */ while ( audio->run(1, ×tamp) && (audio->rawdatawriteoffset == 0) ) { /* Keep looping */ ; } if((Uint32)audio->rawdatawriteoffset*2 <= audio->ring->BufferSize()) audio->ring->WriteDone(audio->rawdatawriteoffset*2, timestamp); } } audio->decoding = false; return(0); } #endif /* THREADED_AUDIO */ // Helper function for SDL audio int Play_MPEGaudio(MPEGaudio *audio, Uint8 *stream, int len) { int volume; long copylen; int mixed = 0; /* Michel Darricau from eProcess conflict name in popcorn */ /* Bail if audio isn't playing */ if ( audio->GetStatus() != MPEG_PLAYING ) { return(0); } volume = audio->volume; /* Increment the current play time (assuming fixed frag size) */ switch (audio->frags_playing++) { // Vivien: Well... the theorical way seems good to me :-) case 0: /* The first audio buffer is being filled */ break; case 1: /* The first audio buffer is starting playback */ audio->frag_time = SDL_GetTicks(); break; default: /* A buffer has completed, filling a new one */ audio->frag_time = SDL_GetTicks(); audio->play_time += ((double)len)/audio->rate_in_s; break; } /* Copy the audio data to output */ #ifdef THREADED_AUDIO Uint8 *rbuf; assert(audio); assert(audio->ring); do { /* this is empirical, I don't realy know how to find out when a certain piece of audio has finished playing or even if the timestamps refer to the time when the frame starts playing or then the frame ends playing, but as is works quite right */ copylen = audio->ring->NextReadBuffer(&rbuf); if ( copylen > len ) { SDL_MixAudio(stream, rbuf, len, volume); mixed += len; audio->ring->ReadSome(len); len = 0; for (int i=0; i < N_TIMESTAMPS -1; i++) audio->timestamp[i] = audio->timestamp[i+1]; audio->timestamp[N_TIMESTAMPS-1] = audio->ring->ReadTimeStamp(); } else { SDL_MixAudio(stream, rbuf, copylen, volume); mixed += copylen; ++audio->currentframe; audio->ring->ReadDone(); //fprintf(stderr, "-"); len -= copylen; stream += copylen; } if (audio->timestamp[0] != -1){ double timeshift = audio->Time() - audio->timestamp[0]; double correction = 0; assert(audio->timestamp >= 0); if (fabs(timeshift) > 1.0){ correction = -timeshift; #ifdef DEBUG_TIMESTAMP_SYNC fprintf(stderr, "audio jump %f\n", timeshift); #endif } else correction = -timeshift/100; #ifdef USE_TIMESTAMP_SYNC audio->play_time += correction; #endif #ifdef DEBUG_TIMESTAMP_SYNC fprintf(stderr, "\raudio: time:%8.3f shift:%8.4f", audio->Time(), timeshift); #endif audio->timestamp[0] = -1; } } while ( copylen && (len > 0) && ((audio->currentframe < audio->decodedframe) || audio->decoding)); #else /* The length is interpreted as being in samples */ len /= 2; /* Copy in any saved data */ if ( audio->rawdatawriteoffset >= audio->rawdatareadoffset) { copylen = (audio->rawdatawriteoffset-audio->rawdatareadoffset); assert(copylen >= 0); if ( copylen >= len ) { SDL_MixAudio(stream, (Uint8 *)&audio->spillover[audio->rawdatareadoffset], len*2, volume); mixed += len*2; audio->rawdatareadoffset += len; goto finished_mixing; } SDL_MixAudio(stream, (Uint8 *)&audio->spillover[audio->rawdatareadoffset], copylen*2, volume); mixed += copylen*2; len -= copylen; stream += copylen*2; } /* Copy in any new data */ audio->rawdata = (Sint16 *)stream; audio->rawdatawriteoffset = 0; audio->run(len/audio->samplesperframe); mixed += audio->rawdatawriteoffset*2; len -= audio->rawdatawriteoffset; stream += audio->rawdatawriteoffset*2; /* Write a save buffer for remainder */ audio->rawdata = audio->spillover; audio->rawdatawriteoffset = 0; if ( audio->run(1) ) { assert(audio->rawdatawriteoffset > len); SDL_MixAudio(stream, (Uint8 *) audio->spillover, len*2, volume); mixed += len*2; audio->rawdatareadoffset = len; } else { audio->rawdatareadoffset = 0; } finished_mixing: #endif return(mixed); } void Play_MPEGaudioSDL(void *udata, Uint8 *stream, int len) { MPEGaudio *audio = (MPEGaudio *)udata; Play_MPEGaudio(audio, stream, len); } // EOF smpeg-0.4.5+cvs20030824.orig/audio/README.LIB0100644000175000017500000000320506761142240017717 0ustar hoseheadhoseheadmpegsound README.LIB(International) MPEG/WAVE player library This library have NO WARRANTY. You can use this under Library GPL. This library uses part from vplay, maplay 1.2 for linux, maplay 1.2+ for Win95. This is library which can make program play MPEG-1/2 audio and Wave file easily. Detail is in ChangeLog CAUTION The current implementation was tested with little endian architecture. Bigendian is implemented. But I don't test. Hackers... please help me! What's the difference? For example; unsigned char a[4]={0x11,0x22,0x33,0x44}; unsigned int *b=(unsigned int *)&a; Little endian (Intel) : 0x44332211 Big endian : 0x11223344 The classes 'mpegtoraw' and 'bitwindow' are endian dependent. OTHER ENDIAN PROBLEM Some machines can access integer type variables when they are aligned at 4-bytes. If endian problem is solved. It cause serious problem. I have exploited the linear properties of 2 and 3 dimensional arrays. like for example; int a[4][4]; a[1][0]==a[0][4] is true. Of course, It may occur boundary problem. But it may make player faster! IMPROVED Using mpg123 code, I improved performance of this library. Thank you for authors of mpg123 ENGLISH PROBLEM I release README with International (English) and Korean (my native lang) The Korean version should be ok, but the english version have many spelling mistakes and confusing words and sentences. Please forgive me and help me correct the english. PROBLEM? Please send me bug report or patches.(Please comment where is changed) to: jwj95@eve.kaist.ac.kr jwj95@nownuri.net THANKS FOR this document. Tommy Thorn smpeg-0.4.5+cvs20030824.orig/video/0042755000175000017500000000000007721741434016453 5ustar hoseheadhoseheadsmpeg-0.4.5+cvs20030824.orig/video/Makefile.in0100644000175000017500000002146107721741434020517 0ustar hoseheadhosehead# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include DESTDIR = pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_alias = @host_alias@ host_triplet = @host@ AS = @AS@ ASFLAGS = @ASFLAGS@ BINARY_AGE = @BINARY_AGE@ CC = @CC@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ CXX = @CXX@ DLLTOOL = @DLLTOOL@ GL_LIBS = @GL_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_CONFIG = @GTK_CONFIG@ GTK_LIBS = @GTK_LIBS@ HAVE_LIB = @HAVE_LIB@ INTERFACE_AGE = @INTERFACE_AGE@ LIB = @LIB@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIB = @LTLIB@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAJOR_VERSION = @MAJOR_VERSION@ MAKEINFO = @MAKEINFO@ MICRO_VERSION = @MICRO_VERSION@ MINOR_VERSION = @MINOR_VERSION@ OBJDUMP = @OBJDUMP@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ SMPEG_RLD_FLAGS = @SMPEG_RLD_FLAGS@ VERSION = @VERSION@ noinst_LTLIBRARIES = libvideo.la libvideo_la_SOURCES = MPEGvideo.cpp decoders.cpp decoders.h dither.h floatdct.cpp gdith.cpp jrevdct.cpp motionvector.cpp parseblock.cpp proto.h readfile.cpp util.cpp util.h video.cpp video.h vhar128.cpp vhar128.h mmxflags_asm.S mmxidct_asm.S EXTRA_DIST = README COPYRIGHT mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) DEFS = @DEFS@ -I. -I$(srcdir) CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ X_CFLAGS = @X_CFLAGS@ X_LIBS = @X_LIBS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ libvideo_la_LDFLAGS = libvideo_la_LIBADD = libvideo_la_OBJECTS = MPEGvideo.lo decoders.lo floatdct.lo gdith.lo \ jrevdct.lo motionvector.lo parseblock.lo readfile.lo util.lo video.lo \ vhar128.lo mmxflags_asm.lo mmxidct_asm.lo CXXFLAGS = @CXXFLAGS@ CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ DIST_COMMON = README Makefile.am Makefile.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar GZIP_ENV = --best SOURCES = $(libvideo_la_SOURCES) OBJECTS = $(libvideo_la_OBJECTS) all: all-redirect .SUFFIXES: .SUFFIXES: .S .c .cpp .lo .o .s $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps video/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status mostlyclean-noinstLTLIBRARIES: clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) distclean-noinstLTLIBRARIES: maintainer-clean-noinstLTLIBRARIES: .c.o: $(COMPILE) -c $< .s.o: $(COMPILE) -c $< .S.o: $(COMPILE) -c $< mostlyclean-compile: -rm -f *.o core *.core clean-compile: distclean-compile: -rm -f *.tab.c maintainer-clean-compile: .c.lo: $(LIBTOOL) --mode=compile $(COMPILE) -c $< .s.lo: $(LIBTOOL) --mode=compile $(COMPILE) -c $< .S.lo: $(LIBTOOL) --mode=compile $(COMPILE) -c $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: maintainer-clean-libtool: libvideo.la: $(libvideo_la_OBJECTS) $(libvideo_la_DEPENDENCIES) $(CXXLINK) $(libvideo_la_LDFLAGS) $(libvideo_la_OBJECTS) $(libvideo_la_LIBADD) $(LIBS) .cpp.o: $(CXXCOMPILE) -c $< .cpp.lo: $(LTCXXCOMPILE) -c $< tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ awk ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ here=`pwd` && cd $(srcdir) \ && mkid -f$$here/ID $$unique $(LISP) TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ awk ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) mostlyclean-tags: clean-tags: distclean-tags: -rm -f TAGS ID maintainer-clean-tags: distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) subdir = video distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done info-am: info: info-am dvi-am: dvi: dvi-am check-am: all-am check: check-am installcheck-am: installcheck: installcheck-am install-exec-am: install-exec: install-exec-am install-data-am: install-data: install-data-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am install: install-am uninstall-am: uninstall: uninstall-am all-am: Makefile $(LTLIBRARIES) all-redirect: all-am install-strip: $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install installdirs: mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: mostlyclean-am: mostlyclean-noinstLTLIBRARIES mostlyclean-compile \ mostlyclean-libtool mostlyclean-tags \ mostlyclean-generic mostlyclean: mostlyclean-am clean-am: clean-noinstLTLIBRARIES clean-compile clean-libtool \ clean-tags clean-generic mostlyclean-am clean: clean-am distclean-am: distclean-noinstLTLIBRARIES distclean-compile \ distclean-libtool distclean-tags distclean-generic \ clean-am -rm -f libtool distclean: distclean-am maintainer-clean-am: maintainer-clean-noinstLTLIBRARIES \ maintainer-clean-compile maintainer-clean-libtool \ maintainer-clean-tags maintainer-clean-generic \ distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." maintainer-clean: maintainer-clean-am .PHONY: mostlyclean-noinstLTLIBRARIES distclean-noinstLTLIBRARIES \ clean-noinstLTLIBRARIES maintainer-clean-noinstLTLIBRARIES \ mostlyclean-compile distclean-compile clean-compile \ maintainer-clean-compile mostlyclean-libtool distclean-libtool \ clean-libtool maintainer-clean-libtool tags mostlyclean-tags \ distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ install-exec install-data-am install-data install-am install \ uninstall-am uninstall all-redirect all-am all installdirs \ mostlyclean-generic distclean-generic clean-generic \ maintainer-clean-generic clean mostlyclean distclean maintainer-clean #16bit_mmx.o: 16bit_mmx.cpp # $(CXX) -c -o $@ $^ $(CXXFLAGS) 16bit_mmx.lo: 16bit_mmx.cpp $(CXX) -c -o $@ $^ $(CXXFLAGS) #32bit_mmx.o: 32bit_mmx.cpp # $(CXX) -c -o $@ $^ $(CXXFLAGS) 32bit_mmx.lo: 32bit_mmx.cpp $(CXX) -c -o $@ $^ $(CXXFLAGS) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: smpeg-0.4.5+cvs20030824.orig/video/README0100644000175000017500000000014206761142240017314 0ustar hoseheadhosehead This code is based on mpeg_play, available from: http://bmrc.berkeley.edu/frame/research/mpeg/ smpeg-0.4.5+cvs20030824.orig/video/Makefile.am0100644000175000017500000000117707166665373020522 0ustar hoseheadhosehead noinst_LTLIBRARIES = libvideo.la libvideo_la_SOURCES = \ MPEGvideo.cpp \ decoders.cpp \ decoders.h \ dither.h \ floatdct.cpp \ gdith.cpp \ jrevdct.cpp \ motionvector.cpp \ parseblock.cpp \ proto.h \ readfile.cpp \ util.cpp \ util.h \ video.cpp \ video.h \ vhar128.cpp \ vhar128.h \ mmxflags_asm.S \ mmxidct_asm.S EXTRA_DIST = \ README \ COPYRIGHT #16bit_mmx.o: 16bit_mmx.cpp # $(CXX) -c -o $@ $^ $(CXXFLAGS) 16bit_mmx.lo: 16bit_mmx.cpp $(CXX) -c -o $@ $^ $(CXXFLAGS) #32bit_mmx.o: 32bit_mmx.cpp # $(CXX) -c -o $@ $^ $(CXXFLAGS) 32bit_mmx.lo: 32bit_mmx.cpp $(CXX) -c -o $@ $^ $(CXXFLAGS) smpeg-0.4.5+cvs20030824.orig/video/MPEGvideo.cpp0100644000175000017500000003745407313465715020750 0ustar hoseheadhosehead/* SMPEG - SDL MPEG Player Library Copyright (C) 1999 Loki Entertainment Software - Modified by Michel Darricau from eProcess for popcorn - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* * Copyright (c) 1995 The Regents of the University of California. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement is * hereby granted, provided that the above copyright notice and the following * two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ /* * Portions of this software Copyright (c) 1995 Brown University. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement * is hereby granted, provided that the above copyright notice and the * following two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF BROWN * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * BROWN UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" * BASIS, AND BROWN UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ /* Changes to make the code reentrant: Got rid of setjmp, longjmp deglobalized: EOF_flag, FilmState, curVidStream, bitOffset, bitLength, bitBuffer, sys_layer, input, seekValue, window, X Windows globals (to xinfo), curBits, ditherType, matched_depth, totNumFrames, realTimeStart Additional changes: Ability to play >1 movie (w/out CONTROLS) Make sure we do a full frame for each movie DISABLE_DITHER #ifdef to avoid compiling dithering code Changes to deal with non-MPEG streams Now deals with NO_DITHER, PPM_DITHER and noDisplayFlag==1 CONTROLS version now can deal with >1 movie -lsh@cs.brown.edu (Loring Holden) */ #include #include #include "video.h" #include "proto.h" #include "dither.h" #include "util.h" #include "MPEGvideo.h" #include "MPEGfilter.h" /*--------------------------------------------------------------*/ /* Define buffer length. */ #define BUF_LENGTH 80000 /* TODO: Eliminate these globals so multiple movies can be played. */ /* Quiet flag (verbose). */ int quietFlag = 1; /* Framerate, -1: specified in stream (default) 0: as fast as possible N (N>0): N frames/sec */ #ifdef TIME_MPEG int framerate = 0; #else int framerate = -1; #endif /* Flag for high quality at the expense of speed */ #ifdef QUALITY int qualityFlag = 1; #else int qualityFlag = 0; #endif /*--------------------------------------------------------------*/ MPEGvideo::MPEGvideo(MPEGstream *stream) { Uint32 start_code; MPEGstream_marker *marker; /* Set the MPEG data stream */ mpeg = stream; time_source = NULL; /* Set default playback variables */ _thread = NULL; _dst = NULL; _mutex = NULL; _stream = NULL; /* Mark the data to leave the stream unchanged */ /* after parsing */ marker = mpeg->new_marker(0); /* Get the width and height of the video */ start_code = mpeg->copy_byte(); start_code <<= 8; start_code |= mpeg->copy_byte(); start_code <<= 8; start_code |= mpeg->copy_byte(); while ( ! mpeg->eof() && (start_code != SEQ_START_CODE) ) { start_code <<= 8; start_code |= mpeg->copy_byte(); } if ( start_code == SEQ_START_CODE ) { Uint8 buf[4]; /* Get the width and height of the video */ mpeg->copy_data(buf, 4); _w = (buf[0]<<4)|(buf[1]>>4); /* 12 bits of width */ _h = ((buf[1]&0xF)<<8)|buf[2]; /* 12 bits of height */ switch(buf[3]&0xF) /* 4 bits of fps */ { case 1: _fps = 23.97f; break; case 2: _fps = 24.00f; break; case 3: _fps = 25.00f; break; case 4: _fps = 29.97f; break; case 5: _fps = 30.00f; break; case 6: _fps = 50.00f; break; case 7: _fps = 59.94f; break; case 8: _fps = 60.00f; break; case 9: _fps = 15.00f; break; default: _fps = 30.00f; break; } } else { _w = 0; _h = 0; _fps = 0.00; SetError("Not a valid MPEG video stream"); } /* Rewind back to the old position */ mpeg->seek_marker(marker); mpeg->delete_marker(marker); /* Keep original width and height in _ow and _oh */ _ow = _w; _oh = _h; /* Now round up width and height to a multiple */ /* of a macroblock size (16 pixels) to keep the */ /* video decoder happy */ _w = (_w + 15) & ~15; _h = (_h + 15) & ~15; /* Set the default playback area */ _dstrect.x = 0; _dstrect.y = 0; _dstrect.w = 0; _dstrect.h = 0; /* Set the source area */ _srcrect.x = 0; _srcrect.y = 0; _srcrect.w = _ow; _srcrect.h = _oh; _image = 0; _filter = SMPEGfilter_null(); _filter_mutex = SDL_CreateMutex(); // printf("[MPEGvideo::MPEGvideo]_filter_mutex[%lx] = SDL_CreateMutex()\n",_filter_mutex); } MPEGvideo:: ~MPEGvideo() { /* Stop it before we free everything */ Stop(); /* Free actual video stream */ if( _stream ) DestroyVidStream( _stream ); /* Free overlay */ if(_image) SDL_FreeYUVOverlay(_image); /* Release filter */ SDL_DestroyMutex(_filter_mutex); _filter->destroy(_filter); } /* Simple thread play function */ int Play_MPEGvideo( void *udata ) { MPEGvideo *mpeg = (MPEGvideo *)udata; /* Get the time the playback started */ mpeg->_stream->realTimeStart += ReadSysClock(); #ifdef TIME_MPEG int start_frames, stop_frames; int total_frames; Uint32 start_time, stop_time; float total_time; start_frames = mpeg->_stream->totNumFrames; start_time = SDL_GetTicks(); #endif while( mpeg->playing ) { int mark = mpeg->_stream->totNumFrames; /* make sure we do a whole frame */ while( (mark == mpeg->_stream->totNumFrames) && mpeg->playing ) { mpegVidRsrc( 0, mpeg->_stream, 0 ); } if( mpeg->_stream->film_has_ended ) { mpeg->playing = false; } } /* Get the time the playback stopped */ mpeg->_stream->realTimeStart -= ReadSysClock(); #ifdef TIME_MPEG stop_time = SDL_GetTicks(); stop_frames = mpeg->_stream->totNumFrames; total_frames = (stop_frames-start_frames); total_time = (float)(stop_time-start_time)/1000.0; if ( total_time > 0 ) { printf("%d frames in %2.2f seconds (%2.2f FPS)\n", total_frames, total_time, (float)total_frames/total_time); } #endif return(0); } void MPEGvideo:: Play(void) { ResetPause(); if ( _stream ) { if ( playing ) { Stop(); } playing = true; #ifdef PROFILE_VIDEO /* Profiling doesn't work well with threads */ Play_MPEGvideo(this); #else _thread = SDL_CreateThread( Play_MPEGvideo, this ); if ( !_thread ) { playing = false; } #endif } } void MPEGvideo:: Stop(void) { if ( _thread ) { playing = false; SDL_WaitThread(_thread, NULL); _thread = NULL; } ResetPause(); } void MPEGvideo:: Rewind(void) { Stop(); if ( _stream ) { /* Reinitialize vid_stream pointers */ ResetVidStream( _stream ); #ifdef ANALYSIS init_stats(); #endif } } void MPEGvideo:: ResetSynchro(double time) { if( _stream ) { _stream->_jumpFrame = -1; _stream->realTimeStart = -time; play_time = time; if (time > 0) { double oneframetime; if (_stream->_oneFrameTime == 0) oneframetime = 1.0 / _stream->_smpeg->_fps; else oneframetime = _stream->_oneFrameTime; /* time -> frame */ _stream->totNumFrames = (int)(time / oneframetime); /* Set Current Frame To 0 & Frame Adjust Frag Set */ _stream->current_frame = 0; _stream->need_frameadjust=true; } } } void MPEGvideo::Skip(float seconds) { int frame; /* Called only when there is no timestamp info in the MPEG */ /* This is quite slow however */ printf("Video: Skipping %f seconds...\n", seconds); frame = (int) (_fps * seconds); if( _stream ) { _stream->_jumpFrame = frame; while( (_stream->totNumFrames < frame) && ! _stream->film_has_ended ) { mpegVidRsrc( 0, _stream, 0 ); } ResetSynchro(0); } } /* Michel Darricau from eProcess conflict name in popcorn */ MPEGstatus MPEGvideo:: GetStatus(void) { if ( _stream ) { if( !_thread || (_stream->film_has_ended ) ) { return MPEG_STOPPED; } else { return MPEG_PLAYING; } } return MPEG_ERROR; } bool MPEGvideo:: GetVideoInfo(MPEG_VideoInfo *info) { if ( info ) { info->width = _ow; info->height = _oh; if ( _stream ) { info->current_frame = _stream->current_frame; #ifdef CALCULATE_FPS /* Get the appropriate indices for the timestamps */ /* Calculate the frames-per-second from the timestamps */ if ( _stream->frame_time[_stream->timestamp_index] ) { double *timestamps; double time_diff; int this_index; int last_index; timestamps = _stream->frame_time; last_index = _stream->timestamp_index; this_index = last_index - 1; if ( this_index < 0 ) { this_index = FPS_WINDOW-1; } time_diff = timestamps[this_index] - timestamps[last_index]; info->current_fps = (double)FPS_WINDOW / time_diff; } else { info->current_fps = 0.0; } #else info->current_fps = _stream->totNumFrames / (ReadSysClock() - _stream->realTimeStart); #endif } else { info->current_frame = 0; info->current_fps = 0.0; } } return(!WasError()); } /* Returns zero if fails. surf - Surface to play movie on. lock - lock is held while MPEG stream is playing callback - called on every frame, for display update */ bool MPEGvideo:: SetDisplay(SDL_Surface *dst, SDL_mutex *lock, MPEG_DisplayCallback callback) { _mutex = lock; _dst = dst; _callback = callback; if ( _image ) { SDL_FreeYUVOverlay(_image); } _image = SDL_CreateYUVOverlay(_srcrect.w, _srcrect.h, SDL_YV12_OVERLAY, dst); if ( !_dstrect.w || !_dstrect.h ) { _dstrect.w = dst->w; _dstrect.h = dst->h; } if ( !_stream ) { decodeInitTables(); InitCrop(); InitIDCT(); _stream = NewVidStream( (unsigned int) BUF_LENGTH ); if( _stream ) { _stream->_smpeg = this; _stream->ditherType = FULL_COLOR_DITHER; _stream->matched_depth = dst->format->BitsPerPixel; if( mpegVidRsrc( 0, _stream, 1 ) == NULL ) { SetError("Not an MPEG video stream"); return false; } } if ( ! InitPictImages(_stream, _w, _h, _dst) ) return false; } return true; } /* If this is being called during play, the calling program is responsible for clearing the old area and coordinating with the update callback. */ void MPEGvideo:: MoveDisplay( int x, int y ) { SDL_mutexP( _mutex ); _dstrect.x = x; _dstrect.y = y; SDL_mutexV( _mutex ); } void MPEGvideo:: ScaleDisplayXY( int w, int h ) { SDL_mutexP( _mutex ); _dstrect.w = w; _dstrect.h = h; SDL_mutexV( _mutex ); } void MPEGvideo:: SetDisplayRegion(int x, int y, int w, int h) { SDL_mutexP( _mutex ); _srcrect.x = x; _srcrect.y = y; _srcrect.w = w; _srcrect.h = h; if(_image) { SDL_FreeYUVOverlay(_image); _image = SDL_CreateYUVOverlay(_srcrect.w, _srcrect.h, SDL_YV12_OVERLAY, _dst); } SDL_mutexV( _mutex ); } /* API CHANGE: This function no longer takes a destination surface and x/y You must use SetDisplay() and MoveDisplay() to set those attributes. */ void MPEGvideo:: RenderFrame( int frame ) { _stream->need_frameadjust = true; if( _stream->current_frame > frame ) { mpeg->rewind_stream(); mpeg->next_packet(); Rewind(); } _stream->_jumpFrame = frame; while( (_stream->current_frame < frame) && ! _stream->film_has_ended ) { mpegVidRsrc( 0, _stream, 0 ); } _stream->_jumpFrame = -1; } void MPEGvideo:: RenderFinal(SDL_Surface *dst, int x, int y) { SDL_Surface *saved_dst; int saved_x, saved_y; /* This operation can only be performed when stopped */ Stop(); /* Set (and save) the destination and location */ saved_dst = _dst; saved_x = _dstrect.x; saved_y = _dstrect.y; SetDisplay(dst, _mutex, _callback); MoveDisplay(x, y); if ( ! _stream->film_has_ended ) { /* Search for the last "group of pictures" start code */ Uint32 start_code; MPEGstream_marker * marker, * oldmarker; marker = 0; start_code = mpeg->copy_byte(); start_code <<= 8; start_code |= mpeg->copy_byte(); start_code <<= 8; start_code |= mpeg->copy_byte(); while ( ! mpeg->eof() ) { start_code <<= 8; start_code |= mpeg->copy_byte(); if ( start_code == GOP_START_CODE ) { oldmarker = marker; marker = mpeg->new_marker(-4); if( oldmarker ) mpeg->delete_marker( oldmarker ); mpeg->garbage_collect(); } } /* Set the stream to the last spot marked */ if ( ! mpeg->seek_marker( marker ) ) { mpeg->rewind_stream(); mpeg->next_packet(); } mpeg->delete_marker( marker ); _stream->buf_length = 0; _stream->bit_offset = 0; /* Process all frames without displaying any */ _stream->_skipFrame = 1; RenderFrame( INT_MAX ); mpeg->garbage_collect(); } /* Display the frame */ DisplayFrame(_stream); /* Restore the destination and location */ SetDisplay(saved_dst, _mutex, _callback); MoveDisplay(saved_x, saved_y); } /* EOF */ smpeg-0.4.5+cvs20030824.orig/video/decoders.cpp0100644000175000017500000007727507155260604020760 0ustar hoseheadhosehead/* * decoders.c * * This file contains all the routines for Huffman decoding required in * MPEG * */ /* * Copyright (c) 1995 The Regents of the University of California. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement is * hereby granted, provided that the above copyright notice and the following * two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ /* * Portions of this software Copyright (c) 1995 Brown University. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement * is hereby granted, provided that the above copyright notice and the * following two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF BROWN * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * BROWN UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" * BASIS, AND BROWN UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ #include #include #include "decoders.h" #include "util.h" #include "video.h" #include "proto.h" /* Changes to make the code reentrant: curVidStream now not global - DecodeDCT* functioned #ifdef'd out (are they needed?) Additional changes: none -lsh@cs.brown.edu (Loring Holden) */ /* Decoding table for macroblock_address_increment */ mb_addr_inc_entry mb_addr_inc[2048]; /* Decoding table for macroblock_type in predictive-coded pictures */ mb_type_entry mb_type_P[64]; /* Decoding table for macroblock_type in bidirectionally-coded pictures */ mb_type_entry mb_type_B[64]; /* Decoding table for motion vectors */ motion_vectors_entry motion_vectors[2048]; /* Decoding table for coded_block_pattern */ const coded_block_pattern_entry coded_block_pattern[512] = { {(unsigned int)ERROR, 0}, {(unsigned int)ERROR, 0}, {39, 9}, {27, 9}, {59, 9}, {55, 9}, {47, 9}, {31, 9}, {58, 8}, {58, 8}, {54, 8}, {54, 8}, {46, 8}, {46, 8}, {30, 8}, {30, 8}, {57, 8}, {57, 8}, {53, 8}, {53, 8}, {45, 8}, {45, 8}, {29, 8}, {29, 8}, {38, 8}, {38, 8}, {26, 8}, {26, 8}, {37, 8}, {37, 8}, {25, 8}, {25, 8}, {43, 8}, {43, 8}, {23, 8}, {23, 8}, {51, 8}, {51, 8}, {15, 8}, {15, 8}, {42, 8}, {42, 8}, {22, 8}, {22, 8}, {50, 8}, {50, 8}, {14, 8}, {14, 8}, {41, 8}, {41, 8}, {21, 8}, {21, 8}, {49, 8}, {49, 8}, {13, 8}, {13, 8}, {35, 8}, {35, 8}, {19, 8}, {19, 8}, {11, 8}, {11, 8}, {7, 8}, {7, 8}, {34, 7}, {34, 7}, {34, 7}, {34, 7}, {18, 7}, {18, 7}, {18, 7}, {18, 7}, {10, 7}, {10, 7}, {10, 7}, {10, 7}, {6, 7}, {6, 7}, {6, 7}, {6, 7}, {33, 7}, {33, 7}, {33, 7}, {33, 7}, {17, 7}, {17, 7}, {17, 7}, {17, 7}, {9, 7}, {9, 7}, {9, 7}, {9, 7}, {5, 7}, {5, 7}, {5, 7}, {5, 7}, {63, 6}, {63, 6}, {63, 6}, {63, 6}, {63, 6}, {63, 6}, {63, 6}, {63, 6}, {3, 6}, {3, 6}, {3, 6}, {3, 6}, {3, 6}, {3, 6}, {3, 6}, {3, 6}, {36, 6}, {36, 6}, {36, 6}, {36, 6}, {36, 6}, {36, 6}, {36, 6}, {36, 6}, {24, 6}, {24, 6}, {24, 6}, {24, 6}, {24, 6}, {24, 6}, {24, 6}, {24, 6}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3} }; /* Decoding tables for dct_dc_size_luminance */ const dct_dc_size_entry dct_dc_size_luminance[32] = { {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {0, 3}, {0, 3}, {0, 3}, {0, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {4, 3}, {4, 3}, {4, 3}, {4, 3}, {5, 4}, {5, 4}, {6, 5}, {(unsigned int)ERROR, 0} }; const dct_dc_size_entry dct_dc_size_luminance1[16] = { {7, 6}, {7, 6}, {7, 6}, {7, 6}, {7, 6}, {7, 6}, {7, 6}, {7, 6}, {8, 7}, {8, 7}, {8, 7}, {8, 7}, {9, 8}, {9, 8}, {10, 9}, {11, 9} }; /* Decoding table for dct_dc_size_chrominance */ const dct_dc_size_entry dct_dc_size_chrominance[32] = { {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {4, 4}, {4, 4}, {5, 5}, {(unsigned int)ERROR, 0} }; const dct_dc_size_entry dct_dc_size_chrominance1[32] = { {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {7, 7}, {7, 7}, {7, 7}, {7, 7}, {7, 7}, {7, 7}, {7, 7}, {7, 7}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {9, 9}, {9, 9}, {10, 10}, {11, 10} }; /* DCT coeff tables. */ const unsigned short int dct_coeff_tbl_0[256] = { 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x052f, 0x051f, 0x050f, 0x04ff, 0x183f, 0x402f, 0x3c2f, 0x382f, 0x342f, 0x302f, 0x2c2f, 0x7c1f, 0x781f, 0x741f, 0x701f, 0x6c1f, 0x028e, 0x028e, 0x027e, 0x027e, 0x026e, 0x026e, 0x025e, 0x025e, 0x024e, 0x024e, 0x023e, 0x023e, 0x022e, 0x022e, 0x021e, 0x021e, 0x020e, 0x020e, 0x04ee, 0x04ee, 0x04de, 0x04de, 0x04ce, 0x04ce, 0x04be, 0x04be, 0x04ae, 0x04ae, 0x049e, 0x049e, 0x048e, 0x048e, 0x01fd, 0x01fd, 0x01fd, 0x01fd, 0x01ed, 0x01ed, 0x01ed, 0x01ed, 0x01dd, 0x01dd, 0x01dd, 0x01dd, 0x01cd, 0x01cd, 0x01cd, 0x01cd, 0x01bd, 0x01bd, 0x01bd, 0x01bd, 0x01ad, 0x01ad, 0x01ad, 0x01ad, 0x019d, 0x019d, 0x019d, 0x019d, 0x018d, 0x018d, 0x018d, 0x018d, 0x017d, 0x017d, 0x017d, 0x017d, 0x016d, 0x016d, 0x016d, 0x016d, 0x015d, 0x015d, 0x015d, 0x015d, 0x014d, 0x014d, 0x014d, 0x014d, 0x013d, 0x013d, 0x013d, 0x013d, 0x012d, 0x012d, 0x012d, 0x012d, 0x011d, 0x011d, 0x011d, 0x011d, 0x010d, 0x010d, 0x010d, 0x010d, 0x282c, 0x282c, 0x282c, 0x282c, 0x282c, 0x282c, 0x282c, 0x282c, 0x242c, 0x242c, 0x242c, 0x242c, 0x242c, 0x242c, 0x242c, 0x242c, 0x143c, 0x143c, 0x143c, 0x143c, 0x143c, 0x143c, 0x143c, 0x143c, 0x0c4c, 0x0c4c, 0x0c4c, 0x0c4c, 0x0c4c, 0x0c4c, 0x0c4c, 0x0c4c, 0x085c, 0x085c, 0x085c, 0x085c, 0x085c, 0x085c, 0x085c, 0x085c, 0x047c, 0x047c, 0x047c, 0x047c, 0x047c, 0x047c, 0x047c, 0x047c, 0x046c, 0x046c, 0x046c, 0x046c, 0x046c, 0x046c, 0x046c, 0x046c, 0x00fc, 0x00fc, 0x00fc, 0x00fc, 0x00fc, 0x00fc, 0x00fc, 0x00fc, 0x00ec, 0x00ec, 0x00ec, 0x00ec, 0x00ec, 0x00ec, 0x00ec, 0x00ec, 0x00dc, 0x00dc, 0x00dc, 0x00dc, 0x00dc, 0x00dc, 0x00dc, 0x00dc, 0x00cc, 0x00cc, 0x00cc, 0x00cc, 0x00cc, 0x00cc, 0x00cc, 0x00cc, 0x681c, 0x681c, 0x681c, 0x681c, 0x681c, 0x681c, 0x681c, 0x681c, 0x641c, 0x641c, 0x641c, 0x641c, 0x641c, 0x641c, 0x641c, 0x641c, 0x601c, 0x601c, 0x601c, 0x601c, 0x601c, 0x601c, 0x601c, 0x601c, 0x5c1c, 0x5c1c, 0x5c1c, 0x5c1c, 0x5c1c, 0x5c1c, 0x5c1c, 0x5c1c, 0x581c, 0x581c, 0x581c, 0x581c, 0x581c, 0x581c, 0x581c, 0x581c, }; const unsigned short int dct_coeff_tbl_1[16] = { 0x00bb, 0x202b, 0x103b, 0x00ab, 0x084b, 0x1c2b, 0x541b, 0x501b, 0x009b, 0x4c1b, 0x481b, 0x045b, 0x0c3b, 0x008b, 0x182b, 0x441b, }; const unsigned short int dct_coeff_tbl_2[4] = { 0x4019, 0x1429, 0x0079, 0x0839, }; const unsigned short int dct_coeff_tbl_3[4] = { 0x0449, 0x3c19, 0x3819, 0x1029, }; const unsigned short int dct_coeff_next[256] = { 0xffff, 0xffff, 0xffff, 0xffff, 0xf7d5, 0xf7d5, 0xf7d5, 0xf7d5, 0x0826, 0x0826, 0x2416, 0x2416, 0x0046, 0x0046, 0x2016, 0x2016, 0x1c15, 0x1c15, 0x1c15, 0x1c15, 0x1815, 0x1815, 0x1815, 0x1815, 0x0425, 0x0425, 0x0425, 0x0425, 0x1415, 0x1415, 0x1415, 0x1415, 0x3417, 0x0067, 0x3017, 0x2c17, 0x0c27, 0x0437, 0x0057, 0x2817, 0x0034, 0x0034, 0x0034, 0x0034, 0x0034, 0x0034, 0x0034, 0x0034, 0x1014, 0x1014, 0x1014, 0x1014, 0x1014, 0x1014, 0x1014, 0x1014, 0x0c14, 0x0c14, 0x0c14, 0x0c14, 0x0c14, 0x0c14, 0x0c14, 0x0c14, 0x0023, 0x0023, 0x0023, 0x0023, 0x0023, 0x0023, 0x0023, 0x0023, 0x0023, 0x0023, 0x0023, 0x0023, 0x0023, 0x0023, 0x0023, 0x0023, 0x0813, 0x0813, 0x0813, 0x0813, 0x0813, 0x0813, 0x0813, 0x0813, 0x0813, 0x0813, 0x0813, 0x0813, 0x0813, 0x0813, 0x0813, 0x0813, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, }; const unsigned short int dct_coeff_first[256] = { 0xffff, 0xffff, 0xffff, 0xffff, 0xf7d5, 0xf7d5, 0xf7d5, 0xf7d5, 0x0826, 0x0826, 0x2416, 0x2416, 0x0046, 0x0046, 0x2016, 0x2016, 0x1c15, 0x1c15, 0x1c15, 0x1c15, 0x1815, 0x1815, 0x1815, 0x1815, 0x0425, 0x0425, 0x0425, 0x0425, 0x1415, 0x1415, 0x1415, 0x1415, 0x3417, 0x0067, 0x3017, 0x2c17, 0x0c27, 0x0437, 0x0057, 0x2817, 0x0034, 0x0034, 0x0034, 0x0034, 0x0034, 0x0034, 0x0034, 0x0034, 0x1014, 0x1014, 0x1014, 0x1014, 0x1014, 0x1014, 0x1014, 0x1014, 0x0c14, 0x0c14, 0x0c14, 0x0c14, 0x0c14, 0x0c14, 0x0c14, 0x0c14, 0x0023, 0x0023, 0x0023, 0x0023, 0x0023, 0x0023, 0x0023, 0x0023, 0x0023, 0x0023, 0x0023, 0x0023, 0x0023, 0x0023, 0x0023, 0x0023, 0x0813, 0x0813, 0x0813, 0x0813, 0x0813, 0x0813, 0x0813, 0x0813, 0x0813, 0x0813, 0x0813, 0x0813, 0x0813, 0x0813, 0x0813, 0x0813, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0412, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, }; /* Macro for filling up the decoding table for mb_addr_inc */ #define ASSIGN1(start, end, step, val, num) \ for (i = start; i < end; i+= step) { \ for (j = 0; j < step; j++) { \ mb_addr_inc[i+j].value = val; \ mb_addr_inc[i+j].num_bits = num; \ } \ val--; \ } /* *-------------------------------------------------------------- * * init_mb_addr_inc -- * * Initialize the VLC decoding table for macro_block_address_increment * * Results: * The decoding table for macro_block_address_increment will * be filled; illegal values will be filled as ERROR. * * Side effects: * The global array mb_addr_inc will be filled. * *-------------------------------------------------------------- */ static void init_mb_addr_inc() { int i, j, val; for (i = 0; i < 8; i++) { mb_addr_inc[i].value = ERROR; mb_addr_inc[i].num_bits = 0; } mb_addr_inc[8].value = MACRO_BLOCK_ESCAPE; mb_addr_inc[8].num_bits = 11; for (i = 9; i < 15; i++) { mb_addr_inc[i].value = ERROR; mb_addr_inc[i].num_bits = 0; } mb_addr_inc[15].value = MACRO_BLOCK_STUFFING; mb_addr_inc[15].num_bits = 11; for (i = 16; i < 24; i++) { mb_addr_inc[i].value = ERROR; mb_addr_inc[i].num_bits = 0; } val = 33; ASSIGN1(24, 36, 1, val, 11); ASSIGN1(36, 48, 2, val, 10); ASSIGN1(48, 96, 8, val, 8); ASSIGN1(96, 128, 16, val, 7); ASSIGN1(128, 256, 64, val, 5); ASSIGN1(256, 512, 128, val, 4); ASSIGN1(512, 1024, 256, val, 3); ASSIGN1(1024, 2048, 1024, val, 1); } /* Macro for filling up the decoding table for mb_type */ #define ASSIGN2(start, end, quant, motion_forward, motion_backward, pattern, intra, num, mb_type) \ for (i = start; i < end; i ++) { \ mb_type[i].mb_quant = quant; \ mb_type[i].mb_motion_forward = motion_forward; \ mb_type[i].mb_motion_backward = motion_backward; \ mb_type[i].mb_pattern = pattern; \ mb_type[i].mb_intra = intra; \ mb_type[i].num_bits = num; \ } /* *-------------------------------------------------------------- * * init_mb_type_P -- * * Initialize the VLC decoding table for macro_block_type in * predictive-coded pictures. * * Results: * The decoding table for macro_block_type in predictive-coded * pictures will be filled; illegal values will be filled as ERROR. * * Side effects: * The global array mb_type_P will be filled. * *-------------------------------------------------------------- */ static void init_mb_type_P() { int i; mb_type_P[0].mb_quant = mb_type_P[0].mb_motion_forward = mb_type_P[0].mb_motion_backward = mb_type_P[0].mb_pattern = mb_type_P[0].mb_intra = ERROR; mb_type_P[0].num_bits = 0; ASSIGN2(1, 2, 1, 0, 0, 0, 1, 6, mb_type_P) ASSIGN2(2, 4, 1, 0, 0, 1, 0, 5, mb_type_P) ASSIGN2(4, 6, 1, 1, 0, 1, 0, 5, mb_type_P); ASSIGN2(6, 8, 0, 0, 0, 0, 1, 5, mb_type_P); ASSIGN2(8, 16, 0, 1, 0, 0, 0, 3, mb_type_P); ASSIGN2(16, 32, 0, 0, 0, 1, 0, 2, mb_type_P); ASSIGN2(32, 64, 0, 1, 0, 1, 0, 1, mb_type_P); } /* *-------------------------------------------------------------- * * init_mb_type_B -- * * Initialize the VLC decoding table for macro_block_type in * bidirectionally-coded pictures. * * Results: * The decoding table for macro_block_type in bidirectionally-coded * pictures will be filled; illegal values will be filled as ERROR. * * Side effects: * The global array mb_type_B will be filled. * *-------------------------------------------------------------- */ static void init_mb_type_B() { int i; mb_type_B[0].mb_quant = mb_type_B[0].mb_motion_forward = mb_type_B[0].mb_motion_backward = mb_type_B[0].mb_pattern = mb_type_B[0].mb_intra = ERROR; mb_type_B[0].num_bits = 0; ASSIGN2(1, 2, 1, 0, 0, 0, 1, 6, mb_type_B); ASSIGN2(2, 3, 1, 0, 1, 1, 0, 6, mb_type_B); ASSIGN2(3, 4, 1, 1, 0, 1, 0, 6, mb_type_B); ASSIGN2(4, 6, 1, 1, 1, 1, 0, 5, mb_type_B); ASSIGN2(6, 8, 0, 0, 0, 0, 1, 5, mb_type_B); ASSIGN2(8, 12, 0, 1, 0, 0, 0, 4, mb_type_B); ASSIGN2(12, 16, 0, 1, 0, 1, 0, 4, mb_type_B); ASSIGN2(16, 24, 0, 0, 1, 0, 0, 3, mb_type_B); ASSIGN2(24, 32, 0, 0, 1, 1, 0, 3, mb_type_B); ASSIGN2(32, 48, 0, 1, 1, 0, 0, 2, mb_type_B); ASSIGN2(48, 64, 0, 1, 1, 1, 0, 2, mb_type_B); } /* Macro for filling up the decoding tables for motion_vectors */ #define ASSIGN3(start, end, step, val, num) \ for (i = start; i < end; i+= step) { \ for (j = 0; j < step / 2; j++) { \ motion_vectors[i+j].code = val; \ motion_vectors[i+j].num_bits = num; \ } \ for (j = step / 2; j < step; j++) { \ motion_vectors[i+j].code = -val; \ motion_vectors[i+j].num_bits = num; \ } \ val--; \ } /* *-------------------------------------------------------------- * * init_motion_vectors -- * * Initialize the VLC decoding table for the various motion * vectors, including motion_horizontal_forward_code, * motion_vertical_forward_code, motion_horizontal_backward_code, * and motion_vertical_backward_code. * * Results: * The decoding table for the motion vectors will be filled; * illegal values will be filled as ERROR. * * Side effects: * The global array motion_vector will be filled. * *-------------------------------------------------------------- */ static void init_motion_vectors() { int i, j, val = 16; for (i = 0; i < 24; i++) { motion_vectors[i].code = ERROR; motion_vectors[i].num_bits = 0; } ASSIGN3(24, 36, 2, val, 11); ASSIGN3(36, 48, 4, val, 10); ASSIGN3(48, 96, 16, val, 8); ASSIGN3(96, 128, 32, val, 7); ASSIGN3(128, 256, 128, val, 5); ASSIGN3(256, 512, 256, val, 4); ASSIGN3(512, 1024, 512, val, 3); ASSIGN3(1024, 2048, 1024, val, 1); } extern void init_pre_idct(); /* *-------------------------------------------------------------- * * decodeInitTables -- * * Initialize all the tables for VLC decoding; this must be * called when the system is set up before any decoding can * take place. * * Results: * All the decoding tables will be filled accordingly. * * Side effects: * The corresponding global array for each decoding table * will be filled. * *-------------------------------------------------------------- */ void decodeInitTables() { init_mb_addr_inc(); init_mb_type_P(); init_mb_type_B(); init_motion_vectors(); #ifdef FLOATDCT if (qualityFlag) init_float_idct(); else #endif init_pre_idct(); #ifdef ANALYSIS { init_stats(); } #endif } #if OLDCODE /* *-------------------------------------------------------------- * * DecodeDCTDCSizeLum -- * * Huffman Decoder for dct_dc_size_luminance; location where * the result of decoding will be placed is passed as argument. * The decoded values are obtained by doing a table lookup on * dct_dc_size_luminance. * * Results: * The decoded value for dct_dc_size_luminance or ERROR for * unbound values will be placed in the location specified. * * Side effects: * Bit stream is irreversibly parsed. * *-------------------------------------------------------------- */ void decodeDCTDCSizeLum(value) unsigned int *value; { unsigned int index; show_bits5(index); if (index < 31) { *value = dct_dc_size_luminance[index].value; flush_bits(dct_dc_size_luminance[index].num_bits); } else { show_bits9(index); index -= 0x1f0; *value = dct_dc_size_luminance1[index].value; flush_bits(dct_dc_size_luminance1[index].num_bits); } } /* *-------------------------------------------------------------- * * DecodeDCTDCSizeChrom -- * * Huffman Decoder for dct_dc_size_chrominance; location where * the result of decoding will be placed is passed as argument. * The decoded values are obtained by doing a table lookup on * dct_dc_size_chrominance. * * Results: * The decoded value for dct_dc_size_chrominance or ERROR for * unbound values will be placed in the location specified. * * Side effects: * Bit stream is irreversibly parsed. * *-------------------------------------------------------------- */ void decodeDCTDCSizeChrom(value) unsigned int *value; { unsigned int index; show_bits5(index); if (index < 31) { *value = dct_dc_size_chrominance[index].value; flush_bits(dct_dc_size_chrominance[index].num_bits); } else { show_bits10(index); index -= 0x3e0; *value = dct_dc_size_chrominance1[index].value; flush_bits(dct_dc_size_chrominance1[index].num_bits); } } /* *-------------------------------------------------------------- * * decodeDCTCoeff -- * * Huffman Decoder for dct_coeff_first and dct_coeff_next; * locations where the results of decoding: run and level, are to * be placed and also the type of DCT coefficients, either * dct_coeff_first or dct_coeff_next, are being passed as argument. * * The decoder first examines the next 8 bits in the input stream, * and perform according to the following cases: * * '0000 0000' - examine 8 more bits (i.e. 16 bits total) and * perform a table lookup on dct_coeff_tbl_0. * One more bit is then examined to determine the sign * of level. * * '0000 0001' - examine 4 more bits (i.e. 12 bits total) and * perform a table lookup on dct_coeff_tbl_1. * One more bit is then examined to determine the sign * of level. * * '0000 0010' - examine 2 more bits (i.e. 10 bits total) and * perform a table lookup on dct_coeff_tbl_2. * One more bit is then examined to determine the sign * of level. * * '0000 0011' - examine 2 more bits (i.e. 10 bits total) and * perform a table lookup on dct_coeff_tbl_3. * One more bit is then examined to determine the sign * of level. * * otherwise - perform a table lookup on dct_coeff_tbl. If the * value of run is not ESCAPE, extract one more bit * to determine the sign of level; otherwise 6 more * bits will be extracted to obtain the actual value * of run , and then 8 or 16 bits to get the value of level. * * * * Results: * The decoded values of run and level or ERROR for unbound values * are placed in the locations specified. * * Side effects: * Bit stream is irreversibly parsed. * *-------------------------------------------------------------- */ static void decodeDCTCoeff(dct_coeff_tbl, run, level) unsigned short int *dct_coeff_tbl; unsigned int *run; int *level; { unsigned int temp, index /*, num_bits */; unsigned int value, next32bits, flushed; /* * Grab the next 32 bits and use it to improve performance of * getting the bits to parse. Thus, calls are translated as: * * show_bitsX <--> next32bits >> (32-X) * get_bitsX <--> val = next32bits >> (32-flushed-X); * flushed += X; * next32bits &= bitMask[flushed]; * flush_bitsX <--> flushed += X; * next32bits &= bitMask[flushed]; * */ show_bits32(next32bits); flushed = 0; /* show_bits8(index); */ index = next32bits >> 24; if (index > 3) { value = dct_coeff_tbl[index]; *run = (value & RUN_MASK) >> RUN_SHIFT; if (*run == END_OF_BLOCK) { *level = END_OF_BLOCK; } else { /* num_bits = (value & NUM_MASK) + 1; */ /* flush_bits(num_bits); */ flushed = (value & NUM_MASK) + 1; next32bits &= bitMask[flushed]; if (*run != ESCAPE) { *level = (value & LEVEL_MASK) >> LEVEL_SHIFT; /* get_bits1(value); */ /* if (value) *level = -*level; */ if (next32bits >> (31-flushed)) *level = -*level; flushed++; /* next32bits &= bitMask[flushed]; last op before update */ #ifdef NO_GRIFF_MODS #else /* CG: moved into if case 12jul2000 */ /* Update bitstream... */ flush_bits(flushed); #endif } else { /* *run == ESCAPE */ /* get_bits14(temp); */ temp = next32bits >> (18-flushed); flushed += 14; next32bits &= bitMask[flushed]; *run = temp >> 8; temp &= 0xff; if (temp == 0) { /* get_bits8(*level); */ *level = next32bits >> (24-flushed); flushed += 8; /* next32bits &= bitMask[flushed]; last op before update */ #ifdef NO_GRIFF_MODS assert(*level >= 128); #else /* CG: Try to overcome the assertion and incorrect decoding in * case of lost packets. 12jul2000 */ if (*level >= 128) { flush_bits(flushed); } else { *run = END_OF_BLOCK; *level = END_OF_BLOCK; } #endif } else if (temp != 128) { /* Grab sign bit */ *level = ((int) (temp << 24)) >> 24; #ifdef NO_GRIFF_MODS #else /* CG: moved into else case 12jul2000 */ /* Update bitstream... */ flush_bits(flushed); #endif } else { /* get_bits8(*level); */ *level = next32bits >> (24-flushed); flushed += 8; /* next32bits &= bitMask[flushed]; last op before update */ *level = *level - 256; #ifdef NO_GRIFF_MODS assert(*level <= -128 && *level >= -255); #else /* CG: Try to overcome the assertion and incorrect decoding in * case of lost packets. 12jul2000 */ if (*level <= -128 && *level >= -255) { flush_bits(flushed); } else { *run = END_OF_BLOCK; *level = END_OF_BLOCK; } #endif } } #ifdef NO_GRIFF_MODS /* Update bitstream... */ flush_bits(flushed); #endif } } else { if (index == 2) { /* show_bits10(index); */ index = next32bits >> 22; value = dct_coeff_tbl_2[index & 3]; } else if (index == 3) { /* show_bits10(index); */ index = next32bits >> 22; value = dct_coeff_tbl_3[index & 3]; } else if (index) { /* index == 1 */ /* show_bits12(index); */ index = next32bits >> 20; value = dct_coeff_tbl_1[index & 15]; } else { /* index == 0 */ /* show_bits16(index); */ index = next32bits >> 16; value = dct_coeff_tbl_0[index & 255]; } *run = (value & RUN_MASK) >> RUN_SHIFT; *level = (value & LEVEL_MASK) >> LEVEL_SHIFT; /* * Fold these operations together to make it fast... */ /* num_bits = (value & NUM_MASK) + 1; */ /* flush_bits(num_bits); */ /* get_bits1(value); */ /* if (value) *level = -*level; */ flushed = (value & NUM_MASK) + 2; if ((next32bits >> (32-flushed)) & 0x1) *level = -*level; /* Update bitstream ... */ flush_bits(flushed); } } /* *-------------------------------------------------------------- * * decodeDCTCoeffFirst -- * * Huffman Decoder for dct_coeff_first. Locations for the * decoded results: run and level, are being passed as * arguments. Actual work is being done by calling DecodeDCTCoeff, * with the table dct_coeff_first. * * Results: * The decoded values of run and level for dct_coeff_first or * ERROR for unbound values are placed in the locations given. * * Side effects: * Bit stream is irreversibly parsed. * *-------------------------------------------------------------- */ void decodeDCTCoeffFirst(run, level) unsigned int *run; int *level; { decodeDCTCoeff(dct_coeff_first, run, level); } /* *-------------------------------------------------------------- * * decodeDCTCoeffNext -- * * Huffman Decoder for dct_coeff_first. Locations for the * decoded results: run and level, are being passed as * arguments. Actual work is being done by calling DecodeDCTCoeff, * with the table dct_coeff_next. * * Results: * The decoded values of run and level for dct_coeff_next or * ERROR for unbound values are placed in the locations given. * * Side effects: * Bit stream is irreversibly parsed. * *-------------------------------------------------------------- */ void decodeDCTCoeffNext(run, level) unsigned int *run; int *level; { decodeDCTCoeff(dct_coeff_next, run, level); } #endif smpeg-0.4.5+cvs20030824.orig/video/decoders.h0100644000175000017500000005315007155260604020407 0ustar hoseheadhosehead/* * Copyright (c) 1995 The Regents of the University of California. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement is * hereby granted, provided that the above copyright notice and the following * two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ /* * decoders.h * * This file contains the declarations of structures required for Huffman * decoding * */ /* Include util.h for bit i/o parsing macros. */ #include "util.h" /* Code for unbound values in decoding tables */ #define ERROR (-1) #define DCT_ERROR 63 #define MACRO_BLOCK_STUFFING 34 #define MACRO_BLOCK_ESCAPE 35 /* Two types of DCT Coefficients */ #define DCT_COEFF_FIRST 0 #define DCT_COEFF_NEXT 1 /* Special values for DCT Coefficients */ #define END_OF_BLOCK 62 #define ESCAPE 61 /* Structure for an entry in the decoding table of * macroblock_address_increment */ typedef struct { int value; /* value for macroblock_address_increment */ int num_bits; /* length of the Huffman code */ } mb_addr_inc_entry; /* Decoding table for macroblock_address_increment */ extern mb_addr_inc_entry mb_addr_inc[2048]; /* Structure for an entry in the decoding table of macroblock_type */ typedef struct { unsigned int mb_quant; /* macroblock_quant */ unsigned int mb_motion_forward; /* macroblock_motion_forward */ unsigned int mb_motion_backward; /* macroblock_motion_backward */ unsigned int mb_pattern; /* macroblock_pattern */ unsigned int mb_intra; /* macroblock_intra */ int num_bits; /* length of the Huffman code */ } mb_type_entry; /* Decoding table for macroblock_type in predictive-coded pictures */ extern mb_type_entry mb_type_P[64]; /* Decoding table for macroblock_type in bidirectionally-coded pictures */ extern mb_type_entry mb_type_B[64]; /* Structures for an entry in the decoding table of coded_block_pattern */ typedef struct { unsigned int cbp; /* coded_block_pattern */ int num_bits; /* length of the Huffman code */ } coded_block_pattern_entry; /* External declaration of coded block pattern table. */ extern const coded_block_pattern_entry coded_block_pattern[512]; /* Structure for an entry in the decoding table of motion vectors */ typedef struct { int code; /* value for motion_horizontal_forward_code, * motion_vertical_forward_code, * motion_horizontal_backward_code, or * motion_vertical_backward_code. */ int num_bits; /* length of the Huffman code */ } motion_vectors_entry; /* Decoding table for motion vectors */ extern motion_vectors_entry motion_vectors[2048]; /* Structure for an entry in the decoding table of dct_dc_size */ typedef struct { unsigned int value; /* value of dct_dc_size (luminance or chrominance) */ int num_bits; /* length of the Huffman code */ } dct_dc_size_entry; /* External declaration of dct dc size lumiance table. */ extern const dct_dc_size_entry dct_dc_size_luminance[32]; extern const dct_dc_size_entry dct_dc_size_luminance1[16]; /* External declaration of dct dc size chrom table. */ extern const dct_dc_size_entry dct_dc_size_chrominance[32]; extern const dct_dc_size_entry dct_dc_size_chrominance1[32]; /* DCT coeff tables. */ #define RUN_MASK 0xfc00 #define LEVEL_MASK 0x03f0 #define NUM_MASK 0x000f #define RUN_SHIFT 10 #define LEVEL_SHIFT 4 /* External declaration of dct coeff tables. */ extern const unsigned short int dct_coeff_tbl_0[256]; extern const unsigned short int dct_coeff_tbl_1[16]; extern const unsigned short int dct_coeff_tbl_2[4]; extern const unsigned short int dct_coeff_tbl_3[4]; extern const unsigned short int dct_coeff_next[256]; extern const unsigned short int dct_coeff_first[256]; #define DecodeDCTDCSizeLum(macro_val) \ { \ unsigned int index; \ \ show_bits5(index); \ \ if (index < 31) { \ macro_val = dct_dc_size_luminance[index].value; \ flush_bits(dct_dc_size_luminance[index].num_bits); \ } \ else { \ show_bits9(index); \ index -= 0x1f0; \ macro_val = dct_dc_size_luminance1[index].value; \ flush_bits(dct_dc_size_luminance1[index].num_bits); \ } \ } #define DecodeDCTDCSizeChrom(macro_val) \ { \ unsigned int index; \ \ show_bits5(index); \ \ if (index < 31) { \ macro_val = dct_dc_size_chrominance[index].value; \ flush_bits(dct_dc_size_chrominance[index].num_bits); \ } \ else { \ show_bits10(index); \ index -= 0x3e0; \ macro_val = dct_dc_size_chrominance1[index].value; \ flush_bits(dct_dc_size_chrominance1[index].num_bits); \ } \ } #ifdef NO_GRIFF_MODS #define DecodeDCTCoeff(dct_coeff_tbl, run, level) \ { \ unsigned int temp, index; \ unsigned int value, next32bits, flushed; \ \ /* \ * Grab the next 32 bits and use it to improve performance of \ * getting the bits to parse. Thus, calls are translated as: \ * \ * show_bitsX <--> next32bits >> (32-X) \ * get_bitsX <--> val = next32bits >> (32-flushed-X); \ * flushed += X; \ * next32bits &= bitMask[flushed]; \ * flush_bitsX <--> flushed += X; \ * next32bits &= bitMask[flushed]; \ * \ * I've streamlined the code a lot, so that we don't have to mask \ * out the low order bits and a few of the extra adds are removed. \ */ \ show_bits32(next32bits); \ \ /* show_bits8(index); */ \ index = next32bits >> 24; \ \ if (index > 3) { \ value = dct_coeff_tbl[index]; \ run = value >> RUN_SHIFT; \ if (run != END_OF_BLOCK) { \ /* num_bits = (value & NUM_MASK) + 1; */ \ /* flush_bits(num_bits); */ \ if (run != ESCAPE) { \ /* get_bits1(value); */ \ /* if (value) level = -level; */ \ flushed = (value & NUM_MASK) + 2; \ level = (value & LEVEL_MASK) >> LEVEL_SHIFT; \ value = next32bits >> (32-flushed); \ value &= 0x1; \ if (value) level = -level; \ /* next32bits &= ((~0) >> flushed); last op before update */ \ } \ else { /* run == ESCAPE */ \ /* Get the next six into run, and next 8 into temp */ \ /* get_bits14(temp); */ \ flushed = (value & NUM_MASK) + 1; \ temp = next32bits >> (18-flushed); \ /* Normally, we'd ad 14 to flushed, but I've saved a few \ * instr by moving the add below */ \ temp &= 0x3fff; \ run = temp >> 8; \ temp &= 0xff; \ if (temp == 0) { \ /* get_bits8(level); */ \ level = next32bits >> (10-flushed); \ level &= 0xff; \ flushed += 22; \ assert(level >= 128); \ } else if (temp != 128) { \ /* Grab sign bit */ \ flushed += 14; \ level = ((int) (temp << 24)) >> 24; \ } else { \ /* get_bits8(level); */ \ level = next32bits >> (10-flushed); \ level &= 0xff; \ flushed += 22; \ level = level - 256; \ assert(level <= -128 && level >= -255); \ } \ } \ /* Update bitstream... */ \ flush_bits(flushed); \ assert (flushed <= 32); \ } \ } \ else { \ switch (index) { \ case 2: { \ /* show_bits10(index); */ \ index = next32bits >> 22; \ value = dct_coeff_tbl_2[index & 3]; \ break; \ } \ case 3: { \ /* show_bits10(index); */ \ index = next32bits >> 22; \ value = dct_coeff_tbl_3[index & 3]; \ break; \ } \ case 1: { \ /* show_bits12(index); */ \ index = next32bits >> 20; \ value = dct_coeff_tbl_1[index & 15]; \ break; \ } \ default: { /* index == 0 */ \ /* show_bits16(index); */ \ index = next32bits >> 16; \ value = dct_coeff_tbl_0[index & 255]; \ }} \ run = value >> RUN_SHIFT; \ level = (value & LEVEL_MASK) >> LEVEL_SHIFT; \ \ /* \ * Fold these operations together to make it fast... \ */ \ /* num_bits = (value & NUM_MASK) + 1; */ \ /* flush_bits(num_bits); */ \ /* get_bits1(value); */ \ /* if (value) level = -level; */ \ \ flushed = (value & NUM_MASK) + 2; \ value = next32bits >> (32-flushed); \ value &= 0x1; \ if (value) level = -level; \ \ /* Update bitstream ... */ \ flush_bits(flushed); \ assert (flushed <= 32); \ } \ } #else /* NO_GRIFF_MODS */ #define DecodeDCTCoeff(dct_coeff_tbl, run, level) \ { \ unsigned int temp, index; \ unsigned int value, next32bits, flushed; \ \ /* \ * Grab the next 32 bits and use it to improve performance of \ * getting the bits to parse. Thus, calls are translated as: \ * \ * show_bitsX <--> next32bits >> (32-X) \ * get_bitsX <--> val = next32bits >> (32-flushed-X); \ * flushed += X; \ * next32bits &= bitMask[flushed]; \ * flush_bitsX <--> flushed += X; \ * next32bits &= bitMask[flushed]; \ * \ * I've streamlined the code a lot, so that we don't have to mask \ * out the low order bits and a few of the extra adds are removed. \ */ \ show_bits32(next32bits); \ \ /* show_bits8(index); */ \ index = next32bits >> 24; \ \ if (index > 3) { \ value = dct_coeff_tbl[index]; \ run = value >> RUN_SHIFT; \ if (run != END_OF_BLOCK) { \ /* num_bits = (value & NUM_MASK) + 1; */ \ /* flush_bits(num_bits); */ \ if (run != ESCAPE) { \ /* get_bits1(value); */ \ /* if (value) level = -level; */ \ flushed = (value & NUM_MASK) + 2; \ level = (value & LEVEL_MASK) >> LEVEL_SHIFT; \ value = next32bits >> (32-flushed); \ value &= 0x1; \ if (value) level = -level; \ /* next32bits &= ((~0) >> flushed); last op before update */ \ \ /* Update bitstream... */ \ flush_bits(flushed); \ assert (flushed <= 32); \ } \ else { /* run == ESCAPE */ \ /* Get the next six into run, and next 8 into temp */ \ /* get_bits14(temp); */ \ flushed = (value & NUM_MASK) + 1; \ temp = next32bits >> (18-flushed); \ /* Normally, we'd ad 14 to flushed, but I've saved a few \ * instr by moving the add below */ \ temp &= 0x3fff; \ run = temp >> 8; \ temp &= 0xff; \ if (temp == 0) { \ /* get_bits8(level); */ \ level = next32bits >> (10-flushed); \ level &= 0xff; \ flushed += 22; \ /* CG: 12jul2000 - assert(level >= 128); */ \ if (level >= 128) { \ /* Update bitstream... */ \ flush_bits(flushed); \ assert (flushed <= 32); \ } else { \ run = END_OF_BLOCK; \ level = END_OF_BLOCK; \ } \ } else if (temp != 128) { \ /* Grab sign bit */ \ flushed += 14; \ level = ((int) (temp << 24)) >> 24; \ /* Update bitstream... */ \ flush_bits(flushed); \ assert (flushed <= 32); \ } else { \ /* get_bits8(level); */ \ level = next32bits >> (10-flushed); \ level &= 0xff; \ flushed += 22; \ level = level - 256; \ /* CG: 12jul2000 - assert(level <= -128 && level >= -255); */ \ if ( level <= -128 && level >= -255) { \ /* Update bitstream... */ \ flush_bits(flushed); \ assert (flushed <= 32); \ } else { \ run = END_OF_BLOCK; \ level = END_OF_BLOCK; \ } \ } \ } \ } \ } \ else { \ switch (index) { \ case 2: { \ /* show_bits10(index); */ \ index = next32bits >> 22; \ value = dct_coeff_tbl_2[index & 3]; \ break; \ } \ case 3: { \ /* show_bits10(index); */ \ index = next32bits >> 22; \ value = dct_coeff_tbl_3[index & 3]; \ break; \ } \ case 1: { \ /* show_bits12(index); */ \ index = next32bits >> 20; \ value = dct_coeff_tbl_1[index & 15]; \ break; \ } \ default: { /* index == 0 */ \ /* show_bits16(index); */ \ index = next32bits >> 16; \ value = dct_coeff_tbl_0[index & 255]; \ }} \ run = value >> RUN_SHIFT; \ level = (value & LEVEL_MASK) >> LEVEL_SHIFT; \ \ /* \ * Fold these operations together to make it fast... \ */ \ /* num_bits = (value & NUM_MASK) + 1; */ \ /* flush_bits(num_bits); */ \ /* get_bits1(value); */ \ /* if (value) level = -level; */ \ \ flushed = (value & NUM_MASK) + 2; \ value = next32bits >> (32-flushed); \ value &= 0x1; \ if (value) level = -level; \ \ /* Update bitstream ... */ \ flush_bits(flushed); \ assert (flushed <= 32); \ } \ } #endif /* NO_GRIFF_MODS */ #define DecodeDCTCoeffFirst(runval, levelval) \ { \ DecodeDCTCoeff(dct_coeff_first, runval, levelval); \ } #define DecodeDCTCoeffNext(runval, levelval) \ { \ DecodeDCTCoeff(dct_coeff_next, runval, levelval); \ } /* *-------------------------------------------------------------- * * DecodeMBAddrInc -- * * Huffman Decoder for macro_block_address_increment; the location * in which the result will be placed is being passed as argument. * The decoded value is obtained by doing a table lookup on * mb_addr_inc. * * Results: * The decoded value for macro_block_address_increment or ERROR * for unbound values will be placed in the location specified. * * Side effects: * Bit stream is irreversibly parsed. * *-------------------------------------------------------------- */ #define DecodeMBAddrInc(val) \ { \ unsigned int index; \ show_bits11(index); \ val = mb_addr_inc[index].value; \ flush_bits(mb_addr_inc[index].num_bits); \ } /* *-------------------------------------------------------------- * * DecodeMotionVectors -- * * Huffman Decoder for the various motion vectors, including * motion_horizontal_forward_code, motion_vertical_forward_code, * motion_horizontal_backward_code, motion_vertical_backward_code. * Location where the decoded result will be placed is being passed * as argument. The decoded values are obtained by doing a table * lookup on motion_vectors. * * Results: * The decoded value for the motion vector or ERROR for unbound * values will be placed in the location specified. * * Side effects: * Bit stream is irreversibly parsed. * *-------------------------------------------------------------- */ #define DecodeMotionVectors(value) \ { \ unsigned int index; \ show_bits11(index); \ value = motion_vectors[index].code; \ flush_bits(motion_vectors[index].num_bits); \ } /* *-------------------------------------------------------------- * * DecodeMBTypeB -- * * Huffman Decoder for macro_block_type in bidirectionally-coded * pictures;locations in which the decoded results: macroblock_quant, * macroblock_motion_forward, macro_block_motion_backward, * macroblock_pattern, macro_block_intra, will be placed are * being passed as argument. The decoded values are obtained by * doing a table lookup on mb_type_B. * * Results: * The various decoded values for macro_block_type in * bidirectionally-coded pictures or ERROR for unbound values will * be placed in the locations specified. * * Side effects: * Bit stream is irreversibly parsed. * *-------------------------------------------------------------- */ #define DecodeMBTypeB(quant, motion_fwd, motion_bwd, pat, intra) \ { \ unsigned int index; \ \ show_bits6(index); \ \ quant = mb_type_B[index].mb_quant; \ motion_fwd = mb_type_B[index].mb_motion_forward; \ motion_bwd = mb_type_B[index].mb_motion_backward; \ pat = mb_type_B[index].mb_pattern; \ intra = mb_type_B[index].mb_intra; \ flush_bits(mb_type_B[index].num_bits); \ } /* *-------------------------------------------------------------- * * DecodeMBTypeI -- * * Huffman Decoder for macro_block_type in intra-coded pictures; * locations in which the decoded results: macroblock_quant, * macroblock_motion_forward, macro_block_motion_backward, * macroblock_pattern, macro_block_intra, will be placed are * being passed as argument. * * Results: * The various decoded values for macro_block_type in intra-coded * pictures or ERROR for unbound values will be placed in the * locations specified. * * Side effects: * Bit stream is irreversibly parsed. * *-------------------------------------------------------------- */ #define DecodeMBTypeI(quant, motion_fwd, motion_bwd, pat, intra) \ { \ unsigned int index; \ static int quantTbl[4] = {ERROR, 1, 0, 0}; \ \ show_bits2(index); \ \ motion_fwd = 0; \ motion_bwd = 0; \ pat = 0; \ intra = 1; \ quant = quantTbl[index]; \ if (index) { \ flush_bits (1 + quant); \ } \ } /* *-------------------------------------------------------------- * * DecodeMBTypeP -- * * Huffman Decoder for macro_block_type in predictive-coded pictures; * locations in which the decoded results: macroblock_quant, * macroblock_motion_forward, macro_block_motion_backward, * macroblock_pattern, macro_block_intra, will be placed are * being passed as argument. The decoded values are obtained by * doing a table lookup on mb_type_P. * * Results: * The various decoded values for macro_block_type in * predictive-coded pictures or ERROR for unbound values will be * placed in the locations specified. * * Side effects: * Bit stream is irreversibly parsed. * *-------------------------------------------------------------- */ #define DecodeMBTypeP(quant, motion_fwd, motion_bwd, pat, intra) \ { \ unsigned int index; \ \ show_bits6(index); \ \ quant = mb_type_P[index].mb_quant; \ motion_fwd = mb_type_P[index].mb_motion_forward; \ motion_bwd = mb_type_P[index].mb_motion_backward; \ pat = mb_type_P[index].mb_pattern; \ intra = mb_type_P[index].mb_intra; \ \ flush_bits(mb_type_P[index].num_bits); \ } /* *-------------------------------------------------------------- * * DecodeCBP -- * * Huffman Decoder for coded_block_pattern; location in which the * decoded result will be placed is being passed as argument. The * decoded values are obtained by doing a table lookup on * coded_block_pattern. * * Results: * The decoded value for coded_block_pattern or ERROR for unbound * values will be placed in the location specified. * * Side effects: * Bit stream is irreversibly parsed. * *-------------------------------------------------------------- */ #define DecodeCBP(coded_bp) \ { \ unsigned int index; \ \ show_bits9(index); \ coded_bp = coded_block_pattern[index].cbp; \ flush_bits(coded_block_pattern[index].num_bits); \ } smpeg-0.4.5+cvs20030824.orig/video/dither.h0100644000175000017500000000440106761142240020066 0ustar hoseheadhosehead/* * Copyright (c) 1995 The Regents of the University of California. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement is * hereby granted, provided that the above copyright notice and the following * two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ extern int LUM_RANGE; extern int CR_RANGE; extern int CB_RANGE; #define CB_BASE 1 #define CR_BASE (CB_BASE*CB_RANGE) #define LUM_BASE (CR_BASE*CR_RANGE) extern unsigned char pixel[256]; extern unsigned long wpixel[256]; extern int *lum_values; extern int *cr_values; extern int *cb_values; #define Min(x,y) (((x) < (y)) ? (x) : (y)) #define Max(x,y) (((x) > (y)) ? (x) : (y)) #define GAMMA_CORRECTION(x) ((int)(pow((x) / 255.0, 1.0 / gammaCorrect) * 255.0)) #define CHROMA_CORRECTION256(x) ((x) >= 128 \ ? 128 + Min(127, (int)(((x) - 128.0) * chromaCorrect)) \ : 128 - Min(128, (int)((128.0 - (x)) * chromaCorrect))) #define CHROMA_CORRECTION128(x) ((x) >= 0 \ ? Min(127, (int)(((x) * chromaCorrect))) \ : Max(-128, (int)(((x) * chromaCorrect)))) #define CHROMA_CORRECTION256D(x) ((x) >= 128 \ ? 128.0 + Min(127.0, (((x) - 128.0) * chromaCorrect)) \ : 128.0 - Min(128.0, (((128.0 - (x)) * chromaCorrect)))) #define CHROMA_CORRECTION128D(x) ((x) >= 0 \ ? Min(127.0, ((x) * chromaCorrect)) \ : Max(-128.0, ((x) * chromaCorrect))) smpeg-0.4.5+cvs20030824.orig/video/floatdct.cpp0100644000175000017500000000567206761142240020755 0ustar hoseheadhosehead/* idctref.c, Inverse Discrete Fourier Transform, double precision */ /* Copyright (C) 1994, MPEG Software Simulation Group. All Rights Reserved. */ /* * Disclaimer of Warranty * * These software programs are available to the user without any license fee or * royalty on an "as is" basis. The MPEG Software Simulation Group disclaims * any and all warranties, whether express, implied, or statuary, including any * implied warranties or merchantability or of fitness for a particular * purpose. In no event shall the copyright-holder be liable for any * incidental, punitive, or consequential damages of any kind whatsoever * arising from the use of these programs. * * This disclaimer of warranty extends to the user of these programs and user's * customers, employees, agents, transferees, successors, and assigns. * * The MPEG Software Simulation Group does not represent or warrant that the * programs furnished hereunder are free of infringement of any third-party * patents. * * Commercial implementations of MPEG-1 and MPEG-2 video, including shareware, * are subject to royalty fees to patent holders. Many of these patents are * general enough such that they are unavoidable regardless of implementation * design. * */ /* Perform IEEE 1180 reference (64-bit floating point, separable 8x1 * direct matrix multiply) Inverse Discrete Cosine Transform */ /* Here we use math.h to generate constants. Compiler results may vary a little */ #include #ifndef __STDC__ #define _ANSI_ARGS_(x) () #else #define _ANSI_ARGS_(x) x #endif #define RB "rb" #define WB "wb" #ifndef O_BINARY #define O_BINARY 0 #endif #ifndef PI # ifdef M_PI # define PI M_PI # else # define PI 3.14159265358979323846 # endif #endif /* global declarations */ void init_float_idct _ANSI_ARGS_((void)); void float_idct _ANSI_ARGS_((short *block)); /* private data */ /* cosine transform matrix for 8x1 IDCT */ static double c[8][8]; /* initialize DCT coefficient matrix */ void init_float_idct() { int freq, time; double scale; for (freq=0; freq < 8; freq++) { scale = (freq == 0) ? sqrt(0.125) : 0.5; for (time=0; time<8; time++) c[freq][time] = scale*cos((PI/8.0)*freq*(time + 0.5)); } } /* perform IDCT matrix multiply for 8x8 coefficient block */ void float_idct( short* block ) { int i, j, k, v; double partial_product; double tmp[64]; for (i=0; i<8; i++) for (j=0; j<8; j++) { partial_product = 0.0; for (k=0; k<8; k++) partial_product+= c[k][j]*block[8*i+k]; tmp[8*i+j] = partial_product; } /* Transpose operation is integrated into address mapping by switching loop order of i and j */ for (j=0; j<8; j++) for (i=0; i<8; i++) { partial_product = 0.0; for (k=0; k<8; k++) partial_product+= c[k][i]*tmp[8*k+j]; v = (int) floor( partial_product + 0.5 ); block[8*i+j] = (v<-256) ? -256 : ((v>255) ? 255 : v); } } /* EOF */ smpeg-0.4.5+cvs20030824.orig/video/gdith.cpp0100644000175000017500000003067307262735303020260 0ustar hoseheadhosehead/* * gdith.c -- * * Procedures dealing with grey-scale and mono dithering, * as well as X Windows set up procedures. * */ /* * Copyright (c) 1995 The Regents of the University of California. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement is * hereby granted, provided that the above copyright notice and the following * two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ /* * Portions of this software Copyright (c) 1995 Brown University. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement * is hereby granted, provided that the above copyright notice and the * following two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF BROWN * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * BROWN UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" * BASIS, AND BROWN UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ #include #include "video.h" #include "proto.h" #include "dither.h" #include "SDL_timer.h" #ifdef USE_ATI #include "vhar128.h" #endif #ifdef __STDC__ #include #include #endif /* Changes to make the code reentrant: X variables now passed in xinfo: display, ximage,cmap,window, gc, etc De-globalized: ditherType, matched_depth, totNumFrames vid_stream->film_has_ended instead of FilmState Additional changes: Now can name and position each movie window individually DISABLE_DITHER cpp define - do not include dither code if defined NOFRAMECOUNT cpp define - do not count frames when running without controls Short circuit InitColorDisplay if not displaying anything ExistingWindow default now 0 -lsh@cs.brown.edu (Loring Holden) */ /* Frame Rate Info */ extern int framerate; /* Video rates table */ /* Cheat on Vid rates, round to 30, and use 30 if illegal value Except for 9, where Xing means 15, and given their popularity, we'll be nice and do it */ static double VidRateNum[16]={ 30, 23.97, 24, 25, 29.97, 30, 50, 59.94, 60, 15, 30, 30, 30, 15, 30, 30 }; #ifdef CALCULATE_FPS static inline void TimestampFPS( VidStream* vid_stream ) { MPEGvideo* mpeg = (MPEGvideo*) vid_stream->_smpeg; vid_stream->frame_time[vid_stream->timestamp_index] = mpeg->Time(); ++vid_stream->timestamp_index; if ( vid_stream->timestamp_index == FPS_WINDOW ) { vid_stream->timestamp_index = 0; } } #endif /* Do frame rate control. Returns _skipFrame */ #define LOOSE_MPEG_SCHEDULING #ifdef LOOSE_MPEG_SCHEDULING #define MAX_FRAME_SKIP 4 #define MAX_FUDGE_TIME (MAX_FRAME_SKIP*vid_stream->_oneFrameTime) #else #ifdef TIGHT_MPEG_SCHEDULING #define MAX_FRAME_SKIP 1 #define MAX_FUDGE_TIME (MAX_FRAME_SKIP*vid_stream->_oneFrameTime) #else #define MAX_FRAME_SKIP 3 #define MAX_FUDGE_TIME (MAX_FRAME_SKIP*vid_stream->_oneFrameTime) #endif /* TIGHT_MPEG_SCHEDULING */ #endif /* LOOSE_MPEG_SCHEDULING */ #define FUDGE_TIME (((MAX_FRAME_SKIP+1)/2)*vid_stream->_oneFrameTime) /* This results in smoother framerate, but more dropped frames on systems that can play most of the video fine, but have problems with jerkiness in a few spots. */ //#define SLOW_START_SCHEDULING #define SLOW_START_INCREMENT 0.3 /* Define this to debug the frame scheduler */ //#define DEBUG_MPEG_SCHEDULING inline double CurrentTime( VidStream* vid_stream ) { MPEGvideo* mpeg = (MPEGvideo*) vid_stream->_smpeg; double now; if ( mpeg->TimeSource() ) { now = mpeg->TimeSource()->Time(); } else { now = ReadSysClock() - vid_stream->realTimeStart; } return now; } int MPEGvideo::timeSync( VidStream* vid_stream ) { static double correction = -1; /* Update the number of frames displayed */ vid_stream->totNumFrames++; vid_stream->current_frame++; /* Do we need to initialize framerate? */ if ( vid_stream->rate_deal < 0 ) { switch( framerate ) { case -1: /* Go with stream Value */ vid_stream->rate_deal = VidRateNum[ vid_stream->picture_rate ]; break; case 0: /* as fast as possible */ vid_stream->rate_deal = 0; break; default: vid_stream->rate_deal = framerate; break; } if ( vid_stream->rate_deal ) { vid_stream->_oneFrameTime = 1.0 / vid_stream->rate_deal; } } /* Update the current play time */ play_time += vid_stream->_oneFrameTime; /* Synchronize using system timestamps */ if(vid_stream->current && vid_stream->current->show_time > 0){ #ifdef DEBUG_TIMESTAMP_SYNC fprintf(stderr, "video: time:%.3f shift:%.3f\r", play_time, play_time - vid_stream->current->show_time); #endif if(correction == -1) #ifdef STRANGE_SYNC_TEST /* this forces us to maintain the offset we have at the begining all the time, and is only usefull for testing */ correction = play_time - vid_stream->current->show_time; #else correction = 0; #endif #ifdef USE_TIMESTAMP_SYNC play_time = vid_stream->current->show_time + correction ; #endif vid_stream->current->show_time = -1; } /* If we are looking for a particular frame... */ if( vid_stream->_jumpFrame > -1 ) { if ( vid_stream->totNumFrames != vid_stream->_jumpFrame ) { vid_stream->_skipFrame = 1; } else { vid_stream->_skipFrame = 0; } return vid_stream->_skipFrame; } /* If we're already behind, don't check timing */ if ( vid_stream->_skipFrame > 0 ) { return --vid_stream->_skipFrame; } /* See if we need to skip frames, based on timing */ if ( vid_stream->rate_deal ) { static const double TIMESLICE = 0.01; // Seconds per OS timeslice double time_behind; /* Calculate the frame time relative to real time */ time_behind = CurrentTime(vid_stream) - Time(); #ifdef DEBUG_MPEG_SCHEDULING printf("Frame %d: frame time: %f, real time: %f, time behind: %f\n", vid_stream->totNumFrames, Time(), CurrentTime(vid_stream), time_behind); #endif /* Allow up to MAX_FUDGE_TIME of delay in output */ if ( time_behind < -TIMESLICE ) { time_behind = -time_behind; vid_stream->_skipCount = 0; #ifdef DEBUG_MPEG_SCHEDULING printf("Ahead! Sleeping %f\n", time_behind-TIMESLICE); #endif SDL_Delay((Uint32)((time_behind-TIMESLICE)*1000)); } else if ( time_behind < FUDGE_TIME ) { if ( vid_stream->_skipCount > 0 ) { vid_stream->_skipCount /= 2; } #ifdef DEBUG_MPEG_SCHEDULING printf("Just right.\n"); #endif } else if ( time_behind < MAX_FUDGE_TIME ) { if ( vid_stream->_skipCount > 0 ) { vid_stream->_skipCount--; } vid_stream->_skipFrame = 1+(int)(vid_stream->_skipCount/2); #ifdef DEBUG_MPEG_SCHEDULING printf("A little behind, skipping %d frames\n", vid_stream->_skipFrame); #endif } else { /* time_behind >= MAX_FUDGE_TIME */ if ( (time_behind > (MAX_FUDGE_TIME*2)) && (vid_stream->_skipCount == MAX_FRAME_SKIP) ) { #ifdef DEBUG_MPEG_SCHEDULING printf("Way too far behind, losing time sync...\n"); #endif #if 0 // This results in smoother video, but sync's terribly on slow machines play_time = CurrentTime(vid_stream) - (MAX_FUDGE_TIME*2); #endif } #ifdef SLOW_START_SCHEDULING vid_stream->_skipCount += SLOW_START_INCREMENT; #else vid_stream->_skipCount += 1.0; #endif if( vid_stream->_skipCount > MAX_FRAME_SKIP ) { vid_stream->_skipCount = MAX_FRAME_SKIP; } vid_stream->_skipFrame = (int)(vid_stream->_skipCount+0.9); #ifdef DEBUG_MPEG_SCHEDULING printf("A lot behind, skipping %d frames\n", vid_stream->_skipFrame); #endif } } return(vid_stream->_skipFrame); } /* Do the hard work of copying from the video stream working buffer to the screen display and then calling the update callback. */ void MPEGvideo::DisplayFrame( VidStream * vid_stream ) { SMPEG_FilterInfo info; if ( _filter_mutex ) SDL_mutexP( _filter_mutex ); /* Get a pointer to _image pixels */ if ( SDL_LockYUVOverlay( _image ) ) { return; } /* Compute additionnal info for the filter */ if((_filter->flags & SMPEG_FILTER_INFO_PIXEL_ERROR) && vid_stream->current->mb_qscale) { register int x, y; register Uint16 * ptr; /* Compute quantization error for each pixel */ info.yuv_pixel_square_error = (Uint16 *) malloc(_w*_h*12/8*sizeof(Uint16)); ptr = info.yuv_pixel_square_error; for(y = 0; y < _h; y++) for(x = 0; x < _w; x++) *ptr++ = (Uint16) (((Uint32) vid_stream->noise_base_matrix[x & 7][y & 7] * vid_stream->current->mb_qscale[((y>>4) * (_w>>4)) + (x >> 4)]) >> 8); } if((_filter->flags & SMPEG_FILTER_INFO_MB_ERROR) && vid_stream->current->mb_qscale) { /* Retreive macroblock quantization error info */ info.yuv_mb_square_error = vid_stream->current->mb_qscale; } if( _filter ) { SDL_Overlay src; Uint16 pitches[3]; Uint8 *pixels[3]; /* Fill in an SDL YV12 overlay structure for the source */ #ifdef USE_ATI vhar128_lockimage(vid_stream->ati_handle, vid_stream->current->image, &src); #else src.format = SDL_YV12_OVERLAY; src.w = _w; src.h = _h; src.planes = 3; pitches[0] = _w; pitches[1] = _w / 2; pitches[2] = _w / 2; src.pitches = pitches; pixels[0] = vid_stream->current->image; pixels[1] = vid_stream->current->image + pitches[0] * _h; pixels[2] = vid_stream->current->image + pitches[0] * _h + pitches[1] * _h / 2; src.pixels = pixels; #endif _filter->callback(_image, &src, &_srcrect, &info, _filter->data ); #ifdef USE_ATI vhar128_unlockimage(vid_stream->ati_handle, vid_stream->current->image, &src); #endif } /* Now display the image */ if ( _mutex ) SDL_mutexP( _mutex ); SDL_DisplayYUVOverlay(_image, &_dstrect); if ( _callback ) _callback(_dst, _dstrect.x, _dstrect.y, _dstrect.w, _dstrect.h); SDL_UnlockYUVOverlay( _image ); if( _filter ) { if( _filter->flags & SMPEG_FILTER_INFO_PIXEL_ERROR ) free(info.yuv_pixel_square_error); } if ( _filter_mutex ) SDL_mutexV( _filter_mutex ); if ( _mutex ) SDL_mutexV( _mutex ); } /* *-------------------------------------------------------------- * * ExecuteDisplay -- * * Actually displays display plane in previously created window. * * Results: * None. * * Side effects: * Updates video frame timing control * *-------------------------------------------------------------- */ void MPEGvideo::ExecuteDisplay( VidStream* vid_stream ) { if( ! vid_stream->_skipFrame ) { DisplayFrame(vid_stream); #ifdef CALCULATE_FPS TimestampFPS(vid_stream); #endif } timeSync( vid_stream ); } SMPEG_Filter * MPEGvideo:: Filter(SMPEG_Filter * filter) { SMPEG_Filter * old_filter; old_filter = _filter; if ( _filter_mutex ) SDL_mutexP( _filter_mutex ); _filter = filter; if ( _filter_mutex ) SDL_mutexV( _filter_mutex ); return(old_filter); } /* EOF */ smpeg-0.4.5+cvs20030824.orig/video/jrevdct.cpp0100644000175000017500000013443707005444342020620 0ustar hoseheadhosehead/* * jrevdct.c * * Copyright (C) 1991, 1992, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains the basic inverse-DCT transformation subroutine. * * This implementation is based on an algorithm described in * C. Loeffler, A. Ligtenberg and G. Moschytz, "Practical Fast 1-D DCT * Algorithms with 11 Multiplications", Proc. Int'l. Conf. on Acoustics, * Speech, and Signal Processing 1989 (ICASSP '89), pp. 988-991. * The primary algorithm described there uses 11 multiplies and 29 adds. * We use their alternate method with 12 multiplies and 32 adds. * The advantage of this method is that no data path contains more than one * multiplication; this allows a very simple and accurate implementation in * scaled fixed-point arithmetic, with a minimal number of shifts. * * I've made lots of modifications to attempt to take advantage of the * sparse nature of the DCT matrices we're getting. Although the logic * is cumbersome, it's straightforward and the resulting code is much * faster. * * A better way to do this would be to pass in the DCT block as a sparse * matrix, perhaps with the difference cases encoded. */ #include #include "video.h" #include "proto.h" #define GLOBAL /* a function referenced thru EXTERNs */ /* We assume that right shift corresponds to signed division by 2 with * rounding towards minus infinity. This is correct for typical "arithmetic * shift" instructions that shift in copies of the sign bit. But some * C compilers implement >> with an unsigned shift. For these machines you * must define RIGHT_SHIFT_IS_UNSIGNED. * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity. * It is only applied with constant shift counts. SHIFT_TEMPS must be * included in the variables of any routine using RIGHT_SHIFT. */ #ifdef RIGHT_SHIFT_IS_UNSIGNED #define SHIFT_TEMPS INT32 shift_temp; #define RIGHT_SHIFT(x,shft) \ ((shift_temp = (x)) < 0 ? \ (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \ (shift_temp >> (shft))) #else #define SHIFT_TEMPS #define RIGHT_SHIFT(x,shft) ((x) >> (shft)) #endif /* * This routine is specialized to the case DCTSIZE = 8. */ #if DCTSIZE != 8 Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ #endif /* * A 2-D IDCT can be done by 1-D IDCT on each row followed by 1-D IDCT * on each column. Direct algorithms are also available, but they are * much more complex and seem not to be any faster when reduced to code. * * The poop on this scaling stuff is as follows: * * Each 1-D IDCT step produces outputs which are a factor of sqrt(N) * larger than the true IDCT outputs. The final outputs are therefore * a factor of N larger than desired; since N=8 this can be cured by * a simple right shift at the end of the algorithm. The advantage of * this arrangement is that we save two multiplications per 1-D IDCT, * because the y0 and y4 inputs need not be divided by sqrt(N). * * We have to do addition and subtraction of the integer inputs, which * is no problem, and multiplication by fractional constants, which is * a problem to do in integer arithmetic. We multiply all the constants * by CONST_SCALE and convert them to integer constants (thus retaining * CONST_BITS bits of precision in the constants). After doing a * multiplication we have to divide the product by CONST_SCALE, with proper * rounding, to produce the correct output. This division can be done * cheaply as a right shift of CONST_BITS bits. We postpone shifting * as long as possible so that partial sums can be added together with * full fractional precision. * * The outputs of the first pass are scaled up by PASS1_BITS bits so that * they are represented to better-than-integral precision. These outputs * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word * with the recommended scaling. (To scale up 12-bit sample data further, an * intermediate INT32 array would be needed.) * * To avoid overflow of the 32-bit intermediate results in pass 2, we must * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis * shows that the values given below are the most effective. */ #ifdef EIGHT_BIT_SAMPLES #define PASS1_BITS 2 #else #define PASS1_BITS 1 /* lose a little precision to avoid overflow */ #endif #define ONE ((INT32) 1) #define CONST_SCALE (ONE << CONST_BITS) /* Convert a positive real constant to an integer scaled by CONST_SCALE. * IMPORTANT: if your compiler doesn't do this arithmetic at compile time, * you will pay a significant penalty in run time. In that case, figure * the correct integer constant values and insert them by hand. */ #define FIX(x) ((INT32) ((x) * CONST_SCALE + 0.5)) /* When adding two opposite-signed fixes, the 0.5 cancels */ #define FIX2(x) ((INT32) ((x) * CONST_SCALE)) /* Descale and correctly round an INT32 value that's scaled by N bits. * We assume RIGHT_SHIFT rounds towards minus infinity, so adding * the fudge factor is correct for either sign of X. */ #define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n) /* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. * For 8-bit samples with the recommended scaling, all the variable * and constant values involved are no more than 16 bits wide, so a * 16x16->32 bit multiply can be used instead of a full 32x32 multiply; * this provides a useful speedup on many machines. * There is no way to specify a 16x16->32 multiply in portable C, but * some C compilers will do the right thing if you provide the correct * combination of casts. * NB: for 12-bit samples, a full 32-bit multiplication will be needed. */ #ifdef EIGHT_BIT_SAMPLES #ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */ #define MULTIPLY(var,const) (((INT16) (var)) * ((INT16) (const))) #endif #ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */ #define MULTIPLY(var,const) (((INT16) (var)) * ((INT32) (const))) #endif #endif #ifndef MULTIPLY /* default definition */ #define MULTIPLY(var,const) ((var) * (const)) #endif #ifndef NO_SPARSE_DCT #define SPARSE_SCALE_FACTOR 8 #endif /* Precomputed idct value arrays. */ static DCTELEM PreIDCT[64][64]; /* *-------------------------------------------------------------- * * init_pre_idct -- * * Pre-computes singleton coefficient IDCT values. * * Results: * None. * * Side effects: * None. * *-------------------------------------------------------------- */ void init_pre_idct() { int i; for (i=0; i<64; i++) { memset((char *) PreIDCT[i], 0, 64*sizeof(DCTELEM)); PreIDCT[i][i] = 1 << SPARSE_SCALE_FACTOR; j_rev_dct(PreIDCT[i]); } } #ifndef NO_SPARSE_DCT /* *-------------------------------------------------------------- * * j_rev_dct_sparse -- * * Performs the inverse DCT on one block of coefficients. * * Results: * None. * * Side effects: * None. * *-------------------------------------------------------------- */ void j_rev_dct_sparse( DCTBLOCK data, int pos ) { short int val; register int *dp; register int v; int quant; #ifdef SPARSE_AC register DCTELEM *dataptr; DCTELEM *ndataptr; int coeff, rr; DCTBLOCK tmpdata, tmp2data; DCTELEM *tmpdataptr, *tmp2dataptr; int printFlag = 1; #endif /* If DC Coefficient. */ if (pos == 0) { dp = (int *)data; v = *data; quant = 8; /* Compute 32 bit value to assign. This speeds things up a bit */ if (v < 0) { val = -v; val += (quant >> 1); val /= quant; val = -val; } else { val = (v + (quant >> 1)) / quant; } v = ((val & 0xffff) | (val << 16)); dp[0] = v; dp[1] = v; dp[2] = v; dp[3] = v; dp[4] = v; dp[5] = v; dp[6] = v; dp[7] = v; dp[8] = v; dp[9] = v; dp[10] = v; dp[11] = v; dp[12] = v; dp[13] = v; dp[14] = v; dp[15] = v; dp[16] = v; dp[17] = v; dp[18] = v; dp[19] = v; dp[20] = v; dp[21] = v; dp[22] = v; dp[23] = v; dp[24] = v; dp[25] = v; dp[26] = v; dp[27] = v; dp[28] = v; dp[29] = v; dp[30] = v; dp[31] = v; return; } /* Some other coefficient. */ #ifdef SPARSE_AC dataptr = (DCTELEM *)data; coeff = dataptr[pos]; ndataptr = PreIDCT[pos]; printf (" \n"); printf ("COEFFICIENT = %3d, POSITION = %2d\n", coeff, pos); for (v=0; v<64; v++) { memcpy((char *) tmpdata, data, 64*sizeof(DCTELEM)); } tmpdataptr = (DCTELEM *)tmpdata; for (v=0; v<64; v++) { memcpy((char *) tmp2data, data, 64*sizeof(DCTELEM)); } tmp2dataptr = (DCTELEM *)tmp2data; #ifdef DEBUG printf ("original DCTBLOCK:\n"); for (rr=0; rr<8; rr++) { for (v=0; v<8; v++) { if (dataptr[8*rr+v] != tmpdataptr[8*rr+v]) fprintf(stderr, "Error in copy\n"); printf ("%3d ", dataptr[8*rr+v]); } printf("\n"); } #endif printf("\n"); for (rr=0; rr<4; rr++) { dataptr[0] = (ndataptr[0] * coeff) >> SPARSE_SCALE_FACTOR; dataptr[1] = (ndataptr[1] * coeff) >> SPARSE_SCALE_FACTOR; dataptr[2] = (ndataptr[2] * coeff) >> SPARSE_SCALE_FACTOR; dataptr[3] = (ndataptr[3] * coeff) >> SPARSE_SCALE_FACTOR; dataptr[4] = (ndataptr[4] * coeff) >> SPARSE_SCALE_FACTOR; dataptr[5] = (ndataptr[5] * coeff) >> SPARSE_SCALE_FACTOR; dataptr[6] = (ndataptr[6] * coeff) >> SPARSE_SCALE_FACTOR; dataptr[7] = (ndataptr[7] * coeff) >> SPARSE_SCALE_FACTOR; dataptr[8] = (ndataptr[8] * coeff) >> SPARSE_SCALE_FACTOR; dataptr[9] = (ndataptr[9] * coeff) >> SPARSE_SCALE_FACTOR; dataptr[10] = (ndataptr[10] * coeff) >> SPARSE_SCALE_FACTOR; dataptr[11] = (ndataptr[11] * coeff) >> SPARSE_SCALE_FACTOR; dataptr[12] = (ndataptr[12] * coeff) >> SPARSE_SCALE_FACTOR; dataptr[13] = (ndataptr[13] * coeff) >> SPARSE_SCALE_FACTOR; dataptr[14] = (ndataptr[14] * coeff) >> SPARSE_SCALE_FACTOR; dataptr[15] = (ndataptr[15] * coeff) >> SPARSE_SCALE_FACTOR; dataptr += 16; ndataptr += 16; } dataptr = (DCTELEM *) data; #ifdef DEBUG printf ("sparse IDCT:\n"); for (rr=0; rr<8; rr++) { for (v=0; v<8; v++) { printf ("%3d ", dataptr[8*rr+v]); } printf("\n"); } printf("\n"); #endif /* DEBUG */ #else /* NO_SPARSE_AC */ #ifdef FLOATDCT if (qualityFlag) float_idct(data); else #endif /* FLOATDCT */ j_rev_dct(data); #endif /* SPARSE_AC */ return; } #else /* *-------------------------------------------------------------- * * j_rev_dct_sparse -- * * Performs the original inverse DCT on one block of * coefficients. * * Results: * None. * * Side effects: * None. * *-------------------------------------------------------------- */ void j_rev_dct_sparse( DCTBLOCK data, int pos ) { j_rev_dct(data); } #endif /* SPARSE_DCT */ #ifndef FIVE_DCT #ifndef ORIG_DCT /* *-------------------------------------------------------------- * * j_rev_dct -- * * The inverse DCT function. * * Results: * None. * * Side effects: * None. * * Profiling results: * This function only takes about 0.01ms per call, but is called many * many times, taking about 30% of the total time used by playback. * *-------------------------------------------------------------- */ void j_rev_dct( DCTBLOCK data ) { INT32 tmp0, tmp1, tmp2, tmp3; INT32 tmp10, tmp11, tmp12, tmp13; INT32 z1, z2, z3, z4, z5; INT32 d0, d1, d2, d3, d4, d5, d6, d7; register DCTELEM *dataptr; int rowctr; SHIFT_TEMPS /* Pass 1: process rows. */ /* Note results are scaled up by sqrt(8) compared to a true IDCT; */ /* furthermore, we scale the results by 2**PASS1_BITS. */ dataptr = data; for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) { /* Due to quantization, we will usually find that many of the input * coefficients are zero, especially the AC terms. We can exploit this * by short-circuiting the IDCT calculation for any row in which all * the AC terms are zero. In that case each output is equal to the * DC coefficient (with scale factor as needed). * With typical images and quantization tables, half or more of the * row DCT calculations can be simplified this way. */ register int *idataptr = (int*)dataptr; d0 = dataptr[0]; d1 = dataptr[1]; if ((d1 == 0) && (idataptr[1] | idataptr[2] | idataptr[3]) == 0) { /* AC terms all zero */ if (d0) { /* Compute a 32 bit value to assign. */ DCTELEM dcval = (DCTELEM) (d0 << PASS1_BITS); register int v = (dcval & 0xffff) | (dcval << 16); idataptr[0] = v; idataptr[1] = v; idataptr[2] = v; idataptr[3] = v; } dataptr += DCTSIZE; /* advance pointer to next row */ continue; } d2 = dataptr[2]; d3 = dataptr[3]; d4 = dataptr[4]; d5 = dataptr[5]; d6 = dataptr[6]; d7 = dataptr[7]; /* Even part: reverse the even part of the forward DCT. */ /* The rotator is sqrt(2)*c(-6). */ if (d6) { if (d4) { if (d2) { if (d0) { /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */ z1 = MULTIPLY(d2 + d6, FIX(0.541196100)); tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065)); tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865)); tmp0 = (d0 + d4) << CONST_BITS; tmp1 = (d0 - d4) << CONST_BITS; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; } else { /* d0 == 0, d2 != 0, d4 != 0, d6 != 0 */ z1 = MULTIPLY(d2 + d6, FIX(0.541196100)); tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065)); tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865)); tmp0 = d4 << CONST_BITS; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp2 - tmp0; tmp12 = -(tmp0 + tmp2); } } else { if (d0) { /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */ tmp2 = MULTIPLY(d6, - FIX2(1.306562965)); tmp3 = MULTIPLY(d6, FIX(0.541196100)); tmp0 = (d0 + d4) << CONST_BITS; tmp1 = (d0 - d4) << CONST_BITS; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; } else { /* d0 == 0, d2 == 0, d4 != 0, d6 != 0 */ tmp2 = MULTIPLY(d6, - FIX2(1.306562965)); tmp3 = MULTIPLY(d6, FIX(0.541196100)); tmp0 = d4 << CONST_BITS; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp2 - tmp0; tmp12 = -(tmp0 + tmp2); } } } else { if (d2) { if (d0) { /* d0 != 0, d2 != 0, d4 == 0, d6 != 0 */ z1 = MULTIPLY(d2 + d6, FIX(0.541196100)); tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065)); tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865)); tmp0 = d0 << CONST_BITS; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp0 + tmp2; tmp12 = tmp0 - tmp2; } else { /* d0 == 0, d2 != 0, d4 == 0, d6 != 0 */ z1 = MULTIPLY(d2 + d6, FIX(0.541196100)); tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065)); tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865)); tmp10 = tmp3; tmp13 = -tmp3; tmp11 = tmp2; tmp12 = -tmp2; } } else { if (d0) { /* d0 != 0, d2 == 0, d4 == 0, d6 != 0 */ tmp2 = MULTIPLY(d6, - FIX2(1.306562965)); tmp3 = MULTIPLY(d6, FIX(0.541196100)); tmp0 = d0 << CONST_BITS; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp0 + tmp2; tmp12 = tmp0 - tmp2; } else { /* d0 == 0, d2 == 0, d4 == 0, d6 != 0 */ tmp2 = MULTIPLY(d6, - FIX2(1.306562965)); tmp3 = MULTIPLY(d6, FIX(0.541196100)); tmp10 = tmp3; tmp13 = -tmp3; tmp11 = tmp2; tmp12 = -tmp2; } } } } else { if (d4) { if (d2) { if (d0) { /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */ tmp2 = (INT32)MULTIPLY(d2, FIX(0.541196100)); tmp3 = (INT32)MULTIPLY(d2, (FIX(1.306562965) + .5)); tmp0 = (d0 + d4) << CONST_BITS; tmp1 = (d0 - d4) << CONST_BITS; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; } else { /* d0 == 0, d2 != 0, d4 != 0, d6 == 0 */ tmp2 = (INT32)MULTIPLY(d2, FIX(0.541196100)); tmp3 = (INT32)MULTIPLY(d2, (FIX(1.306562965) + .5)); tmp0 = d4 << CONST_BITS; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp2 - tmp0; tmp12 = -(tmp0 + tmp2); } } else { if (d0) { /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */ tmp10 = tmp13 = (d0 + d4) << CONST_BITS; tmp11 = tmp12 = (d0 - d4) << CONST_BITS; } else { /* d0 == 0, d2 == 0, d4 != 0, d6 == 0 */ tmp10 = tmp13 = d4 << CONST_BITS; tmp11 = tmp12 = -tmp10; } } } else { if (d2) { if (d0) { /* d0 != 0, d2 != 0, d4 == 0, d6 == 0 */ tmp2 = (INT32)MULTIPLY(d2, FIX(0.541196100)); tmp3 = (INT32)MULTIPLY(d2, (FIX(1.306562965) + .5)); tmp0 = d0 << CONST_BITS; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp0 + tmp2; tmp12 = tmp0 - tmp2; } else { /* d0 == 0, d2 != 0, d4 == 0, d6 == 0 */ tmp2 = (INT32)MULTIPLY(d2, FIX(0.541196100)); tmp3 = (INT32)MULTIPLY(d2, (FIX(1.306562965) + .5)); tmp10 = tmp3; tmp13 = -tmp3; tmp11 = tmp2; tmp12 = -tmp2; } } else { if (d0) { /* d0 != 0, d2 == 0, d4 == 0, d6 == 0 */ tmp10 = tmp13 = tmp11 = tmp12 = d0 << CONST_BITS; } else { /* d0 == 0, d2 == 0, d4 == 0, d6 == 0 */ tmp10 = tmp13 = tmp11 = tmp12 = 0; } } } } /* Odd part per figure 8; the matrix is unitary and hence its * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. */ if (d7) { if (d5) { if (d3) { if (d1) { /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */ z1 = d7 + d1; z2 = d5 + d3; z3 = d7 + d3; z4 = d5 + d1; z5 = MULTIPLY(z3 + z4, FIX(1.175875602)); tmp0 = MULTIPLY(d7, FIX(0.298631336)); tmp1 = MULTIPLY(d5, FIX(2.053119869)); tmp2 = MULTIPLY(d3, FIX(3.072711026)); tmp3 = MULTIPLY(d1, FIX(1.501321110)); z1 = MULTIPLY(z1, - FIX(0.899976223)); z2 = MULTIPLY(z2, - FIX(2.562915447)); z3 = MULTIPLY(z3, - FIX(1.961570560)); z4 = MULTIPLY(z4, - FIX(0.390180644)); z3 += z5; z4 += z5; tmp0 += z1 + z3; tmp1 += z2 + z4; tmp2 += z2 + z3; tmp3 += z1 + z4; } else { /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */ z2 = d5 + d3; z3 = d7 + d3; z5 = MULTIPLY(z3 + d5, FIX(1.175875602)); tmp0 = MULTIPLY(d7, FIX(0.298631336)); tmp1 = MULTIPLY(d5, FIX(2.053119869)); tmp2 = MULTIPLY(d3, FIX(3.072711026)); z1 = MULTIPLY(d7, - FIX(0.899976223)); z2 = MULTIPLY(z2, - FIX(2.562915447)); z3 = MULTIPLY(z3, - FIX(1.961570560)); z4 = MULTIPLY(d5, - FIX(0.390180644)); z3 += z5; z4 += z5; tmp0 += z1 + z3; tmp1 += z2 + z4; tmp2 += z2 + z3; tmp3 = z1 + z4; } } else { if (d1) { /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */ z1 = d7 + d1; z4 = d5 + d1; z5 = MULTIPLY(d7 + z4, FIX(1.175875602)); tmp0 = MULTIPLY(d7, FIX(0.298631336)); tmp1 = MULTIPLY(d5, FIX(2.053119869)); tmp3 = MULTIPLY(d1, FIX(1.501321110)); z1 = MULTIPLY(z1, - FIX(0.899976223)); z2 = MULTIPLY(d5, - FIX(2.562915447)); z3 = MULTIPLY(d7, - FIX(1.961570560)); z4 = MULTIPLY(z4, - FIX(0.390180644)); z3 += z5; z4 += z5; tmp0 += z1 + z3; tmp1 += z2 + z4; tmp2 = z2 + z3; tmp3 += z1 + z4; } else { /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */ z5 = MULTIPLY(d7 + d5, FIX(1.175875602)); tmp0 = MULTIPLY(d7, - FIX2(0.601344887)); tmp1 = MULTIPLY(d5, - FIX2(0.509795578)); z1 = MULTIPLY(d7, - FIX(0.899976223)); z3 = MULTIPLY(d7, - FIX(1.961570560)); z2 = MULTIPLY(d5, - FIX(2.562915447)); z4 = MULTIPLY(d5, - FIX(0.390180644)); z3 += z5; z4 += z5; tmp0 += z3; tmp1 += z4; tmp2 = z2 + z3; tmp3 = z1 + z4; } } } else { if (d3) { if (d1) { /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */ z1 = d7 + d1; z3 = d7 + d3; z5 = MULTIPLY(z3 + d1, FIX(1.175875602)); tmp0 = MULTIPLY(d7, FIX(0.298631336)); tmp2 = MULTIPLY(d3, FIX(3.072711026)); tmp3 = MULTIPLY(d1, FIX(1.501321110)); z1 = MULTIPLY(z1, - FIX(0.899976223)); z2 = MULTIPLY(d3, - FIX(2.562915447)); z3 = MULTIPLY(z3, - FIX(1.961570560)); z4 = MULTIPLY(d1, - FIX(0.390180644)); z3 += z5; z4 += z5; tmp0 += z1 + z3; tmp1 = z2 + z4; tmp2 += z2 + z3; tmp3 += z1 + z4; } else { /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */ z3 = d7 + d3; z5 = MULTIPLY(z3, FIX(1.175875602)); tmp0 = MULTIPLY(d7, - FIX2(0.601344887)); tmp2 = MULTIPLY(d3, FIX(0.509795579)); z1 = MULTIPLY(d7, - FIX(0.899976223)); z2 = MULTIPLY(d3, - FIX(2.562915447)); z3 = MULTIPLY(z3, - FIX2(0.785694958)); tmp0 += z3; tmp1 = z2 + z5; tmp2 += z3; tmp3 = z1 + z5; } } else { if (d1) { /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */ z1 = d7 + d1; z5 = MULTIPLY(z1, FIX(1.175875602)); tmp0 = MULTIPLY(d7, - FIX2(1.662939224)); tmp3 = MULTIPLY(d1, FIX2(1.111140466)); z1 = MULTIPLY(z1, FIX2(0.275899379)); z3 = MULTIPLY(d7, - FIX(1.961570560)); z4 = MULTIPLY(d1, - FIX(0.390180644)); tmp0 += z1; tmp1 = z4 + z5; tmp2 = z3 + z5; tmp3 += z1; } else { /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */ tmp0 = MULTIPLY(d7, - FIX2(1.387039845)); tmp1 = MULTIPLY(d7, FIX(1.175875602)); tmp2 = MULTIPLY(d7, - FIX2(0.785694958)); tmp3 = MULTIPLY(d7, FIX2(0.275899379)); } } } } else { if (d5) { if (d3) { if (d1) { /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */ z2 = d5 + d3; z4 = d5 + d1; z5 = MULTIPLY(d3 + z4, FIX(1.175875602)); tmp1 = MULTIPLY(d5, FIX(2.053119869)); tmp2 = MULTIPLY(d3, FIX(3.072711026)); tmp3 = MULTIPLY(d1, FIX(1.501321110)); z1 = MULTIPLY(d1, - FIX(0.899976223)); z2 = MULTIPLY(z2, - FIX(2.562915447)); z3 = MULTIPLY(d3, - FIX(1.961570560)); z4 = MULTIPLY(z4, - FIX(0.390180644)); z3 += z5; z4 += z5; tmp0 = z1 + z3; tmp1 += z2 + z4; tmp2 += z2 + z3; tmp3 += z1 + z4; } else { /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */ z2 = d5 + d3; z5 = MULTIPLY(z2, FIX(1.175875602)); tmp1 = MULTIPLY(d5, FIX2(1.662939225)); tmp2 = MULTIPLY(d3, FIX2(1.111140466)); z2 = MULTIPLY(z2, - FIX2(1.387039845)); z3 = MULTIPLY(d3, - FIX(1.961570560)); z4 = MULTIPLY(d5, - FIX(0.390180644)); tmp0 = z3 + z5; tmp1 += z2; tmp2 += z2; tmp3 = z4 + z5; } } else { if (d1) { /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */ z4 = d5 + d1; z5 = MULTIPLY(z4, FIX(1.175875602)); tmp1 = MULTIPLY(d5, - FIX2(0.509795578)); tmp3 = MULTIPLY(d1, FIX2(0.601344887)); z1 = MULTIPLY(d1, - FIX(0.899976223)); z2 = MULTIPLY(d5, - FIX(2.562915447)); z4 = MULTIPLY(z4, FIX2(0.785694958)); tmp0 = z1 + z5; tmp1 += z4; tmp2 = z2 + z5; tmp3 += z4; } else { /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */ tmp0 = MULTIPLY(d5, FIX(1.175875602)); tmp1 = MULTIPLY(d5, FIX2(0.275899380)); tmp2 = MULTIPLY(d5, - FIX2(1.387039845)); tmp3 = MULTIPLY(d5, FIX2(0.785694958)); } } } else { if (d3) { if (d1) { /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */ z5 = d3 + d1; tmp2 = MULTIPLY(d3, - FIX(1.451774981)); tmp3 = MULTIPLY(d1, (FIX(0.211164243) - 1)); z1 = MULTIPLY(d1, FIX(1.061594337)); z2 = MULTIPLY(d3, - FIX(2.172734803)); z4 = MULTIPLY(z5, FIX(0.785694958)); z5 = MULTIPLY(z5, FIX(1.175875602)); tmp0 = z1 - z4; tmp1 = z2 + z4; tmp2 += z5; tmp3 += z5; } else { /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */ tmp0 = MULTIPLY(d3, - FIX2(0.785694958)); tmp1 = MULTIPLY(d3, - FIX2(1.387039845)); tmp2 = MULTIPLY(d3, - FIX2(0.275899379)); tmp3 = MULTIPLY(d3, FIX(1.175875602)); } } else { if (d1) { /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */ tmp0 = MULTIPLY(d1, FIX2(0.275899379)); tmp1 = MULTIPLY(d1, FIX2(0.785694958)); tmp2 = MULTIPLY(d1, FIX(1.175875602)); tmp3 = MULTIPLY(d1, FIX2(1.387039845)); } else { /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */ tmp0 = tmp1 = tmp2 = tmp3 = 0; } } } } /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ dataptr[0] = (DCTELEM) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS); dataptr[7] = (DCTELEM) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS); dataptr[1] = (DCTELEM) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS); dataptr[6] = (DCTELEM) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS); dataptr[2] = (DCTELEM) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS); dataptr[5] = (DCTELEM) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS); dataptr[3] = (DCTELEM) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS); dataptr[4] = (DCTELEM) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS); dataptr += DCTSIZE; /* advance pointer to next row */ } /* Pass 2: process columns. */ /* Note that we must descale the results by a factor of 8 == 2**3, */ /* and also undo the PASS1_BITS scaling. */ dataptr = data; for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) { /* Columns of zeroes can be exploited in the same way as we did with rows. * However, the row calculation has created many nonzero AC terms, so the * simplification applies less often (typically 5% to 10% of the time). * On machines with very fast multiplication, it's possible that the * test takes more time than it's worth. In that case this section * may be commented out. */ d0 = dataptr[DCTSIZE*0]; d1 = dataptr[DCTSIZE*1]; d2 = dataptr[DCTSIZE*2]; d3 = dataptr[DCTSIZE*3]; d4 = dataptr[DCTSIZE*4]; d5 = dataptr[DCTSIZE*5]; d6 = dataptr[DCTSIZE*6]; d7 = dataptr[DCTSIZE*7]; /* Even part: reverse the even part of the forward DCT. */ /* The rotator is sqrt(2)*c(-6). */ if (d6) { if (d4) { if (d2) { if (d0) { /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */ z1 = MULTIPLY(d2 + d6, FIX(0.541196100)); tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065)); tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865)); tmp0 = (d0 + d4) << CONST_BITS; tmp1 = (d0 - d4) << CONST_BITS; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; } else { /* d0 == 0, d2 != 0, d4 != 0, d6 != 0 */ z1 = MULTIPLY(d2 + d6, FIX(0.541196100)); tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065)); tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865)); tmp0 = d4 << CONST_BITS; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp2 - tmp0; tmp12 = -(tmp0 + tmp2); } } else { if (d0) { /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */ tmp2 = MULTIPLY(d6, - FIX2(1.306562965)); tmp3 = MULTIPLY(d6, FIX(0.541196100)); tmp0 = (d0 + d4) << CONST_BITS; tmp1 = (d0 - d4) << CONST_BITS; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; } else { /* d0 == 0, d2 == 0, d4 != 0, d6 != 0 */ tmp2 = MULTIPLY(d6, -FIX2(1.306562965)); tmp3 = MULTIPLY(d6, FIX(0.541196100)); tmp0 = d4 << CONST_BITS; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp2 - tmp0; tmp12 = -(tmp0 + tmp2); } } } else { if (d2) { if (d0) { /* d0 != 0, d2 != 0, d4 == 0, d6 != 0 */ z1 = MULTIPLY(d2 + d6, FIX(0.541196100)); tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065)); tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865)); tmp0 = d0 << CONST_BITS; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp0 + tmp2; tmp12 = tmp0 - tmp2; } else { /* d0 == 0, d2 != 0, d4 == 0, d6 != 0 */ z1 = MULTIPLY(d2 + d6, FIX(0.541196100)); tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065)); tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865)); tmp10 = tmp3; tmp13 = -tmp3; tmp11 = tmp2; tmp12 = -tmp2; } } else { if (d0) { /* d0 != 0, d2 == 0, d4 == 0, d6 != 0 */ tmp2 = MULTIPLY(d6, - FIX2(1.306562965)); tmp3 = MULTIPLY(d6, FIX(0.541196100)); tmp0 = d0 << CONST_BITS; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp0 + tmp2; tmp12 = tmp0 - tmp2; } else { /* d0 == 0, d2 == 0, d4 == 0, d6 != 0 */ tmp2 = MULTIPLY(d6, - FIX2(1.306562965)); tmp3 = MULTIPLY(d6, FIX(0.541196100)); tmp10 = tmp3; tmp13 = -tmp3; tmp11 = tmp2; tmp12 = -tmp2; } } } } else { if (d4) { if (d2) { if (d0) { /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */ tmp2 = (INT32)MULTIPLY(d2, FIX(0.541196100)); tmp3 = (INT32)MULTIPLY(d2, (FIX(1.306562965) + .5)); tmp0 = (d0 + d4) << CONST_BITS; tmp1 = (d0 - d4) << CONST_BITS; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; } else { /* d0 == 0, d2 != 0, d4 != 0, d6 == 0 */ tmp2 = (INT32)MULTIPLY(d2, FIX(0.541196100)); tmp3 = (INT32)MULTIPLY(d2, (FIX(1.306562965) + .5)); tmp0 = d4 << CONST_BITS; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp2 - tmp0; tmp12 = -(tmp0 + tmp2); } } else { if (d0) { /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */ tmp10 = tmp13 = (d0 + d4) << CONST_BITS; tmp11 = tmp12 = (d0 - d4) << CONST_BITS; } else { /* d0 == 0, d2 == 0, d4 != 0, d6 == 0 */ tmp10 = tmp13 = d4 << CONST_BITS; tmp11 = tmp12 = -tmp10; } } } else { if (d2) { if (d0) { /* d0 != 0, d2 != 0, d4 == 0, d6 == 0 */ tmp2 = (INT32)MULTIPLY(d2, FIX(0.541196100)); tmp3 = (INT32)MULTIPLY(d2, (FIX(1.306562965) + .5)); tmp0 = d0 << CONST_BITS; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp0 + tmp2; tmp12 = tmp0 - tmp2; } else { /* d0 == 0, d2 != 0, d4 == 0, d6 == 0 */ tmp2 = (INT32)MULTIPLY(d2, FIX(0.541196100)); tmp3 = (INT32)MULTIPLY(d2, (FIX(1.306562965) + .5)); tmp10 = tmp3; tmp13 = -tmp3; tmp11 = tmp2; tmp12 = -tmp2; } } else { if (d0) { /* d0 != 0, d2 == 0, d4 == 0, d6 == 0 */ tmp10 = tmp13 = tmp11 = tmp12 = d0 << CONST_BITS; } else { /* d0 == 0, d2 == 0, d4 == 0, d6 == 0 */ tmp10 = tmp13 = tmp11 = tmp12 = 0; } } } } /* Odd part per figure 8; the matrix is unitary and hence its * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. */ if (d7) { if (d5) { if (d3) { if (d1) { /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */ z1 = d7 + d1; z2 = d5 + d3; z3 = d7 + d3; z4 = d5 + d1; z5 = MULTIPLY(z3 + z4, FIX(1.175875602)); tmp0 = MULTIPLY(d7, FIX(0.298631336)); tmp1 = MULTIPLY(d5, FIX(2.053119869)); tmp2 = MULTIPLY(d3, FIX(3.072711026)); tmp3 = MULTIPLY(d1, FIX(1.501321110)); z1 = MULTIPLY(z1, - FIX(0.899976223)); z2 = MULTIPLY(z2, - FIX(2.562915447)); z3 = MULTIPLY(z3, - FIX(1.961570560)); z4 = MULTIPLY(z4, - FIX(0.390180644)); z3 += z5; z4 += z5; tmp0 += z1 + z3; tmp1 += z2 + z4; tmp2 += z2 + z3; tmp3 += z1 + z4; } else { /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */ z2 = d5 + d3; z3 = d7 + d3; z5 = MULTIPLY(z3 + d5, FIX(1.175875602)); tmp0 = MULTIPLY(d7, FIX(0.298631336)); tmp1 = MULTIPLY(d5, FIX(2.053119869)); tmp2 = MULTIPLY(d3, FIX(3.072711026)); z1 = MULTIPLY(d7, - FIX(0.899976223)); z2 = MULTIPLY(z2, - FIX(2.562915447)); z3 = MULTIPLY(z3, - FIX(1.961570560)); z4 = MULTIPLY(d5, - FIX(0.390180644)); z3 += z5; z4 += z5; tmp0 += z1 + z3; tmp1 += z2 + z4; tmp2 += z2 + z3; tmp3 = z1 + z4; } } else { if (d1) { /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */ z1 = d7 + d1; z4 = d5 + d1; z5 = MULTIPLY(d7 + z4, FIX(1.175875602)); tmp0 = MULTIPLY(d7, FIX(0.298631336)); tmp1 = MULTIPLY(d5, FIX(2.053119869)); tmp3 = MULTIPLY(d1, FIX(1.501321110)); z1 = MULTIPLY(z1, - FIX(0.899976223)); z2 = MULTIPLY(d5, - FIX(2.562915447)); z3 = MULTIPLY(d7, - FIX(1.961570560)); z4 = MULTIPLY(z4, - FIX(0.390180644)); z3 += z5; z4 += z5; tmp0 += z1 + z3; tmp1 += z2 + z4; tmp2 = z2 + z3; tmp3 += z1 + z4; } else { /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */ z5 = MULTIPLY(d5 + d7, FIX(1.175875602)); tmp0 = MULTIPLY(d7, - FIX2(0.601344887)); tmp1 = MULTIPLY(d5, - FIX2(0.509795578)); z1 = MULTIPLY(d7, - FIX(0.899976223)); z3 = MULTIPLY(d7, - FIX(1.961570560)); z2 = MULTIPLY(d5, - FIX(2.562915447)); z4 = MULTIPLY(d5, - FIX(0.390180644)); z3 += z5; z4 += z5; tmp0 += z3; tmp1 += z4; tmp2 = z2 + z3; tmp3 = z1 + z4; } } } else { if (d3) { if (d1) { /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */ z1 = d7 + d1; z3 = d7 + d3; z5 = MULTIPLY(z3 + d1, FIX(1.175875602)); tmp0 = MULTIPLY(d7, FIX(0.298631336)); tmp2 = MULTIPLY(d3, FIX(3.072711026)); tmp3 = MULTIPLY(d1, FIX(1.501321110)); z1 = MULTIPLY(z1, - FIX(0.899976223)); z2 = MULTIPLY(d3, - FIX(2.562915447)); z3 = MULTIPLY(z3, - FIX(1.961570560)); z4 = MULTIPLY(d1, - FIX(0.390180644)); z3 += z5; z4 += z5; tmp0 += z1 + z3; tmp1 = z2 + z4; tmp2 += z2 + z3; tmp3 += z1 + z4; } else { /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */ z3 = d7 + d3; z5 = MULTIPLY(z3, FIX(1.175875602)); tmp0 = MULTIPLY(d7, - FIX2(0.601344887)); z1 = MULTIPLY(d7, - FIX(0.899976223)); tmp2 = MULTIPLY(d3, FIX(0.509795579)); z2 = MULTIPLY(d3, - FIX(2.562915447)); z3 = MULTIPLY(z3, - FIX2(0.785694958)); tmp0 += z3; tmp1 = z2 + z5; tmp2 += z3; tmp3 = z1 + z5; } } else { if (d1) { /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */ z1 = d7 + d1; z5 = MULTIPLY(z1, FIX(1.175875602)); tmp0 = MULTIPLY(d7, - FIX2(1.662939224)); tmp3 = MULTIPLY(d1, FIX2(1.111140466)); z1 = MULTIPLY(z1, FIX2(0.275899379)); z3 = MULTIPLY(d7, - FIX(1.961570560)); z4 = MULTIPLY(d1, - FIX(0.390180644)); tmp0 += z1; tmp1 = z4 + z5; tmp2 = z3 + z5; tmp3 += z1; } else { /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */ tmp0 = MULTIPLY(d7, - FIX2(1.387039845)); tmp1 = MULTIPLY(d7, FIX(1.175875602)); tmp2 = MULTIPLY(d7, - FIX2(0.785694958)); tmp3 = MULTIPLY(d7, FIX2(0.275899379)); } } } } else { if (d5) { if (d3) { if (d1) { /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */ z2 = d5 + d3; z4 = d5 + d1; z5 = MULTIPLY(d3 + z4, FIX(1.175875602)); tmp1 = MULTIPLY(d5, FIX(2.053119869)); tmp2 = MULTIPLY(d3, FIX(3.072711026)); tmp3 = MULTIPLY(d1, FIX(1.501321110)); z1 = MULTIPLY(d1, - FIX(0.899976223)); z2 = MULTIPLY(z2, - FIX(2.562915447)); z3 = MULTIPLY(d3, - FIX(1.961570560)); z4 = MULTIPLY(z4, - FIX(0.390180644)); z3 += z5; z4 += z5; tmp0 = z1 + z3; tmp1 += z2 + z4; tmp2 += z2 + z3; tmp3 += z1 + z4; } else { /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */ z2 = d5 + d3; z5 = MULTIPLY(z2, FIX(1.175875602)); tmp1 = MULTIPLY(d5, FIX2(1.662939225)); tmp2 = MULTIPLY(d3, FIX2(1.111140466)); z2 = MULTIPLY(z2, - FIX2(1.387039845)); z3 = MULTIPLY(d3, - FIX(1.961570560)); z4 = MULTIPLY(d5, - FIX(0.390180644)); tmp0 = z3 + z5; tmp1 += z2; tmp2 += z2; tmp3 = z4 + z5; } } else { if (d1) { /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */ z4 = d5 + d1; z5 = MULTIPLY(z4, FIX(1.175875602)); tmp1 = MULTIPLY(d5, - FIX2(0.509795578)); tmp3 = MULTIPLY(d1, FIX2(0.601344887)); z1 = MULTIPLY(d1, - FIX(0.899976223)); z2 = MULTIPLY(d5, - FIX(2.562915447)); z4 = MULTIPLY(z4, FIX2(0.785694958)); tmp0 = z1 + z5; tmp1 += z4; tmp2 = z2 + z5; tmp3 += z4; } else { /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */ tmp0 = MULTIPLY(d5, FIX(1.175875602)); tmp1 = MULTIPLY(d5, FIX2(0.275899380)); tmp2 = MULTIPLY(d5, - FIX2(1.387039845)); tmp3 = MULTIPLY(d5, FIX2(0.785694958)); } } } else { if (d3) { if (d1) { /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */ z5 = d3 + d1; tmp2 = MULTIPLY(d3, - FIX(1.451774981)); tmp3 = MULTIPLY(d1, (FIX(0.211164243) - 1)); z1 = MULTIPLY(d1, FIX(1.061594337)); z2 = MULTIPLY(d3, - FIX(2.172734803)); z4 = MULTIPLY(z5, FIX(0.785694958)); z5 = MULTIPLY(z5, FIX(1.175875602)); tmp0 = z1 - z4; tmp1 = z2 + z4; tmp2 += z5; tmp3 += z5; } else { /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */ tmp0 = MULTIPLY(d3, - FIX2(0.785694958)); tmp1 = MULTIPLY(d3, - FIX2(1.387039845)); tmp2 = MULTIPLY(d3, - FIX2(0.275899379)); tmp3 = MULTIPLY(d3, FIX(1.175875602)); } } else { if (d1) { /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */ tmp0 = MULTIPLY(d1, FIX2(0.275899379)); tmp1 = MULTIPLY(d1, FIX2(0.785694958)); tmp2 = MULTIPLY(d1, FIX(1.175875602)); tmp3 = MULTIPLY(d1, FIX2(1.387039845)); } else { /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */ tmp0 = tmp1 = tmp2 = tmp3 = 0; } } } } /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp3, CONST_BITS+PASS1_BITS+3); dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp10 - tmp3, CONST_BITS+PASS1_BITS+3); dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp11 + tmp2, CONST_BITS+PASS1_BITS+3); dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(tmp11 - tmp2, CONST_BITS+PASS1_BITS+3); dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(tmp12 + tmp1, CONST_BITS+PASS1_BITS+3); dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp12 - tmp1, CONST_BITS+PASS1_BITS+3); dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp13 + tmp0, CONST_BITS+PASS1_BITS+3); dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp13 - tmp0, CONST_BITS+PASS1_BITS+3); dataptr++; /* advance pointer to next column */ } } #else /* *-------------------------------------------------------------- * * j_rev_dct -- * * The original inverse DCT function. * * Results: * None. * * Side effects: * None. * *-------------------------------------------------------------- */ void j_rev_dct( DCTBLOCK data ) { INT32 tmp0, tmp1, tmp2, tmp3; INT32 tmp10, tmp11, tmp12, tmp13; INT32 z1, z2, z3, z4, z5; register DCTELEM *dataptr; int rowctr; SHIFT_TEMPS /* Pass 1: process rows. */ /* Note results are scaled up by sqrt(8) compared to a true IDCT; */ /* furthermore, we scale the results by 2**PASS1_BITS. */ dataptr = data; for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) { /* Due to quantization, we will usually find that many of the input * coefficients are zero, especially the AC terms. We can exploit this * by short-circuiting the IDCT calculation for any row in which all * the AC terms are zero. In that case each output is equal to the * DC coefficient (with scale factor as needed). * With typical images and quantization tables, half or more of the * row DCT calculations can be simplified this way. */ if ((dataptr[1] | dataptr[2] | dataptr[3] | dataptr[4] | dataptr[5] | dataptr[6] | dataptr[7]) == 0) { /* AC terms all zero */ DCTELEM dcval = (DCTELEM) (dataptr[0] << PASS1_BITS); dataptr[0] = dcval; dataptr[1] = dcval; dataptr[2] = dcval; dataptr[3] = dcval; dataptr[4] = dcval; dataptr[5] = dcval; dataptr[6] = dcval; dataptr[7] = dcval; dataptr += DCTSIZE; /* advance pointer to next row */ continue; } /* Even part: reverse the even part of the forward DCT. */ /* The rotator is sqrt(2)*c(-6). */ z2 = (INT32) dataptr[2]; z3 = (INT32) dataptr[6]; z1 = MULTIPLY(z2 + z3, FIX(0.541196100)); tmp2 = z1 + MULTIPLY(z3, - FIX(1.847759065)); tmp3 = z1 + MULTIPLY(z2, FIX(0.765366865)); tmp0 = ((INT32) dataptr[0] + (INT32) dataptr[4]) << CONST_BITS; tmp1 = ((INT32) dataptr[0] - (INT32) dataptr[4]) << CONST_BITS; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; /* Odd part per figure 8; the matrix is unitary and hence its * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. */ tmp0 = (INT32) dataptr[7]; tmp1 = (INT32) dataptr[5]; tmp2 = (INT32) dataptr[3]; tmp3 = (INT32) dataptr[1]; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; z3 = tmp0 + tmp2; z4 = tmp1 + tmp3; z5 = MULTIPLY(z3 + z4, FIX(1.175875602)); /* sqrt(2) * c3 */ tmp0 = MULTIPLY(tmp0, FIX(0.298631336)); /* sqrt(2) * (-c1+c3+c5-c7) */ tmp1 = MULTIPLY(tmp1, FIX(2.053119869)); /* sqrt(2) * ( c1+c3-c5+c7) */ tmp2 = MULTIPLY(tmp2, FIX(3.072711026)); /* sqrt(2) * ( c1+c3+c5-c7) */ tmp3 = MULTIPLY(tmp3, FIX(1.501321110)); /* sqrt(2) * ( c1+c3-c5-c7) */ z1 = MULTIPLY(z1, - FIX(0.899976223)); /* sqrt(2) * (c7-c3) */ z2 = MULTIPLY(z2, - FIX(2.562915447)); /* sqrt(2) * (-c1-c3) */ z3 = MULTIPLY(z3, - FIX(1.961570560)); /* sqrt(2) * (-c3-c5) */ z4 = MULTIPLY(z4, - FIX(0.390180644)); /* sqrt(2) * (c5-c3) */ z3 += z5; z4 += z5; tmp0 += z1 + z3; tmp1 += z2 + z4; tmp2 += z2 + z3; tmp3 += z1 + z4; /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ dataptr[0] = (DCTELEM) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS); dataptr[7] = (DCTELEM) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS); dataptr[1] = (DCTELEM) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS); dataptr[6] = (DCTELEM) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS); dataptr[2] = (DCTELEM) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS); dataptr[5] = (DCTELEM) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS); dataptr[3] = (DCTELEM) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS); dataptr[4] = (DCTELEM) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS); dataptr += DCTSIZE; /* advance pointer to next row */ } /* Pass 2: process columns. */ /* Note that we must descale the results by a factor of 8 == 2**3, */ /* and also undo the PASS1_BITS scaling. */ dataptr = data; for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) { /* Columns of zeroes can be exploited in the same way as we did with rows. * However, the row calculation has created many nonzero AC terms, so the * simplification applies less often (typically 5% to 10% of the time). * On machines with very fast multiplication, it's possible that the * test takes more time than it's worth. In that case this section * may be commented out. */ #ifndef NO_ZERO_COLUMN_TEST if ((dataptr[DCTSIZE*1] | dataptr[DCTSIZE*2] | dataptr[DCTSIZE*3] | dataptr[DCTSIZE*4] | dataptr[DCTSIZE*5] | dataptr[DCTSIZE*6] | dataptr[DCTSIZE*7]) == 0) { /* AC terms all zero */ DCTELEM dcval = (DCTELEM) DESCALE((INT32) dataptr[0], PASS1_BITS+3); dataptr[DCTSIZE*0] = dcval; dataptr[DCTSIZE*1] = dcval; dataptr[DCTSIZE*2] = dcval; dataptr[DCTSIZE*3] = dcval; dataptr[DCTSIZE*4] = dcval; dataptr[DCTSIZE*5] = dcval; dataptr[DCTSIZE*6] = dcval; dataptr[DCTSIZE*7] = dcval; dataptr++; /* advance pointer to next column */ continue; } #endif /* Even part: reverse the even part of the forward DCT. */ /* The rotator is sqrt(2)*c(-6). */ z2 = (INT32) dataptr[DCTSIZE*2]; z3 = (INT32) dataptr[DCTSIZE*6]; z1 = MULTIPLY(z2 + z3, FIX(0.541196100)); tmp2 = z1 + MULTIPLY(z3, - FIX(1.847759065)); tmp3 = z1 + MULTIPLY(z2, FIX(0.765366865)); tmp0 = ((INT32) dataptr[DCTSIZE*0] + (INT32) dataptr[DCTSIZE*4]) << CONST_BITS; tmp1 = ((INT32) dataptr[DCTSIZE*0] - (INT32) dataptr[DCTSIZE*4]) << CONST_BITS; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; /* Odd part per figure 8; the matrix is unitary and hence its * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. */ tmp0 = (INT32) dataptr[DCTSIZE*7]; tmp1 = (INT32) dataptr[DCTSIZE*5]; tmp2 = (INT32) dataptr[DCTSIZE*3]; tmp3 = (INT32) dataptr[DCTSIZE*1]; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; z3 = tmp0 + tmp2; z4 = tmp1 + tmp3; z5 = MULTIPLY(z3 + z4, FIX(1.175875602)); /* sqrt(2) * c3 */ tmp0 = MULTIPLY(tmp0, FIX(0.298631336)); /* sqrt(2) * (-c1+c3+c5-c7) */ tmp1 = MULTIPLY(tmp1, FIX(2.053119869)); /* sqrt(2) * ( c1+c3-c5+c7) */ tmp2 = MULTIPLY(tmp2, FIX(3.072711026)); /* sqrt(2) * ( c1+c3+c5-c7) */ tmp3 = MULTIPLY(tmp3, FIX(1.501321110)); /* sqrt(2) * ( c1+c3-c5-c7) */ z1 = MULTIPLY(z1, - FIX(0.899976223)); /* sqrt(2) * (c7-c3) */ z2 = MULTIPLY(z2, - FIX(2.562915447)); /* sqrt(2) * (-c1-c3) */ z3 = MULTIPLY(z3, - FIX(1.961570560)); /* sqrt(2) * (-c3-c5) */ z4 = MULTIPLY(z4, - FIX(0.390180644)); /* sqrt(2) * (c5-c3) */ z3 += z5; z4 += z5; tmp0 += z1 + z3; tmp1 += z2 + z4; tmp2 += z2 + z3; tmp3 += z1 + z4; /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp3, CONST_BITS+PASS1_BITS+3); dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp10 - tmp3, CONST_BITS+PASS1_BITS+3); dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp11 + tmp2, CONST_BITS+PASS1_BITS+3); dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(tmp11 - tmp2, CONST_BITS+PASS1_BITS+3); dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(tmp12 + tmp1, CONST_BITS+PASS1_BITS+3); dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp12 - tmp1, CONST_BITS+PASS1_BITS+3); dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp13 + tmp0, CONST_BITS+PASS1_BITS+3); dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp13 - tmp0, CONST_BITS+PASS1_BITS+3); dataptr++; /* advance pointer to next column */ } } #endif /* ORIG_DCT */ #endif /* FIVE_DCT */ smpeg-0.4.5+cvs20030824.orig/video/motionvector.cpp0100644000175000017500000001625406761142240021703 0ustar hoseheadhosehead/* * motionvector.c -- * * Procedures to compute motion vectors. * */ /* * Copyright (c) 1995 The Regents of the University of California. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement is * hereby granted, provided that the above copyright notice and the following * two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ /* * Portions of this software Copyright (c) 1995 Brown University. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement * is hereby granted, provided that the above copyright notice and the * following two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF BROWN * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * BROWN UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" * BASIS, AND BROWN UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ #include "util.h" #include "video.h" #include "proto.h" /* Changes to make the code reentrant: deglobalize curVidStream Additional changes: none -lsh@cs.brown.edu (Loring Holden) */ /* *-------------------------------------------------------------- * * ComputeVector -- * * Computes motion vector given parameters previously parsed * and reconstructed. * * Results: * Reconstructed motion vector info is put into recon_* parameters * passed to this function. Also updated previous motion vector * information. * * Side effects: * None. * *-------------------------------------------------------------- */ #define ComputeVector(recon_right_ptr, recon_down_ptr, recon_right_prev, recon_down_prev, f, full_pel_vector, motion_h_code, motion_v_code, motion_h_r, motion_v_r) \ \ { \ int comp_h_r, comp_v_r; \ int right_little, right_big, down_little, down_big; \ int max, min, new_vector; \ \ /* The following procedure for the reconstruction of motion vectors \ is a direct and simple implementation of the instructions given \ in the mpeg December 1991 standard draft. \ */ \ \ if (f == 1 || motion_h_code == 0) \ comp_h_r = 0; \ else \ comp_h_r = f - 1 - motion_h_r; \ \ if (f == 1 || motion_v_code == 0) \ comp_v_r = 0; \ else \ comp_v_r = f - 1 - motion_v_r; \ \ right_little = motion_h_code * f; \ if (right_little == 0) \ right_big = 0; \ else { \ if (right_little > 0) { \ right_little = right_little - comp_h_r; \ right_big = right_little - 32 * f; \ } \ else { \ right_little = right_little + comp_h_r; \ right_big = right_little + 32 * f; \ } \ } \ \ down_little = motion_v_code * f; \ if (down_little == 0) \ down_big = 0; \ else { \ if (down_little > 0) { \ down_little = down_little - comp_v_r; \ down_big = down_little - 32 * f; \ } \ else { \ down_little = down_little + comp_v_r; \ down_big = down_little + 32 * f; \ } \ } \ \ max = 16 * f - 1; \ min = -16 * f; \ \ new_vector = recon_right_prev + right_little; \ \ if (new_vector <= max && new_vector >= min) \ *recon_right_ptr = recon_right_prev + right_little; \ /* just new_vector */ \ else \ *recon_right_ptr = recon_right_prev + right_big; \ recon_right_prev = *recon_right_ptr; \ if (full_pel_vector) \ *recon_right_ptr = *recon_right_ptr << 1; \ \ new_vector = recon_down_prev + down_little; \ if (new_vector <= max && new_vector >= min) \ *recon_down_ptr = recon_down_prev + down_little; \ /* just new_vector */ \ else \ *recon_down_ptr = recon_down_prev + down_big; \ recon_down_prev = *recon_down_ptr; \ if (full_pel_vector) \ *recon_down_ptr = *recon_down_ptr << 1; \ } /* *-------------------------------------------------------------- * * ComputeForwVector -- * * Computes forward motion vector by calling ComputeVector * with appropriate parameters. * * Results: * Reconstructed motion vector placed in recon_right_for_ptr and * recon_down_for_ptr. * * Side effects: * None. * *-------------------------------------------------------------- */ void ComputeForwVector( int* recon_right_for_ptr, int* recon_down_for_ptr, VidStream* the_stream ) { Pict *picture; Macroblock *mblock; picture = &(the_stream->picture); mblock = &(the_stream->mblock); ComputeVector(recon_right_for_ptr, recon_down_for_ptr, mblock->recon_right_for_prev, mblock->recon_down_for_prev, (int) picture->forw_f, picture->full_pel_forw_vector, mblock->motion_h_forw_code, mblock->motion_v_forw_code, mblock->motion_h_forw_r, mblock->motion_v_forw_r); } /* *-------------------------------------------------------------- * * ComputeBackVector -- * * Computes backward motion vector by calling ComputeVector * with appropriate parameters. * * Results: * Reconstructed motion vector placed in recon_right_back_ptr and * recon_down_back_ptr. * * Side effects: * None. * *-------------------------------------------------------------- */ void ComputeBackVector( int* recon_right_back_ptr, int* recon_down_back_ptr, VidStream* the_stream ) { Pict *picture; Macroblock *mblock; picture = &(the_stream->picture); mblock = &(the_stream->mblock); ComputeVector(recon_right_back_ptr, recon_down_back_ptr, mblock->recon_right_back_prev, mblock->recon_down_back_prev, (int) picture->back_f, picture->full_pel_back_vector, mblock->motion_h_back_code, mblock->motion_v_back_code, mblock->motion_h_back_r, mblock->motion_v_back_r); } /* EOF */ smpeg-0.4.5+cvs20030824.orig/video/parseblock.cpp0100644000175000017500000004266407166665373021325 0ustar hoseheadhosehead/* * parseblock.c -- * * Procedures to read in the values of a block and store them * in a place where the player can use them. * */ /* * Copyright (c) 1995 The Regents of the University of California. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement is * hereby granted, provided that the above copyright notice and the following * two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ /* * Portions of this software Copyright (c) 1995 Brown University. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement * is hereby granted, provided that the above copyright notice and the * following two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF BROWN * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * BROWN UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" * BASIS, AND BROWN UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ #define NO_SANITY_CHECKS #include #include #include "util.h" #include "video.h" #include "proto.h" #include "decoders.h" #ifdef USE_MMX extern "C" { extern unsigned int cpu_flags(void); extern void IDCT_mmx(DCTBLOCK data); }; #define mmx_ok() (cpu_flags() & 0x800000) #endif /* Changes to make the code reentrant: deglobalized: curBits, bitOffset, bitLength, bitBuffer, curVidStream, zigzag_direct now a const int variable initialized once -lsh@cs.brown.edu (Loring Holden) */ /* External declarations. */ #ifdef DCPREC extern int dcprec; #endif /* Macro for returning 1 if num is positive, -1 if negative, 0 if 0. */ #define Sign(num) ((num > 0) ? 1 : ((num == 0) ? 0 : -1)) #ifdef USE_MMX /* This is global for the ditherer as well */ int mmx_available = 0; static const int zigzag_direct_nommx[64] = { 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63}; static const int zigzag_direct_mmx[64] = { 0*8+0/* 0*/, 1*8+0/* 1*/, 0*8+1/* 8*/, 0*8+2/*16*/, 1*8+1/* 9*/, 2*8+0/* 2*/, 3*8+0/* 3*/, 2*8+1/*10*/, 1*8+2/*17*/, 0*8+3/*24*/, 0*8+4/*32*/, 1*8+3/*25*/, 2*8+2/*18*/, 3*8+1/*11*/, 4*8+0/* 4*/, 5*8+0/* 5*/, 4*8+1/*12*/, 5*8+2/*19*/, 2*8+3/*26*/, 1*8+4/*33*/, 0*8+5/*40*/, 0*8+6/*48*/, 1*8+5/*41*/, 2*8+4/*34*/, 3*8+3/*27*/, 4*8+2/*20*/, 5*8+1/*13*/, 6*8+0/* 6*/, 7*8+0/* 7*/, 6*8+1/*14*/, 5*8+2/*21*/, 4*8+3/*28*/, 3*8+4/*35*/, 2*8+5/*42*/, 1*8+6/*49*/, 0*8+7/*56*/, 1*8+7/*57*/, 2*8+6/*50*/, 3*8+5/*43*/, 4*8+4/*36*/, 5*8+3/*29*/, 6*8+2/*22*/, 7*8+1/*15*/, 7*8+2/*23*/, 6*8+3/*30*/, 5*8+4/*37*/, 4*8+5/*44*/, 3*8+6/*51*/, 2*8+7/*58*/, 3*8+7/*59*/, 4*8+6/*52*/, 5*8+5/*45*/, 6*8+4/*38*/, 7*8+3/*31*/, 7*8+4/*39*/, 6*8+5/*46*/, 7*8+6/*53*/, 4*8+7/*60*/, 5*8+7/*61*/, 6*8+6/*54*/, 7*8+5/*47*/, 7*8+6/*55*/, 6*8+7/*62*/, 7*8+7/*63*/ }; static int zigzag_direct[256]; void InitIDCT(void) { int i; char *use_mmx; use_mmx = getenv("SMPEG_USE_MMX"); if ( use_mmx ) { mmx_available = atoi(use_mmx); } else { mmx_available = mmx_ok(); } if (mmx_available) { //printf("Using MMX IDCT algorithm!\n"); for(i=0;i<64;i++) { zigzag_direct[i]=zigzag_direct_mmx[i]; } } else { for(i=0;i<64;i++) { zigzag_direct[i]=zigzag_direct_nommx[i]; } } while ( i < 256 ) zigzag_direct[i++] = 0; } #else /* Array mapping zigzag to array pointer offset. */ const int zigzag_direct[64] = { 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63 }; void InitIDCT(void) { return; } #endif /* *-------------------------------------------------------------- * * ParseReconBlock -- * * Parse values for block structure from bitstream. * n is an indication of the position of the block within * the macroblock (i.e. 0-5) and indicates the type of * block (i.e. luminance or chrominance). Reconstructs * coefficients from values parsed and puts in * block.dct_recon array in vid stream structure. * sparseFlag is set when the block contains only one * coeffictient and is used by the IDCT. * * Results: * * * Side effects: * Bit stream irreversibly parsed. * *-------------------------------------------------------------- */ #define DCT_recon blockPtr->dct_recon #define DCT_dc_y_past blockPtr->dct_dc_y_past #define DCT_dc_cr_past blockPtr->dct_dc_cr_past #define DCT_dc_cb_past blockPtr->dct_dc_cb_past #define DECODE_DCT_COEFF_FIRST DecodeDCTCoeffFirst #define DECODE_DCT_COEFF_NEXT DecodeDCTCoeffNext /* * Profiling results: * This function only takes about 0.01ms per call, but is called many * many times, taking about 15% of the total time used by playback. * *-------------------------------------------------------------- */ void ParseReconBlock( int n, VidStream* vid_stream ) { Block *blockPtr = &vid_stream->block; int coeffCount=0; if (vid_stream->buf_length < 100) correct_underflow(vid_stream); int diff; int size, level=0, i, run, pos, coeff; #ifdef USE_ATI long int *reconptr; #else short int *reconptr; #endif unsigned char *iqmatrixptr, *niqmatrixptr; int qscale; #ifdef USE_ATI reconptr = DCT_recon[n]; memset(reconptr, 0, 130*sizeof(reconptr[0])); #else reconptr = DCT_recon[0]; #if 0 /* * Hand coded version of memset that's a little faster... * Old call: * memset((char *) DCT_recon, 0, 64*sizeof(short int)); */ { INT32 *p; p = (INT32 *) reconptr; p[0] = p[1] = p[2] = p[3] = p[4] = p[5] = p[6] = p[7] = p[8] = p[9] = p[10] = p[11] = p[12] = p[13] = p[14] = p[15] = p[16] = p[17] = p[18] = p[19] = p[20] = p[21] = p[22] = p[23] = p[24] = p[25] = p[26] = p[27] = p[28] = p[29] = p[30] = p[31] = 0; } #else memset(reconptr, 0, 64*sizeof(reconptr[0])); #endif #endif if (vid_stream->mblock.mb_intra) { if (n < 4) { /* * Get the luminance bits. This code has been hand optimized to * get by the normal bit parsing routines. We get some speedup * by grabbing the next 16 bits and parsing things locally. * Thus, calls are translated as: * * show_bitsX <--> next16bits >> (16-X) * get_bitsX <--> val = next16bits >> (16-flushed-X); * flushed += X; * next16bits &= bitMask[flushed]; * flush_bitsX <--> flushed += X; * next16bits &= bitMask[flushed]; * * I've streamlined the code a lot, so that we don't have to mask * out the low order bits and a few of the extra adds are removed. * bsmith */ unsigned int next16bits, index, flushed; show_bits16(next16bits); index = next16bits >> (16-5); if (index < 31) { size = dct_dc_size_luminance[index].value; flushed = dct_dc_size_luminance[index].num_bits; } else { index = next16bits >> (16-9); index -= 0x1f0; size = dct_dc_size_luminance1[index].value; flushed = dct_dc_size_luminance1[index].num_bits; } next16bits &= bitMask[16+flushed]; if (size != 0) { flushed += size; diff = next16bits >> (16-flushed); if (!(diff & bitTest[32-size])) { diff = rBitMask[size] | (diff + 1); } diff <<= 3; } else { diff = 0; } flush_bits(flushed); #ifdef USE_ATI if ( (n == 0) && ((vid_stream->mblock.mb_address - vid_stream->mblock.past_intra_addr) > 1) ) { DCT_dc_y_past = diff; } else { DCT_dc_y_past += diff; } *reconptr++ = 0; *reconptr++ = DCT_dc_y_past; #else if ( (n == 0) && ((vid_stream->mblock.mb_address - vid_stream->mblock.past_intra_addr) > 1) ) { coeff = diff + 1024; } else { coeff = diff + DCT_dc_y_past; } DCT_dc_y_past = coeff; #endif } else { /* n = 4 or 5 */ /* * Get the chrominance bits. This code has been hand optimized to * as described above */ unsigned int next16bits, index, flushed; show_bits16(next16bits); index = next16bits >> (16-5); if (index < 31) { size = dct_dc_size_chrominance[index].value; flushed = dct_dc_size_chrominance[index].num_bits; } else { index = next16bits >> (16-10); index -= 0x3e0; size = dct_dc_size_chrominance1[index].value; flushed = dct_dc_size_chrominance1[index].num_bits; } next16bits &= bitMask[16+flushed]; if (size != 0) { flushed += size; diff = next16bits >> (16-flushed); if (!(diff & bitTest[32-size])) { diff = rBitMask[size] | (diff + 1); } diff <<= 3; } else { diff = 0; } flush_bits(flushed); #ifdef USE_ATI *reconptr++ = 0; if(n == 5) { if (vid_stream->mblock.mb_address - vid_stream->mblock.past_intra_addr > 1) { DCT_dc_cr_past = diff; } else { DCT_dc_cr_past += diff; } *reconptr++ = DCT_dc_cr_past; } else { if (vid_stream->mblock.mb_address - vid_stream->mblock.past_intra_addr > 1) { DCT_dc_cb_past = diff; } else { DCT_dc_cb_past += diff; } *reconptr++ = DCT_dc_cb_past; } #else /* We test 5 first; a result of the mixup of Cr and Cb */ coeff = diff; if (n == 5) { if (vid_stream->mblock.mb_address - vid_stream->mblock.past_intra_addr > 1) { coeff += 1024; } else { coeff += DCT_dc_cr_past; } DCT_dc_cr_past = coeff; } else { if (vid_stream->mblock.mb_address - vid_stream->mblock.past_intra_addr > 1) { coeff += 1024; } else { coeff += DCT_dc_cb_past; } DCT_dc_cb_past = coeff; } #endif } #ifndef USE_ATI *reconptr = coeff; #ifdef USE_MMX if ( mmx_available ) { *reconptr <<= 4; } #endif /* USE_MMX */ #endif /* USE_ATI */ pos = 0; coeffCount = (coeff != 0); i = 0; if (vid_stream->picture.code_type != 4) { qscale = vid_stream->slice.quant_scale; iqmatrixptr = vid_stream->intra_quant_matrix[0]; while(1) { DECODE_DCT_COEFF_NEXT(run, level); if (run >= END_OF_BLOCK) break; i = i + run + 1; pos = zigzag_direct[i&0x3f]; /* quantizes and oddifies each coefficient */ if (level < 0) { coeff = ((level<<1) * qscale * ((int) (iqmatrixptr[pos]))) / 16; coeff += (1 - (coeff & 1)); } else { coeff = ((level<<1) * qscale * ((int) (*(iqmatrixptr+pos)))) >> 4; coeff -= (1 - (coeff & 1)); } #ifdef USE_ATI *reconptr++ = run; *reconptr++ = coeff; #else #ifdef USE_MMX if ( mmx_available ) coeff *= 16; #endif #ifdef QUANT_CHECK printf ("coeff: %d\n", coeff); #endif reconptr[pos] = coeff; coeffCount++; #endif /* USE_ATI */ } #ifdef QUANT_CHECK printf ("\n"); #endif #ifdef USE_ATI /* mark end of block */ *reconptr++ = 0xFFFFFFFF; #endif #ifdef ANALYSIS { extern unsigned int *mbCoeffPtr; mbCoeffPtr[pos]++; } #endif flush_bits(2); goto end; } } else { /* non-intra-coded macroblock */ niqmatrixptr = vid_stream->non_intra_quant_matrix[0]; qscale = vid_stream->slice.quant_scale; DECODE_DCT_COEFF_FIRST(run, level); i = run; pos = zigzag_direct[i&0x3f]; /* quantizes and oddifies each coefficient */ if (level < 0) { coeff = (((level<<1) - 1) * qscale * ((int) (niqmatrixptr[pos]))) / 16; if ((coeff & 1) == 0) {coeff = coeff + 1;} } else { coeff = (((level<<1) + 1) * qscale * ((int) (*(niqmatrixptr+pos)))) >> 4; coeff = (coeff-1) | 1; /* equivalent to: if ((coeff&1)==0) coeff = coeff - 1; */ } #ifdef USE_ATI *reconptr++ = run; *reconptr++ = coeff; #else #ifdef USE_MMX if ( mmx_available ) coeff *= 16; #endif reconptr[pos] = coeff; if (coeff) { coeffCount = 1; } #endif /* USE_ATI */ if (vid_stream->picture.code_type != 4) { while(1) { DECODE_DCT_COEFF_NEXT(run, level); if (run >= END_OF_BLOCK) { break; } i = i+run+1; pos = zigzag_direct[i&0x3f]; if (level < 0) { coeff = (((level<<1) - 1) * qscale * ((int) (niqmatrixptr[pos]))) / 16; if ((coeff & 1) == 0) {coeff = coeff + 1;} } else { coeff = (((level<<1) + 1) * qscale * ((int) (*(niqmatrixptr+pos)))) >> 4; coeff = (coeff-1) | 1; /* equivalent to: if ((coeff&1)==0) coeff = coeff - 1; */ } #ifdef USE_ATI *reconptr++ = run; *reconptr++ = coeff; #else #ifdef USE_MMX if ( mmx_available ) coeff *= 16; #endif reconptr[pos] = coeff; coeffCount++; #endif /* USE_ATI */ } /* end while */ #ifdef USE_ATI /* mark end of block */ *reconptr++ = 0xFFFFFFFF; #endif #ifdef ANALYSIS { extern unsigned int *mbCoeffPtr; mbCoeffPtr[pos]++; } #endif flush_bits(2); goto end; } /* end if (vid_stream->picture.code_type != 4) */ } end: #ifdef USE_ATI return; #else if( ! vid_stream->_skipFrame || (vid_stream->picture.code_type != B_TYPE) ) { if( coeffCount == 1 ) { #ifdef USE_MMX if ( mmx_available ) IDCT_mmx(reconptr); else j_rev_dct_sparse (reconptr, pos); #else j_rev_dct_sparse (reconptr, pos); #endif } else { #ifdef FLOATDCT if (qualityFlag) { float_idct(reconptr); } else #endif #ifdef USE_MMX if ( mmx_available ) IDCT_mmx(reconptr); else j_rev_dct(reconptr); #else j_rev_dct(reconptr); #endif } } #ifdef USE_MMX if ( mmx_available ) { __asm__ ("emms"); } #endif #endif } #undef DCT_recon #undef DCT_dc_y_past #undef DCT_dc_cr_past #undef DCT_dc_cb_past /* *-------------------------------------------------------------- * * ParseAwayBlock -- * * Parses off block values, throwing them away. * Used with grayscale dithering. * * Results: * None. * * Side effects: * None. * *-------------------------------------------------------------- */ void ParseAwayBlock( int n, VidStream* vid_stream ) { unsigned int diff; unsigned int size, run; int level; if (vid_stream->buf_length < 100) correct_underflow(vid_stream); if (vid_stream->mblock.mb_intra) { /* If the block is a luminance block... */ if (n < 4) { /* Parse and decode size of first coefficient. */ DecodeDCTDCSizeLum(size); /* Parse first coefficient. */ if (size != 0) { get_bitsn(size, diff); } } /* Otherwise, block is chrominance block... */ else { /* Parse and decode size of first coefficient. */ DecodeDCTDCSizeChrom(size); /* Parse first coefficient. */ if (size != 0) { get_bitsn(size, diff); } } } /* Otherwise, block is not intracoded... */ else { /* Decode and set first coefficient. */ DECODE_DCT_COEFF_FIRST(run, level); } /* If picture is not D type (i.e. I, P, or B)... */ if (vid_stream->picture.code_type != 4) { /* While end of macroblock has not been reached... */ while (1) { /* Get the dct_coeff_next */ DECODE_DCT_COEFF_NEXT(run, level); if (run >= END_OF_BLOCK) break; } /* End_of_block */ flush_bits(2); } } /* EOF */ smpeg-0.4.5+cvs20030824.orig/video/proto.h0100644000175000017500000002372707166665373020007 0ustar hoseheadhosehead/* * Copyright (c) 1995 The Regents of the University of California. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement is * hereby granted, provided that the above copyright notice and the following * two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ /* * Portions of this software Copyright (c) 1995 Brown University. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement * is hereby granted, provided that the above copyright notice and the * following two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF BROWN * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * BROWN UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" * BASIS, AND BROWN UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ #ifdef WIN32 #define __STDC__ 1 #endif #ifdef __STDC__ # define P(s) s #include /* used by almost all modules */ #else # define P(s) () #endif /* util.c */ void correct_underflow P((VidStream *vid_stream )); int next_bits P((int num , unsigned int mask , VidStream *vid_stream )); char *get_ext_data P((VidStream *vid_stream )); int next_start_code P((VidStream *vid_stream)); char *get_extra_bit_info P((VidStream *vid_stream )); /* video.c */ void init_stats P((void )); void PrintAllStats P((VidStream *vid_stream )); double ReadSysClock P((void )); void PrintTimeInfo P(( VidStream *vid_stream )); void InitCrop P((void )); void InitIDCT P((void )); VidStream *NewVidStream P((unsigned int buffer_len )); void ResetVidStream P((VidStream *vid )); void DestroyVidStream P((VidStream *astream )); PictImage *NewPictImage P(( VidStream *vid_stream )); bool InitPictImages P(( VidStream *vid_stream, int w, int h, SDL_Surface *dst )); void DestroyPictImage P(( VidStream *vid_stream, PictImage *apictimage )); VidStream *mpegVidRsrc P((TimeStamp time_stamp,VidStream *vid_stream, int first )); void SetBFlag P((BOOLEAN val )); void SetPFlag P((BOOLEAN val )); /* parseblock.c */ void ParseReconBlock P((int n, VidStream *vid_stream )); void ParseAwayBlock P((int n , VidStream *vid_stream )); /* motionvector.c */ void ComputeForwVector P((int *recon_right_for_ptr , int *recon_down_for_ptr , VidStream *the_stream )); void ComputeBackVector P((int *recon_right_back_ptr , int *recon_down_back_ptr, VidStream *the_stream )); /* decoders.c */ void decodeInitTables P((void )); void decodeDCTDCSizeLum P((unsigned int *value )); void decodeDCTDCSizeChrom P((unsigned int *value )); void decodeDCTCoeffFirst P((unsigned int *run , int *level )); void decodeDCTCoeffNext P((unsigned int *run , int *level )); /* gdith.c */ void InitColor P((void )); /* fs2.c */ void InitFS2Dither P((void )); void FS2DitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *disp , int rows , int cols )); /* fs2fast.c */ void InitFS2FastDither P((void )); void FS2FastDitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w )); /* fs4.c */ void InitFS4Dither P((void )); void FS4DitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *disp , int rows , int cols )); /* hybrid.c */ void InitHybridDither P((void )); void HybridDitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w )); /* hybriderr.c */ void InitHybridErrorDither P((void )); void HybridErrorDitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w )); /* gray.c */ void GrayDitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w )); void Gray2DitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w )); void Gray16DitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w )); void Gray216DitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w )); void Gray32DitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w )); void Gray232DitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w )); /* mono.c */ void MonoThresholdImage(unsigned char *lum, unsigned char *cr, unsigned char *cb, unsigned char *out, int h, int w); void MonoDitherImage(unsigned char *lum, unsigned char *cr, unsigned char *cb, unsigned char *out, int h, int w); /* jrevdct.c */ void init_pre_idct P((void )); void j_rev_dct_sparse P((DCTBLOCK data , int pos )); void j_rev_dct P((DCTBLOCK data )); void j_rev_dct_sparse P((DCTBLOCK data , int pos )); void j_rev_dct P((DCTBLOCK data )); /* floatdct.c */ void init_float_idct P((void )); void float_idct P((short* block )); /* 16bit.c */ void InitColorDither P(( int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask )); void Color16DitherImageMod P((unsigned char *lum, unsigned char *cr, unsigned char *cb, unsigned char *out, int rows, int cols, int mod )); void Color16DitherImageMMX P((unsigned char *lum, unsigned char *cr, unsigned char *cb, unsigned char *out, int rows, int cols, int mod )); void Color32DitherImageMod P((unsigned char *lum, unsigned char *cr, unsigned char *cb, unsigned char *out, int rows, int cols, int mod )); void Color32DitherImageMMX P((unsigned char *lum, unsigned char *cr, unsigned char *cb, unsigned char *out, int rows, int cols, int mod )); void Color16DitherImageModInterlace P((unsigned char *lum, unsigned char *cr, unsigned char *cb, unsigned char *out, int rows, int cols, int mod, int start )); void Color32DitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int rows , int cols )); void ScaleColor16DitherImageMod P((unsigned char *lum, unsigned char *cr, unsigned char *cb, unsigned char *out, int rows, int cols, int mod, int scale )); void ScaleColor32DitherImageMod P((unsigned char *lum, unsigned char *cr, unsigned char *cb, unsigned char *out, int rows, int cols, int mod, int scale )); void ScaleColor16DitherImageModInterlace P((unsigned char *lum, unsigned char *cr, unsigned char *cb, unsigned char *out, int rows, int cols, int mod, int start, int scale )); void Twox2Color32DitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int rows , int cols )); /* ordered.c */ void InitOrderedDither P((void )); void OrderedDitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w )); /* ordered2.c */ void InitOrdered2Dither P((void )); void Ordered2DitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w )); /* mb_ordered.c */ void InitMBOrderedDither P((void )); void MBOrderedDitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w, char *ditherFlags )); void MBOrderedDitherDisplayCopy P((VidStream *vid_stream , int mb_addr , int motion_forw , int r_right_forw , int r_down_forw , int motion_back , int r_right_back , int r_down_back , unsigned char *past , unsigned char *future )); /* readfile.c */ void SeekStream P((VidStream *vid_stream )); void clear_data_stream P(( VidStream *vid_stream)); int get_more_data P(( VidStream *vid_stream )); int pure_get_more_data P((unsigned int *buf_start , int max_length , int *length_ptr , unsigned int **buf_ptr, VidStream *vid_stream )); int read_sys P(( VidStream *vid_stream, unsigned int start )); int ReadStartCode P(( unsigned int *startCode, VidStream *vid_stream )); int ReadPackHeader P(( double *systemClockTime, unsigned long *muxRate, VidStream *vid_stream )); int ReadSystemHeader P(( VidStream *vid_stream )); int find_start_code P(( FILE *input )); int ReadPacket P(( unsigned char packetID, VidStream *vid_stream )); void ReadTimeStamp P(( unsigned char *inputBuffer, unsigned char *hiBit, unsigned long *low4Bytes)); void ReadSTD P(( unsigned char *inputBuffer, unsigned char *stdBufferScale, unsigned long *stdBufferSize)); void ReadRate P(( unsigned char *inputBuffer, unsigned long *rate)); int MakeFloatClockTime P(( unsigned char hiBit, unsigned long low4Bytes, double *floatClockTime)); #ifndef NOCONTROLS /* ctrlbar.c */ double StopWatch P((int action )); bool WindowMapped P((Display *dsp, XEvent *xev, char *window )); bool IfEventType P((Display *dsp, XEvent *xev, char *type )); void MakeControlBar P(( XInfo *xinfo )); void UpdateFrameTotal P((Display *display)); void UpdateControlDisplay P((Display *display)); void ControlBar P((VidStream **vid_stream, XInfo *xinfo, int numMovies )); void ControlLoop P((VidStream **theStream, XInfo *xinfo, int numStreams )); #endif /* !NOCONTROLS */ #undef P smpeg-0.4.5+cvs20030824.orig/video/readfile.cpp0100644000175000017500000001260707110636471020727 0ustar hoseheadhosehead/* * readfile.c -- * * Procedures concerned with reading data and parsing * start codes from MPEG files. * */ /* * Copyright (c) 1995 The Regents of the University of California. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement is * hereby granted, provided that the above copyright notice and the following * two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ /* * Portions of this software Copyright (c) 1995 Brown University. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement * is hereby granted, provided that the above copyright notice and the * following two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF BROWN * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * BROWN UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" * BASIS, AND BROWN UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ #include #ifdef __STDC__ #include #include #endif #include #include #include "SDL_endian.h" #include "video.h" #include "proto.h" #include "util.h" #include "dither.h" /* Changes to make the code reentrant: deglobalized: totNumFrames, realTimeStart, stream id vars, Prase_done, swap, seekValue, input, EOF_flag, ReadPacket statics, sys_layer, bitOffset, bitLength, bitBuffer, curVidStream removed: [aud,sys,vid]Bytes Additional changes: get rid on ANSI C complaints about shifting -lsh@cs.brown.edu (Loring Holden) */ /* *-------------------------------------------------------------- * * get_more_data -- * * Called by get_more_data to read in more data from * video MPG files (non-system-layer) * * Results: * Input buffer updated, buffer length updated. * Returns 1 if data read, 0 if EOF, -1 if error. * * Side effects: * None. * *-------------------------------------------------------------- */ int get_more_data( VidStream* vid_stream ) { unsigned int *buf_start; int length, num_read, i; unsigned int request; unsigned char *buffer, *mark; unsigned int *lmark; Sint32 timestamp_offset; Uint32 data_pos; if (vid_stream->EOF_flag) return 0; buf_start = vid_stream->buf_start; length = vid_stream->buf_length; buffer = (unsigned char *) vid_stream->buffer; if (length > 0) { memcpy((unsigned char *) buf_start, buffer, (unsigned int) (length*4)); mark = ((unsigned char *) (buf_start + length)); } else { mark = (unsigned char *) buf_start; length = 0; } request = (vid_stream->max_buf_length-length)*4; data_pos = vid_stream->_smpeg->mpeg->pos; num_read = vid_stream->_smpeg->mpeg->copy_data(mark, request); vid_stream->timestamp = vid_stream->_smpeg->mpeg->timestamp; timestamp_offset = vid_stream->_smpeg->mpeg->timestamp_pos - data_pos; vid_stream->timestamp_mark = (unsigned int *)(mark+timestamp_offset); vid_stream->timestamp_used = false; /* Paulo Villegas - 26/1/1993: Correction for 4-byte alignment */ { int num_read_rounded; unsigned char *index; num_read_rounded = 4*(num_read/4); /* this can happen only if num_readbuffer = buf_start; /* Make 32 bits after end equal to 0 and 32 * bits after that equal to seq end code * in order to prevent messy data from infinite * recursion. */ *(buf_start + length) = 0x0; *(buf_start + length+1) = SEQ_END_CODE; vid_stream->EOF_flag = 1; return 0; } lmark = (unsigned int *) mark; num_read = num_read/4; for (i = 0; i < num_read; i++) { *lmark = SDL_SwapBE32(*lmark); lmark++; } vid_stream->buffer = buf_start; vid_stream->buf_length = length + num_read; return 1; } /* EOF */ smpeg-0.4.5+cvs20030824.orig/video/util.cpp0100644000175000017500000003062407155260604020130 0ustar hoseheadhosehead/* * util.c -- * * Miscellaneous utility procedures. * */ /* * Copyright (c) 1995 The Regents of the University of California. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement is * hereby granted, provided that the above copyright notice and the following * two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ /* * Portions of this software Copyright (c) 1995 Brown University. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement * is hereby granted, provided that the above copyright notice and the * following two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF BROWN * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * BROWN UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" * BASIS, AND BROWN UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ #include "MPEG.h" #include #include "video.h" #include "proto.h" #include "util.h" #ifndef NOCONTROLS #include "ctrlbar.h" #endif /* Changes to make the code reentrant: de-globalized: totNumFrames, realTimeStart, vid_stream, sys_layer, bitOffset, bitLength, bitBuffer, curVidStream setjmp/longjmp replaced Additional changes: only call DestroyVidStream up in mpegVidRsrc, not in correct_underflow -lsh@cs.brown.edu (Loring Holden) */ /* Bit masks used by bit i/o operations. */ unsigned int nBitMask[] = { 0x00000000, 0x80000000, 0xc0000000, 0xe0000000, 0xf0000000, 0xf8000000, 0xfc000000, 0xfe000000, 0xff000000, 0xff800000, 0xffc00000, 0xffe00000, 0xfff00000, 0xfff80000, 0xfffc0000, 0xfffe0000, 0xffff0000, 0xffff8000, 0xffffc000, 0xffffe000, 0xfffff000, 0xfffff800, 0xfffffc00, 0xfffffe00, 0xffffff00, 0xffffff80, 0xffffffc0, 0xffffffe0, 0xfffffff0, 0xfffffff8, 0xfffffffc, 0xfffffffe}; unsigned int bitMask[] = { 0xffffffff, 0x7fffffff, 0x3fffffff, 0x1fffffff, 0x0fffffff, 0x07ffffff, 0x03ffffff, 0x01ffffff, 0x00ffffff, 0x007fffff, 0x003fffff, 0x001fffff, 0x000fffff, 0x0007ffff, 0x0003ffff, 0x0001ffff, 0x0000ffff, 0x00007fff, 0x00003fff, 0x00001fff, 0x00000fff, 0x000007ff, 0x000003ff, 0x000001ff, 0x000000ff, 0x0000007f, 0x0000003f, 0x0000001f, 0x0000000f, 0x00000007, 0x00000003, 0x00000001}; unsigned int rBitMask[] = { 0xffffffff, 0xfffffffe, 0xfffffffc, 0xfffffff8, 0xfffffff0, 0xffffffe0, 0xffffffc0, 0xffffff80, 0xffffff00, 0xfffffe00, 0xfffffc00, 0xfffff800, 0xfffff000, 0xffffe000, 0xffffc000, 0xffff8000, 0xffff0000, 0xfffe0000, 0xfffc0000, 0xfff80000, 0xfff00000, 0xffe00000, 0xffc00000, 0xff800000, 0xff000000, 0xfe000000, 0xfc000000, 0xf8000000, 0xf0000000, 0xe0000000, 0xc0000000, 0x80000000}; unsigned int bitTest[] = { 0x80000000, 0x40000000, 0x20000000, 0x10000000, 0x08000000, 0x04000000, 0x02000000, 0x01000000, 0x00800000, 0x00400000, 0x00200000, 0x00100000, 0x00080000, 0x00040000, 0x00020000, 0x00010000, 0x00008000, 0x00004000, 0x00002000, 0x00001000, 0x00000800, 0x00000400, 0x00000200, 0x00000100, 0x00000080, 0x00000040, 0x00000020, 0x00000010, 0x00000008, 0x00000004, 0x00000002, 0x00000001}; /* *-------------------------------------------------------------- * * correct_underflow -- * * Called when buffer does not have sufficient data to * satisfy request for bits. * Calls get_more_data, an application specific routine * required to fill the buffer with more data. * * Results: * None really. * * Side effects: * buf_length and buffer fields may be changed. * *-------------------------------------------------------------- */ void correct_underflow( VidStream* vid_stream ) { int status; status = get_more_data(vid_stream); if (status < 0) { if (!quietFlag) { fprintf (stderr, "\n"); perror("Unexpected read error."); } exit(1); } else if ((status == 0) && (vid_stream->buf_length < 1)) { if (!quietFlag) { fprintf(stderr, "\nImproper or missing sequence end code.\n"); } #ifdef ANALYSIS PrintAllStats(vid_stream); #endif vid_stream->film_has_ended=TRUE; return; } #ifdef UTIL2 vid_stream->curBits = *vid_stream->buffer << vid_stream->bit_offset; #else vid_stream->curBits = *vid_stream->buffer; #endif } /* *-------------------------------------------------------------- * * next_bits -- * * Compares next num bits to low order position in mask. * Buffer pointer is NOT advanced. * * Results: * TRUE, FALSE, or error code. * * Side effects: * None. * *-------------------------------------------------------------- */ int next_bits( int num, unsigned int mask, VidStream* vid_stream ) { unsigned int stream; int ret_value; #if 0 /* If no current stream, return error. */ if (vid_stream == NULL) return NO_VID_STREAM; #endif /* Get next num bits, no buffer pointer advance. */ show_bitsn(num, stream); /* Compare bit stream and mask. Set return value toTRUE if equal, FALSE if differs. */ if (mask == stream) { ret_value = TRUE; } else ret_value = FALSE; /* Return return value. */ return ret_value; } /* *-------------------------------------------------------------- * * get_ext_data -- * * Assumes that bit stream is at begining of extension * data. Parses off extension data into dynamically * allocated space until start code is hit. * * Results: * Pointer to dynamically allocated memory containing * extension data. * * Side effects: * Bit stream irreversibly parsed. * *-------------------------------------------------------------- */ char* get_ext_data( VidStream* vid_stream ) { unsigned int size, marker; char *dataPtr; unsigned int data; /* Set initial ext data buffer size. */ size = EXT_BUF_SIZE; /* Allocate ext data buffer. */ dataPtr = (char *) malloc(size); /* Initialize marker to keep place in ext data buffer. */ marker = 0; /* While next data is not start code... */ while (!next_bits(24, 0x000001, vid_stream)) { /* Get next byte of ext data. */ get_bits8(data); /* Put ext data into ext data buffer. Advance marker. */ dataPtr[marker] = (char) data; marker++; /* If end of ext data buffer reached, resize data buffer. */ if (marker == size) { size += EXT_BUF_SIZE; dataPtr = (char *) realloc(dataPtr, size); } } /* Realloc data buffer to free any extra space. */ dataPtr = (char *) realloc(dataPtr, marker); /* Return pointer to ext data buffer. */ return dataPtr; } /* *-------------------------------------------------------------- * * next_start_code -- * * Parses off bitstream until start code reached. When done * next 4 bytes of bitstream will be start code. Bit offset * reset to 0. * * Results: * Status code. * * Side effects: * Bit stream irreversibly parsed. * *-------------------------------------------------------------- */ int next_start_code( VidStream* vid_stream ) { int state; int byteoff; unsigned int data; #if 0 /* If no current stream, return error. */ if (vid_stream== NULL) return NO_VID_STREAM; #endif /* If insufficient buffer length, correct underflow. */ if (vid_stream->buf_length < 4) { correct_underflow(vid_stream); } /* If bit offset not zero, reset and advance buffer pointer. */ byteoff = vid_stream->bit_offset % 8; if (byteoff != 0) { flush_bits((8-byteoff)); } /* Set state = 0. */ state = 0; /* While buffer has data ... */ while(vid_stream->buf_length > 0) { /* If insufficient data exists, correct underflow. */ if (vid_stream->buf_length < 4) { correct_underflow(vid_stream); } /* If next byte is zero... */ get_bits8(data); if (data == 0) { /* If state < 2, advance state. */ if (state < 2) state++; } /* If next byte is one... */ else if (data == 1) { /* If state == 2, advance state (i.e. start code found). */ if (state == 2) state++; /* Otherwise, reset state to zero. */ else state = 0; } /* Otherwise byte is neither 1 or 0, reset state to 0. */ else { state = 0; } /* If state == 3 (i.e. start code found)... */ if (state == 3) { /* Set buffer pointer back and reset length & bit offsets so * next bytes will be beginning of start code. */ vid_stream->bit_offset = vid_stream->bit_offset - 24; #ifdef ANALYSIS bitCount -= 24; #endif if (vid_stream->bit_offset < 0) { vid_stream->bit_offset = 32 + vid_stream->bit_offset; vid_stream->buf_length++; vid_stream->buffer--; #ifdef UTIL2 vid_stream->curBits = *vid_stream->buffer << vid_stream->bit_offset; #else vid_stream->curBits = *vid_stream->buffer; #endif } else { #ifdef UTIL2 vid_stream->curBits = *vid_stream->buffer << vid_stream->bit_offset; #else vid_stream->curBits = *vid_stream->buffer; #endif } #ifdef NO_GRIFF_MODS /* Return success. */ return OK; #else /* NO_GRIFF_MODS */ show_bits32(data); if ( data==SEQ_START_CODE || data==GOP_START_CODE || data==PICTURE_START_CODE || (data>=SLICE_MIN_START_CODE && data<=SLICE_MAX_START_CODE) || data==EXT_START_CODE || data==USER_START_CODE ) { /* Return success. */ return OK; } else { flush_bits32; } #endif /* NO_GRIFF_MODS */ } } /* Return underflow error. */ return STREAM_UNDERFLOW; } /* *-------------------------------------------------------------- * * get_extra_bit_info -- * * Parses off extra bit info stream into dynamically * allocated memory. Extra bit info is indicated by * a flag bit set to 1, followed by 8 bits of data. * This continues until the flag bit is zero. Assumes * that bit stream set to first flag bit in extra * bit info stream. * * Results: * Pointer to dynamically allocated memory with extra * bit info in it. Flag bits are NOT included. * * Side effects: * Bit stream irreversibly parsed. * *-------------------------------------------------------------- */ char* get_extra_bit_info( VidStream* vid_stream ) { unsigned int size, marker; char *dataPtr; unsigned int data; /* Get first flag bit. */ get_bits1(data); /* If flag is false, return NULL pointer (i.e. no extra bit info). */ if (!data) return NULL; /* Initialize size of extra bit info buffer and allocate. */ size = EXT_BUF_SIZE; dataPtr = (char *) malloc(size); /* Reset marker to hold place in buffer. */ marker = 0; /* While flag bit is true. */ while (data) { /* Get next 8 bits of data. */ get_bits8(data); /* Place in extra bit info buffer. */ dataPtr[marker] = (char) data; marker++; /* If buffer is full, reallocate. */ if (marker == size) { size += EXT_BUF_SIZE; dataPtr = (char *) realloc(dataPtr, size); } /* Get next flag bit. */ get_bits1(data); } /* Reallocate buffer to free extra space. */ dataPtr = (char *) realloc(dataPtr, marker); /* Return pointer to extra bit info buffer. */ return dataPtr; } /* EOF */ smpeg-0.4.5+cvs20030824.orig/video/util.h0100644000175000017500000005525706761142240017603 0ustar hoseheadhosehead/* * Copyright (c) 1995 The Regents of the University of California. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement is * hereby granted, provided that the above copyright notice and the following * two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ /* * Portions of this software Copyright (c) 1995 Brown University. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement * is hereby granted, provided that the above copyright notice and the * following two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF BROWN * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * BROWN UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" * BASIS, AND BROWN UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ /* Changes to make the code reentrant: deglobalized: curBits, curVidStream deglobalized: bitOffset, bitLength, bitBuffer in vid_stream, not used here Additional changes: -lsh@cs.brown.edu (Loring Holden) */ /* Status codes for bit stream i/o operations. */ #include "MPEG.h" #define NO_VID_STREAM (-1) #define STREAM_UNDERFLOW (-2) #define OK 1 /* Size increment of extension data buffers. */ #define EXT_BUF_SIZE 1024 /* External declarations for bitstream i/o operations. */ extern unsigned int bitMask[]; extern unsigned int nBitMask[]; extern unsigned int rBitMask[]; extern unsigned int bitTest[]; /* Macro for updating bit counter if analysis tool is on. */ #ifdef ANALYSIS #define UPDATE_COUNT(numbits) bitCount += numbits #else #define UPDATE_COUNT(numbits) #endif #ifdef NO_SANITY_CHECKS #define get_bits1(result) \ { \ UPDATE_COUNT(1); \ result = ((vid_stream->curBits & 0x80000000) != 0); \ vid_stream->curBits <<= 1; \ vid_stream->bit_offset++; \ \ if (vid_stream->bit_offset & 0x20) { \ vid_stream->bit_offset = 0; \ vid_stream->buffer++; \ vid_stream->curBits = *vid_stream->buffer; \ vid_stream->buf_length--; \ } \ } #define get_bits2(result) \ { \ UPDATE_COUNT(2); \ vid_stream->bit_offset += 2; \ \ if (vid_stream->bit_offset & 0x20) { \ vid_stream->bit_offset -= 32; \ vid_stream->buffer++; \ vid_stream->buf_length--; \ if (vid_stream->bit_offset) { \ vid_stream->curBits |= \ (*vid_stream->buffer >> (2 - vid_stream->bit_offset)); \ } \ result = ((vid_stream->curBits & 0xc0000000) >> 30); \ vid_stream->curBits = *vid_stream->buffer << vid_stream->bit_offset; \ } \ \ result = ((vid_stream->curBits & 0xc0000000) >> 30); \ vid_stream->curBits <<= 2; \ } #define get_bitsX(num, mask, shift, result) \ { \ UPDATE_COUNT(num); \ vid_stream->bit_offset += num; \ \ if (vid_stream->bit_offset & 0x20) { \ vid_stream->bit_offset -= 32; \ vid_stream->buffer++; \ vid_stream->buf_length--; \ if (vid_stream->bit_offset) { \ vid_stream->curBits |= (*vid_stream->buffer >> \ (num - vid_stream->bit_offset)); \ } \ result = ((vid_stream->curBits & mask) >> shift); \ vid_stream->curBits = *vid_stream->buffer << vid_stream->bit_offset; \ } \ else { \ result = ((vid_stream->curBits & mask) >> shift); \ vid_stream->curBits <<= num; \ } \ } #else #define get_bits1(result) \ { \ /* Check for underflow. */ \ \ if (vid_stream->buf_length < 2) { \ correct_underflow(vid_stream); \ } \ UPDATE_COUNT(1); \ result = ((vid_stream->curBits & 0x80000000) != 0); \ vid_stream->curBits <<= 1; \ vid_stream->bit_offset++; \ \ if (vid_stream->bit_offset & 0x20) { \ vid_stream->bit_offset = 0; \ vid_stream->buffer++; \ vid_stream->curBits = *vid_stream->buffer; \ vid_stream->buf_length--; \ } \ } #define get_bits2(result) \ { \ /* Check for underflow. */ \ \ if (vid_stream->buf_length < 2) { \ correct_underflow(vid_stream); \ } \ UPDATE_COUNT(2); \ vid_stream->bit_offset += 2; \ \ if (vid_stream->bit_offset & 0x20) { \ vid_stream->bit_offset -= 32; \ vid_stream->buffer++; \ vid_stream->buf_length--; \ if (vid_stream->bit_offset) { \ vid_stream->curBits |= (*vid_stream->buffer >> \ (2 - vid_stream->bit_offset)); \ } \ result = ((vid_stream->curBits & 0xc0000000) >> 30); \ vid_stream->curBits = *vid_stream->buffer << vid_stream->bit_offset; \ } \ \ result = ((vid_stream->curBits & 0xc0000000) >> 30); \ vid_stream->curBits <<= 2; \ } #define get_bitsX(num, mask, shift, result) \ { \ /* Check for underflow. */ \ \ if (vid_stream->buf_length < 2) { \ correct_underflow(vid_stream); \ } \ UPDATE_COUNT(num); \ vid_stream->bit_offset += num; \ \ if (vid_stream->bit_offset & 0x20) { \ vid_stream->bit_offset -= 32; \ vid_stream->buffer++; \ vid_stream->buf_length--; \ if (vid_stream->bit_offset) { \ vid_stream->curBits |= (*vid_stream->buffer >> \ (num - vid_stream->bit_offset)); \ } \ result = ((vid_stream->curBits & mask) >> shift); \ vid_stream->curBits = *vid_stream->buffer << vid_stream->bit_offset; \ } \ else { \ result = ((vid_stream->curBits & mask) >> shift); \ vid_stream->curBits <<= num; \ } \ } #endif #define get_bits3(result) get_bitsX(3, 0xe0000000, 29, result) #define get_bits4(result) get_bitsX(4, 0xf0000000, 28, result) #define get_bits5(result) get_bitsX(5, 0xf8000000, 27, result) #define get_bits6(result) get_bitsX(6, 0xfc000000, 26, result) #define get_bits7(result) get_bitsX(7, 0xfe000000, 25, result) #define get_bits8(result) get_bitsX(8, 0xff000000, 24, result) #define get_bits9(result) get_bitsX(9, 0xff800000, 23, result) #define get_bits10(result) get_bitsX(10, 0xffc00000, 22, result) #define get_bits11(result) get_bitsX(11, 0xffe00000, 21, result) #define get_bits12(result) get_bitsX(12, 0xfff00000, 20, result) #define get_bits14(result) get_bitsX(14, 0xfffc0000, 18, result) #define get_bits16(result) get_bitsX(16, 0xffff0000, 16, result) #define get_bits18(result) get_bitsX(18, 0xffffc000, 14, result) #define get_bits32(result) get_bitsX(32, 0xffffffff, 0, result) #define get_bitsn(num, result) get_bitsX((num), nBitMask[num], (32-(num)), result) #ifdef NO_SANITY_CHECKS #define show_bits32(result) \ { \ if (vid_stream->bit_offset) { \ result = vid_stream->curBits | (*(vid_stream->buffer+1) >> \ (32 - vid_stream->bit_offset)); \ } \ else { \ result = vid_stream->curBits; \ } \ } #define show_bitsX(num, mask, shift, result) \ { \ int bO; \ bO = vid_stream->bit_offset + num; \ if (bO > 32) { \ bO -= 32; \ result = ((vid_stream->curBits & mask) >> shift) | \ (*(vid_stream->buffer+1) >> (shift + (num - bO))); \ } \ else { \ result = ((vid_stream->curBits & mask) >> shift); \ } \ } #else #define show_bits32(result) \ { \ /* Check for underflow. */ \ if (vid_stream->buf_length < 2) { \ correct_underflow(vid_stream); \ } \ if (vid_stream->bit_offset) { \ result = vid_stream->curBits | (*(vid_stream->buffer+1) >> \ (32 - vid_stream->bit_offset)); \ } \ else { \ result = vid_stream->curBits; \ } \ } #define show_bitsX(num, mask, shift, result) \ { \ int bO; \ \ /* Check for underflow. */ \ if (vid_stream->buf_length < 2) { \ correct_underflow(vid_stream); \ } \ bO = vid_stream->bit_offset + num; \ if (bO > 32) { \ bO -= 32; \ result = ((vid_stream->curBits & mask) >> shift) | \ (*(vid_stream->buffer+1) >> (shift + (num - bO))); \ } \ else { \ result = ((vid_stream->curBits & mask) >> shift); \ } \ } #endif #define show_bits1(result) show_bitsX(1, 0x80000000, 31, result) #define show_bits2(result) show_bitsX(2, 0xc0000000, 30, result) #define show_bits3(result) show_bitsX(3, 0xe0000000, 29, result) #define show_bits4(result) show_bitsX(4, 0xf0000000, 28, result) #define show_bits5(result) show_bitsX(5, 0xf8000000, 27, result) #define show_bits6(result) show_bitsX(6, 0xfc000000, 26, result) #define show_bits7(result) show_bitsX(7, 0xfe000000, 25, result) #define show_bits8(result) show_bitsX(8, 0xff000000, 24, result) #define show_bits9(result) show_bitsX(9, 0xff800000, 23, result) #define show_bits10(result) show_bitsX(10, 0xffc00000, 22, result) #define show_bits11(result) show_bitsX(11, 0xffe00000, 21, result) #define show_bits12(result) show_bitsX(12, 0xfff00000, 20, result) #define show_bits13(result) show_bitsX(13, 0xfff80000, 19, result) #define show_bits14(result) show_bitsX(14, 0xfffc0000, 18, result) #define show_bits15(result) show_bitsX(15, 0xfffe0000, 17, result) #define show_bits16(result) show_bitsX(16, 0xffff0000, 16, result) #define show_bits17(result) show_bitsX(17, 0xffff8000, 15, result) #define show_bits18(result) show_bitsX(18, 0xffffc000, 14, result) #define show_bits19(result) show_bitsX(19, 0xffffe000, 13, result) #define show_bits20(result) show_bitsX(20, 0xfffff000, 12, result) #define show_bits21(result) show_bitsX(21, 0xfffff800, 11, result) #define show_bits22(result) show_bitsX(22, 0xfffffc00, 10, result) #define show_bits23(result) show_bitsX(23, 0xfffffe00, 9, result) #define show_bits24(result) show_bitsX(24, 0xffffff00, 8, result) #define show_bits25(result) show_bitsX(25, 0xffffff80, 7, result) #define show_bits26(result) show_bitsX(26, 0xffffffc0, 6, result) #define show_bits27(result) show_bitsX(27, 0xffffffe0, 5, result) #define show_bits28(result) show_bitsX(28, 0xfffffff0, 4, result) #define show_bits29(result) show_bitsX(29, 0xfffffff8, 3, result) #define show_bits30(result) show_bitsX(30, 0xfffffffc, 2, result) #define show_bits31(result) show_bitsX(31, 0xfffffffe, 1, result) #define show_bitsn(num,result) show_bitsX((num), (0xffffffff << (32-(num))), (32-(num)), result) #ifdef NO_SANITY_CHECKS #define flush_bits32 \ { \ UPDATE_COUNT(32); \ \ vid_stream->buffer++; \ vid_stream->buf_length--; \ vid_stream->curBits = *vid_stream->buffer << vid_stream->bit_offset;\ } #define flush_bits(num) \ { \ vid_stream->bit_offset += num; \ \ UPDATE_COUNT(num); \ \ if (vid_stream->bit_offset & 0x20) { \ vid_stream->bit_offset -= 32; \ vid_stream->buffer++; \ vid_stream->buf_length--; \ vid_stream->curBits = *vid_stream->buffer << vid_stream->bit_offset;\ } \ else { \ vid_stream->curBits <<= num; \ } \ } #else #define flush_bits32 \ { \ if (vid_stream == NULL) { \ /* Deal with no vid stream here. */ \ } \ \ if (vid_stream->buf_length < 2) { \ correct_underflow(vid_stream); \ } \ \ UPDATE_COUNT(32); \ \ vid_stream->buffer++; \ vid_stream->buf_length--; \ vid_stream->curBits = *vid_stream->buffer << vid_stream->bit_offset;\ } #define flush_bits(num) \ { \ if (vid_stream== NULL) { \ /* Deal with no vid stream here. */ \ } \ \ if (vid_stream->buf_length < 2) { \ correct_underflow(vid_stream); \ } \ \ UPDATE_COUNT(num); \ \ vid_stream->bit_offset += num; \ \ if (vid_stream->bit_offset & 0x20) { \ vid_stream->buf_length--; \ vid_stream->bit_offset -= 32; \ vid_stream->buffer++; \ vid_stream->curBits = *vid_stream->buffer << vid_stream->bit_offset;\ } \ else { \ vid_stream->curBits <<= num; \ } \ } #endif #define UTIL2 smpeg-0.4.5+cvs20030824.orig/video/video.cpp0100644000175000017500000042715607272376321020277 0ustar hoseheadhosehead/* * video.c -- * * This file contains C code that implements the video decoder model. * */ /* * Copyright (c) 1995 The Regents of the University of California. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement is * hereby granted, provided that the above copyright notice and the following * two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ /* * Portions of this software Copyright (c) 1995 Brown University. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement * is hereby granted, provided that the above copyright notice and the * following two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF BROWN * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * BROWN UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" * BASIS, AND BROWN UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ /* We use FULL_COLOR_DITHER code for SMPEG */ #define DISABLE_DITHER /* Correct bad motion information */ #define LOOSE_MPEG /* If hardware accelerated, prevent use of dither code */ #ifdef USE_ATI #ifndef DISABLE_DITHER #define DISABLE_DITHER #endif #endif #include #include #include #include #include "decoders.h" #include "video.h" #include "util.h" #include "proto.h" #ifdef USE_ATI #include "vhar128.h" #endif /* Declarations of functions. */ #ifndef USE_ATI static void ReconIMBlock( VidStream*, int bnum ); static void ReconPMBlock( VidStream*, int bnum, int recon_right_for, int recon_down_for, int zflag ); static void ReconBMBlock( VidStream*, int bnum, int recon_right_back, int recon_down_back, int zflag ); static void ReconBiMBlock( VidStream*, int bnum, int recon_right_for, int recon_down_for, int recon_right_back, int recon_down_back, int zflag ); static void ReconSkippedBlock( unsigned char *source, unsigned char *dest, int row, int col, int row_size, int right, int down, int right_half, int down_half, int width ); #endif /* USE_ATI */ static void DoPictureDisplay( VidStream* ); static int ParseSeqHead( VidStream* ); static int ParseGOP( VidStream* ); static int ParsePicture( VidStream*, TimeStamp ); static int ParseSlice( VidStream* ); static int ParseMacroBlock( VidStream* ); static void ProcessSkippedPFrameMBlocks( VidStream* ); static void ProcessSkippedBFrameMBlocks( VidStream* ); /* Changes to make the code reentrant: de-globalized: totNumFrames, realTimeStart, matched_depth, ditherType, curBits, ReconPMBlock statics, first, [lc]max[xy], ditherFlags, vid_stream, Parse_done, seekValue, ReadPack static, sys_layer, bitOffset, bitLength, bitBuffer, curVidStream, X globals to xinfo (window, et al) use vid_stream->film_has_ended instead of FilmState lookup tables only initialized once, global as possible (default_intra_matrix, zigzag, zigzag_direct, scan) get rid of setjmp, long jmp Additional changes: if DISABLE_DITHER defined then do not compile dithering code -lsh@cs.brown.edu (Loring Holden) */ /* Macro for returning 1 if num is positive, -1 if negative, 0 if 0. */ #define Sign(num) ((num > 0) ? 1 : ((num == 0) ? 0 : -1)) /* Set up array for fast conversion from zig zag order to row/column coordinates. */ const int zigzag[64][2] = { { 0, 0 }, { 1, 0 }, { 0, 1 }, { 0, 2 }, { 1, 1 }, { 2, 0 }, { 3, 0 }, { 2, 1 }, { 1, 2 }, { 0, 3 }, { 0, 4 }, { 1, 3 }, { 2, 2 }, { 3, 1 }, { 4, 0 }, { 5, 0 }, { 4, 1 }, { 3, 2 }, { 2, 3 }, { 1, 4 }, { 0, 5 }, { 0, 6 }, { 1, 5 }, { 2, 4 }, { 3, 3 }, { 4, 2 }, { 5, 1 }, { 6, 0 }, { 7, 0 }, { 6, 1 }, { 5, 2 }, { 4, 3 }, { 3, 4 }, { 2, 5 }, { 1, 6 }, { 0, 7 }, { 1, 7 }, { 2, 6 }, { 3, 5 }, { 4, 4 }, { 5, 3 }, { 6, 2 }, { 7, 1 }, { 7, 2 }, { 6, 3 }, { 5, 4 }, { 4, 5 }, { 3, 6 }, { 2, 7 }, { 3, 7 }, { 4, 6 }, { 5, 5 }, { 6, 4 }, { 7, 3 }, { 7, 4 }, { 6, 5 }, { 5, 6 }, { 4, 7 }, { 5, 7 }, { 6, 6 }, { 7, 5 }, { 7, 6 }, { 6, 7 }, { 7, 7 } }; /* Set up array for fast conversion from row/column coordinates to zig zag order. */ const int scan[8][8] = { { 0, 1, 5, 6, 14, 15, 27, 28 }, { 2, 4, 7, 13, 16, 26, 29, 42 }, { 3, 8, 12, 17, 25, 30, 41, 43 }, { 9, 11, 18, 24, 31, 40, 44, 53 }, { 10, 19, 23, 32, 39, 45, 52, 54 }, { 20, 22, 33, 38, 46, 51, 55, 60 }, { 21, 34, 37, 47, 50, 56, 59, 61 }, { 35, 36, 48, 49, 57, 58, 62, 63 } }; /* Max lum, chrom indices for illegal block checking. */ #ifdef USE_CROP_TABLE /* * We use a lookup table to make sure values stay in the 0..255 range. * Since this is cropping (ie, x = (x < 0)?0:(x>255)?255:x; ), wee call this * table the "crop table". * MAX_NEG_CROP is the maximum neg/pos value we can handle. */ #define MAX_NEG_CROP 2048 #define NUM_CROP_ENTRIES (2048+2*MAX_NEG_CROP) static unsigned char cropTbl[NUM_CROP_ENTRIES]; #define crop(x) cm[x] #else static inline unsigned char crop(int x) { if(x<=0) return 0; if(x>=255) return 255; return x; } #endif /* USE_CROP_TABLE */ /* The following accounts for time and size spent in various parsing acitivites if ANALYSIS has been defined. */ #ifdef ANALYSIS unsigned int bitCount = 0; /* #define SHOWMB_FLAG */ /* #define SHOWEACHFLAG */ typedef struct { int frametype; unsigned int totsize; unsigned int number; unsigned int i_mbsize; unsigned int p_mbsize; unsigned int b_mbsize; unsigned int bi_mbsize; unsigned int i_mbnum; unsigned int p_mbnum; unsigned int b_mbnum; unsigned int bi_mbnum; unsigned int i_mbcbp[64]; unsigned int p_mbcbp[64]; unsigned int b_mbcbp[64]; unsigned int bi_mbcbp[64]; unsigned int i_mbcoeff[64]; unsigned int p_mbcoeff[64]; unsigned int b_mbcoeff[64]; unsigned int bi_mbcoeff[64]; double tottime; } Statval; Statval stat_a[4]; unsigned int pictureSizeCount; unsigned int mbSizeCount; unsigned int *mbCBPPtr, *mbCoeffPtr, *mbSizePtr; unsigned int cacheHit[8][8]; unsigned int cacheMiss[8][8]; static void init_stat_struct(astat) Statval *astat; { int j; astat->frametype = 0; astat->totsize = 0; astat->number = 0; astat->i_mbsize = 0; astat->p_mbsize = 0; astat->b_mbsize = 0; astat->bi_mbsize = 0; astat->i_mbnum = 0; astat->p_mbnum = 0; astat->b_mbnum = 0; astat->bi_mbnum = 0; for (j = 0; j < 64; j++) { astat->i_mbcbp[j] = 0; astat->p_mbcbp[j] = 0; astat->b_mbcbp[j] = 0; astat->bi_mbcbp[j] = 0; astat->i_mbcoeff[j] = 0; astat->p_mbcoeff[j] = 0; astat->b_mbcoeff[j] = 0; astat->bi_mbcoeff[j] = 0; } astat->tottime = 0.0; } void init_stats() { int i, j; for (i = 0; i < 4; i++) { init_stat_struct(&(stat_a[i])); stat_a[i].frametype = i; } for (i = 0; i < 8; i++) { for (j = 0; j < 8; j++) { cacheHit[i][j] = 0; cacheMiss[i][j] = 0; } } bitCount = 0; } static void PrintOneStat() { int i; printf("\n"); switch (stat_a[0].frametype) { case I_TYPE: printf("I FRAME\n"); break; case P_TYPE: printf("P FRAME\n"); break; case B_TYPE: printf("B FRAME\n"); break; } printf("Size: %d bytes + %d bits\n", stat_a[0].totsize / 8, stat_a[0].totsize % 8); if (stat_a[0].i_mbnum > 0) { printf("\tI Macro Block Stats:\n"); printf("\t%d I Macroblocks\n", stat_a[0].i_mbnum); printf("\tAvg. Size: %d bytes + %d bits\n", stat_a[0].i_mbsize / (8 * stat_a[0].i_mbnum), (stat_a[0].i_mbsize * stat_a[0].i_mbnum) % 8); printf("\t\tCoded Block Pattern Histogram:\n"); for (i = 0; i < 64; i += 8) { printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[0].i_mbcbp[i], stat_a[0].i_mbcbp[i + 1], stat_a[0].i_mbcbp[i + 2], stat_a[0].i_mbcbp[i + 3], stat_a[0].i_mbcbp[i + 4], stat_a[0].i_mbcbp[i + 5], stat_a[0].i_mbcbp[i + 6], stat_a[0].i_mbcbp[i + 7]); } printf("\n\t\tNumber of Coefficients/Block Histogram:\n"); for (i = 0; i < 64; i += 8) { printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[0].i_mbcoeff[i], stat_a[0].i_mbcoeff[i + 1], stat_a[0].i_mbcoeff[i + 2], stat_a[0].i_mbcoeff[i + 3], stat_a[0].i_mbcoeff[i + 4], stat_a[0].i_mbcoeff[i + 5], stat_a[0].i_mbcoeff[i + 6], stat_a[0].i_mbcoeff[i + 7]); } } if (stat_a[0].p_mbnum > 0) { printf("\tP Macro Block Stats:\n"); printf("\t%d P Macroblocks\n", stat_a[0].p_mbnum); printf("\tAvg. Size: %d bytes + %d bits\n", stat_a[0].p_mbsize / (8 * stat_a[0].p_mbnum), (stat_a[0].p_mbsize / stat_a[0].p_mbnum) % 8); printf("\t\tCoded Block Pattern Histogram:\n"); for (i = 0; i < 64; i += 8) { printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[0].p_mbcbp[i], stat_a[0].p_mbcbp[i + 1], stat_a[0].p_mbcbp[i + 2], stat_a[0].p_mbcbp[i + 3], stat_a[0].p_mbcbp[i + 4], stat_a[0].p_mbcbp[i + 5], stat_a[0].p_mbcbp[i + 6], stat_a[0].p_mbcbp[i + 7]); } printf("\n\t\tNumber of Coefficients/Block Histogram:\n"); for (i = 0; i < 64; i += 8) { printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[0].p_mbcoeff[i], stat_a[0].p_mbcoeff[i + 1], stat_a[0].p_mbcoeff[i + 2], stat_a[0].p_mbcoeff[i + 3], stat_a[0].p_mbcoeff[i + 4], stat_a[0].p_mbcoeff[i + 5], stat_a[0].p_mbcoeff[i + 6], stat_a[0].p_mbcoeff[i + 7]); } } if (stat_a[0].b_mbnum > 0) { printf("\tB Macro Block Stats:\n"); printf("\t%d B Macroblocks\n", stat_a[0].b_mbnum); printf("\tAvg. Size: %d bytes + %d bits\n", stat_a[0].b_mbsize / (8 * stat_a[0].b_mbnum), (stat_a[0].b_mbsize / stat_a[0].b_mbnum) % 8); printf("\t\tCoded Block Pattern Histogram:\n"); for (i = 0; i < 64; i += 8) { printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[0].b_mbcbp[i], stat_a[0].b_mbcbp[i + 1], stat_a[0].b_mbcbp[i + 2], stat_a[0].b_mbcbp[i + 3], stat_a[0].b_mbcbp[i + 4], stat_a[0].b_mbcbp[i + 5], stat_a[0].b_mbcbp[i + 6], stat_a[0].b_mbcbp[i + 7]); } printf("\n\t\tNumber of Coefficients/Block Histogram:\n"); for (i = 0; i < 64; i += 8) { printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[0].b_mbcoeff[i], stat_a[0].b_mbcoeff[i + 1], stat_a[0].b_mbcoeff[i + 2], stat_a[0].b_mbcoeff[i + 3], stat_a[0].b_mbcoeff[i + 4], stat_a[0].b_mbcoeff[i + 5], stat_a[0].b_mbcoeff[i + 6], stat_a[0].b_mbcoeff[i + 7]); } } if (stat_a[0].bi_mbnum > 0) { printf("\tBi Macro Block Stats:\n"); printf("\t%d Bi Macroblocks\n", stat_a[0].bi_mbnum); printf("\tAvg. Size: %d bytes + %d bits\n", stat_a[0].bi_mbsize / (8 * stat_a[0].bi_mbnum), (stat_a[0].bi_mbsize * stat_a[0].bi_mbnum) % 8); printf("\t\tCoded Block Pattern Histogram:\n"); for (i = 0; i < 64; i += 8) { printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[0].bi_mbcbp[i], stat_a[0].bi_mbcbp[i + 1], stat_a[0].bi_mbcbp[i + 2], stat_a[0].bi_mbcbp[i + 3], stat_a[0].bi_mbcbp[i + 4], stat_a[0].bi_mbcbp[i + 5], stat_a[0].bi_mbcbp[i + 6], stat_a[0].bi_mbcbp[i + 7]); } printf("\n\t\tNumber of Coefficients/Block Histogram:\n"); for (i = 0; i < 64; i += 8) { printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[0].bi_mbcoeff[i], stat_a[0].bi_mbcoeff[i + 1], stat_a[0].bi_mbcoeff[i + 2], stat_a[0].bi_mbcoeff[i + 3], stat_a[0].bi_mbcoeff[i + 4], stat_a[0].bi_mbcoeff[i + 5], stat_a[0].bi_mbcoeff[i + 6], stat_a[0].bi_mbcoeff[i + 7]); } } printf("\nTime to Decode: %g secs.\n", stat_a[0].tottime); printf("****************\n"); } void PrintAllStats(vid_stream) VidStream *vid_stream; { int i, j; unsigned int supertot, supernum; double supertime; printf("\n"); printf("General Info: \n"); printf("Width: %d\nHeight: %d\n", vid_stream->mb_width * 16, vid_stream->mb_height * 16); for (i = 1; i < 4; i++) { if (stat_a[i].number == 0) continue; switch (i) { case 1: printf("I FRAMES\n"); break; case 2: printf("P FRAMES\n"); break; case 3: printf("B FRAMES\n"); break; } printf("Number: %d\n", stat_a[i].number); printf("Avg. Size: %d bytes + %d bits\n", stat_a[i].totsize / (8 * stat_a[i].number), (stat_a[i].totsize / stat_a[i].number) % 8); if (stat_a[i].i_mbnum > 0) { printf("\tI Macro Block Stats:\n"); printf("\t%d I Macroblocks\n", stat_a[i].i_mbnum); printf("\tAvg. Size: %d bytes + %d bits\n", stat_a[i].i_mbsize / (8 * stat_a[i].i_mbnum), (stat_a[i].i_mbsize / stat_a[i].i_mbnum) % 8); printf("\t\tCoded Block Pattern Histogram:\n"); for (j = 0; j < 64; j += 8) { printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[i].i_mbcbp[j], stat_a[i].i_mbcbp[j + 1], stat_a[i].i_mbcbp[j + 2], stat_a[i].i_mbcbp[j + 3], stat_a[i].i_mbcbp[j + 4], stat_a[i].i_mbcbp[j + 5], stat_a[i].i_mbcbp[j + 6], stat_a[i].i_mbcbp[j + 7]); } printf("\n\t\tNumber of Coefficients/Block Histogram:\n"); for (j = 0; j < 64; j += 8) { printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[i].i_mbcoeff[j], stat_a[i].i_mbcoeff[j + 1], stat_a[i].i_mbcoeff[j + 2], stat_a[i].i_mbcoeff[j + 3], stat_a[i].i_mbcoeff[j + 4], stat_a[i].i_mbcoeff[j + 5], stat_a[i].i_mbcoeff[j + 6], stat_a[i].i_mbcoeff[j + 7]); } } if (stat_a[i].p_mbnum > 0) { printf("\tP Macro Block Stats:\n"); printf("\t%d P Macroblocks\n", stat_a[i].p_mbnum); printf("\tAvg. Size: %d bytes + %d bits\n", stat_a[i].p_mbsize / (8 * stat_a[i].p_mbnum), (stat_a[i].p_mbsize / stat_a[i].p_mbnum) % 8); printf("\t\tCoded Block Pattern Histogram:\n"); for (j = 0; j < 64; j += 8) { printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[i].p_mbcbp[j], stat_a[i].p_mbcbp[j + 1], stat_a[i].p_mbcbp[j + 2], stat_a[i].p_mbcbp[j + 3], stat_a[i].p_mbcbp[j + 4], stat_a[i].p_mbcbp[j + 5], stat_a[i].p_mbcbp[j + 6], stat_a[i].p_mbcbp[j + 7]); } printf("\n\t\tNumber of Coefficients/Block Histogram:\n"); for (j = 0; j < 64; j += 8) { printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[i].p_mbcoeff[j], stat_a[i].p_mbcoeff[j + 1], stat_a[i].p_mbcoeff[j + 2], stat_a[i].p_mbcoeff[j + 3], stat_a[i].p_mbcoeff[j + 4], stat_a[i].p_mbcoeff[j + 5], stat_a[i].p_mbcoeff[j + 6], stat_a[i].p_mbcoeff[j + 7]); } } if (stat_a[i].b_mbnum > 0) { printf("\tB Macro Block Stats:\n"); printf("\t%d B Macroblocks\n", stat_a[i].b_mbnum); printf("\tAvg. Size: %d bytes + %d bits\n", stat_a[i].b_mbsize / (8 * stat_a[i].b_mbnum), (stat_a[i].b_mbsize * stat_a[i].b_mbnum) % 8); printf("\t\tCoded Block Pattern Histogram:\n"); for (j = 0; j < 64; j += 8) { printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[i].b_mbcbp[j], stat_a[i].b_mbcbp[j + 1], stat_a[i].b_mbcbp[j + 2], stat_a[i].b_mbcbp[j + 3], stat_a[i].b_mbcbp[j + 4], stat_a[i].b_mbcbp[j + 5], stat_a[i].b_mbcbp[j + 6], stat_a[i].b_mbcbp[j + 7]); } printf("\n\t\tNumber of Coefficients/Block Histogram:\n"); for (j = 0; j < 64; j += 8) { printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[i].b_mbcoeff[j], stat_a[i].b_mbcoeff[j + 1], stat_a[i].b_mbcoeff[j + 2], stat_a[i].b_mbcoeff[j + 3], stat_a[i].b_mbcoeff[j + 4], stat_a[i].b_mbcoeff[j + 5], stat_a[i].b_mbcoeff[j + 6], stat_a[i].b_mbcoeff[j + 7]); } } if (stat_a[i].bi_mbnum > 0) { printf("\tBi Macro Block Stats:\n"); printf("\t%d Bi Macroblocks\n", stat_a[i].bi_mbnum); printf("\tAvg. Size: %d bytes + %d bits\n", stat_a[i].bi_mbsize / (8 * stat_a[i].bi_mbnum), (stat_a[i].bi_mbsize * stat_a[i].bi_mbnum) % 8); printf("\t\tCoded Block Pattern Histogram:\n"); for (j = 0; j < 64; j += 8) { printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[i].bi_mbcbp[j], stat_a[i].bi_mbcbp[j + 1], stat_a[i].bi_mbcbp[j + 2], stat_a[i].bi_mbcbp[j + 3], stat_a[i].bi_mbcbp[j + 4], stat_a[i].bi_mbcbp[j + 5], stat_a[i].bi_mbcbp[j + 6], stat_a[i].bi_mbcbp[j + 7]); } printf("\n\t\tNumber of Coefficients/Block Histogram:\n"); for (j = 0; j < 64; j += 8) { printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[i].bi_mbcoeff[j], stat_a[i].bi_mbcoeff[j + 1], stat_a[i].bi_mbcoeff[j + 2], stat_a[i].bi_mbcoeff[j + 3], stat_a[i].bi_mbcoeff[j + 4], stat_a[i].bi_mbcoeff[j + 5], stat_a[i].bi_mbcoeff[j + 6], stat_a[i].bi_mbcoeff[j + 7]); } } printf("\nAvg. Time to Decode: %f secs.\n", (stat_a[i].tottime / ((double) stat_a[i].number))); printf("\n"); printf("*************************\n\n"); } supertot = stat_a[1].totsize + stat_a[2].totsize + stat_a[3].totsize; supernum = stat_a[1].number + stat_a[2].number + stat_a[3].number; supertime = stat_a[1].tottime + stat_a[2].tottime + stat_a[3].tottime; printf("Total Number of Frames: %d\n", supernum); printf("Avg Frame Size: %d bytes %d bits\n", supertot / (8 * supernum), (supertot / supernum) % 8); printf("Total Time Decoding: %g secs.\n", supertime); printf("Avg Decoding Time/Frame: %g secs.\n", supertime / ((double) supernum)); printf("Avg Decoding Frames/Sec: %g secs.\n", ((double) supernum) / supertime); printf("\n"); printf("Cache Hits/Miss\n"); for (i = 0; i < 8; i++) { printf("%.6d/%.6d\t%.6d/%.6d\t%.6d/%.6d\t%.6d/%.6d\n", cacheHit[i][0], cacheMiss[i][0], cacheHit[i][1], cacheMiss[i][1], cacheHit[i][2], cacheMiss[i][2], cacheHit[i][3], cacheMiss[i][3]); printf("%.6d/%.6d\t%.6d/%.6d\t%.6d/%.6d\t%.6d/%.6d\n", cacheHit[i][4], cacheMiss[i][4], cacheHit[i][5], cacheMiss[i][5], cacheHit[i][6], cacheMiss[i][6], cacheHit[i][7], cacheMiss[i][7]); } } static void CollectStats() { int i, j; i = stat_a[0].frametype; stat_a[i].totsize += stat_a[0].totsize; stat_a[i].number += stat_a[0].number; stat_a[i].i_mbsize += stat_a[0].i_mbsize; stat_a[i].p_mbsize += stat_a[0].p_mbsize; stat_a[i].b_mbsize += stat_a[0].b_mbsize; stat_a[i].bi_mbsize += stat_a[0].bi_mbsize; stat_a[i].i_mbnum += stat_a[0].i_mbnum; stat_a[i].p_mbnum += stat_a[0].p_mbnum; stat_a[i].b_mbnum += stat_a[0].b_mbnum; stat_a[i].bi_mbnum += stat_a[0].bi_mbnum; for (j = 0; j < 64; j++) { stat_a[i].i_mbcbp[j] += stat_a[0].i_mbcbp[j]; stat_a[i].p_mbcbp[j] += stat_a[0].p_mbcbp[j]; stat_a[i].b_mbcbp[j] += stat_a[0].b_mbcbp[j]; stat_a[i].bi_mbcbp[j] += stat_a[0].bi_mbcbp[j]; stat_a[i].i_mbcoeff[j] += stat_a[0].i_mbcoeff[j]; stat_a[i].p_mbcoeff[j] += stat_a[0].p_mbcoeff[j]; stat_a[i].b_mbcoeff[j] += stat_a[0].b_mbcoeff[j]; stat_a[i].bi_mbcoeff[j] += stat_a[0].bi_mbcoeff[j]; } stat_a[i].tottime += stat_a[0].tottime; init_stat_struct(&(stat_a[0])); } static unsigned int bitCountRead() { return bitCount; } static void StartTime() { stat_a[0].tottime = ReadSysClock(); } static void EndTime() { stat_a[0].tottime = ReadSysClock() - stat_a[0].tottime; } #endif /* *-------------------------------------------------------------- * * ReadSysClock -- * * Computes the current time according to the system clock. * * Results: * The current time according to the system clock. * * Side effects: * None. * *-------------------------------------------------------------- */ double ReadSysClock() { return(SDL_GetTicks()/1000.0); } /* *-------------------------------------------------------------- * * InitCrop -- * * Initializes cropTbl - this was taken from newVidStream so * that it wasn't done for each new video stream * * Results: * None * * Side effects: * cropTbl will be initialized * *-------------------------------------------------------------- */ void InitCrop() { #ifdef USE_CROP_TABLE int i; /* Initialize crop table. */ for (i = (-MAX_NEG_CROP); i < NUM_CROP_ENTRIES - MAX_NEG_CROP; i++) { if (i <= 0) { cropTbl[i + MAX_NEG_CROP] = 0; #ifdef TWELVE_BITS } else if (i >= 2047) { cropTbl[i + MAX_NEG_CROP] = 2047; #endif } else if (i >= 255) { cropTbl[i + MAX_NEG_CROP] = 255; } else { cropTbl[i + MAX_NEG_CROP] = i; } } #endif /* USE_CROP_TABLE */ } /* *-------------------------------------------------------------- * * NewVidStream -- * * Allocates and initializes a VidStream structure. Takes * as parameter requested size for buffer length. * * Results: * A pointer to the new VidStream structure. * * Side effects: * None. * *-------------------------------------------------------------- */ VidStream* NewVidStream( unsigned int buffer_len ) { int i, j; VidStream* vs; static const unsigned char default_intra_matrix[64] = { 8, 16, 19, 22, 26, 27, 29, 34, 16, 16, 22, 24, 27, 29, 34, 37, 19, 22, 26, 27, 29, 34, 34, 38, 22, 22, 26, 27, 29, 34, 37, 40, 22, 26, 27, 29, 32, 35, 40, 48, 26, 27, 29, 32, 35, 40, 48, 58, 26, 27, 29, 34, 38, 46, 56, 69, 27, 29, 35, 38, 46, 56, 69, 83 }; /* Check for legal buffer length. */ if( buffer_len < 4 ) return NULL; /* Make buffer length multiple of 4. */ buffer_len = (buffer_len + 3) >> 2; /* Allocate memory for vs structure. */ vs = (VidStream *) malloc(sizeof(VidStream)); memset( vs, 0, (sizeof *vs) ); /* Initialize pointers to extension and user data. */ vs->group.ext_data = vs->group.user_data = vs->picture.extra_info = vs->picture.user_data = vs->picture.ext_data = vs->slice.extra_info = vs->ext_data = vs->user_data = NULL; /* Copy default intra matrix. */ for( i = 0; i < 8; i++ ) { for( j = 0; j < 8; j++ ) { vs->intra_quant_matrix[i][j] = default_intra_matrix[i * 8 + j]; } } /* Initialize non intra quantization matrix. */ for( i = 0; i < 8; i++ ) { for( j = 0; j < 8; j++ ) { vs->non_intra_quant_matrix[i][j] = 16; } } /* Initialize noise base matrix */ for( i = 0; i < 8; i++ ) for( j = 0; j < 8; j++ ) vs->noise_base_matrix[i][j] = (short) vs->non_intra_quant_matrix[i][j]; j_rev_dct((short *) vs->noise_base_matrix); for( i = 0; i < 8; i++ ) for( j = 0; j < 8; j++ ) vs->noise_base_matrix[i][j] *= vs->noise_base_matrix[i][j]; /* Initialize pointers to image spaces. */ vs->current = vs->past = vs->future = NULL; for( i = 0; i < RING_BUF_SIZE; i++ ) { vs->ring[i] = NULL; } /* Create buffer. */ vs->buf_start = (unsigned int *) malloc(buffer_len * 4); /* * Set max_buf_length to one less than actual length to deal with messy * data without proper seq. end codes. */ vs->max_buf_length = buffer_len - 1; /* Initialize fields that used to be global */ vs->ditherFlags = NULL; vs->rate_deal = -1; /* Reset everything for start of display */ ResetVidStream(vs); #ifdef USE_ATI /* Initialize Rage128 hardware */ vs->ati_handle = vhar128_new(); #endif /* Return structure. */ return vs; } /* *-------------------------------------------------------------- * * ResetVidStream -- * * Re-initializes a VidStream structure. Takes * as parameter a pointer to the VidStream to reset. * * Results: * None. * * Side effects: * None. * *-------------------------------------------------------------- */ void ResetVidStream( VidStream* vid ) { int i; /* Initialize pointers to image spaces. */ vid->current = vid->past = vid->future = NULL; /* Initialize rings */ for (i = 0; i < RING_BUF_SIZE; i++) { if ( vid->ring[i] ) vid->ring[i]->locked = 0; /* Unlock */ } /* Initialize bitstream i/o fields. */ vid->bit_offset = 0; vid->buf_length = 0; vid->buffer = vid->buf_start; vid->curBits = 0; /* We are at the beginning of the film, so film has not ended */ vid->film_has_ended = FALSE; /* Reset number of frames to zero */ vid->totNumFrames=0; #ifdef CALCULATE_FPS for ( i=0; iframe_time[i] = 0.0; vid->timestamp_index = 0; #endif /* Fields added by KR for synchronization */ vid->_skipFrame = 0; vid->_skipCount = 0; vid->_jumpFrame = -1; vid->realTimeStart = 0; /* Reset EOF_flag to 0 */ vid->EOF_flag = FALSE; vid->current_frame=0; vid->need_frameadjust=false; } /* *-------------------------------------------------------------- * * DestroyVidStream -- * * Deallocates a VidStream structure. * * Results: * None. * * Side effects: * None. * *-------------------------------------------------------------- */ void DestroyVidStream( VidStream* astream ) { int i; if( astream->ext_data != NULL ) free(astream->ext_data); if( astream->user_data != NULL ) free(astream->user_data); if( astream->group.ext_data != NULL ) free(astream->group.ext_data); if( astream->group.user_data != NULL ) free(astream->group.user_data); if( astream->picture.extra_info != NULL ) free(astream->picture.extra_info); if( astream->picture.ext_data != NULL ) free(astream->picture.ext_data); if( astream->picture.user_data != NULL ) free(astream->picture.user_data); if( astream->slice.extra_info != NULL ) free(astream->slice.extra_info); if( astream->buf_start != NULL ) free(astream->buf_start); for( i = 0; i < RING_BUF_SIZE; i++ ) { if( astream->ring[i] != NULL ) { DestroyPictImage( astream, astream->ring[i] ); astream->ring[i] = NULL; } } if( astream->ditherFlags != NULL ) free( astream->ditherFlags ); #ifdef USE_ATI vhar128_close(astream->ati_handle); #endif #ifdef USE_ATI vhar128_delete(); #endif free( (char*) astream ); } /* *-------------------------------------------------------------- * * NewPictImage -- * * Allocates and initializes a PictImage structure. * The width and height of the image space are passed in * as parameters. * * Results: * A pointer to the new PictImage structure. * * Side effects: * None. * *-------------------------------------------------------------- */ PictImage* NewPictImage( VidStream* vid_stream, int w, int h, SDL_Surface *dst ) { PictImage* pi; /* Allocate memory space for pi structure. */ pi = (PictImage *) malloc(sizeof(PictImage)); /* Create a YV12 image (Y + V + U) */ #ifdef USE_ATI pi->image = vhar128_newimage(vid_stream->ati_handle, w, h); #else pi->image = (unsigned char *) malloc(w*h*12/8); pi->luminance = (unsigned char *)pi->image; pi->Cr = pi->luminance + (w*h); pi->Cb = pi->luminance + (w*h) + (w*h)/4; #endif /* Alloc space for filter info */ pi->mb_qscale = (unsigned short int *) malloc(vid_stream->mb_width * vid_stream->mb_height * sizeof(unsigned int)); /* Reset locked flag. */ pi->locked = 0; /* Return pointer to pi structure. */ return pi; } bool InitPictImages( VidStream* vid_stream, int w, int h, SDL_Surface* dst ) { int i; vid_stream->current = vid_stream->past = vid_stream->future = NULL; for (i = 0; i < RING_BUF_SIZE; i++) { if ( vid_stream->ring[i] ) { DestroyPictImage(vid_stream, vid_stream->ring[i]); } vid_stream->ring[i] = NewPictImage( vid_stream, w, h, dst ); if ( ! vid_stream->ring[i] ) return false; } #ifdef USE_ATI struct vhar128_image * ring[RING_BUF_SIZE]; for (i = 0; i < RING_BUF_SIZE; i++) { ring[i] = vid_stream->ring[i]->image; } vhar128_init(vid_stream->ati_handle, w, h, ring, RING_BUF_SIZE); #endif return true; } /* *-------------------------------------------------------------- * * DestroyPictImage -- * * Deallocates a PictImage structure. * * Results: * None. * * Side effects: * None. * *-------------------------------------------------------------- */ void DestroyPictImage( VidStream* vid_stream, PictImage* apictimage ) { #ifdef USE_ATI vhar128_destroyimage(vid_stream->ati_handle, apictimage->image); #else if (apictimage->image != NULL) free(apictimage->image); #endif free(apictimage->mb_qscale); free(apictimage); } /* *-------------------------------------------------------------- * * mpegVidRsrc -- * * Parses bit stream until MB_QUANTUM number of * macroblocks have been decoded or current slice or * picture ends, whichever comes first. If the start * of a frame is encountered, the frame is time stamped * with the value passed in time_stamp. If the value * passed in buffer is not null, the video stream buffer * is set to buffer and the length of the buffer is * expected in value passed in through length. * * Results: * A pointer to the video stream structure used. * * Side effects: * Bit stream is irreversibly parsed. If a picture is completed, * a function is called to display the frame at the correct time. * *-------------------------------------------------------------- */ VidStream* mpegVidRsrc( TimeStamp time_stamp, VidStream* vid_stream, int first ) { unsigned int data; int i, status; /* * If called for the first time, find start code, make sure it is a * sequence start code. */ if( first ) { vid_stream->num_left = 0; vid_stream->leftover_bytes = 0; vid_stream->Parse_done = FALSE; next_start_code(vid_stream); /* sets curBits */ show_bits32(data); if( data != SEQ_START_CODE ) { vid_stream->_smpeg->SetError("Invalid sequence in video stream"); /* Let whoever called NewVidStream call DestroyVidStream - KR DestroyVidStream( vid_stream ); */ return 0; } } else { #ifdef UTIL2 vid_stream->curBits = *vid_stream->buffer << vid_stream->bit_offset; #else vid_stream->curBits = *vid_stream->buffer; #endif } /* Get next 32 bits (size of start codes). */ show_bits32(data); /* Check for end of file */ if(vid_stream->EOF_flag) { /* Set ended flag first so that ExecuteDisplay may check it. */ vid_stream->film_has_ended = TRUE; if( vid_stream->future != NULL ) { vid_stream->current = vid_stream->future; vid_stream->_smpeg->ExecuteDisplay( vid_stream ); } #ifdef ANALYSIS PrintAllStats(vid_stream); #endif goto done; } /* * Process according to start code (or parse macroblock if not a start code * at all). */ switch( data ) { case SEQ_END_CODE: case 0x000001b9: /* handle ISO_11172_END_CODE too */ #ifdef VERBOSE_DEBUG printf("SEQ_END_CODE\n"); #endif flush_bits32; goto done; break; case SEQ_START_CODE: /* Sequence start code. Parse sequence header. */ #ifdef VERBOSE_DEBUG printf("SEQ_START_CODE\n"); #endif if( ParseSeqHead( vid_stream ) != PARSE_OK ) { fprintf( stderr, "mpegVidRsrc ParseSeqHead\n" ); goto error; } /* * Return after sequence start code so that application above can use * info in header. */ goto done; case GOP_START_CODE: /* Group of Pictures start code. Parse gop header. */ #ifdef VERBOSE_DEBUG printf("GOP_START_CODE\n"); #endif if( ParseGOP(vid_stream) != PARSE_OK ) { fprintf( stderr, "mpegVidRsrc ParseGOP\n" ); goto error; } /* need adjust current_frame (after Seek) */ if (vid_stream->need_frameadjust) { int prev; prev = vid_stream->totNumFrames; vid_stream->current_frame = (int) ( vid_stream->group.tc_hours * 3600 * vid_stream->rate_deal + vid_stream->group.tc_minutes * 60 * vid_stream->rate_deal + vid_stream->group.tc_seconds * vid_stream->rate_deal + vid_stream->group.tc_pictures); vid_stream->need_frameadjust=false; vid_stream->totNumFrames=vid_stream->current_frame; #if 0 printf("Adjusted Frame %d -> %d\n",prev,vid_stream->current_frame); #endif } goto done; case PICTURE_START_CODE: /* Picture start code. Parse picture header and first slice header. */ #ifdef VERBOSE_DEBUG printf("PICTURE_START_CODE\n"); #endif if (vid_stream->timestamp_mark < vid_stream->buffer && !vid_stream->timestamp_used){ vid_stream->timestamp_used = true; status = ParsePicture( vid_stream, vid_stream->timestamp ); } else status = ParsePicture( vid_stream, -1); if((vid_stream->picture.code_type == B_TYPE) && vid_stream->_skipFrame && (vid_stream->_jumpFrame < 0)) { status = SKIP_PICTURE; } if( !vid_stream->current ) status = SKIP_PICTURE; if( status == SKIP_PICTURE ) { //fprintf( stderr, "%d\r", vid_stream->totNumFrames ); next_start_code( vid_stream ); while( ! next_bits( 32, PICTURE_START_CODE, vid_stream ) ) { if( next_bits( 32, GOP_START_CODE, vid_stream) ) break; else if( next_bits( 32, SEQ_END_CODE, vid_stream ) ) break; flush_bits( 24 ); next_start_code( vid_stream ); } vid_stream->_smpeg->timeSync( vid_stream ); goto done; } else if( status != PARSE_OK ) { fprintf( stderr, "mpegVidRsrc ParsePicture\n" ); goto error; } if( ParseSlice(vid_stream) != PARSE_OK ) { fprintf( stderr, "mpegVidRsrc ParseSlice\n" ); goto error; } break; case SEQUENCE_ERROR_CODE: #ifdef VERBOSE_DEBUG printf("SEQUENCE_ERROR_CODE\n"); #endif flush_bits32; next_start_code(vid_stream); goto done; default: /* No base picture for decoding */ if( !vid_stream->current ) { flush_bits32; next_start_code(vid_stream); #ifdef VERBOSE_DEBUG printf("No base picture, flushing to next start code\n"); #endif goto done; } /* Check for slice start code. */ if( (data >= SLICE_MIN_START_CODE) && (data <= SLICE_MAX_START_CODE) ) { /* Slice start code. Parse slice header. */ if( ParseSlice(vid_stream) != PARSE_OK ) { fprintf( stderr, "mpegVidRsrc ParseSlice\n" ); goto error; } } #ifdef VERBOSE_DEBUG else fprintf(stderr, "Unknown data [%x] - not slice start code!\n", data); #endif break; } /* Parse next MB_QUANTUM macroblocks. */ for( i = 0; i < MB_QUANTUM; i++ ) { /* Check to see if actually a startcode and not a macroblock. */ if( ! next_bits( 23, 0x00000000, vid_stream ) && ! vid_stream->film_has_ended ) { /* Not start code. Parse Macroblock. */ if (ParseMacroBlock(vid_stream) != PARSE_OK) { #ifdef VERBOSE_WARNINGS fprintf( stderr, "mpegVidRsrc ParseMacroBlock\n" ); #endif goto error; } } else { /* Not macroblock, actually start code. Get start code. */ next_start_code(vid_stream); show_bits32(data); /* * If start code is outside range of slice start codes, frame is * complete, display frame. */ if( ((dataSLICE_MAX_START_CODE)) && (data != SEQUENCE_ERROR_CODE) ) { DoPictureDisplay( vid_stream ); } goto done; } } /* Check if we just finished a picture on the MB_QUANTUMth macroblock */ if( next_bits( 23, 0x00000000, vid_stream ) ) { next_start_code(vid_stream); show_bits32(data); if( (data < SLICE_MIN_START_CODE) || (data > SLICE_MAX_START_CODE) ) { DoPictureDisplay( vid_stream ); } } goto done; error: next_start_code( vid_stream ); return vid_stream; done: return vid_stream; } /* *-------------------------------------------------------------- * * ParseSeqHead -- * * Assumes bit stream is at the begining of the sequence * header start code. Parses off the sequence header. * * Results: * Fills the vid_stream structure with values derived and * decoded from the sequence header. Allocates the pict image * structures based on the dimensions of the image space * found in the sequence header. * * Side effects: * Bit stream irreversibly parsed off. * *-------------------------------------------------------------- */ static int ParseSeqHead( VidStream* vid_stream ) { unsigned int data; int i, j; #ifndef DISABLE_DITHER int ditherType=vid_stream->ditherType; #endif /* Flush off sequence start code. */ flush_bits32; /* Get horizontal size of image space. */ get_bits12(data); vid_stream->h_size = (data + 15) & ~15; /* Get vertical size of image space. */ get_bits12(data); vid_stream->v_size = (data + 15) & ~15; /* Calculate macroblock width and height of image space. */ vid_stream->mb_width = (vid_stream->h_size + 15) / 16; vid_stream->mb_height = (vid_stream->v_size + 15) / 16; #ifndef DISABLE_DITHER /* If dither type is MBORDERED allocate ditherFlags. */ if (ditherType == MBORDERED_DITHER) { vid_stream->ditherFlags = (char *) malloc(vid_stream->mb_width*vid_stream->mb_height); } #endif /* Parse of aspect ratio code. */ get_bits4(data); vid_stream->aspect_ratio = (unsigned char) data; /* Parse off picture rate code. */ get_bits4(data); vid_stream->picture_rate = (unsigned char) data; /* Parse off bit rate. */ get_bits18(data); vid_stream->bit_rate = data; /* Flush marker bit. */ flush_bits(1); /* Parse off vbv buffer size. */ get_bits10(data); vid_stream->vbv_buffer_size = data; #ifdef not_def /* Lets not bother with this. Only increases memory image */ if (data*1024>vid_stream->max_buf_length) { unsigned int *newbuf; int sz=1024*data+1; /* If they actually want a bigger buffer than we default to, let them have it! (if we can) */ newbuf = (unsigned int *) realloc(vid_stream->buf_start, (unsigned int) 4*sz); if (newbuf!=(unsigned int *)NULL) { vid_stream->max_buf_length=sz; vid_stream->buffer= (vid_stream->buffer-vid_stream->buf_start)+newbuf; vid_stream->buf_start=newbuf; }} #endif /* Parse off contrained parameter flag. */ get_bits1(data); if (data) { vid_stream->const_param_flag = TRUE; } else vid_stream->const_param_flag = FALSE; /* * If intra_quant_matrix_flag set, parse off intra quant matrix values. */ get_bits1(data); if (data) { for (i = 0; i < 64; i++) { get_bits8(data); vid_stream->intra_quant_matrix[zigzag[i][1]][zigzag[i][0]] = (unsigned char) data; } } /* * If non intra quant matrix flag set, parse off non intra quant matrix * values. */ get_bits1(data); if (data) { for (i = 0; i < 64; i++) { get_bits8(data); vid_stream->non_intra_quant_matrix[zigzag[i][1]][zigzag[i][0]] = (unsigned char) data; } } /* Adjust noise base matrix according to non_intra matrix */ for( i = 0; i < 8; i++ ) for( j = 0; j < 8; j++ ) vid_stream->noise_base_matrix[i][j] = (short) vid_stream->non_intra_quant_matrix[i][j]; j_rev_dct((short *) vid_stream->noise_base_matrix); for( i = 0; i < 8; i++ ) for( j = 0; j < 8; j++ ) vid_stream->noise_base_matrix[i][j] *= vid_stream->noise_base_matrix[i][j]; /* Go to next start code. */ next_start_code(vid_stream); /* * If next start code is extension start code, parse off extension data. */ if (next_bits(32, EXT_START_CODE, vid_stream)) { flush_bits32; if (vid_stream->ext_data != NULL) { free(vid_stream->ext_data); vid_stream->ext_data = NULL; } vid_stream->ext_data = get_ext_data(vid_stream); } /* If next start code is user start code, parse off user data. */ if (next_bits(32, USER_START_CODE, vid_stream)) { flush_bits32; if (vid_stream->user_data != NULL) { free(vid_stream->user_data); vid_stream->user_data = NULL; } vid_stream->user_data = get_ext_data(vid_stream); } return PARSE_OK; } /* *-------------------------------------------------------------- * * ParseGOP -- * * Parses of group of pictures header from bit stream * associated with vid_stream. * * Results: * Values in gop header placed into video stream structure. * * Side effects: * Bit stream irreversibly parsed. * *-------------------------------------------------------------- */ static int ParseGOP( VidStream* vid_stream ) { unsigned int data; /* Flush group of pictures start code. */ flush_bits32; /* Parse off drop frame flag. */ get_bits1(data); if (data) { vid_stream->group.drop_flag = TRUE; } else vid_stream->group.drop_flag = FALSE; /* Parse off hour component of time code. */ get_bits5(data); vid_stream->group.tc_hours = data; /* Parse off minute component of time code. */ get_bits6(data); vid_stream->group.tc_minutes = data; /* Flush marker bit. */ flush_bits(1); /* Parse off second component of time code. */ get_bits6(data); vid_stream->group.tc_seconds = data; /* Parse off picture count component of time code. */ get_bits6(data); vid_stream->group.tc_pictures = data; /* Parse off closed gop and broken link flags. */ get_bits2(data); if (data > 1) { vid_stream->group.closed_gop = TRUE; if (data > 2) { vid_stream->group.broken_link = TRUE; } else vid_stream->group.broken_link = FALSE; } else { vid_stream->group.closed_gop = FALSE; if (data) { vid_stream->group.broken_link = TRUE; } else vid_stream->group.broken_link = FALSE; } /* Goto next start code. */ next_start_code(vid_stream); /* If next start code is extension data, parse off extension data. */ if (next_bits(32, EXT_START_CODE, vid_stream)) { flush_bits32; if (vid_stream->group.ext_data != NULL) { free(vid_stream->group.ext_data); vid_stream->group.ext_data = NULL; } vid_stream->group.ext_data = get_ext_data(vid_stream); } /* If next start code is user data, parse off user data. */ if (next_bits(32, USER_START_CODE,vid_stream)) { flush_bits32; if (vid_stream->group.user_data != NULL) { free(vid_stream->group.user_data); vid_stream->group.user_data = NULL; } vid_stream->group.user_data = get_ext_data(vid_stream); } return PARSE_OK; } /* *-------------------------------------------------------------- * * ParsePicture -- * * Parses picture header. Marks picture to be presented * at particular time given a time stamp. * * Results: * Values from picture header put into video stream structure. * * Side effects: * Bit stream irreversibly parsed. * *-------------------------------------------------------------- */ static int ParsePicture( VidStream* vid_stream, TimeStamp time_stamp ) { unsigned int data; int i; /* Flush header start code. */ flush_bits32; /* This happens if there is a picture code before a sequence start */ if (vid_stream->ring[0] == NULL) { printf("Warning: picture block before sequence header block\n"); return SKIP_PICTURE; } /* Parse off temporal reference. */ get_bits10(data); vid_stream->picture.temp_ref = data; /* Parse of picture type. */ get_bits3(data); vid_stream->picture.code_type = data; if ((vid_stream->picture.code_type == B_TYPE) && ((vid_stream->future == NULL) || ((vid_stream->past == NULL) && !(vid_stream->group.closed_gop)))) /* According to 2-D.5.1 (p D-18) this is ok, if the refereneces are OK */ return SKIP_PICTURE; if ((vid_stream->picture.code_type == P_TYPE) && (vid_stream->future == NULL)) return SKIP_PICTURE; #ifdef ANALYSIS StartTime(); stat_a[0].frametype = vid_stream->picture.code_type; stat_a[0].number = 1; stat_a[0].totsize = 45; pictureSizeCount = bitCountRead(); #endif /* Parse off vbv buffer delay value. */ get_bits16(data); vid_stream->picture.vbv_delay = data; /* If P or B type frame... */ if ((vid_stream->picture.code_type == P_TYPE) || (vid_stream->picture.code_type == B_TYPE)) { /* Parse off forward vector full pixel flag. */ get_bits1(data); if (data) { vid_stream->picture.full_pel_forw_vector = TRUE; } else { vid_stream->picture.full_pel_forw_vector = FALSE; } /* Parse of forw_r_code. */ get_bits3(data); /* Decode forw_r_code into forw_r_size and forw_f. */ vid_stream->picture.forw_r_size = data - 1; vid_stream->picture.forw_f = (1 << vid_stream->picture.forw_r_size); } /* If B type frame... */ if (vid_stream->picture.code_type == B_TYPE) { /* Parse off back vector full pixel flag. */ get_bits1(data); if (data) vid_stream->picture.full_pel_back_vector = TRUE; else vid_stream->picture.full_pel_back_vector = FALSE; /* Parse off back_r_code. */ get_bits3(data); /* Decode back_r_code into back_r_size and back_f. */ vid_stream->picture.back_r_size = data - 1; vid_stream->picture.back_f = (1 << vid_stream->picture.back_r_size); } /* Get extra bit picture info. */ if (vid_stream->picture.extra_info != NULL) { free(vid_stream->picture.extra_info); vid_stream->picture.extra_info = NULL; } vid_stream->picture.extra_info = get_extra_bit_info(vid_stream); /* Goto next start code. */ next_start_code(vid_stream); /* If start code is extension start code, parse off extension data. */ if (next_bits(32, EXT_START_CODE, vid_stream)) { flush_bits32; if (vid_stream->picture.ext_data != NULL) { free(vid_stream->picture.ext_data); vid_stream->picture.ext_data = NULL; } vid_stream->picture.ext_data = get_ext_data(vid_stream); } /* If start code is user start code, parse off user data. */ if (next_bits(32, USER_START_CODE, vid_stream)) { flush_bits32; if (vid_stream->picture.user_data != NULL) { free(vid_stream->picture.user_data); vid_stream->picture.user_data = NULL; } vid_stream->picture.user_data = get_ext_data(vid_stream); } /* Find a pict image structure in ring buffer not currently locked. */ i = 0; while (vid_stream->ring[i]->locked != 0) { if (++i >= RING_BUF_SIZE) { perror("Fatal error. Ring buffer full."); exit(1); } } /* Set current pict image structure to the one just found in ring. */ vid_stream->current = vid_stream->ring[i]; /* Set time stamp. */ vid_stream->current->show_time = time_stamp; /* Reset past macroblock address field. */ vid_stream->mblock.past_mb_addr = -1; #ifdef USE_ATI int back, forw, current; back = forw = -1; current = i; /* Look for indexes of future and past frames */ for(i = 0; i < RING_BUF_SIZE; i++) { if(vid_stream->future == vid_stream->ring[i]) forw = i; if(vid_stream->past == vid_stream->ring[i]) back = i; } /* Start decoding a new frame */ switch(vid_stream->picture.code_type) { case B_TYPE: vhar128_newdecode(vid_stream->ati_handle, forw, back, current); break; case P_TYPE: vhar128_newdecode(vid_stream->ati_handle, -1, forw, current); break; case I_TYPE: vhar128_newdecode(vid_stream->ati_handle, -1, -1, current); break; } #endif return PARSE_OK; } /* *-------------------------------------------------------------- * * ParseSlice -- * * Parses off slice header. * * Results: * Values found in slice header put into video stream structure. * * Side effects: * Bit stream irreversibly parsed. * *-------------------------------------------------------------- */ static int ParseSlice( VidStream* vid_stream ) { unsigned int data; /* Flush slice start code. */ flush_bits(24); /* Parse off slice vertical position. */ get_bits8(data); vid_stream->slice.vert_pos = data; /* Parse off quantization scale. */ get_bits5(data); vid_stream->slice.quant_scale = data; /* Parse off extra bit slice info. */ if (vid_stream->slice.extra_info != NULL) { free(vid_stream->slice.extra_info); vid_stream->slice.extra_info = NULL; } vid_stream->slice.extra_info = get_extra_bit_info(vid_stream); /* Reset past intrablock address. */ vid_stream->mblock.past_intra_addr = -2; /* Reset previous recon motion vectors. */ vid_stream->mblock.recon_right_for_prev = 0; vid_stream->mblock.recon_down_for_prev = 0; vid_stream->mblock.recon_right_back_prev = 0; vid_stream->mblock.recon_down_back_prev = 0; /* Reset macroblock address. */ vid_stream->mblock.mb_address = ((vid_stream->slice.vert_pos - 1) * vid_stream->mb_width) - 1; /* Reset past dct dc y, cr, and cb values. */ #ifdef USE_ATI vid_stream->block.dct_dc_y_past = 0; vid_stream->block.dct_dc_cr_past = 0; vid_stream->block.dct_dc_cb_past = 0; #else vid_stream->block.dct_dc_y_past = 1024 << 3; vid_stream->block.dct_dc_cr_past = 1024 << 3; vid_stream->block.dct_dc_cb_past = 1024 << 3; #endif return PARSE_OK; } /* *-------------------------------------------------------------- * * ParseMacroBlock -- * * Parseoff macroblock. Reconstructs DCT values. Applies * inverse DCT, reconstructs motion vectors, calculates and * set pixel values for macroblock in current pict image * structure. * * Results: * Here's where everything really happens. Welcome to the * heart of darkness. * * Side effects: * Bit stream irreversibly parsed off. * *-------------------------------------------------------------- */ static int ParseMacroBlock( VidStream* vid_stream ) { int addr_incr; unsigned int data; int mask, i, recon_right_for, recon_down_for, recon_right_back, recon_down_back; int zero_block_flag; BOOLEAN mb_quant = 0, mb_motion_forw = 0, mb_motion_back = 0, mb_pattern = 0; #ifndef DISABLE_DITHER int no_dith_flag = 0; int ditherType = vid_stream->ditherType; #endif #ifdef ANALYSIS mbSizeCount = bitCountRead(); #endif #ifdef USE_ATI /* Empty macroblock */ vid_stream->block.dct_recon[0][0] = 0xFFFFFFFF; vid_stream->block.dct_recon[1][0] = 0xFFFFFFFF; vid_stream->block.dct_recon[2][0] = 0xFFFFFFFF; vid_stream->block.dct_recon[3][0] = 0xFFFFFFFF; vid_stream->block.dct_recon[4][0] = 0xFFFFFFFF; vid_stream->block.dct_recon[5][0] = 0xFFFFFFFF; #endif /* * Parse off macroblock address increment and add to macroblock address. */ do { unsigned int ind; show_bits11(ind); DecodeMBAddrInc(addr_incr); if (mb_addr_inc[ind].num_bits==0) { addr_incr = 1; } if (addr_incr == MB_ESCAPE) { vid_stream->mblock.mb_address += 33; addr_incr = MB_STUFFING; } } while (addr_incr == MB_STUFFING); vid_stream->mblock.mb_address += addr_incr; if( vid_stream->mblock.mb_address > (int) (vid_stream->mb_height * vid_stream->mb_width - 1) ) return SKIP_TO_START_CODE; if( vid_stream->mblock.mb_address < 0 ) return SKIP_TO_START_CODE; /* * If macroblocks have been skipped, process skipped macroblocks. */ if (vid_stream->mblock.mb_address - vid_stream->mblock.past_mb_addr > 1) { if (vid_stream->picture.code_type == P_TYPE) ProcessSkippedPFrameMBlocks(vid_stream); else if (vid_stream->picture.code_type == B_TYPE) ProcessSkippedBFrameMBlocks(vid_stream); } /* Set past macroblock address to current macroblock address. */ vid_stream->mblock.past_mb_addr = vid_stream->mblock.mb_address; /* Based on picture type decode macroblock type. */ switch (vid_stream->picture.code_type) { case I_TYPE: DecodeMBTypeI(mb_quant, mb_motion_forw, mb_motion_back, mb_pattern, vid_stream->mblock.mb_intra); break; case P_TYPE: DecodeMBTypeP(mb_quant, mb_motion_forw, mb_motion_back, mb_pattern, vid_stream->mblock.mb_intra); break; case B_TYPE: DecodeMBTypeB(mb_quant, mb_motion_forw, mb_motion_back, mb_pattern, vid_stream->mblock.mb_intra); break; case D_TYPE: fprintf(stderr, "ERROR: MPEG-1 Streams with D-frames are not supported\n"); exit(1); } /* If quantization flag set, parse off new quantization scale. */ if (mb_quant == TRUE) { get_bits5(data); vid_stream->slice.quant_scale = data; } /* If forward motion vectors exist... */ if (mb_motion_forw == TRUE) { /* Parse off and decode horizontal forward motion vector. */ DecodeMotionVectors(vid_stream->mblock.motion_h_forw_code); /* If horiz. forward r data exists, parse off. */ if ((vid_stream->picture.forw_f != 1) && (vid_stream->mblock.motion_h_forw_code != 0)) { get_bitsn(vid_stream->picture.forw_r_size, data); vid_stream->mblock.motion_h_forw_r = data; } /* Parse off and decode vertical forward motion vector. */ DecodeMotionVectors(vid_stream->mblock.motion_v_forw_code); /* If vert. forw. r data exists, parse off. */ if ((vid_stream->picture.forw_f != 1) && (vid_stream->mblock.motion_v_forw_code != 0)) { get_bitsn(vid_stream->picture.forw_r_size, data); vid_stream->mblock.motion_v_forw_r = data; } } /* If back motion vectors exist... */ if (mb_motion_back == TRUE) { /* Parse off and decode horiz. back motion vector. */ DecodeMotionVectors(vid_stream->mblock.motion_h_back_code); /* If horiz. back r data exists, parse off. */ if ((vid_stream->picture.back_f != 1) && (vid_stream->mblock.motion_h_back_code != 0)) { get_bitsn(vid_stream->picture.back_r_size, data); vid_stream->mblock.motion_h_back_r = data; } /* Parse off and decode vert. back motion vector. */ DecodeMotionVectors(vid_stream->mblock.motion_v_back_code); /* If vert. back r data exists, parse off. */ if ((vid_stream->picture.back_f != 1) && (vid_stream->mblock.motion_v_back_code != 0)) { get_bitsn(vid_stream->picture.back_r_size, data); vid_stream->mblock.motion_v_back_r = data; } } #ifdef ANALYSIS if (vid_stream->mblock.mb_intra) { stat_a[0].i_mbnum++; mbCBPPtr = stat_a[0].i_mbcbp; mbCoeffPtr = stat_a[0].i_mbcoeff; mbSizePtr = &(stat_a[0].i_mbsize); } else if (mb_motion_back && mb_motion_forw) { stat_a[0].bi_mbnum++; mbCBPPtr = stat_a[0].bi_mbcbp; mbCoeffPtr = stat_a[0].bi_mbcoeff; mbSizePtr = &(stat_a[0].bi_mbsize); } else if (mb_motion_back) { stat_a[0].b_mbnum++; mbCBPPtr = stat_a[0].b_mbcbp; mbCoeffPtr = stat_a[0].b_mbcoeff; mbSizePtr = &(stat_a[0].b_mbsize); } else { stat_a[0].p_mbnum++; mbCBPPtr = stat_a[0].p_mbcbp; mbCoeffPtr = stat_a[0].p_mbcoeff; mbSizePtr = &(stat_a[0].p_mbsize); } #endif /* If mblock pattern flag set, parse and decode CBP (code block pattern). */ if (mb_pattern == TRUE) { DecodeCBP(vid_stream->mblock.cbp); } /* Otherwise, set CBP to zero. */ else vid_stream->mblock.cbp = 0; #ifdef ANALYSIS mbCBPPtr[vid_stream->mblock.cbp]++; #endif /* Reconstruct motion vectors depending on picture type. */ if (vid_stream->picture.code_type == P_TYPE) { /* * If no forw motion vectors, reset previous and current vectors to 0. */ if (!mb_motion_forw) { recon_right_for = 0; recon_down_for = 0; vid_stream->mblock.recon_right_for_prev = 0; vid_stream->mblock.recon_down_for_prev = 0; } /* * Otherwise, compute new forw motion vectors. Reset previous vectors to * current vectors. */ else { ComputeForwVector(&recon_right_for, &recon_down_for, vid_stream); } } if (vid_stream->picture.code_type == B_TYPE) { /* Reset prev. and current vectors to zero if mblock is intracoded. */ if (vid_stream->mblock.mb_intra) { vid_stream->mblock.recon_right_for_prev = 0; vid_stream->mblock.recon_down_for_prev = 0; vid_stream->mblock.recon_right_back_prev = 0; vid_stream->mblock.recon_down_back_prev = 0; } else { /* If no forw vectors, current vectors equal prev. vectors. */ if (!mb_motion_forw) { recon_right_for = vid_stream->mblock.recon_right_for_prev; recon_down_for = vid_stream->mblock.recon_down_for_prev; } /* * Otherwise compute forw. vectors. Reset prev vectors to new values. */ else { ComputeForwVector(&recon_right_for, &recon_down_for, vid_stream); } /* If no back vectors, set back vectors to prev back vectors. */ if (!mb_motion_back) { recon_right_back = vid_stream->mblock.recon_right_back_prev; recon_down_back = vid_stream->mblock.recon_down_back_prev; } /* Otherwise compute new vectors and reset prev. back vectors. */ else { ComputeBackVector(&recon_right_back, &recon_down_back, vid_stream); } /* * Store vector existence flags in structure for possible skipped * macroblocks to follow. */ vid_stream->mblock.bpict_past_forw = mb_motion_forw; vid_stream->mblock.bpict_past_back = mb_motion_back; } } #ifndef DISABLE_DITHER /* For each possible block in macroblock. */ if (ditherType == GRAY_DITHER || ditherType == GRAY2_DITHER || ditherType == GRAY256_DITHER || ditherType == GRAY2562_DITHER || ditherType == MONO_DITHER || ditherType == MONO_THRESHOLD) { for (mask = 32, i = 0; i < 4; mask >>= 1, i++) { /* If block exists... */ if ((vid_stream->mblock.mb_intra) || (vid_stream->mblock.cbp & mask)) { zero_block_flag = 0; ParseReconBlock(i, vid_stream); } else { zero_block_flag = 1; } /* If macroblock is intra coded... */ if (vid_stream->mblock.mb_intra) { ReconIMBlock(vid_stream, i); } else if (mb_motion_forw && mb_motion_back) { ReconBiMBlock(vid_stream, i, recon_right_for, recon_down_for, recon_right_back, recon_down_back, zero_block_flag); } else if (mb_motion_forw || (vid_stream->picture.code_type == P_TYPE)) { ReconPMBlock(vid_stream, i, recon_right_for, recon_down_for, zero_block_flag); } else if (mb_motion_back) { ReconBMBlock(vid_stream, i, recon_right_back, recon_down_back, zero_block_flag); } } /* Kill the Chrominance blocks... */ if ((vid_stream->mblock.mb_intra) || (vid_stream->mblock.cbp & 0x2)) { ParseAwayBlock(4, vid_stream); } if ((vid_stream->mblock.mb_intra) || (vid_stream->mblock.cbp & 0x1)) { ParseAwayBlock(5, vid_stream); } } else { if ((ditherType == MBORDERED_DITHER) && (vid_stream->mblock.cbp == 0) && (vid_stream->picture.code_type == 3) && (!vid_stream->mblock.mb_intra) && (!(mb_motion_forw && mb_motion_back))) { MBOrderedDitherDisplayCopy(vid_stream, vid_stream->mblock.mb_address, mb_motion_forw, recon_right_for, recon_down_for, mb_motion_back, recon_right_back, recon_down_back, vid_stream->past->display, vid_stream->future->display); vid_stream->ditherFlags[vid_stream->mblock.mb_address] = 0; no_dith_flag = 1; } else { #endif for (mask = 32, i = 0; i < 6; mask >>= 1, i++) { /* If block exists... */ if ((vid_stream->mblock.mb_intra) || (vid_stream->mblock.cbp & mask)) { zero_block_flag = 0; ParseReconBlock(i, vid_stream); } else { zero_block_flag = 1; } #ifndef USE_ATI /* If macroblock is intra coded... */ if (vid_stream->mblock.mb_intra) { ReconIMBlock(vid_stream, i); } else if (mb_motion_forw && mb_motion_back) { ReconBiMBlock(vid_stream, i, recon_right_for, recon_down_for, recon_right_back, recon_down_back, zero_block_flag); } else if (mb_motion_forw || (vid_stream->picture.code_type == P_TYPE)) { ReconPMBlock(vid_stream, i, recon_right_for, recon_down_for, zero_block_flag); } else if (mb_motion_back) { ReconBMBlock(vid_stream, i, recon_right_back, recon_down_back, zero_block_flag); } #endif } #ifdef USE_ATI vhar128_macroblock(vid_stream->ati_handle, (vid_stream->mblock.mb_address % vid_stream->mb_width) << 4, (vid_stream->mblock.mb_address / vid_stream->mb_width) << 4, vid_stream->mblock.mb_intra, mb_motion_back, mb_motion_forw, recon_right_back, recon_down_back, recon_right_for, recon_down_for, vid_stream->block.dct_recon); #endif #ifndef DISABLE_DITHER } } #endif #ifndef DISABLE_DITHER if ((ditherType == MBORDERED_DITHER) && (!no_dith_flag)) { if ((vid_stream->picture.code_type == 2) && (vid_stream->mblock.cbp == 0) && (!vid_stream->mblock.mb_intra)) { MBOrderedDitherDisplayCopy(vid_stream, vid_stream->mblock.mb_address, 1, recon_right_for, recon_down_for, 0, 0, 0, vid_stream->future->display, (unsigned char *) NULL); vid_stream->ditherFlags[vid_stream->mblock.mb_address] = 0; } else { vid_stream->ditherFlags[vid_stream->mblock.mb_address] = 1; } } #endif /* If D Type picture, flush marker bit. */ if (vid_stream->picture.code_type == 4) flush_bits(1); /* If macroblock was intracoded, set macroblock past intra address. */ if (vid_stream->mblock.mb_intra) vid_stream->mblock.past_intra_addr = vid_stream->mblock.mb_address; /* Store macroblock error for filter info */ if (vid_stream->mblock.mb_intra) vid_stream->current->mb_qscale[vid_stream->mblock.mb_address] = 0; else vid_stream->current->mb_qscale[vid_stream->mblock.mb_address] = vid_stream->slice.quant_scale; #ifdef ANALYSIS *mbSizePtr += bitCountRead() - mbSizeCount; #endif return PARSE_OK; } /* software decoder follows */ #ifndef USE_ATI /* *-------------------------------------------------------------- * * ReconIMBlock -- * * Reconstructs intra coded macroblock. * * Results: * None. * * Side effects: * None. * *-------------------------------------------------------------- */ #if defined(USE_CROP_TABLE) && !defined(NDEBUG) /* If people really want to see such things, check 'em */ #define myassert(x,expression)\ if (!(expression)) {\ fprintf (stderr,"Bad crop value (%d) at line %d\n", x, __LINE__);\ next_start_code(vid_stream); return;} #define assertCrop(x) myassert(x,((x) >= -MAX_NEG_CROP) && \ ((x) <= 2048+MAX_NEG_CROP)) #else #define assertCrop(x) #endif static void ReconIMBlock( VidStream* vid_stream, int bnum ) { int mb_row, mb_col, row, col, row_size, rr; unsigned char *dest; /* Calculate macroblock row and column from address. */ mb_row = vid_stream->mblock.mb_address / vid_stream->mb_width; mb_col = vid_stream->mblock.mb_address % vid_stream->mb_width; /* If block is luminance block... */ if (bnum < 4) { /* Calculate row and col values for upper left pixel of block. */ row = mb_row * 16; col = mb_col * 16; if (bnum > 1) row += 8; if (bnum % 2) col += 8; /* Set dest to luminance plane of current pict image. */ dest = vid_stream->current->luminance; /* Establish row size. */ row_size = vid_stream->mb_width * 16; } /* Otherwise if block is Cr block... */ /* Cr first because of the earlier mixup */ else if (bnum == 5) { /* Set dest to Cr plane of current pict image. */ dest = vid_stream->current->Cr; /* Establish row size. */ row_size = vid_stream->mb_width * 8; /* Calculate row,col for upper left pixel of block. */ row = mb_row * 8; col = mb_col * 8; } /* Otherwise block is Cb block, and ... */ else { /* Set dest to Cb plane of current pict image. */ dest = vid_stream->current->Cb; /* Establish row size. */ row_size = vid_stream->mb_width * 8; /* Calculate row,col for upper left pixel value of block. */ row = mb_row * 8; col = mb_col * 8; } /* * For each pixel in block, set to cropped reconstructed value from inverse * dct. */ { short *sp = &vid_stream->block.dct_recon[0][0]; #ifdef USE_CROP_TABLE unsigned char *cm = cropTbl + MAX_NEG_CROP; #endif dest += row * row_size + col; for (rr = 0; rr < 4; rr++, sp += 16, dest += row_size) { dest[0] = crop(sp[0]); assertCrop(sp[0]); dest[1] = crop(sp[1]); assertCrop(sp[1]); dest[2] = crop(sp[2]); assertCrop(sp[2]); dest[3] = crop(sp[3]); assertCrop(sp[3]); dest[4] = crop(sp[4]); assertCrop(sp[4]); dest[5] = crop(sp[5]); assertCrop(sp[5]); dest[6] = crop(sp[6]); assertCrop(sp[6]); dest[7] = crop(sp[7]); assertCrop(sp[7]); dest += row_size; dest[0] = crop(sp[8]); assertCrop(sp[8]); dest[1] = crop(sp[9]); assertCrop(sp[9]); dest[2] = crop(sp[10]); assertCrop(sp[10]); dest[3] = crop(sp[11]); assertCrop(sp[11]); dest[4] = crop(sp[12]); assertCrop(sp[12]); dest[5] = crop(sp[13]); assertCrop(sp[13]); dest[6] = crop(sp[14]); assertCrop(sp[14]); dest[7] = crop(sp[15]); assertCrop(sp[15]); } } } /* *-------------------------------------------------------------- * * ReconPMBlock -- * * Reconstructs forward predicted macroblocks. * * Results: * None. * * Side effects: * None. * *-------------------------------------------------------------- */ static void ReconPMBlock( VidStream* vid_stream, int bnum, int recon_right_for, int recon_down_for, int zflag ) { int mb_row, mb_col, row, col, row_size, rr; unsigned char *dest, *past = 0; unsigned char *rindex1, *rindex2, *rindex3, *rindex4; unsigned char *index; short int *blockvals; #ifdef LOOSE_MPEG int maxx, maxy, cc; int illegalBlock = 0; int row_start, row_end, rfirst, rlast, col_start, col_end, cfirst, clast; #endif /* Calculate macroblock row and column from address. */ mb_row = vid_stream->mblock.mb_address / vid_stream->mb_width; mb_col = vid_stream->mblock.mb_address % vid_stream->mb_width; if (bnum < 4) { /* Calculate right_for, down_for motion vectors. */ vid_stream->right_for = recon_right_for >> 1; vid_stream->down_for = recon_down_for >> 1; vid_stream->right_half_for = recon_right_for & 0x1; vid_stream->down_half_for = recon_down_for & 0x1; /* Set dest to luminance plane of current pict image. */ dest = vid_stream->current->luminance; if (vid_stream->picture.code_type == B_TYPE) { if (vid_stream->past != NULL) past = vid_stream->past->luminance; } else { /* Set predictive frame to current future frame. */ if (vid_stream->future != NULL) past = vid_stream->future->luminance; } /* Establish row size. */ row_size = vid_stream->mb_width << 4; /* Calculate row,col of upper left pixel in block. */ row = mb_row << 4; col = mb_col << 4; if (bnum > 1) row += 8; if (bnum % 2) col += 8; #ifdef LOOSE_MPEG /* Check for block illegality. */ maxx = vid_stream->mb_width*16-1; maxy = vid_stream->mb_height*16-1; if (row + vid_stream->down_for + vid_stream->down_half_for + 7 > maxy) illegalBlock |= 0x4; else if (row + vid_stream->down_for < 0) illegalBlock |= 0x1; if (col + vid_stream->right_for + vid_stream->right_half_for + 7 > maxx) illegalBlock |= 0x2; else if (col + vid_stream->right_for < 0) illegalBlock |= 0x8; #endif } /* Otherwise, block is NOT luminance block, ... */ else { /* Construct motion vectors. */ recon_right_for /= 2; recon_down_for /= 2; vid_stream->right_for = recon_right_for >> 1; vid_stream->down_for = recon_down_for >> 1; vid_stream->right_half_for = recon_right_for & 0x1; vid_stream->down_half_for = recon_down_for & 0x1; /* Establish row size. */ row_size = vid_stream->mb_width << 3; /* Calculate row,col of upper left pixel in block. */ row = mb_row << 3; col = mb_col << 3; #ifdef LOOSE_MPEG /* Check for block illegality. */ maxx = vid_stream->mb_width*8-1; maxy = vid_stream->mb_height*8-1; if (row + vid_stream->down_for + vid_stream->down_half_for + 7 > maxy) illegalBlock |= 0x4; else if (row + vid_stream->down_for < 0) illegalBlock |= 0x1; if (col + vid_stream->right_for + vid_stream->right_half_for + 7 > maxx) illegalBlock |= 0x2; else if (col + vid_stream->right_for < 0) illegalBlock |= 0x8; #endif /* If block is Cr block... */ /* 5 first because order was mixed up in earlier versions */ if (bnum == 5) { /* Set dest to Cr plane of current pict image. */ dest = vid_stream->current->Cr; if (vid_stream->picture.code_type == B_TYPE) { if (vid_stream->past != NULL) past = vid_stream->past->Cr; } else { if (vid_stream->future != NULL) past = vid_stream->future->Cr; } } /* Otherwise, block is Cb block... */ else { /* Set dest to Cb plane of current pict image. */ dest = vid_stream->current->Cb; if (vid_stream->picture.code_type == B_TYPE) { if (vid_stream->past != NULL) past = vid_stream->past->Cb; } else { if (vid_stream->future != NULL) past = vid_stream->future->Cb; } } } /* For each pixel in block... */ #ifdef LOOSE_MPEG if (illegalBlock) { if (illegalBlock & 0x1) { row_start = 0; row_end = row+vid_stream->down_for+8; rfirst = rlast = 8 - row_end; } else if (illegalBlock & 0x4) { row_start = row + vid_stream->down_for; row_end = maxy+1; rlast = row_end - row_start - 1; rfirst = 0; } else { row_start = row+vid_stream->down_for; row_end = row_start+8; rfirst = 0; } if (illegalBlock & 0x8) { col_start = 0; col_end = col + vid_stream->right_for + 8; cfirst = clast = 8 - col_end; } else if (illegalBlock & 0x2) { col_start = col + vid_stream->right_for; col_end = maxx + 1; clast = col_end - col_start - 1; cfirst = 0; } else { col_start = col + vid_stream->right_for; col_end = col_start + 8; cfirst = 0; } for (rr = row_start; rr < row_end; rr++) { rindex1 = past + (rr * row_size) + col_start; index = dest + ((row + rfirst) * row_size) + col + cfirst; for (cc = col_start; cc < col_end; cc++) { *index++ = *rindex1++; } } if (illegalBlock & 0x1) { for (rr = rlast -1; rr >=0; rr--) { index = dest + ((row + rr) * row_size) + col; rindex1 = dest + ((row + rlast) * row_size) + col; for (cc = 0; cc < 8; cc ++) { *index++ = *rindex1++; } } } else if (illegalBlock & 0x4) { for (rr = rlast+1; rr < 8; rr++) { index = dest + ((row + rr) * row_size) + col; rindex1 = dest + ((row + rlast) * row_size) + col; for (cc = 0; cc < 8; cc ++) { *index++ = *rindex1++; } } } if (illegalBlock & 0x2) { for (cc = clast+1; cc < 8; cc++) { index = dest + (row * row_size) + (col + cc); rindex1 = dest + (row * row_size) + (col + clast); for (rr = 0; rr < 8; rr++) { *index = *rindex1; index += row_size; rindex1 += row_size; } } } else if (illegalBlock & 0x8) { for (cc = clast-1; cc >= 0; cc--) { index = dest + (row * row_size) + (col + cc); rindex1 = dest + (row * row_size) + (col + clast); for (rr = 0; rr < 8; rr++) { *index = *rindex1; index += row_size; rindex1 += row_size; } } } if (!zflag) { for (rr = 0; rr < 8; rr++) { index = dest + (row*row_size) + col; blockvals = &(vid_stream->block.dct_recon[rr][0]); index[0] += blockvals[0]; index[1] += blockvals[1]; index[2] += blockvals[2]; index[3] += blockvals[3]; index[4] += blockvals[4]; index[5] += blockvals[5]; index[6] += blockvals[6]; index[7] += blockvals[7]; } } } else { #endif index = dest + (row * row_size) + col; rindex1 = past + (row + vid_stream->down_for) * row_size + col + vid_stream->right_for; blockvals = &(vid_stream->block.dct_recon[0][0]); /* * Calculate predictive pixel value based on motion vectors and copy to * dest plane. */ if ((!vid_stream->down_half_for) && (!vid_stream->right_half_for)) { #ifdef USE_CROP_TABLE unsigned char *cm = cropTbl + MAX_NEG_CROP; #endif if (!zflag) for (rr = 0; rr < 4; rr++) { index[0] = crop((int) rindex1[0] + (int) blockvals[0]); index[1] = crop((int) rindex1[1] + (int) blockvals[1]); index[2] = crop((int) rindex1[2] + (int) blockvals[2]); index[3] = crop((int) rindex1[3] + (int) blockvals[3]); index[4] = crop((int) rindex1[4] + (int) blockvals[4]); index[5] = crop((int) rindex1[5] + (int) blockvals[5]); index[6] = crop((int) rindex1[6] + (int) blockvals[6]); index[7] = crop((int) rindex1[7] + (int) blockvals[7]); index += row_size; rindex1 += row_size; index[0] = crop((int) rindex1[0] + (int) blockvals[8]); index[1] = crop((int) rindex1[1] + (int) blockvals[9]); index[2] = crop((int) rindex1[2] + (int) blockvals[10]); index[3] = crop((int) rindex1[3] + (int) blockvals[11]); index[4] = crop((int) rindex1[4] + (int) blockvals[12]); index[5] = crop((int) rindex1[5] + (int) blockvals[13]); index[6] = crop((int) rindex1[6] + (int) blockvals[14]); index[7] = crop((int) rindex1[7] + (int) blockvals[15]); blockvals += 16; index += row_size; rindex1 += row_size; } else { if (vid_stream->right_for & 0x1) { /* No alignment, use bye copy */ for (rr = 0; rr < 4; rr++) { index[0] = rindex1[0]; index[1] = rindex1[1]; index[2] = rindex1[2]; index[3] = rindex1[3]; index[4] = rindex1[4]; index[5] = rindex1[5]; index[6] = rindex1[6]; index[7] = rindex1[7]; index += row_size; rindex1 += row_size; index[0] = rindex1[0]; index[1] = rindex1[1]; index[2] = rindex1[2]; index[3] = rindex1[3]; index[4] = rindex1[4]; index[5] = rindex1[5]; index[6] = rindex1[6]; index[7] = rindex1[7]; index += row_size; rindex1 += row_size; } } else if (vid_stream->right_for & 0x2) { /* Half-word bit aligned, use 16 bit copy */ short *src = (short *)rindex1; short *dest = (short *)index; row_size >>= 1; for (rr = 0; rr < 4; rr++) { dest[0] = src[0]; dest[1] = src[1]; dest[2] = src[2]; dest[3] = src[3]; dest += row_size; src += row_size; dest[0] = src[0]; dest[1] = src[1]; dest[2] = src[2]; dest[3] = src[3]; dest += row_size; src += row_size; } } else { /* Word aligned, use 32 bit copy */ int *src = (int *)rindex1; int *dest = (int *)index; row_size >>= 2; for (rr = 0; rr < 4; rr++) { dest[0] = src[0]; dest[1] = src[1]; dest += row_size; src += row_size; dest[0] = src[0]; dest[1] = src[1]; dest += row_size; src += row_size; } } } } else { #ifdef USE_CROP_TABLE unsigned char *cm = cropTbl + MAX_NEG_CROP; #endif rindex2 = rindex1 + vid_stream->right_half_for + (vid_stream->down_half_for * row_size); /* if one of the two is zero, then quality makes no difference */ if ((!vid_stream->right_half_for) || (!vid_stream->down_half_for) || (!qualityFlag)) { if (!zflag) { for (rr = 0; rr < 4; rr++) { index[0] = crop(((int) (rindex1[0] + rindex2[0] + 1) >> 1) + blockvals[0]); index[1] = crop(((int) (rindex1[1] + rindex2[1] + 1) >> 1) + blockvals[1]); index[2] = crop(((int) (rindex1[2] + rindex2[2] + 1) >> 1) + blockvals[2]); index[3] = crop(((int) (rindex1[3] + rindex2[3] + 1) >> 1) + blockvals[3]); index[4] = crop(((int) (rindex1[4] + rindex2[4] + 1) >> 1) + blockvals[4]); index[5] = crop(((int) (rindex1[5] + rindex2[5] + 1) >> 1) + blockvals[5]); index[6] = crop(((int) (rindex1[6] + rindex2[6] + 1) >> 1) + blockvals[6]); index[7] = crop(((int) (rindex1[7] + rindex2[7] + 1) >> 1) + blockvals[7]); index += row_size; rindex1 += row_size; rindex2 += row_size; index[0] = crop(((int) (rindex1[0] + rindex2[0] + 1) >> 1) + blockvals[8]); index[1] = crop(((int) (rindex1[1] + rindex2[1] + 1) >> 1) + blockvals[9]); index[2] = crop(((int) (rindex1[2] + rindex2[2] + 1) >> 1) + blockvals[10]); index[3] = crop(((int) (rindex1[3] + rindex2[3] + 1) >> 1) + blockvals[11]); index[4] = crop(((int) (rindex1[4] + rindex2[4] + 1) >> 1) + blockvals[12]); index[5] = crop(((int) (rindex1[5] + rindex2[5] + 1) >> 1) + blockvals[13]); index[6] = crop(((int) (rindex1[6] + rindex2[6] + 1) >> 1) + blockvals[14]); index[7] = crop(((int) (rindex1[7] + rindex2[7] + 1) >> 1) + blockvals[15]); blockvals += 16; index += row_size; rindex1 += row_size; rindex2 += row_size; } } else { /* zflag */ for (rr = 0; rr < 8; rr++) { index[0] = (int) (rindex1[0] + rindex2[0] + 1) >> 1; index[1] = (int) (rindex1[1] + rindex2[1] + 1) >> 1; index[2] = (int) (rindex1[2] + rindex2[2] + 1) >> 1; index[3] = (int) (rindex1[3] + rindex2[3] + 1) >> 1; index[4] = (int) (rindex1[4] + rindex2[4] + 1) >> 1; index[5] = (int) (rindex1[5] + rindex2[5] + 1) >> 1; index[6] = (int) (rindex1[6] + rindex2[6] + 1) >> 1; index[7] = (int) (rindex1[7] + rindex2[7] + 1) >> 1; index += row_size; rindex1 += row_size; rindex2 += row_size; } } } else { /* qualityFlag on and both vectors are non-zero */ rindex3 = rindex1 + vid_stream->right_half_for; rindex4 = rindex1 + (vid_stream->down_half_for * row_size); if (!zflag) { for (rr = 0; rr < 4; rr++) { index[0] = crop(((int) (rindex1[0] + rindex2[0] + rindex3[0] + rindex4[0] + 2) >> 2) + blockvals[0]); index[1] = crop(((int) (rindex1[1] + rindex2[1] + rindex3[1] + rindex4[1] + 2) >> 2) + blockvals[1]); index[2] = crop(((int) (rindex1[2] + rindex2[2] + rindex3[2] + rindex4[2] + 2) >> 2) + blockvals[2]); index[3] = crop(((int) (rindex1[3] + rindex2[3] + rindex3[3] + rindex4[3] + 2) >> 2) + blockvals[3]); index[4] = crop(((int) (rindex1[4] + rindex2[4] + rindex3[4] + rindex4[4] + 2) >> 2) + blockvals[4]); index[5] = crop(((int) (rindex1[5] + rindex2[5] + rindex3[5] + rindex4[5] + 2) >> 2) + blockvals[5]); index[6] = crop(((int) (rindex1[6] + rindex2[6] + rindex3[6] + rindex4[6] + 2) >> 2) + blockvals[6]); index[7] = crop(((int) (rindex1[7] + rindex2[7] + rindex3[7] + rindex4[7] + 2) >> 2) + blockvals[7]); index += row_size; rindex1 += row_size; rindex2 += row_size; rindex3 += row_size; rindex4 += row_size; index[0] = crop(((int) (rindex1[0] + rindex2[0] + rindex3[0] + rindex4[0] + 2) >> 2) + blockvals[8]); index[1] = crop(((int) (rindex1[1] + rindex2[1] + rindex3[1] + rindex4[1] + 2) >> 2) + blockvals[9]); index[2] = crop(((int) (rindex1[2] + rindex2[2] + rindex3[2] + rindex4[2] + 2) >> 2) + blockvals[10]); index[3] = crop(((int) (rindex1[3] + rindex2[3] + rindex3[3] + rindex4[3] + 2) >> 2) + blockvals[11]); index[4] = crop(((int) (rindex1[4] + rindex2[4] + rindex3[4] + rindex4[4] + 2) >> 2) + blockvals[12]); index[5] = crop(((int) (rindex1[5] + rindex2[5] + rindex3[5] + rindex4[5] + 2) >> 2) + blockvals[13]); index[6] = crop(((int) (rindex1[6] + rindex2[6] + rindex3[6] + rindex4[6] + 2) >> 2) + blockvals[14]); index[7] = crop(((int) (rindex1[7] + rindex2[7] + rindex3[7] + rindex4[7] + 2) >> 2) + blockvals[15]); blockvals += 16; index += row_size; rindex1 += row_size; rindex2 += row_size; rindex3 += row_size; rindex4 += row_size; } } else { /* zflag */ for (rr = 0; rr < 8; rr++) { index[0] = (int) (rindex1[0] + rindex2[0] + rindex3[0] + rindex4[0] + 2) >> 2; index[1] = (int) (rindex1[1] + rindex2[1] + rindex3[1] + rindex4[1] + 2) >> 2; index[2] = (int) (rindex1[2] + rindex2[2] + rindex3[2] + rindex4[2] + 2) >> 2; index[3] = (int) (rindex1[3] + rindex2[3] + rindex3[3] + rindex4[3] + 2) >> 2; index[4] = (int) (rindex1[4] + rindex2[4] + rindex3[4] + rindex4[4] + 2) >> 2; index[5] = (int) (rindex1[5] + rindex2[5] + rindex3[5] + rindex4[5] + 2) >> 2; index[6] = (int) (rindex1[6] + rindex2[6] + rindex3[6] + rindex4[6] + 2) >> 2; index[7] = (int) (rindex1[7] + rindex2[7] + rindex3[7] + rindex4[7] + 2) >> 2; index += row_size; rindex1 += row_size; rindex2 += row_size; rindex3 += row_size; rindex4 += row_size; } } } } #ifdef LOOSE_MPEG } #endif } /* *-------------------------------------------------------------- * * ReconBMBlock -- * * Reconstructs back predicted macroblocks. * * Results: * None. * * Side effects: * None. * *-------------------------------------------------------------- */ static void ReconBMBlock( VidStream* vid_stream, int bnum, int recon_right_back, int recon_down_back, int zflag ) { int mb_row, mb_col, row, col, row_size, rr; unsigned char *dest, *future = 0; int right_back, down_back, right_half_back, down_half_back; unsigned char *rindex1, *rindex2, *rindex3, *rindex4; unsigned char *index; short int *blockvals; #ifdef LOOSE_MPEG int illegalBlock = 0; int maxx, maxy, cc; int row_start, row_end, rlast, rfirst, col_start, col_end, clast, cfirst; #endif /* Calculate macroblock row and column from address. */ mb_row = vid_stream->mblock.mb_address / vid_stream->mb_width; mb_col = vid_stream->mblock.mb_address % vid_stream->mb_width; /* If block is luminance block... */ if (bnum < 4) { /* Calculate right_back, down_back motion vectors. */ right_back = recon_right_back >> 1; down_back = recon_down_back >> 1; right_half_back = recon_right_back & 0x1; down_half_back = recon_down_back & 0x1; /* Set dest to luminance plane of current pict image. */ dest = vid_stream->current->luminance; /* * If future frame exists, set future to luminance plane of future frame. */ if (vid_stream->future != NULL) future = vid_stream->future->luminance; /* Establish row size. */ row_size = vid_stream->mb_width << 4; /* Calculate row,col of upper left pixel in block. */ row = mb_row << 4; col = mb_col << 4; if (bnum > 1) row += 8; if (bnum % 2) col += 8; #ifdef LOOSE_MPEG /* Check for block illegality. */ maxx = vid_stream->mb_width*16-1; maxy = vid_stream->mb_height*16-1; if (row + down_back + down_half_back + 7 > maxy) illegalBlock |= 0x4; else if (row + down_back < 0) illegalBlock |= 0x1; if (col + right_back + right_half_back + 7 > maxx) illegalBlock |= 0x2; else if (col + right_back < 0) illegalBlock |= 0x8; #endif } /* Otherwise, block is NOT luminance block, ... */ else { /* Construct motion vectors. */ recon_right_back /= 2; recon_down_back /= 2; right_back = recon_right_back >> 1; down_back = recon_down_back >> 1; right_half_back = recon_right_back & 0x1; down_half_back = recon_down_back & 0x1; /* Establish row size. */ row_size = vid_stream->mb_width << 3; /* Calculate row,col of upper left pixel in block. */ row = mb_row << 3; col = mb_col << 3; #ifdef LOOSE_MPEG /* Check for block illegality. */ maxx = vid_stream->mb_width*8-1; maxy = vid_stream->mb_height*8-1; if (row + down_back + down_half_back + 7 > maxy) illegalBlock |= 0x4; else if (row + down_back < 0) illegalBlock |= 0x1; if (col + right_back + right_half_back + 7 > maxx) illegalBlock |= 0x2; else if (col + right_back < 0) illegalBlock |= 0x8; #endif /* If block is Cr block... */ /* They were switched earlier, so 5 is first - eyhung */ if (bnum == 5) { /* Set dest to Cr plane of current pict image. */ dest = vid_stream->current->Cr; /* * If future frame exists, set future to Cr plane of future image. */ if (vid_stream->future != NULL) future = vid_stream->future->Cr; } /* Otherwise, block is Cb block... */ else { /* Set dest to Cb plane of current pict image. */ dest = vid_stream->current->Cb; /* * If future frame exists, set future to Cb plane of future frame. */ if (vid_stream->future != NULL) future = vid_stream->future->Cb; } } /* For each pixel in block do... */ #ifdef LOOSE_MPEG if (illegalBlock) { if (illegalBlock & 0x1) { row_start = 0; row_end = row+down_back+8; rfirst = rlast = 8 - row_end; } else if (illegalBlock & 0x4) { row_start = row + down_back; row_end = maxy+1; rlast = row_end - row_start - 1; rfirst = 0; } else { row_start = row+down_back; row_end = row_start+8; rfirst = 0; } if (illegalBlock & 0x8) { col_start = 0; col_end = col + right_back + 8; cfirst = clast = 8 - col_end; } else if (illegalBlock & 0x2) { col_start = col + right_back; col_end = maxx + 1; clast = col_end - col_start - 1; cfirst = 0; } else { col_start = col + right_back; col_end = col_start + 8; cfirst = 0; } for (rr = row_start; rr < row_end; rr++) { rindex1 = future + (rr * row_size) + col_start; index = dest + ((row + rfirst) * row_size) + col + cfirst; for (cc = col_start; cc < col_end; cc++) { *index++ = *rindex1++; } } if (illegalBlock & 0x1) { for (rr = rlast -1; rr >=0; rr--) { index = dest + ((row + rr) * row_size) + col; rindex1 = dest + ((row + rlast) * row_size) + col; for (cc = 0; cc < 8; cc ++) { *index++ = *rindex1++; } } } else if (illegalBlock & 0x4) { for (rr = rlast+1; rr < 8; rr++) { index = dest + ((row + rr) * row_size) + col; rindex1 = dest + ((row + rlast) * row_size) + col; for (cc = 0; cc < 8; cc ++) { *index++ = *rindex1++; } } } if (illegalBlock & 0x2) { for (cc = clast+1; cc < 8; cc++) { index = dest + (row * row_size) + (col + cc); rindex1 = dest + (row * row_size) + (col + clast); for (rr = 0; rr < 8; rr++) { *index = *rindex1; index += row_size; rindex1 += row_size; } } } else if (illegalBlock & 0x8) { for (cc = clast-1; cc >= 0; cc--) { index = dest + (row * row_size) + (col + cc); rindex1 = dest + (row * row_size) + (col + clast); for (rr = 0; rr < 8; rr++) { *index = *rindex1; index += row_size; rindex1 += row_size; } } } if (!zflag) { for (rr = 0; rr < 8; rr++) { index = dest + (row*row_size) + col; blockvals = &(vid_stream->block.dct_recon[rr][0]); index[0] += blockvals[0]; index[1] += blockvals[1]; index[2] += blockvals[2]; index[3] += blockvals[3]; index[4] += blockvals[4]; index[5] += blockvals[5]; index[6] += blockvals[6]; index[7] += blockvals[7]; } } } else { #endif index = dest + (row * row_size) + col; rindex1 = future + (row + down_back) * row_size + col + right_back; blockvals = &(vid_stream->block.dct_recon[0][0]); if ((!right_half_back) && (!down_half_back)) { #ifdef USE_CROP_TABLE unsigned char *cm = cropTbl + MAX_NEG_CROP; #endif if (!zflag) for (rr = 0; rr < 4; rr++) { index[0] = crop((int) rindex1[0] + (int) blockvals[0]); index[1] = crop((int) rindex1[1] + (int) blockvals[1]); index[2] = crop((int) rindex1[2] + (int) blockvals[2]); index[3] = crop((int) rindex1[3] + (int) blockvals[3]); index[4] = crop((int) rindex1[4] + (int) blockvals[4]); index[5] = crop((int) rindex1[5] + (int) blockvals[5]); index[6] = crop((int) rindex1[6] + (int) blockvals[6]); index[7] = crop((int) rindex1[7] + (int) blockvals[7]); index += row_size; rindex1 += row_size; index[0] = crop((int) rindex1[0] + (int) blockvals[8]); index[1] = crop((int) rindex1[1] + (int) blockvals[9]); index[2] = crop((int) rindex1[2] + (int) blockvals[10]); index[3] = crop((int) rindex1[3] + (int) blockvals[11]); index[4] = crop((int) rindex1[4] + (int) blockvals[12]); index[5] = crop((int) rindex1[5] + (int) blockvals[13]); index[6] = crop((int) rindex1[6] + (int) blockvals[14]); index[7] = crop((int) rindex1[7] + (int) blockvals[15]); blockvals += 16; index += row_size; rindex1 += row_size; } else { if (right_back & 0x1) { /* No alignment, use bye copy */ for (rr = 0; rr < 4; rr++) { index[0] = rindex1[0]; index[1] = rindex1[1]; index[2] = rindex1[2]; index[3] = rindex1[3]; index[4] = rindex1[4]; index[5] = rindex1[5]; index[6] = rindex1[6]; index[7] = rindex1[7]; index += row_size; rindex1 += row_size; index[0] = rindex1[0]; index[1] = rindex1[1]; index[2] = rindex1[2]; index[3] = rindex1[3]; index[4] = rindex1[4]; index[5] = rindex1[5]; index[6] = rindex1[6]; index[7] = rindex1[7]; index += row_size; rindex1 += row_size; } } else if (right_back & 0x2) { /* Half-word bit aligned, use 16 bit copy */ short *src = (short *)rindex1; short *dest = (short *)index; row_size >>= 1; for (rr = 0; rr < 4; rr++) { dest[0] = src[0]; dest[1] = src[1]; dest[2] = src[2]; dest[3] = src[3]; dest += row_size; src += row_size; dest[0] = src[0]; dest[1] = src[1]; dest[2] = src[2]; dest[3] = src[3]; dest += row_size; src += row_size; } } else { /* Word aligned, use 32 bit copy */ int *src = (int *)rindex1; int *dest = (int *)index; row_size >>= 2; for (rr = 0; rr < 4; rr++) { dest[0] = src[0]; dest[1] = src[1]; dest += row_size; src += row_size; dest[0] = src[0]; dest[1] = src[1]; dest += row_size; src += row_size; } } } } else { #ifdef USE_CROP_TABLE unsigned char *cm = cropTbl + MAX_NEG_CROP; #endif rindex2 = rindex1 + right_half_back + (down_half_back * row_size); if (!qualityFlag) { if (!zflag) { for (rr = 0; rr < 4; rr++) { index[0] = crop(((int) (rindex1[0] + rindex2[0] + 1) >> 1) + blockvals[0]); index[1] = crop(((int) (rindex1[1] + rindex2[1] + 1) >> 1) + blockvals[1]); index[2] = crop(((int) (rindex1[2] + rindex2[2] + 1) >> 1) + blockvals[2]); index[3] = crop(((int) (rindex1[3] + rindex2[3] + 1) >> 1) + blockvals[3]); index[4] = crop(((int) (rindex1[4] + rindex2[4] + 1) >> 1) + blockvals[4]); index[5] = crop(((int) (rindex1[5] + rindex2[5] + 1) >> 1) + blockvals[5]); index[6] = crop(((int) (rindex1[6] + rindex2[6] + 1) >> 1) + blockvals[6]); index[7] = crop(((int) (rindex1[7] + rindex2[7] + 1) >> 1) + blockvals[7]); index += row_size; rindex1 += row_size; rindex2 += row_size; index[0] = crop(((int) (rindex1[0] + rindex2[0] + 1) >> 1) + blockvals[8]); index[1] = crop(((int) (rindex1[1] + rindex2[1] + 1) >> 1) + blockvals[9]); index[2] = crop(((int) (rindex1[2] + rindex2[2] + 1) >> 1) + blockvals[10]); index[3] = crop(((int) (rindex1[3] + rindex2[3] + 1) >> 1) + blockvals[11]); index[4] = crop(((int) (rindex1[4] + rindex2[4] + 1) >> 1) + blockvals[12]); index[5] = crop(((int) (rindex1[5] + rindex2[5] + 1) >> 1) + blockvals[13]); index[6] = crop(((int) (rindex1[6] + rindex2[6] + 1) >> 1) + blockvals[14]); index[7] = crop(((int) (rindex1[7] + rindex2[7] + 1) >> 1) + blockvals[15]); blockvals += 16; index += row_size; rindex1 += row_size; rindex2 += row_size; } } else { /* zflag */ for (rr = 0; rr < 8; rr++) { index[0] = (int) (rindex1[0] + rindex2[0] + 1) >> 1; index[1] = (int) (rindex1[1] + rindex2[1] + 1) >> 1; index[2] = (int) (rindex1[2] + rindex2[2] + 1) >> 1; index[3] = (int) (rindex1[3] + rindex2[3] + 1) >> 1; index[4] = (int) (rindex1[4] + rindex2[4] + 1) >> 1; index[5] = (int) (rindex1[5] + rindex2[5] + 1) >> 1; index[6] = (int) (rindex1[6] + rindex2[6] + 1) >> 1; index[7] = (int) (rindex1[7] + rindex2[7] + 1) >> 1; index += row_size; rindex1 += row_size; rindex2 += row_size; } } } else { /* qualityFlag on */ rindex3 = rindex1 + right_half_back; rindex4 = rindex1 + (down_half_back * row_size); if (!zflag) { for (rr = 0; rr < 4; rr++) { index[0] = crop(((int) (rindex1[0] + rindex2[0] + rindex3[0] + rindex4[0] + 2) >> 2) + blockvals[0]); index[1] = crop(((int) (rindex1[1] + rindex2[1] + rindex3[1] + rindex4[1] + 2) >> 2) + blockvals[1]); index[2] = crop(((int) (rindex1[2] + rindex2[2] + rindex3[2] + rindex4[2] + 2) >> 2) + blockvals[2]); index[3] = crop(((int) (rindex1[3] + rindex2[3] + rindex3[3] + rindex4[3] + 2) >> 2) + blockvals[3]); index[4] = crop(((int) (rindex1[4] + rindex2[4] + rindex3[4] + rindex4[4] + 2) >> 2) + blockvals[4]); index[5] = crop(((int) (rindex1[5] + rindex2[5] + rindex3[5] + rindex4[5] + 2) >> 2) + blockvals[5]); index[6] = crop(((int) (rindex1[6] + rindex2[6] + rindex3[6] + rindex4[6] + 2) >> 2) + blockvals[6]); index[7] = crop(((int) (rindex1[7] + rindex2[7] + rindex3[7] + rindex4[7] + 2) >> 2) + blockvals[7]); index += row_size; rindex1 += row_size; rindex2 += row_size; rindex3 += row_size; rindex4 += row_size; index[0] = crop(((int) (rindex1[0] + rindex2[0] + rindex3[0] + rindex4[0] + 2) >> 2) + blockvals[8]); index[1] = crop(((int) (rindex1[1] + rindex2[1] + rindex3[1] + rindex4[1] + 2) >> 2) + blockvals[9]); index[2] = crop(((int) (rindex1[2] + rindex2[2] + rindex3[2] + rindex4[2] + 2) >> 2) + blockvals[10]); index[3] = crop(((int) (rindex1[3] + rindex2[3] + rindex3[3] + rindex4[3] + 2) >> 2) + blockvals[11]); index[4] = crop(((int) (rindex1[4] + rindex2[4] + rindex3[4] + rindex4[4] + 2) >> 2) + blockvals[12]); index[5] = crop(((int) (rindex1[5] + rindex2[5] + rindex3[5] + rindex4[5] + 2) >> 2) + blockvals[13]); index[6] = crop(((int) (rindex1[6] + rindex2[6] + rindex3[6] + rindex4[6] + 2) >> 2) + blockvals[14]); index[7] = crop(((int) (rindex1[7] + rindex2[7] + rindex3[7] + rindex4[7] + 2) >> 2) + blockvals[15]); blockvals += 16; index += row_size; rindex1 += row_size; rindex2 += row_size; rindex3 += row_size; rindex4 += row_size; } } else { /* zflag */ for (rr = 0; rr < 8; rr++) { index[0] = (int) (rindex1[0] + rindex2[0] + rindex3[0] + rindex4[0] + 2) >> 2; index[1] = (int) (rindex1[1] + rindex2[1] + rindex3[1] + rindex4[1] + 2) >> 2; index[2] = (int) (rindex1[2] + rindex2[2] + rindex3[2] + rindex4[2] + 2) >> 2; index[3] = (int) (rindex1[3] + rindex2[3] + rindex3[3] + rindex4[3] + 2) >> 2; index[4] = (int) (rindex1[4] + rindex2[4] + rindex3[4] + rindex4[4] + 2) >> 2; index[5] = (int) (rindex1[5] + rindex2[5] + rindex3[5] + rindex4[5] + 2) >> 2; index[6] = (int) (rindex1[6] + rindex2[6] + rindex3[6] + rindex4[6] + 2) >> 2; index[7] = (int) (rindex1[7] + rindex2[7] + rindex3[7] + rindex4[7] + 2) >> 2; index += row_size; rindex1 += row_size; rindex2 += row_size; rindex3 += row_size; rindex4 += row_size; } } } } #ifdef LOOSE_MPEG } #endif } /* *-------------------------------------------------------------- * * ReconBiMBlock -- * * Reconstructs bidirectionally predicted macroblocks. * * Results: * None. * * Side effects: * None. * *-------------------------------------------------------------- */ static void ReconBiMBlock( VidStream* vid_stream, int bnum, int recon_right_for, int recon_down_for, int recon_right_back, int recon_down_back, int zflag ) { int mb_row, mb_col, row, col, row_size, rr; unsigned char *dest, *past=NULL, *future=NULL; int right_for, down_for, right_half_for, down_half_for; int right_back, down_back, right_half_back, down_half_back; unsigned char *index, *rindex1, *bindex1; short int *blockvals; int forw_row_start, back_row_start, forw_col_start, back_col_start; #ifdef LOOSE_MPEG int lmaxx = vid_stream->mb_width*16-1; int lmaxy = vid_stream->mb_height*16-1; int cmaxx = vid_stream->mb_width*8-1; int cmaxy = vid_stream->mb_height*8-1; #endif #ifdef LOOSE_MPEG int illegal_forw = 0; int illegal_back = 0; #endif /* Calculate macroblock row and column from address. */ mb_row = vid_stream->mblock.mb_address / vid_stream->mb_width; mb_col = vid_stream->mblock.mb_address % vid_stream->mb_width; /* If block is luminance block... */ if (bnum < 4) { /* * Calculate right_for, down_for, right_half_for, down_half_for, * right_back, down_bakc, right_half_back, and down_half_back, motion * vectors. */ right_for = recon_right_for >> 1; down_for = recon_down_for >> 1; right_half_for = recon_right_for & 0x1; down_half_for = recon_down_for & 0x1; right_back = recon_right_back >> 1; down_back = recon_down_back >> 1; right_half_back = recon_right_back & 0x1; down_half_back = recon_down_back & 0x1; /* Set dest to luminance plane of current pict image. */ dest = vid_stream->current->luminance; /* If past frame exists, set past to luminance plane of past frame. */ if (vid_stream->past != NULL) past = vid_stream->past->luminance; /* * If future frame exists, set future to luminance plane of future frame. */ if (vid_stream->future != NULL) future = vid_stream->future->luminance; /* Establish row size. */ row_size = (vid_stream->mb_width << 4); /* Calculate row,col of upper left pixel in block. */ row = (mb_row << 4); col = (mb_col << 4); if (bnum > 1) row += 8; if (bnum & 0x01) col += 8; #ifdef LOOSE_MPEG /* Check for illegal pred. blocks. */ /* Illegal forward Y block, right component */ if (col + right_for + right_half_for + 7 > lmaxx) { if(col > lmaxx) // fix mb column col = lmaxx & ~15; if(col + right_for + 7 > lmaxx) // fix full component right_for = lmaxx - col - 7; if(col + right_for + right_half_for + 7 > lmaxx) // fix half component right_half_for = 0; } else if (col + right_for < 0) { if(col < 0) // fix mb column col = 0; if(col + right_for < 0) // fix full component right_for = 0; } /* Illegal forward Y block, down component */ if (row + down_for + down_half_for + 7 > lmaxy) { if(row > lmaxy) // fix mb row row = lmaxy & ~15; if(row + down_for + 7 > lmaxy) // fix full component down_for = lmaxy - row - 7; if(row + down_for + down_half_for + 7 > lmaxy) // fix half component down_half_for = 0; } else if (row + down_for < 0) { if(row < 0) // fix mb row row = 0; if(row + down_for < 0) // fix full component down_for = 0; } /* Illegal backward Y block, right component */ if (col + right_back + right_half_back + 7 > lmaxx) { if(col > lmaxx) // fix mb column col = lmaxx & ~15; if(col + right_back + 7 > lmaxx) // fix full component right_back = lmaxx - col - 7; if(col + right_back + right_half_back + 7 > lmaxx) // fix half component right_half_back = 0; } else if (col + right_back < 0) { if(col < 0) // fix mb column col = 0; if(col + right_back < 0) // fix full component right_back = 0; } /* Illegal backward Y block, down component */ if (row + down_back + down_half_back + 7 > lmaxy) { if(row > lmaxy) // fix mb row row = lmaxy & ~15; if(row + down_back + 7 > lmaxy) // fix full component down_back = lmaxy - row - 7; if(row + down_back + down_half_back + 7 > lmaxy) // fix half component down_half_back = 0; } else if (row + down_back < 0) { if(row < 0) // fix mb row row = 0; if(row + down_back < 0) // fix full component down_back = 0; } #endif forw_col_start = col + right_for; forw_row_start = row + down_for; back_col_start = col + right_back; back_row_start = row + down_back; } /* Otherwise, block is NOT luminance block, ... */ else { /* Construct motion vectors. */ recon_right_for /= 2; recon_down_for /= 2; right_for = recon_right_for >> 1; down_for = recon_down_for >> 1; right_half_for = recon_right_for & 0x1; down_half_for = recon_down_for & 0x1; recon_right_back /= 2; recon_down_back /= 2; right_back = recon_right_back >> 1; down_back = recon_down_back >> 1; right_half_back = recon_right_back & 0x1; down_half_back = recon_down_back & 0x1; /* Establish row size. */ row_size = (vid_stream->mb_width << 3); /* Calculate row,col of upper left pixel in block. */ row = (mb_row << 3); col = (mb_col << 3); #ifdef LOOSE_MPEG /* Check for illegal pred. blocks. */ /* Illegal forward C block, right component */ if (col + right_for + right_half_for + 7 > cmaxx) { if(col > cmaxx) // fix mb column col = cmaxx & ~15; if(col + right_for + 7 > cmaxx) // fix full component right_for = cmaxx - col - 7; if(col + right_for + right_half_for + 7 > cmaxx) // fix half component right_half_for = 0; } else if (col + right_for < 0) { if(col < 0) // fix mb column col = 0; if(col + right_for < 0) // fix full component right_for = 0; } /* Illegal forward C block, down component */ if (row + down_for + down_half_for + 7 > cmaxy) { if(row > cmaxy) // fix mb row row = cmaxy & ~15; if(row + down_for + 7 > cmaxy) // fix full component down_for = cmaxy - row - 7; if(row + down_for + down_half_for + 7 > cmaxy) // fix half component down_half_for = 0; } else if (row + down_for < 0) { if(row < 0) // fix mb row row = 0; if(row + down_for < 0) // fix full component down_for = 0; } /* Illegal backward C block, right component */ if (col + right_back + right_half_back + 7 > cmaxx) { if(col > cmaxx) // fix mb column col = cmaxx & ~15; if(col + right_back + 7 > cmaxx) // fix full component right_back = cmaxx - col - 7; if(col + right_back + right_half_back + 7 > cmaxx) // fix half component right_half_back = 0; } else if (col + right_back < 0) { if(col < 0) // fix mb column col = 0; if(col + right_back < 0) // fix full component right_back = 0; } /* Illegal backward C block, down component */ if (row + down_back + down_half_back + 7 > cmaxy) { if(row > cmaxy) // fix mb row row = cmaxy & ~15; if(row + down_back + 7 > cmaxy) // fix full component down_back = cmaxy - row - 7; if(row + down_back + down_half_back + 7 > cmaxy) // fix half component down_half_back = 0; } else if (row + down_back < 0) { if(row < 0) // fix mb row row = 0; if(row + down_back < 0) // fix full component down_back = 0; } #endif forw_col_start = col + right_for; forw_row_start = row + down_for; back_col_start = col + right_back; back_row_start = row + down_back; /* If block is Cr block... */ /* Switched earlier, so we test Cr first - eyhung */ if (bnum == 5) { /* Set dest to Cr plane of current pict image. */ dest = vid_stream->current->Cr; /* If past frame exists, set past to Cr plane of past image. */ if (vid_stream->past != NULL) past = vid_stream->past->Cr; /* * If future frame exists, set future to Cr plane of future image. */ if (vid_stream->future != NULL) future = vid_stream->future->Cr; } /* Otherwise, block is Cb block... */ else { /* Set dest to Cb plane of current pict image. */ dest = vid_stream->current->Cb; /* If past frame exists, set past to Cb plane of past frame. */ if (vid_stream->past != NULL) past = vid_stream->past->Cb; /* * If future frame exists, set future to Cb plane of future frame. */ if (vid_stream->future != NULL) future = vid_stream->future->Cb; } } /* For each pixel in block... */ index = dest + (row * row_size) + col; #ifdef LOOSE_MPEG if (illegal_forw) rindex1 = future + back_row_start * row_size + back_col_start; else #endif rindex1 = past + forw_row_start * row_size + forw_col_start; #ifdef LOOSE_MPEG if (illegal_back) bindex1 = past + forw_row_start * row_size + forw_col_start; else #endif bindex1 = future + back_row_start * row_size + back_col_start; blockvals = (short int *) &(vid_stream->block.dct_recon[0][0]); { #ifdef USE_CROP_TABLE unsigned char *cm = cropTbl + MAX_NEG_CROP; #endif if (!zflag) for (rr = 0; rr < 4; rr++) { index[0] = crop(((int) (rindex1[0] + bindex1[0]) >> 1) + blockvals[0]); index[1] = crop(((int) (rindex1[1] + bindex1[1]) >> 1) + blockvals[1]); index[2] = crop(((int) (rindex1[2] + bindex1[2]) >> 1) + blockvals[2]); index[3] = crop(((int) (rindex1[3] + bindex1[3]) >> 1) + blockvals[3]); index[4] = crop(((int) (rindex1[4] + bindex1[4]) >> 1) + blockvals[4]); index[5] = crop(((int) (rindex1[5] + bindex1[5]) >> 1) + blockvals[5]); index[6] = crop(((int) (rindex1[6] + bindex1[6]) >> 1) + blockvals[6]); index[7] = crop(((int) (rindex1[7] + bindex1[7]) >> 1) + blockvals[7]); index += row_size; rindex1 += row_size; bindex1 += row_size; index[0] = crop(((int) (rindex1[0] + bindex1[0]) >> 1) + blockvals[8]); index[1] = crop(((int) (rindex1[1] + bindex1[1]) >> 1) + blockvals[9]); index[2] = crop(((int) (rindex1[2] + bindex1[2]) >> 1) + blockvals[10]); index[3] = crop(((int) (rindex1[3] + bindex1[3]) >> 1) + blockvals[11]); index[4] = crop(((int) (rindex1[4] + bindex1[4]) >> 1) + blockvals[12]); index[5] = crop(((int) (rindex1[5] + bindex1[5]) >> 1) + blockvals[13]); index[6] = crop(((int) (rindex1[6] + bindex1[6]) >> 1) + blockvals[14]); index[7] = crop(((int) (rindex1[7] + bindex1[7]) >> 1) + blockvals[15]); blockvals += 16; index += row_size; rindex1 += row_size; bindex1 += row_size; } else for (rr = 0; rr < 4; rr++) { index[0] = (int) (rindex1[0] + bindex1[0]) >> 1; index[1] = (int) (rindex1[1] + bindex1[1]) >> 1; index[2] = (int) (rindex1[2] + bindex1[2]) >> 1; index[3] = (int) (rindex1[3] + bindex1[3]) >> 1; index[4] = (int) (rindex1[4] + bindex1[4]) >> 1; index[5] = (int) (rindex1[5] + bindex1[5]) >> 1; index[6] = (int) (rindex1[6] + bindex1[6]) >> 1; index[7] = (int) (rindex1[7] + bindex1[7]) >> 1; index += row_size; rindex1 += row_size; bindex1 += row_size; index[0] = (int) (rindex1[0] + bindex1[0]) >> 1; index[1] = (int) (rindex1[1] + bindex1[1]) >> 1; index[2] = (int) (rindex1[2] + bindex1[2]) >> 1; index[3] = (int) (rindex1[3] + bindex1[3]) >> 1; index[4] = (int) (rindex1[4] + bindex1[4]) >> 1; index[5] = (int) (rindex1[5] + bindex1[5]) >> 1; index[6] = (int) (rindex1[6] + bindex1[6]) >> 1; index[7] = (int) (rindex1[7] + bindex1[7]) >> 1; index += row_size; rindex1 += row_size; bindex1 += row_size; } } } #endif /* USE_ATI */ /* *-------------------------------------------------------------- * * ProcessSkippedPFrameMBlocks -- * * Processes skipped macroblocks in P frames. * * Results: * Calculates pixel values for luminance, Cr, and Cb planes * in current pict image for skipped macroblocks. * * Side effects: * Pixel values in pict image changed. * *-------------------------------------------------------------- */ static void ProcessSkippedPFrameMBlocks( VidStream* vid_stream ) { int row_size, half_row, mb_row, mb_col, row, col, rr; int addr, row_incr, half_row_incr, crow, ccol; int *dest, *src, *dest1, *src1; #ifndef DISABLE_DITHER int ditherType=vid_stream->ditherType; #endif /* Calculate row sizes for luminance and Cr/Cb macroblock areas. */ row_size = vid_stream->mb_width << 4; half_row = (row_size >> 1); row_incr = row_size >> 2; half_row_incr = half_row >> 2; /* For each skipped macroblock, do... */ for (addr = vid_stream->mblock.past_mb_addr + 1; addr < vid_stream->mblock.mb_address; addr++) { /* Calculate macroblock row and col. */ mb_row = addr / vid_stream->mb_width; mb_col = addr % vid_stream->mb_width; /* Calculate upper left pixel row,col for luminance plane. */ row = mb_row << 4; col = mb_col << 4; #ifdef USE_ATI vhar128_macroblock(vid_stream->ati_handle, col, row, 0, /* skipped block are empty non-intra blocks */ 1, 0, /* P frames are based on past picture */ 0, 0, /* backward motion is null */ 0, 0, /* forward motion is null */ vid_stream->block.dct_recon); #else /* For each row in macroblock luminance plane... */ dest = (int *)(vid_stream->current->luminance + (row * row_size) + col); src = (int *)(vid_stream->future->luminance + (row * row_size) + col); for (rr = 0; rr < 8; rr++) { /* Copy pixel values from last I or P picture. */ dest[0] = src[0]; dest[1] = src[1]; dest[2] = src[2]; dest[3] = src[3]; dest += row_incr; src += row_incr; dest[0] = src[0]; dest[1] = src[1]; dest[2] = src[2]; dest[3] = src[3]; dest += row_incr; src += row_incr; } /* * Divide row,col to get upper left pixel of macroblock in Cr and Cb * planes. */ crow = row >> 1; ccol = col >> 1; /* For each row in Cr, and Cb planes... */ dest = (int *)(vid_stream->current->Cr + (crow * half_row) + ccol); src = (int *)(vid_stream->future->Cr + (crow * half_row) + ccol); dest1 = (int *)(vid_stream->current->Cb + (crow * half_row) + ccol); src1 = (int *)(vid_stream->future->Cb + (crow * half_row) + ccol); for (rr = 0; rr < 4; rr++) { /* Copy pixel values from last I or P picture. */ dest[0] = src[0]; dest[1] = src[1]; dest1[0] = src1[0]; dest1[1] = src1[1]; dest += half_row_incr; src += half_row_incr; dest1 += half_row_incr; src1 += half_row_incr; dest[0] = src[0]; dest[1] = src[1]; dest1[0] = src1[0]; dest1[1] = src1[1]; dest += half_row_incr; src += half_row_incr; dest1 += half_row_incr; src1 += half_row_incr; } #ifndef DISABLE_DITHER if (ditherType == MBORDERED_DITHER) { MBOrderedDitherDisplayCopy(vid_stream, addr, 1, 0, 0, 0, 0, 0, vid_stream->future->display, (unsigned char *) NULL); vid_stream->ditherFlags[addr] = 0; } #endif #endif /* USE_ATI */ } vid_stream->mblock.recon_right_for_prev = 0; vid_stream->mblock.recon_down_for_prev = 0; } /* *-------------------------------------------------------------- * * ProcessSkippedBFrameMBlocks -- * * Processes skipped macroblocks in B frames. * * Results: * Calculates pixel values for luminance, Cr, and Cb planes * in current pict image for skipped macroblocks. * * Side effects: * Pixel values in pict image changed. * *-------------------------------------------------------------- */ static void ProcessSkippedBFrameMBlocks( VidStream* vid_stream ) { int row_size, half_row, mb_row, mb_col, row, col, rr; int right_half_for = 0, down_half_for = 0; int c_right_half_for = 0, c_down_half_for = 0; int right_half_back = 0, down_half_back = 0; int c_right_half_back = 0, c_down_half_back = 0; int addr, right_for = 0, down_for = 0; int recon_right_for, recon_down_for; int recon_right_back, recon_down_back; int right_back = 0, down_back = 0; int c_right_for = 0, c_down_for = 0; int c_right_back = 0, c_down_back = 0; unsigned char forw_lum[256]; unsigned char forw_cr[64], forw_cb[64]; unsigned char back_lum[256], back_cr[64], back_cb[64]; int row_incr, half_row_incr; int ccol, crow; #ifndef DISABLE_DITHER int ditherType=vid_stream->ditherType; #endif #ifdef LOOSE_MPEG int lmaxx = vid_stream->mb_width*16-1; int lmaxy = vid_stream->mb_height*16-1; int cmaxx = vid_stream->mb_width*8-1; int cmaxy = vid_stream->mb_height*8-1; #endif /* Calculate row sizes for luminance and Cr/Cb macroblock areas. */ row_size = vid_stream->mb_width << 4; half_row = (row_size >> 1); row_incr = row_size >> 2; half_row_incr = half_row >> 2; /* Establish motion vector codes based on full pixel flag. */ if (vid_stream->picture.full_pel_forw_vector) { recon_right_for = vid_stream->mblock.recon_right_for_prev << 1; recon_down_for = vid_stream->mblock.recon_down_for_prev << 1; } else { recon_right_for = vid_stream->mblock.recon_right_for_prev; recon_down_for = vid_stream->mblock.recon_down_for_prev; } if (vid_stream->picture.full_pel_back_vector) { recon_right_back = vid_stream->mblock.recon_right_back_prev << 1; recon_down_back = vid_stream->mblock.recon_down_back_prev << 1; } else { recon_right_back = vid_stream->mblock.recon_right_back_prev; recon_down_back = vid_stream->mblock.recon_down_back_prev; } #ifdef USE_ATI /* For each skipped macroblock do ... */ for (addr = vid_stream->mblock.past_mb_addr + 1; addr < vid_stream->mblock.mb_address; addr++) { vhar128_macroblock(vid_stream->ati_handle, (addr % vid_stream->mb_width) << 4, (addr / vid_stream->mb_width) << 4, 0, /* skipped blocks are empty non-intra blocks */ vid_stream->mblock.bpict_past_back, vid_stream->mblock.bpict_past_forw, recon_right_back, recon_down_back, /* backward motion */ recon_right_for, recon_down_for, /* forward motion */ vid_stream->block.dct_recon); } #else /* If only one motion vector, do display copy, else do full calculation. */ #ifndef DISABLE_DITHER if (ditherType == MBORDERED_DITHER) { if (vid_stream->mblock.bpict_past_forw && !vid_stream->mblock.bpict_past_back) { for (addr = vid_stream->mblock.past_mb_addr+1; addr < vid_stream->mblock.mb_address; addr++) { MBOrderedDitherDisplayCopy(vid_stream, addr, 1, recon_right_for, recon_down_for, 0, 0, 0, vid_stream->past->display, vid_stream->future->display); vid_stream->ditherFlags[addr] = 0; } return; } if (vid_stream->mblock.bpict_past_back && !vid_stream->mblock.bpict_past_forw) { for (addr = vid_stream->mblock.past_mb_addr+1; addr < vid_stream->mblock.mb_address; addr++) { MBOrderedDitherDisplayCopy(vid_stream, addr, 0, 0, 0, 1, recon_right_back, recon_down_back, vid_stream->past->display, vid_stream->future->display); vid_stream->ditherFlags[addr] = 0; } return; } } #endif /* Calculate motion vectors. */ if (vid_stream->mblock.bpict_past_forw) { right_for = recon_right_for >> 1; down_for = recon_down_for >> 1; right_half_for = recon_right_for & 0x1; down_half_for = recon_down_for & 0x1; recon_right_for /= 2; recon_down_for /= 2; c_right_for = recon_right_for >> 1; c_down_for = recon_down_for >> 1; c_right_half_for = recon_right_for & 0x1; c_down_half_for = recon_down_for & 0x1; } if (vid_stream->mblock.bpict_past_back) { right_back = recon_right_back >> 1; down_back = recon_down_back >> 1; right_half_back = recon_right_back & 0x1; down_half_back = recon_down_back & 0x1; recon_right_back /= 2; recon_down_back /= 2; c_right_back = recon_right_back >> 1; c_down_back = recon_down_back >> 1; c_right_half_back = recon_right_back & 0x1; c_down_half_back = recon_down_back & 0x1; } /* For each skipped macroblock, do... */ for (addr = vid_stream->mblock.past_mb_addr + 1; addr < vid_stream->mblock.mb_address; addr++) { /* Calculate macroblock row and col. */ mb_row = addr / vid_stream->mb_width; mb_col = addr % vid_stream->mb_width; /* Calculate upper left pixel row,col for luminance plane. */ row = mb_row << 4; col = mb_col << 4; crow = row / 2; ccol = col / 2; #ifdef LOOSE_MPEG /* Check for illegal blocks. */ /* Illegal forward Y block, right component */ if (col + right_for + right_half_for + 7 > lmaxx) { if(col > lmaxx) // fix mb column col = lmaxx & ~15; if(col + right_for + 7 > lmaxx) // fix full component right_for = lmaxx - col - 7; if(col + right_for + right_half_for + 7 > lmaxx) // fix half component right_half_for = 0; } else if (col + right_for < 0) { if(col < 0) // fix mb column col = 0; if(col + right_for < 0) // fix full component right_for = 0; } /* Illegal forward Y block, down component */ if (row + down_for + down_half_for + 7 > lmaxy) { if(row > lmaxy) // fix mb row row = lmaxy & ~15; if(row + down_for + 7 > lmaxy) // fix full component down_for = lmaxy - row - 7; if(row + down_for + down_half_for + 7 > lmaxy) // fix half component down_half_for = 0; } else if (row + down_for < 0) { if(row < 0) // fix mb row row = 0; if(row + down_for < 0) // fix full component down_for = 0; } /* Illegal backward Y block, right component */ if (col + right_back + right_half_back + 7 > lmaxx) { if(col > lmaxx) // fix mb column col = lmaxx & ~15; if(col + right_back + 7 > lmaxx) // fix full component right_back = lmaxx - col - 7; if(col + right_back + right_half_back + 7 > lmaxx) // fix half component right_half_back = 0; } else if (col + right_back < 0) { if(col < 0) // fix mb column col = 0; if(col + right_back < 0) // fix full component right_back = 0; } /* Illegal backward Y block, down component */ if (row + down_back + down_half_back + 7 > lmaxy) { if(row > lmaxy) // fix mb row row = lmaxy & ~15; if(row + down_back + 7 > lmaxy) // fix full component down_back = lmaxy - row - 7; if(row + down_back + down_half_back + 7 > lmaxy) // fix half component down_half_back = 0; } else if (row + down_back < 0) { if(row < 0) // fix mb row row = 0; if(row + down_back < 0) // fix full component down_back = 0; } /* Illegal forward C block, right component */ if (ccol + c_right_for + c_right_half_for + 7 > cmaxx) { if(ccol > cmaxx) // fix mb column ccol = cmaxx & ~15; if(ccol + c_right_for + 7 > cmaxx) // fix full component c_right_for = cmaxx - ccol - 7; if(ccol + c_right_for + c_right_half_for + 7 > cmaxx) // fix half component c_right_half_for = 0; } else if (ccol + c_right_for < 0) { if(ccol < 0) // fix mb column ccol = 0; if(ccol + c_right_for < 0) // fix full component c_right_for = 0; } /* Illegal forward C block, down component */ if (crow + c_down_for + c_down_half_for + 7 > cmaxy) { if(crow > cmaxy) // fix mb row crow = cmaxy & ~15; if(crow + c_down_for + 7 > cmaxy) // fix full component c_down_for = cmaxy - crow - 7; if(crow + c_down_for + c_down_half_for + 7 > cmaxy) // fix half component c_down_half_for = 0; } else if (crow + c_down_for < 0) { if(crow < 0) // fix mb row crow = 0; if(crow + c_down_for < 0) // fix full component c_down_for = 0; } /* Illegal backward C block, right component */ if (ccol + c_right_back + c_right_half_back + 7 > cmaxx) { if(ccol > cmaxx) // fix mb column ccol = cmaxx & ~15; if(ccol + c_right_back + 7 > cmaxx) // fix full component c_right_back = cmaxx - ccol - 7; if(ccol + c_right_back + c_right_half_back + 7 > cmaxx) // fix half component c_right_half_back = 0; } else if (ccol + c_right_back < 0) { if(ccol < 0) // fix mb column ccol = 0; if(ccol + c_right_back < 0) // fix full component c_right_back = 0; } /* Illegal backward C block, down component */ if (crow + c_down_back + c_down_half_back + 7 > cmaxy) { if(crow > cmaxy) // fix mb row crow = cmaxy & ~15; if(crow + c_down_back + 7 > cmaxy) // fix full component c_down_back = cmaxy - crow - 7; if(crow + c_down_back + c_down_half_back + 7 > cmaxy) // fix half component c_down_half_back = 0; } else if (crow + c_down_back < 0) { if(crow < 0) // fix mb row crow = 0; if(crow + c_down_back < 0) // fix full component c_down_back = 0; } #endif /* If forward predicted, calculate prediction values. */ if (vid_stream->mblock.bpict_past_forw) { ReconSkippedBlock(vid_stream->past->luminance, forw_lum, row, col, row_size, right_for, down_for, right_half_for, down_half_for, 16); ReconSkippedBlock(vid_stream->past->Cr, forw_cr, crow, ccol, half_row, c_right_for, c_down_for, c_right_half_for, c_down_half_for, 8); ReconSkippedBlock(vid_stream->past->Cb, forw_cb, crow, ccol, half_row, c_right_for, c_down_for, c_right_half_for, c_down_half_for, 8); } /* If back predicted, calculate prediction values. */ if (vid_stream->mblock.bpict_past_back) { ReconSkippedBlock(vid_stream->future->luminance, back_lum, row, col, row_size, right_back, down_back, right_half_back, down_half_back, 16); ReconSkippedBlock(vid_stream->future->Cr, back_cr, crow, ccol, half_row, c_right_back, c_down_back, c_right_half_back, c_down_half_back, 8); ReconSkippedBlock(vid_stream->future->Cb, back_cb, crow, ccol, half_row, c_right_back, c_down_back, c_right_half_back, c_down_half_back, 8); } if (vid_stream->mblock.bpict_past_forw && !vid_stream->mblock.bpict_past_back) { int *dest, *dest1; int *src, *src1; dest = (int *)(vid_stream->current->luminance + (row * row_size) + col); src = (int *)forw_lum; for (rr = 0; rr < 16; rr++) { /* memcpy(dest, forw_lum+(rr<<4), 16); */ dest[0] = src[0]; dest[1] = src[1]; dest[2] = src[2]; dest[3] = src[3]; dest += row_incr; src += 4; } dest = (int *)(vid_stream->current->Cr + (crow * half_row) + ccol); dest1 = (int *)(vid_stream->current->Cb + (crow * half_row) + ccol); src = (int *)forw_cr; src1 = (int *)forw_cb; for (rr = 0; rr < 8; rr++) { /* * memcpy(dest, forw_cr+(rr<<3), 8); memcpy(dest1, forw_cb+(rr<<3), * 8); */ dest[0] = src[0]; dest[1] = src[1]; dest1[0] = src1[0]; dest1[1] = src1[1]; dest += half_row_incr; dest1 += half_row_incr; src += 2; src1 += 2; } } else if (vid_stream->mblock.bpict_past_back && !vid_stream->mblock.bpict_past_forw) { int *src, *src1; int *dest, *dest1; dest = (int *)(vid_stream->current->luminance + (row * row_size) + col); src = (int *)back_lum; for (rr = 0; rr < 16; rr++) { dest[0] = src[0]; dest[1] = src[1]; dest[2] = src[2]; dest[3] = src[3]; dest += row_incr; src += 4; } dest = (int *)(vid_stream->current->Cr + (crow * half_row) + ccol); dest1 = (int *)(vid_stream->current->Cb + (crow * half_row) + ccol); src = (int *)back_cr; src1 = (int *)back_cb; for (rr = 0; rr < 8; rr++) { /* * memcpy(dest, back_cr+(rr<<3), 8); memcpy(dest1, back_cb+(rr<<3), * 8); */ dest[0] = src[0]; dest[1] = src[1]; dest1[0] = src1[0]; dest1[1] = src1[1]; dest += half_row_incr; dest1 += half_row_incr; src += 2; src1 += 2; } } else { unsigned char *src1, *src2, *src1a, *src2a; unsigned char *dest, *dest1; dest = vid_stream->current->luminance + (row * row_size) + col; src1 = forw_lum; src2 = back_lum; for (rr = 0; rr < 16; rr++) { dest[0] = (int) (src1[0] + src2[0]) >> 1; dest[1] = (int) (src1[1] + src2[1]) >> 1; dest[2] = (int) (src1[2] + src2[2]) >> 1; dest[3] = (int) (src1[3] + src2[3]) >> 1; dest[4] = (int) (src1[4] + src2[4]) >> 1; dest[5] = (int) (src1[5] + src2[5]) >> 1; dest[6] = (int) (src1[6] + src2[6]) >> 1; dest[7] = (int) (src1[7] + src2[7]) >> 1; dest[8] = (int) (src1[8] + src2[8]) >> 1; dest[9] = (int) (src1[9] + src2[9]) >> 1; dest[10] = (int) (src1[10] + src2[10]) >> 1; dest[11] = (int) (src1[11] + src2[11]) >> 1; dest[12] = (int) (src1[12] + src2[12]) >> 1; dest[13] = (int) (src1[13] + src2[13]) >> 1; dest[14] = (int) (src1[14] + src2[14]) >> 1; dest[15] = (int) (src1[15] + src2[15]) >> 1; dest += row_size; src1 += 16; src2 += 16; } dest = vid_stream->current->Cr + (crow * half_row) + ccol; dest1 = vid_stream->current->Cb + (crow * half_row) + ccol; src1 = forw_cr; src2 = back_cr; src1a = forw_cb; src2a = back_cb; for (rr = 0; rr < 8; rr++) { dest[0] = (int) (src1[0] + src2[0]) >> 1; dest[1] = (int) (src1[1] + src2[1]) >> 1; dest[2] = (int) (src1[2] + src2[2]) >> 1; dest[3] = (int) (src1[3] + src2[3]) >> 1; dest[4] = (int) (src1[4] + src2[4]) >> 1; dest[5] = (int) (src1[5] + src2[5]) >> 1; dest[6] = (int) (src1[6] + src2[6]) >> 1; dest[7] = (int) (src1[7] + src2[7]) >> 1; dest += half_row; src1 += 8; src2 += 8; dest1[0] = (int) (src1a[0] + src2a[0]) >> 1; dest1[1] = (int) (src1a[1] + src2a[1]) >> 1; dest1[2] = (int) (src1a[2] + src2a[2]) >> 1; dest1[3] = (int) (src1a[3] + src2a[3]) >> 1; dest1[4] = (int) (src1a[4] + src2a[4]) >> 1; dest1[5] = (int) (src1a[5] + src2a[5]) >> 1; dest1[6] = (int) (src1a[6] + src2a[6]) >> 1; dest1[7] = (int) (src1a[7] + src2a[7]) >> 1; dest1 += half_row; src1a += 8; src2a += 8; } } #ifndef DISABLE_DITHER if (ditherType == MBORDERED_DITHER) { vid_stream->ditherFlags[addr] = 1; } #endif } #endif /* USE_ATI */ } #ifndef USE_ATI /* *-------------------------------------------------------------- * * ReconSkippedBlock -- * * Reconstructs predictive block for skipped macroblocks * in B Frames. * * Results: * No return values. * * Side effects: * None. * *-------------------------------------------------------------- */ static void ReconSkippedBlock( unsigned char *source, unsigned char *dest, int row, int col, int row_size, int right, int down, int right_half, int down_half, int width ) { int rr; unsigned char *source2; source += ((row + down) * row_size) + col + right; if (width == 16) { if ((!right_half) && (!down_half)) { if (right & 0x1) { /* No alignment, use bye copy */ for (rr = 0; rr < 16; rr++) { dest[0] = source[0]; dest[1] = source[1]; dest[2] = source[2]; dest[3] = source[3]; dest[4] = source[4]; dest[5] = source[5]; dest[6] = source[6]; dest[7] = source[7]; dest[8] = source[8]; dest[9] = source[9]; dest[10] = source[10]; dest[11] = source[11]; dest[12] = source[12]; dest[13] = source[13]; dest[14] = source[14]; dest[15] = source[15]; dest += 16; source += row_size; } } else if (right & 0x2) { /* Half-word bit aligned, use 16 bit copy */ short *src = (short *)source; short *d = (short *)dest; row_size >>= 1; for (rr = 0; rr < 16; rr++) { d[0] = src[0]; d[1] = src[1]; d[2] = src[2]; d[3] = src[3]; d[4] = src[4]; d[5] = src[5]; d[6] = src[6]; d[7] = src[7]; d += 8; src += row_size; } } else { /* Word aligned, use 32 bit copy */ int *src = (int *)source; int *d = (int *)dest; row_size >>= 2; for (rr = 0; rr < 16; rr++) { d[0] = src[0]; d[1] = src[1]; d[2] = src[2]; d[3] = src[3]; d += 4; src += row_size; } } } else { source2 = source + right_half + (row_size * down_half); for (rr = 0; rr < width; rr++) { dest[0] = (int) (source[0] + source2[0]) >> 1; dest[1] = (int) (source[1] + source2[1]) >> 1; dest[2] = (int) (source[2] + source2[2]) >> 1; dest[3] = (int) (source[3] + source2[3]) >> 1; dest[4] = (int) (source[4] + source2[4]) >> 1; dest[5] = (int) (source[5] + source2[5]) >> 1; dest[6] = (int) (source[6] + source2[6]) >> 1; dest[7] = (int) (source[7] + source2[7]) >> 1; dest[8] = (int) (source[8] + source2[8]) >> 1; dest[9] = (int) (source[9] + source2[9]) >> 1; dest[10] = (int) (source[10] + source2[10]) >> 1; dest[11] = (int) (source[11] + source2[11]) >> 1; dest[12] = (int) (source[12] + source2[12]) >> 1; dest[13] = (int) (source[13] + source2[13]) >> 1; dest[14] = (int) (source[14] + source2[14]) >> 1; dest[15] = (int) (source[15] + source2[15]) >> 1; dest += width; source += row_size; source2 += row_size; } } } else { /* (width == 8) */ assert(width == 8); if ((!right_half) && (!down_half)) { if (right & 0x1) { for (rr = 0; rr < width; rr++) { dest[0] = source[0]; dest[1] = source[1]; dest[2] = source[2]; dest[3] = source[3]; dest[4] = source[4]; dest[5] = source[5]; dest[6] = source[6]; dest[7] = source[7]; dest += 8; source += row_size; } } else if (right & 0x02) { short *d = (short *)dest; short *src = (short *)source; row_size >>= 1; for (rr = 0; rr < width; rr++) { d[0] = src[0]; d[1] = src[1]; d[2] = src[2]; d[3] = src[3]; d += 4; src += row_size; } } else { int *d = (int *)dest; int *src = (int *)source; row_size >>= 2; for (rr = 0; rr < width; rr++) { d[0] = src[0]; d[1] = src[1]; d += 2; src += row_size; } } } else { source2 = source + right_half + (row_size * down_half); for (rr = 0; rr < width; rr++) { dest[0] = (int) (source[0] + source2[0]) >> 1; dest[1] = (int) (source[1] + source2[1]) >> 1; dest[2] = (int) (source[2] + source2[2]) >> 1; dest[3] = (int) (source[3] + source2[3]) >> 1; dest[4] = (int) (source[4] + source2[4]) >> 1; dest[5] = (int) (source[5] + source2[5]) >> 1; dest[6] = (int) (source[6] + source2[6]) >> 1; dest[7] = (int) (source[7] + source2[7]) >> 1; dest += width; source += row_size; source2 += row_size; } } } } #endif /* USE_ATI */ /* *-------------------------------------------------------------- * * DoPictureDisplay -- * * Converts image from Lum, Cr, Cb to colormap space. Puts * image in lum plane. Updates past and future frame * pointers. Dithers image. Sends to display mechanism. * * Results: * Pict image structure locked if displaying or if frame * is needed as past or future reference. * * Side effects: * Lum plane pummelled. * *-------------------------------------------------------------- */ static void DoPictureDisplay( VidStream *vid_stream ) { #ifdef ANALYSIS EndTime(); stat_a[0].totsize += bitCountRead() - pictureSizeCount; #ifdef SHOWEACHFLAG PrintOneStat(); #endif CollectStats(); #endif #ifdef USE_ATI /* Flush the macroblocks to the hardware decoder */ vhar128_flush( vid_stream->ati_handle ); #endif /* Update past and future references if needed. */ if( (vid_stream->picture.code_type == I_TYPE) || (vid_stream->picture.code_type == P_TYPE) ) { if( vid_stream->future == NULL ) { vid_stream->future = vid_stream->current; vid_stream->future->locked |= FUTURE_LOCK; } else { if( vid_stream->past != NULL ) { vid_stream->past->locked &= ~PAST_LOCK; } vid_stream->past = vid_stream->future; vid_stream->past->locked &= ~FUTURE_LOCK; vid_stream->past->locked |= PAST_LOCK; vid_stream->future = vid_stream->current; vid_stream->future->locked |= FUTURE_LOCK; vid_stream->current = vid_stream->past; vid_stream->_smpeg->ExecuteDisplay( vid_stream ); } } else { vid_stream->_smpeg->ExecuteDisplay( vid_stream ); } } /* EOF */ smpeg-0.4.5+cvs20030824.orig/video/video.h0100644000175000017500000004241207241167612017725 0ustar hoseheadhosehead/* * Copyright (c) 1995 The Regents of the University of California. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement is * hereby granted, provided that the above copyright notice and the following * two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ /* * Portions of this software Copyright (c) 1995 Brown University. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement * is hereby granted, provided that the above copyright notice and the * following two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF BROWN * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * BROWN UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" * BASIS, AND BROWN UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ #ifndef MPEG_LIB_VIDEO_HEADER #define MPEG_LIB_VIDEO_HEADER #include /* Changes to make the code reentrant: deglobalized: ditherFlags, totNumFrames, realTimeStart, matched_depth, filename, ditherType, curBits, ReconPMBlock statics, stream id variables, Parse_done, swap, seekValue, input, EOF_flag, ReadPacket statics, sys_layer, curVidStream, curVidStream, jmb_buf env (removed) X globals now in xinfo: ditherType, visual, depth (also name), hints, owncmFlag, et al now const: scan film_has_ended instead of FilmState Additional changes: if DISABLE_DITHER defined, don't compile dithering code -lsh@cs.brown.edu (Loring Holden) */ #include "MPEGvideo.h" #include "MPEGaudio.h" typedef Sint32 INT32; typedef Sint16 INT16; typedef Sint8 INT8; typedef Uint32 UINT32; typedef Uint16 UINT16; typedef Uint8 UINT8; /* Define Parsing error codes. */ #define SKIP_PICTURE (-10) #define SKIP_TO_START_CODE (-1) #define PARSE_OK 1 /* Define BOOLEAN, TRUE, and FALSE. */ #define BOOLEAN int #define TRUE 1 #define FALSE 0 /* Set ring buffer size. */ #define RING_BUF_SIZE 5 /* Macros for picture code type. */ #define I_TYPE 1 #define P_TYPE 2 #define B_TYPE 3 #define D_TYPE 4 /* Start codes. */ #define SEQ_END_CODE 0x000001b7 #define SEQ_START_CODE 0x000001b3 #define GOP_START_CODE 0x000001b8 #define PICTURE_START_CODE 0x00000100 #define SLICE_MIN_START_CODE 0x00000101 #define SLICE_MAX_START_CODE 0x000001af #define EXT_START_CODE 0x000001b5 #define USER_START_CODE 0x000001b2 #define SEQUENCE_ERROR_CODE 0x000001b4 /* Number of macroblocks to process in one call to mpegVidRsrc. */ #define MB_QUANTUM 100 /* Macros used with macroblock address decoding. */ #define MB_STUFFING 34 #define MB_ESCAPE 35 /* Lock flags for pict images. */ #define DISPLAY_LOCK 0x01 #define PAST_LOCK 0x02 #define FUTURE_LOCK 0x04 #define HYBRID_DITHER 0 #define HYBRID2_DITHER 1 #define FS4_DITHER 2 #define FS2_DITHER 3 #define FS2FAST_DITHER 4 #define Twox2_DITHER 5 #define GRAY_DITHER 6 #define FULL_COLOR_DITHER 7 #define NO_DITHER 8 #define ORDERED_DITHER 9 #define MONO_DITHER 10 #define MONO_THRESHOLD 11 #define ORDERED2_DITHER 12 #define MBORDERED_DITHER 13 #define GRAY256_DITHER 14 #define PPM_DITHER 15 #define FULL_COLOR2_DITHER 16 #define GRAY2_DITHER 17 #define GRAY2562_DITHER 18 #ifdef DISABLE_DITHER #define IS_2x2_DITHER(a) (0) #else #define IS_2x2_DITHER(a) ((a) == Twox2_DITHER || (a) == FULL_COLOR2_DITHER || (a) == GRAY2_DITHER || (a) == (GRAY2562_DITHER)) #endif /* Brown - changed to const int because it is a help variable */ extern const int scan[][8]; /* Structure with reconstructed pixel values. */ typedef struct pict_image { #ifdef USE_ATI struct vhar128_image *image; #else unsigned char *image; /* YV12 format image */ unsigned char *luminance; /* Luminance plane. */ unsigned char *Cr; /* Cr plane. */ unsigned char *Cb; /* Cb plane. */ #endif unsigned short int *mb_qscale; /* macroblock info */ int locked; /* Lock flag. */ TimeStamp show_time; /* Presentation time. */ } PictImage; /* Group of pictures structure. */ typedef struct GoP { BOOLEAN drop_flag; /* Flag indicating dropped frame. */ unsigned int tc_hours; /* Hour component of time code. */ unsigned int tc_minutes; /* Minute component of time code. */ unsigned int tc_seconds; /* Second component of time code. */ unsigned int tc_pictures; /* Picture counter of time code. */ BOOLEAN closed_gop; /* Indicates no pred. vectors to previous group of pictures. */ BOOLEAN broken_link; /* B frame unable to be decoded. */ char *ext_data; /* Extension data. */ char *user_data; /* User data. */ } GoP; /* Picture structure. */ typedef struct pict { unsigned int temp_ref; /* Temporal reference. */ unsigned int code_type; /* Frame type: P, B, I */ unsigned int vbv_delay; /* Buffer delay. */ BOOLEAN full_pel_forw_vector; /* Forw. vectors specified in full pixel values flag. */ unsigned int forw_r_size; /* Used for vector decoding. */ unsigned int forw_f; /* Used for vector decoding. */ BOOLEAN full_pel_back_vector; /* Back vectors specified in full pixel values flag. */ unsigned int back_r_size; /* Used in decoding. */ unsigned int back_f; /* Used in decoding. */ char *extra_info; /* Extra bit picture info. */ char *ext_data; /* Extension data. */ char *user_data; /* User data. */ } Pict; /* Slice structure. */ typedef struct slice { unsigned int vert_pos; /* Vertical position of slice. */ unsigned int quant_scale; /* Quantization scale. */ char *extra_info; /* Extra bit slice info. */ } Slice; /* Macroblock structure. */ typedef struct macroblock { int mb_address; /* Macroblock address. */ int past_mb_addr; /* Previous mblock address. */ int motion_h_forw_code; /* Forw. horiz. motion vector code. */ unsigned int motion_h_forw_r; /* Used in decoding vectors. */ int motion_v_forw_code; /* Forw. vert. motion vector code. */ unsigned int motion_v_forw_r; /* Used in decdoinge vectors. */ int motion_h_back_code; /* Back horiz. motion vector code. */ unsigned int motion_h_back_r; /* Used in decoding vectors. */ int motion_v_back_code; /* Back vert. motion vector code. */ unsigned int motion_v_back_r; /* Used in decoding vectors. */ unsigned int cbp; /* Coded block pattern. */ BOOLEAN mb_intra; /* Intracoded mblock flag. */ BOOLEAN bpict_past_forw; /* Past B frame forw. vector flag. */ BOOLEAN bpict_past_back; /* Past B frame back vector flag. */ int past_intra_addr; /* Addr of last intracoded mblock. */ int recon_right_for_prev; /* Past right forw. vector. */ int recon_down_for_prev; /* Past down forw. vector. */ int recon_right_back_prev; /* Past right back vector. */ int recon_down_back_prev; /* Past down back vector. */ } Macroblock; /* Block structure. */ typedef struct block { #ifdef USE_ATI long int dct_recon[6][130]; /* Reconstructed dct runs & levels */ #else short int dct_recon[8][8]; /* Reconstructed dct coeff matrix. */ #endif short int dct_dc_y_past; /* Past lum. dc dct coefficient. */ short int dct_dc_cr_past; /* Past cr dc dct coefficient. */ short int dct_dc_cb_past; /* Past cb dc dct coefficient. */ } Block; /* Video stream structure. */ typedef struct vid_stream { unsigned int h_size; /* Horiz. size in pixels. */ unsigned int v_size; /* Vert. size in pixels. */ unsigned int mb_height; /* Vert. size in mblocks. */ unsigned int mb_width; /* Horiz. size in mblocks. */ unsigned char aspect_ratio; /* Code for aspect ratio. */ unsigned char picture_rate; /* Code for picture rate. */ unsigned int bit_rate; /* Bit rate. */ unsigned int vbv_buffer_size; /* Minimum buffer size. */ BOOLEAN const_param_flag; /* Contrained parameter flag. */ unsigned char intra_quant_matrix[8][8]; /* Quantization matrix for intracoded frames. */ unsigned char non_intra_quant_matrix[8][8]; /* Quanitization matrix for non intracoded frames. */ char *ext_data; /* Extension data. */ char *user_data; /* User data. */ GoP group; /* Current group of pict. */ Pict picture; /* Current picture. */ Slice slice; /* Current slice. */ Macroblock mblock; /* Current macroblock. */ Block block; /* Current block. */ int state; /* State of decoding. */ int bit_offset; /* Bit offset in stream. */ unsigned int *buffer; /* Pointer to next byte in buffer. */ int buf_length; /* Length of remaining buffer.*/ unsigned int *buf_start; /* Pointer to buffer start. */ /* VC - beginning of added variables for noise computation */ short noise_base_matrix[8][8]; /* Square quantization error */ /* VC - end of added variables */ /* Brown - beginning of added variables that used to be static or global */ int max_buf_length; /* Max length of buffer. */ int film_has_ended; /* Boolean - film has ended */ unsigned int num_left; /* from ReadPacket - leftover */ unsigned int leftover_bytes; /* from ReadPacket - leftover */ int EOF_flag; /* stream is EOF */ BOOLEAN Parse_done; /* from read_sys */ int right_for,down_for; /* From ReconPMBlock, video.c */ int right_half_for, down_half_for; unsigned int curBits; /* current bits */ int matched_depth; /* depth of displayed movie */ int ditherType; /* What type of dithering */ char *ditherFlags; /* flags for MB Ordered dither*/ int totNumFrames; /* Total Number of Frames */ double realTimeStart; /* When did the movie start? */ /* Brown - end of added variables */ PictImage *past; /* Past predictive frame. */ PictImage *future; /* Future predictive frame. */ PictImage *current; /* Current frame. */ PictImage *ring[RING_BUF_SIZE]; /* Ring buffer of frames. */ /* KR - beginning of added variables */ double rate_deal; int _skipFrame; double _skipCount; int _jumpFrame; double _oneFrameTime; MPEGvideo* _smpeg; /* KR - end of added variables */ /* SL - beginning of added variables for FPS calculation */ //#define CALCULATE_FPS #define FPS_WINDOW 60 #ifdef CALCULATE_FPS double frame_time[FPS_WINDOW]; int timestamp_index; #endif /* SL - end of added variables */ /* begining of added variables for system stream based sync */ double timestamp; unsigned int *timestamp_mark; bool timestamp_used; /* begining of added variables */ bool need_frameadjust; int current_frame; #ifdef USE_ATI unsigned int ati_handle; #endif } VidStream; /* Declaration of global display pointer. */ /* Quiet mode flag. */ extern int quietFlag; /* Flag controlling the "Press return" prompt */ extern int requireKeypressFlag; /* Flag controlling speed vs. quality */ extern int qualityFlag; /* Gamma correction stuff */ extern int gammaCorrectFlag; extern double gammaCorrect; /* Chroma correction stuff */ extern int chromaCorrectFlag; extern double chromaCorrect; /* Definition of Contant integer scale factor. */ #define CONST_BITS 13 /* Misc DCT definitions */ #define DCTSIZE 8 /* The basic DCT block is 8x8 samples */ #define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */ #define GLOBAL /* a function referenced thru EXTERNs */ typedef short DCTELEM; typedef DCTELEM DCTBLOCK[DCTSIZE2]; #ifdef ANALYSIS extern unsigned int bitCount; extern int showEachFlag; extern unsigned int cacheHit[8][8]; extern unsigned int cacheMiss[8][8]; #endif #if !defined(__MIPSEL__) && (defined(MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) || defined(__mipsel) || defined(__mipsel__)) #define __MIPSEL__ 1 #endif #if !defined(__MIPSEB__) && (defined(MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__) || defined(__mipseb) || defined(__mipseb__)) #define __MIPSEB__ 1 #endif #if !defined(__SPARC__) && (defined(SPARC) || defined(__SPARC) || defined(__SPARC__) || defined(__sparc) || defined(__sparc__)) #define __SPARC__ 1 #endif #if !defined(__alpha__) && (defined(ALPHA) || defined(__ALPHA) || defined(__ALPHA__) || defined(__alpha)) #define __alpha__ 1 #endif #if !defined(__680x0__) && (defined(__680x0) || defined(__680x0__)) #define __680x0__ 1 #endif #if !defined(__AIX__) && (defined(AIX) || defined(_AIX) || defined(__AIX) || defined(__AIX__)) #define __AIX__ 1 #endif #if !defined(__RS6000__) && (defined(__AIX__) || defined(RS6000) || defined(_RS6000) || defined(__RS6000) || defined(__RS6000__)) #define __RS6000__ 1 #endif #if !defined(__HPUX__) && (defined(HPUX) || defined(_HPUX) || defined(__HPUX) || defined(__HPUX__)) #define __HPUX__ 1 #endif #if !defined(__HPUX__) && (defined(hpux) || defined(_hpux) || defined(__hpux) || defined(__hpux__)) #define __HPUX__ 1 #endif #if !defined(__VAX__) && (defined(VAX) || defined (__VAX)) #define __VAX__ 1 #endif #if !defined(__SCO__) && (defined(SCO) || defined(__SCO) || defined(sco) || defined(__sco__)) #define __SCO__ 1 #endif #if defined(__i386__) || defined(__VAX__) || defined(__MIPSEL__) || defined(__alpha__) || defined(__SCO__) #undef BIG_ENDIAN_ARCHITECTURE #define LITTLE_ENDIAN_ARCHITECTURE 1 #endif #if defined(__RS6000__) || defined(__SPARC__) || defined(__mc68000__) || defined(__HPUX__) || defined(__MIPSEB__) || defined(convex) || defined(__convex__) || defined(__powerpc__) #undef LITTLE_ENDIAN_ARCHITECTURE #define BIG_ENDIAN_ARCHITECTURE 1 #endif #if !defined(LITTLE_ENDIAN_ARCHITECTURE) && !defined(BIG_ENDIAN_ARCHITECTURE) #ifdef WIN32 #undef BIG_ENDIAN_ARCHITECTURE #define LITTLE_ENDIAN_ARCHITECTURE #else #ifdef __BIG_ENDIAN__ #undef LITTLE_ENDIAN_ARCHITECTURE #define BIG_ENDIAN_ARCHITECTURE 1 #else #include #if __BYTE_ORDER == __LITTLE_ENDIAN #undef BIG_ENDIAN_ARCHITECTURE #define LITTLE_ENDIAN_ARCHITECTURE 1 #endif #if __BYTE_ORDER == __BIG_ENDIAN #undef LITTLE_ENDIAN_ARCHITECTURE #define BIG_ENDIAN_ARCHITECTURE 1 #endif #endif #endif #endif #if !defined(LITTLE_ENDIAN_ARCHITECTURE) && !defined(BIG_ENDIAN_ARCHITECTURE) #error Unknown endianism of architecture #endif #ifdef __alpha__ #define SIXTYFOUR_BIT #endif /* Warnings that may help in debugging MPEG streams */ //#define VERBOSE_WARNINGS //#define VERBOSE_DEBUG #endif /* video.h already included */ smpeg-0.4.5+cvs20030824.orig/video/vhar128.cpp0100644000175000017500000001714207166665373020364 0ustar hoseheadhosehead#ifdef USE_ATI #include #include #include #include #include "vhar128.h" /* #define DEBUG_R128VHA */ #define I_FRAME 1 #define P_FRAME 2 #define B_FRAME 3 #define D_FRAME 4 struct vhar128_image { OVDESCRIPTION * overlay; }; struct private_yuvhwdata { OVSURFACE * surface; }; /* Translate error code to something readable */ static void vhar128_perror(char * string, int error_code) { switch(error_code) { case VHAERR_INVALIDPARAMS: fprintf(stderr, "%s: (ATI) Invalid parameters\n", string); break; case VHAERR_UNSUPPORTED: fprintf(stderr, "%s: (ATI) Unsupported feature\n", string); break; case VHAERR_INVALIDHANDLE: fprintf(stderr, "%s: (ATI) Invalid handle\n", string); break; case VHAERR_OUTOFMEMORY: fprintf(stderr, "%s: (ATI) Out of memory\n", string); break; case VHA_OK: fprintf(stderr, "%s: (ATI) Success\n", string); break; default: fprintf(stderr, "%s: (ATI) Undocumented error\n", string); break; } } /* Check and initialize hardware */ unsigned int vhar128_new() { VHA_HARDWAREQUERY vhaQuery; /* Initialize hardware access */ ATIHAP_InitHWAccess(); /* Query hardware information */ memset(&vhaQuery, 0, sizeof(VHA_HARDWAREQUERY)); vhaQuery.uSize = sizeof(VHA_HARDWAREQUERY); vhaQuery.uCards = 0; vhaQuery.ulCodedWidth = 0; vhaQuery.ulCodedHeight = 0; VHA_HardwareQuery(&vhaQuery); #ifdef DEBUG_R128VHA printf("VHA_HardwareQuery :\n"); printf("uHandle = %d\n", vhaQuery.uHandle); if(vhaQuery.ulHWCaps & VHA_HWCAPS_IDCTMC) printf("Hardware supports iScan, iDCT, and MC.\n"); if(vhaQuery.ulHWCaps & VHA_HWCAPS_SUBPIC) printf("Hardware supports Sub-picture.\n"); printf("ulMinOvlyBuffer = %d\n", vhaQuery.ulMinOvlyBuffer); printf("ulMaxOvlyBuffer = %d\n", vhaQuery.ulMaxOvlyBuffer); #endif return(vhaQuery.uHandle); } /* Create a new overlay */ struct vhar128_image * vhar128_newimage(unsigned int handle, unsigned long width, unsigned long height) { struct vhar128_image * image; image = (struct vhar128_image *) malloc(sizeof *image); image->overlay = (OVDESCRIPTION *) malloc(sizeof *image->overlay); memset(image->overlay, 0, sizeof(OVDESCRIPTION)); image->overlay->uSize = sizeof(OVDESCRIPTION); image->overlay->ulOVFormat = OV_FORMAT_YUV12; image->overlay->uWidth = width; image->overlay->uHeight = height; CreateOVSurface(handle, image->overlay); return(image); } /* Lock overlay */ void vhar128_lockimage(unsigned int handle, struct vhar128_image * image, SDL_Overlay * ov) { struct private_yuvhwdata * hwdata; #ifdef DEBUG_R128VHA /* show locked overlay */ SetOVSurface(handle, image->overlay); #endif hwdata = (struct private_yuvhwdata *) malloc(sizeof *hwdata); hwdata->surface = (OVSURFACE *) malloc(sizeof *hwdata->surface); hwdata->surface->uSize = sizeof(OVSURFACE); LockOVSurface(handle, image->overlay, hwdata->surface); /* create an SDL_Overlay from the information in the ATI overlay */ ov->format = SDL_YV12_OVERLAY; ov->w = image->overlay->uWidth; ov->h = image->overlay->uHeight; ov->planes = 3; ov->pitches = (Uint16 *) malloc(ov->planes * sizeof(Uint16)); ov->pitches[0] = hwdata->surface->uPitchPlane1; ov->pitches[1] = hwdata->surface->uPitchPlane3; ov->pitches[2] = hwdata->surface->uPitchPlane2; ov->pixels = (Uint8 **) malloc(ov->planes * sizeof(void *)); ov->pixels[0] = (Uint8 *) hwdata->surface->pSurfPlane1; ov->pixels[1] = (Uint8 *) hwdata->surface->pSurfPlane3; ov->pixels[2] = (Uint8 *) hwdata->surface->pSurfPlane2; ov->hwdata = hwdata; } /* Unlock the overlay */ void vhar128_unlockimage(unsigned int handle, struct vhar128_image * image, SDL_Overlay * ov) { UnlockOVSurface(handle, image->overlay, ov->hwdata->surface); free(ov->pitches); free(ov->pixels); free(ov->hwdata->surface); free(ov->hwdata); } /* Destroy the overlay */ void vhar128_destroyimage(unsigned int handle, struct vhar128_image * image) { DestroyOVSurface(handle, image->overlay); free(image->overlay); free(image); } /* Setup hardware decoding */ int vhar128_init(unsigned int handle, unsigned long width, unsigned long height, struct vhar128_image *ring[], int ring_size) { VHA_INIT vhaInit; register int i; memset(&vhaInit, 0, sizeof(VHA_INIT)); /* obtain yv12 offset and send it to vha */ for(i = 0; i < ring_size; i++) { vhaInit.yv12[i].ulOffsetY = ring[i]->overlay->OVOffset.ulOfsPlane1; vhaInit.yv12[i].ulOffsetU = ring[i]->overlay->OVOffset.ulOfsPlane2; vhaInit.yv12[i].ulOffsetV = ring[i]->overlay->OVOffset.ulOfsPlane3; vhaInit.yv12[i].ulPitchY = ring[i]->overlay->OVOffset.uPitchPlane1; vhaInit.yv12[i].ulPitchUV = ring[i]->overlay->OVOffset.uPitchPlane2; } vhaInit.ulNumYV12Buffer = ring_size; vhaInit.uSize = sizeof(VHA_INIT); vhaInit.ulHWSupports = VHA_HWCAPS_IDCTMC; vhaInit.ulCodedWidth = width; vhaInit.ulCodedHeight = height; #ifdef DEBUG_R128VHA /* set region for showing ATI overlay on the screen */ { RCTL rSrc, rDst, rView; rView.left = rView.top = 0; rView.right = width; rView.bottom = height; rSrc.left = rSrc.top = 0; rSrc.right = width; rSrc.bottom = height; rDst.left = 0; rDst.top = 0; rDst.right = width; rDst.bottom = height; UpdateOVPosition(handle, &rSrc, &rDst, &rView, OV_SHOW); SetOVSurface(handle, ring[0]->overlay); } #endif return(VHA_Init(handle, &vhaInit)); } /* Setup decoding of a new picture */ int vhar128_newdecode(unsigned int handle, int back, int forw, int current) { VHA_NEWDECODE vhaND; int retval; memset(&vhaND, 0, sizeof(VHA_NEWDECODE)); vhaND.uSize = sizeof(VHA_NEWDECODE); vhaND.BackwardRefFrame[0] = vhaND.BackwardRefFrame[1] = back; vhaND.ForwardRefFrame[0] = vhaND.ForwardRefFrame[1] = forw; vhaND.DecodeFrame = current; vhaND.PictureStructure = VHA_PS_FRAME_PICTURE; if((retval = VHA_NewDecode(handle, &vhaND)) != VHA_OK) vhar128_perror("vhar128_newdecode", retval); return(retval); } /* Send a macroblock to the hardware */ int vhar128_macroblock(unsigned int handle, int mb_x, int mb_y, int intra, int back, int forw, int mv_back_x, int mv_back_y, int mv_forw_x, int mv_forw_y, long runlevel[6][130]) { VHA_MACROBLOCK vhaMB; int retval; memset(&vhaMB, 0, sizeof(VHA_MACROBLOCK)); vhaMB.ulSize = sizeof(VHA_MACROBLOCK); memcpy(vhaMB.RunLevel, runlevel, 6*130*sizeof(long)); vhaMB.mb_x = mb_x; vhaMB.mb_y = mb_y; vhaMB.mbType = (intra)?VHA_MBT_INTRA:0; if(forw) vhaMB.mbType |= VHA_MBT_MOTION_FORWARD; if(back) vhaMB.mbType |= VHA_MBT_MOTION_BACKWARD; vhaMB.PredictionType = VHA_PT_FRAME_BASED; vhaMB.ScanType = SCAN_ZIG_ZAG; vhaMB.dct_type = 0; vhaMB.vector[0][0][0] = mv_forw_x; vhaMB.vector[0][0][1] = mv_forw_y; vhaMB.vector[0][1][0] = mv_back_x; vhaMB.vector[0][1][1] = mv_back_y; if((retval = VHA_Macroblock(handle, &vhaMB)) != VHA_OK) vhar128_perror("vhar128_macroblock", retval); return(retval); } /* Flush all macroblocks */ int vhar128_flush(unsigned int handle) { VHA_DECODECOMMAND vhaDC; int retval; memset(&vhaDC, 0, sizeof(VHA_DECODECOMMAND)); vhaDC.uSize = sizeof(VHA_DECODECOMMAND); vhaDC.ulCommand = VHA_CMD_FLUSH; if((retval = VHA_DecodeCommand(handle, &vhaDC)) != VHA_OK) vhar128_perror("vhar128_flush", retval); return(retval); } /* Close hardware decoding */ void vhar128_close(unsigned int handle) { VHA_Close(handle); } /* Close hardware access */ void vhar128_delete() { ATIHAP_CloseHWAccess(); } #endif smpeg-0.4.5+cvs20030824.orig/video/vhar128.h0100644000175000017500000000214107166665373020022 0ustar hoseheadhosehead/* ATI Rage128 video hardware acceleration */ #ifndef _VHAR128_H_ #define _VHAR128_H_ #include "SDL.h" #ifdef __cplusplus extern "C" { #endif struct vhar128_image; unsigned int vhar128_new(); int vhar128_init(unsigned int handle, unsigned long width, unsigned long height, struct vhar128_image *ring[], int ring_size); int vhar128_newdecode(unsigned int handle, int back, int forw, int current); int vhar128_macroblock(unsigned int handle, int mb_x, int mb_y, int intra, int back, int forw, int mv_back_x, int mv_back_y, int mv_forw_x, int mv_forw_y, long runlevel[6][130]); int vhar128_flush(unsigned int handle); void vhar128_close(unsigned int handle); void vhar128_delete(); struct vhar128_image * vhar128_newimage(unsigned int handle, unsigned long width, unsigned long height); void vhar128_lockimage(unsigned int handle, struct vhar128_image * image, SDL_Overlay * surface); void vhar128_unlockimage(unsigned int handle, struct vhar128_image * image, SDL_Overlay * surface); void vhar128_destroyimage(unsigned int handle, struct vhar128_image * image); #ifdef __cplusplus }; #endif #endif /* _VHAR128_H_ */ smpeg-0.4.5+cvs20030824.orig/video/mmxflags_asm.S0100644000175000017500000000144507072744124021252 0ustar hoseheadhosehead #if defined(i386) && defined(USE_MMX) .data .align 16 .type flags,@object flags: .long 0 .text .align 4 .globl cpu_flags .type cpu_flags,@function cpu_flags: pushfl popl %eax movl %eax,%ecx xorl $0x040000,%eax pushl %eax popfl pushfl popl %eax xorl %ecx,%eax jz cpu_flags.L1 # Processor is 386 pushl %ecx popfl movl %ecx,%eax xorl $0x200000,%eax pushl %eax popfl pushfl popl %eax xorl %ecx,%eax je cpu_flags.L1 pusha movl $1,%eax cpuid movl %edx,flags popa movl flags,%eax cpu_flags.L1: ret .Lfe1: .size cpu_flags,.Lfe1-cpu_flags #endif /* i386 && USE_MMX */ smpeg-0.4.5+cvs20030824.orig/video/mmxidct_asm.S0100644000175000017500000005067507072744124021112 0ustar hoseheadhosehead #if defined(i386) && defined(USE_MMX) /* * the input data is tranposed and each 16 bit element in the 8x8 matrix * is left aligned: * for example in 11...1110000 format * If the iDCT is of I macroblock then 0.5 needs to be added to the;DC Component * (element[0][0] of the matrix) */ /* extrn re_matrix */ .data .align 16 .type preSC,@object preSC: .short 16384,22725,21407,19266,16384,12873,8867,4520 .short 22725,31521,29692,26722,22725,17855,12299,6270 .short 21407,29692,27969,25172,21407,16819,11585,5906 .short 19266,26722,25172,22654,19266,15137,10426,5315 .short 16384,22725,21407,19266,16384,12873,8867,4520 .short 12873,17855,16819,15137,25746,20228,13933,7103 .short 17734,24598,23170,20853,17734,13933,9597,4892 .short 18081,25080,23624,21261,18081,14206,9785,4988 .size preSC,128 .align 8 .type x0005000200010001,@object .size x0005000200010001,8 x0005000200010001: .long 0x00010001,0x00050002 .align 8 .type x0040000000000000,@object .size x0040000000000000,8 x0040000000000000: .long 0, 0x00400000 .align 8 .type x5a825a825a825a82,@object .size x5a825a825a825a82,8 x5a825a825a825a82: .long 0x5a825a82, 0x5a825a82 .align 8 .type x539f539f539f539f,@object .size x539f539f539f539f,8 x539f539f539f539f: .long 0x539f539f,0x539f539f .align 8 .type x4546454645464546,@object .size x4546454645464546,8 x4546454645464546: .long 0x45464546,0x45464546 .align 8 .type x61f861f861f861f8,@object .size x61f861f861f861f8,8 x61f861f861f861f8: .long 0x61f861f8,0x61f861f8 .align 8 .type scratch1,@object .size scratch1,8 scratch1: .long 0,0 .align 8 .type scratch3,@object .size scratch3,8 scratch3: .long 0,0 .align 8 .type scratch5,@object .size scratch5,8 scratch5: .long 0,0 .align 8 .type scratch7,@object .size scratch7,8 scratch7: .long 0,0 .type x0,@object .size x0,8 x0: .long 0,0 .align 8 .text .align 4 .globl IDCT_mmx .type IDCT_mmx,@function IDCT_mmx: pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx pushl %esi pushl %edi movl 8(%ebp),%esi /* source matrix */ leal preSC, %ecx /* column 0: even part * use V4, V12, V0, V8 to produce V22..V25 */ movq 8*12(%ecx), %mm0 /* maybe the first mul can be done together */ /* with the dequantization in iHuff module */ pmulhw 8*12(%esi), %mm0 /* V12 */ movq 8*4(%ecx), %mm1 pmulhw 8*4(%esi), %mm1 /* V4 */ movq (%ecx), %mm3 psraw $1, %mm0 /* t64=t66 */ pmulhw (%esi), %mm3 /* V0 */ movq 8*8(%ecx), %mm5 /* duplicate V4 */ movq %mm1, %mm2 /* added 11/1/96 */ pmulhw 8*8(%esi),%mm5 /* V8 */ psubsw %mm0, %mm1 /* V16 */ pmulhw x5a825a825a825a82, %mm1 /* 23170 ->V18 */ paddsw %mm0, %mm2 /* V17 */ movq %mm2, %mm0 /* duplicate V17 */ psraw $1, %mm2 /* t75=t82 */ psraw $2, %mm0 /* t72 */ movq %mm3, %mm4 /* duplicate V0 */ paddsw %mm5, %mm3 /* V19 */ psubsw %mm5, %mm4 /* V20 ;mm5 free */ /* moved from the block below */ movq 8*10(%ecx), %mm7 psraw $1, %mm3 /* t74=t81 */ movq %mm3, %mm6 /* duplicate t74=t81 */ psraw $2, %mm4 /* t77=t79 */ psubsw %mm0, %mm1 /* V21 ; mm0 free */ paddsw %mm2, %mm3 /* V22 */ movq %mm1, %mm5 /* duplicate V21 */ paddsw %mm4, %mm1 /* V23 */ movq %mm3, 8*4(%esi) /* V22 */ psubsw %mm5, %mm4 /* V24; mm5 free */ movq %mm1, 8*12(%esi) /* V23 */ psubsw %mm2, %mm6 /* V25; mm2 free */ movq %mm4, (%esi) /* V24 */ /* keep mm6 alive all along the next block */ /* movq %mm6, 8*8(%esi) V25 */ /* column 0: odd part * use V2, V6, V10, V14 to produce V31, V39, V40, V41 */ /* moved above: movq 8*10(%ecx), %mm7 */ pmulhw 8*10(%esi), %mm7 /* V10 */ movq 8*6(%ecx), %mm0 pmulhw 8*6(%esi), %mm0 /* V6 */ movq 8*2(%ecx), %mm5 movq %mm7, %mm3 /* duplicate V10 */ pmulhw 8*2(%esi), %mm5 /* V2 */ movq 8*14(%ecx), %mm4 psubsw %mm0, %mm7 /* V26 */ pmulhw 8*14(%esi), %mm4 /* V14 */ paddsw %mm0, %mm3 /* V29 ; free mm0 */ movq %mm7, %mm1 /* duplicate V26 */ psraw $1, %mm3 /* t91=t94 */ pmulhw x539f539f539f539f,%mm7 /* V33 */ psraw $1, %mm1 /* t96 */ movq %mm5, %mm0 /* duplicate V2 */ psraw $2, %mm4 /* t85=t87 */ paddsw %mm4,%mm5 /* V27 */ psubsw %mm4, %mm0 /* V28 ; free mm4 */ movq %mm0, %mm2 /* duplicate V28 */ psraw $1, %mm5 /* t90=t93 */ pmulhw x4546454645464546,%mm0 /* V35 */ psraw $1, %mm2 /* t97 */ movq %mm5, %mm4 /* duplicate t90=t93 */ psubsw %mm2, %mm1 /* V32 ; free mm2 */ pmulhw x61f861f861f861f8,%mm1 /* V36 */ psllw $1, %mm7 /* t107 */ paddsw %mm3, %mm5 /* V31 */ psubsw %mm3, %mm4 /* V30 ; free mm3 */ pmulhw x5a825a825a825a82,%mm4 /* V34 */ nop psubsw %mm1, %mm0 /* V38 */ psubsw %mm7, %mm1 /* V37 ; free mm7 */ psllw $1, %mm1 /* t114 */ /* move from the next block */ movq %mm6, %mm3 /* duplicate V25 */ /* move from the next block */ movq 8*4(%esi), %mm7 /* V22 */ psllw $1, %mm0 /* t110 */ psubsw %mm5, %mm0 /* V39 (mm5 needed for next block) */ psllw $2, %mm4 /* t112 */ /* moved from the next block */ movq 8*12(%esi), %mm2 /* V23 */ psubsw %mm0, %mm4 /* V40 */ paddsw %mm4, %mm1 /* V41; free mm0 */ /* moved from the next block */ psllw $1, %mm2 /* t117=t125 */ /* column 0: output butterfly */ /* moved above: * movq %mm6, %mm3 duplicate V25 * movq 8*4(%esi), %mm7 V22 * movq 8*12(%esi), %mm2 V23 * psllw $1, %mm2 t117=t125 */ psubsw %mm1, %mm6 /* tm6 */ paddsw %mm1, %mm3 /* tm8; free mm1 */ movq %mm7, %mm1 /* duplicate V22 */ paddsw %mm5, %mm7 /* tm0 */ movq %mm3, 8*8(%esi) /* tm8; free mm3 */ psubsw %mm5, %mm1 /* tm14; free mm5 */ movq %mm6, 8*6(%esi) /* tm6; free mm6 */ movq %mm2, %mm3 /* duplicate t117=t125 */ movq (%esi), %mm6 /* V24 */ paddsw %mm0, %mm2 /* tm2 */ movq %mm7, (%esi) /* tm0; free mm7 */ psubsw %mm0, %mm3 /* tm12; free mm0 */ movq %mm1, 8*14(%esi) /* tm14; free mm1 */ psllw $1, %mm6 /* t119=t123 */ movq %mm2, 8*2(%esi) /* tm2; free mm2 */ movq %mm6, %mm0 /* duplicate t119=t123 */ movq %mm3, 8*12(%esi) /* tm12; free mm3 */ paddsw %mm4, %mm6 /* tm4 */ /* moved from next block */ movq 8*5(%ecx), %mm1 psubsw %mm4, %mm0 /* tm10; free mm4 */ /* moved from next block */ pmulhw 8*5(%esi), %mm1 /* V5 */ movq %mm6, 8*4(%esi) /* tm4; free mm6 */ movq %mm0, 8*10(%esi) /* tm10; free mm0 */ /* column 1: even part * use V5, V13, V1, V9 to produce V56..V59 */ /* moved to prev block: * movq 8*5(%ecx), %mm1 * pmulhw 8*5(%esi), %mm1 V5 */ movq 8*13(%ecx), %mm7 psllw $1, %mm1 /* t128=t130 */ pmulhw 8*13(%esi), %mm7 /* V13 */ movq %mm1, %mm2 /* duplicate t128=t130 */ movq 8(%ecx), %mm3 pmulhw 8(%esi), %mm3 /* V1 */ movq 8*9(%ecx), %mm5 psubsw %mm7, %mm1 /* V50 */ pmulhw 8*9(%esi), %mm5 /* V9 */ paddsw %mm7, %mm2 /* V51 */ pmulhw x5a825a825a825a82, %mm1 /* 23170 ->V52 */ movq %mm2, %mm6 /* duplicate V51 */ psraw $1, %mm2 /* t138=t144 */ movq %mm3, %mm4 /* duplicate V1 */ psraw $2, %mm6 /* t136 */ paddsw %mm5, %mm3 /* V53 */ psubsw %mm5, %mm4 /* V54 ;mm5 free */ movq %mm3, %mm7 /* duplicate V53 */ /* moved from next block */ movq 8*11(%ecx), %mm0 psraw $1, %mm4 /* t140=t142 */ psubsw %mm6, %mm1 /* V55 ; mm6 free */ paddsw %mm2, %mm3 /* V56 */ movq %mm4, %mm5 /* duplicate t140=t142 */ paddsw %mm1, %mm4 /* V57 */ movq %mm3, 8*5(%esi) /* V56 */ psubsw %mm1, %mm5 /* V58; mm1 free */ movq %mm4, 8*13(%esi) /* V57 */ psubsw %mm2, %mm7 /* V59; mm2 free */ movq %mm5, 8*9(%esi) /* V58 */ /* keep mm7 alive all along the next block * movq %mm7, 8(%esi) V59 * moved above * movq 8*11(%ecx), %mm0 */ pmulhw 8*11(%esi), %mm0 /* V11 */ movq 8*7(%ecx), %mm6 pmulhw 8*7(%esi), %mm6 /* V7 */ movq 8*15(%ecx), %mm4 movq %mm0, %mm3 /* duplicate V11 */ pmulhw 8*15(%esi), %mm4 /* V15 */ movq 8*3(%ecx), %mm5 psllw $1, %mm6 /* t146=t152 */ pmulhw 8*3(%esi), %mm5 /* V3 */ paddsw %mm6, %mm0 /* V63 */ /* note that V15 computation has a correction step: * this is a 'magic' constant that rebiases the results to be closer to the * expected result. this magic constant can be refined to reduce the error * even more by doing the correction step in a later stage when the number * is actually multiplied by 16 */ paddw x0005000200010001, %mm4 psubsw %mm6, %mm3 /* V60 ; free mm6 */ psraw $1, %mm0 /* t154=t156 */ movq %mm3, %mm1 /* duplicate V60 */ pmulhw x539f539f539f539f, %mm1 /* V67 */ movq %mm5, %mm6 /* duplicate V3 */ psraw $2, %mm4 /* t148=t150 */ paddsw %mm4, %mm5 /* V61 */ psubsw %mm4, %mm6 /* V62 ; free mm4 */ movq %mm5, %mm4 /* duplicate V61 */ psllw $1, %mm1 /* t169 */ paddsw %mm0, %mm5 /* V65 -> result */ psubsw %mm0, %mm4 /* V64 ; free mm0 */ pmulhw x5a825a825a825a82, %mm4 /* V68 */ psraw $1, %mm3 /* t158 */ psubsw %mm6, %mm3 /* V66 */ movq %mm5, %mm2 /* duplicate V65 */ pmulhw x61f861f861f861f8, %mm3 /* V70 */ psllw $1, %mm6 /* t165 */ pmulhw x4546454645464546, %mm6 /* V69 */ psraw $1, %mm2 /* t172 */ /* moved from next block */ movq 8*5(%esi), %mm0 /* V56 */ psllw $1, %mm4 /* t174 */ /* moved from next block */ psraw $1, %mm0 /* t177=t188 */ nop psubsw %mm3, %mm6 /* V72 */ psubsw %mm1, %mm3 /* V71 ; free mm1 */ psubsw %mm2, %mm6 /* V73 ; free mm2 */ /* moved from next block */ psraw $1, %mm5 /* t178=t189 */ psubsw %mm6, %mm4 /* V74 */ /* moved from next block */ movq %mm0, %mm1 /* duplicate t177=t188 */ paddsw %mm4, %mm3 /* V75 */ /* moved from next block */ paddsw %mm5, %mm0 /* tm1 */ /* location * 5 - V56 * 13 - V57 * 9 - V58 * X - V59, mm7 * X - V65, mm5 * X - V73, mm6 * X - V74, mm4 * X - V75, mm3 * free mm0, mm1 & mm2 * moved above * movq 8*5(%esi), %mm0 V56 * psllw $1, %mm0 t177=t188 ! new !! * psllw $1, %mm5 t178=t189 ! new !! * movq %mm0, %mm1 duplicate t177=t188 * paddsw %mm5, %mm0 tm1 */ movq 8*13(%esi), %mm2 /* V57 */ psubsw %mm5, %mm1 /* tm15; free mm5 */ movq %mm0, 8(%esi) /* tm1; free mm0 */ psraw $1, %mm7 /* t182=t184 ! new !! */ /* save the store as used directly in the transpose * movq %mm1, 120(%esi) tm15; free mm1 */ movq %mm7, %mm5 /* duplicate t182=t184 */ psubsw %mm3, %mm7 /* tm7 */ paddsw %mm3, %mm5 /* tm9; free mm3 */ movq 8*9(%esi), %mm0 /* V58 */ movq %mm2, %mm3 /* duplicate V57 */ movq %mm7, 8*7(%esi) /* tm7; free mm7 */ psubsw %mm6, %mm3 /* tm13 */ paddsw %mm6, %mm2 /* tm3 ; free mm6 */ /* moved up from the transpose */ movq %mm3, %mm7 /* moved up from the transpose */ punpcklwd %mm1, %mm3 movq %mm0, %mm6 /* duplicate V58 */ movq %mm2, 8*3(%esi) /* tm3; free mm2 */ paddsw %mm4, %mm0 /* tm5 */ psubsw %mm4, %mm6 /* tm11; free mm4 */ /* moved up from the transpose */ punpckhwd %mm1, %mm7 movq %mm0, 8*5(%esi) /* tm5; free mm0 */ /* moved up from the transpose */ movq %mm5, %mm2 /* transpose - M4 part * --------- --------- * | M1 | M2 | | M1'| M3'| * --------- --> --------- * | M3 | M4 | | M2'| M4'| * --------- --------- * Two alternatives: use full mmword approach so the following code can be * scheduled before the transpose is done without stores, or use the faster * half mmword stores (when possible) */ movd %mm3, 8*9+4(%esi) /* MS part of tmt9 */ punpcklwd %mm6, %mm5 movd %mm7, 8*13+4(%esi) /* MS part of tmt13 */ punpckhwd %mm6, %mm2 movd %mm5, 8*9(%esi) /* LS part of tmt9 */ punpckhdq %mm3, %mm5 /* free mm3 */ movd %mm2, 8*13(%esi) /* LS part of tmt13 */ punpckhdq %mm7, %mm2 /* free mm7 */ /* moved up from the M3 transpose */ movq 8*8(%esi), %mm0 /* moved up from the M3 transpose */ movq 8*10(%esi), %mm1 /* moved up from the M3 transpose */ movq %mm0, %mm3 /* shuffle the rest of the data, and write it with 2 mmword writes */ movq %mm5, 8*11(%esi) /* tmt11 */ /* moved up from the M3 transpose */ punpcklwd %mm1, %mm0 movq %mm2, 8*15(%esi) /* tmt15 */ /* moved up from the M3 transpose */ punpckhwd %mm1, %mm3 /* transpose - M3 part * moved up to previous code section * movq 8*8(%esi), %mm0 * movq 8*10(%esi), %mm1 * movq %mm0, %mm3 * punpcklwd %mm1, %mm0 * punpckhwd %mm1, %mm3 */ movq 8*12(%esi), %mm6 movq 8*14(%esi), %mm4 movq %mm6, %mm2 /* shuffle the data and write the lower parts of the transposed in 4 dwords */ punpcklwd %mm4, %mm6 movq %mm0, %mm1 punpckhdq %mm6, %mm1 movq %mm3, %mm7 punpckhwd %mm4, %mm2 /* free mm4 */ punpckldq %mm6, %mm0 /* free mm6 */ /* moved from next block */ movq 8*13(%esi), %mm4 /* tmt13 */ punpckldq %mm2, %mm3 punpckhdq %mm2, %mm7 /* free mm2 */ /* moved from next block */ movq %mm3, %mm5 /* duplicate tmt5 */ /* column 1: even part (after transpose) * moved above * movq %mm3, %mm5 duplicate tmt5 * movq 8*13(%esi), %mm4 tmt13 */ psubsw %mm4, %mm3 /* V134 */ pmulhw x5a825a825a825a82, %mm3 /* 23170 ->V136 */ movq 8*9(%esi), %mm6 /* tmt9 */ paddsw %mm4, %mm5 /* V135 ; mm4 free */ movq %mm0, %mm4 /* duplicate tmt1 */ paddsw %mm6, %mm0 /* V137 */ psubsw %mm6, %mm4 /* V138 ; mm6 free */ psllw $2, %mm3 /* t290 */ psubsw %mm5, %mm3 /* V139 */ movq %mm0, %mm6 /* duplicate V137 */ paddsw %mm5, %mm0 /* V140 */ movq %mm4, %mm2 /* duplicate V138 */ paddsw %mm3, %mm2 /* V141 */ psubsw %mm3, %mm4 /* V142 ; mm3 free */ movq %mm0, 8*9(%esi) /* V140 */ psubsw %mm5, %mm6 /* V143 ; mm5 free */ /* moved from next block */ movq 8*11(%esi), %mm0 /* tmt11 */ movq %mm2, 8*13(%esi) /* V141 */ /* moved from next block */ movq %mm0, %mm2 /* duplicate tmt11 */ /* column 1: odd part (after transpose) */ /* moved up to the prev block * movq 8*11(%esi), %mm0 tmt11 * movq %mm0, %mm2 duplicate tmt11 */ movq 8*15(%esi), %mm5 /* tmt15 */ psubsw %mm7, %mm0 /* V144 */ movq %mm0, %mm3 /* duplicate V144 */ paddsw %mm7, %mm2 /* V147 ; free mm7 */ pmulhw x539f539f539f539f, %mm0 /* 21407-> V151 */ movq %mm1, %mm7 /* duplicate tmt3 */ paddsw %mm5, %mm7 /* V145 */ psubsw %mm5, %mm1 /* V146 ; free mm5 */ psubsw %mm1, %mm3 /* V150 */ movq %mm7, %mm5 /* duplicate V145 */ pmulhw x4546454645464546, %mm1 /* 17734-> V153 */ psubsw %mm2, %mm5 /* V148 */ pmulhw x61f861f861f861f8, %mm3 /* 25080-> V154 */ psllw $2, %mm0 /* t311 */ pmulhw x5a825a825a825a82, %mm5 /* 23170-> V152 */ paddsw %mm2, %mm7 /* V149 ; free mm2 */ psllw $1, %mm1 /* t313 */ nop /* without the nop - freeze here for one clock */ movq %mm3, %mm2 /* duplicate V154 */ psubsw %mm0, %mm3 /* V155 ; free mm0 */ psubsw %mm2, %mm1 /* V156 ; free mm2 */ /* moved from the next block */ movq %mm6, %mm2 /* duplicate V143 */ /* moved from the next block */ movq 8*13(%esi), %mm0 /* V141 */ psllw $1, %mm1 /* t315 */ psubsw %mm7, %mm1 /* V157 (keep V149) */ psllw $2, %mm5 /* t317 */ psubsw %mm1, %mm5 /* V158 */ psllw $1, %mm3 /* t319 */ paddsw %mm5, %mm3 /* V159 */ /* column 1: output butterfly (after transform) * moved to the prev block * movq %mm6, %mm2 duplicate V143 * movq 8*13(%esi), %mm0 V141 */ psubsw %mm3, %mm2 /* V163 */ paddsw %mm3, %mm6 /* V164 ; free mm3 */ movq %mm4, %mm3 /* duplicate V142 */ psubsw %mm5, %mm4 /* V165 ; free mm5 */ movq %mm2, scratch7 /* out7 */ psraw $4, %mm6 psraw $4, %mm4 paddsw %mm5, %mm3 /* V162 */ movq 8*9(%esi), %mm2 /* V140 */ movq %mm0, %mm5 /* duplicate V141 */ /* in order not to perculate this line up, * we read 72(%esi) very near to this location */ movq %mm6, 8*9(%esi) /* out9 */ paddsw %mm1, %mm0 /* V161 */ movq %mm3, scratch5 /* out5 */ psubsw %mm1, %mm5 /* V166 ; free mm1 */ movq %mm4, 8*11(%esi) /* out11 */ psraw $4, %mm5 movq %mm0, scratch3 /* out3 */ movq %mm2, %mm4 /* duplicate V140 */ movq %mm5, 8*13(%esi) /* out13 */ paddsw %mm7, %mm2 /* V160 */ /* moved from the next block */ movq 8(%esi), %mm0 psubsw %mm7, %mm4 /* V167 ; free mm7 */ /* moved from the next block */ movq 8*3(%esi), %mm7 psraw $4, %mm4 movq %mm2, scratch1 /* out1 */ /* moved from the next block */ movq %mm0, %mm1 movq %mm4, 8*15(%esi) /* out15 */ /* moved from the next block */ punpcklwd %mm7, %mm0 /* transpose - M2 parts * moved up to the prev block * movq 8(%esi), %mm0 * movq 8*3(%esi), %mm7 * movq %mm0, %mm1 * punpcklwd %mm7, %mm0 */ movq 8*5(%esi), %mm5 punpckhwd %mm7, %mm1 movq 8*7(%esi), %mm4 movq %mm5, %mm3 /* shuffle the data and write the lower parts of the trasposed in 4 dwords */ movd %mm0, 8*8(%esi) /* LS part of tmt8 */ punpcklwd %mm4, %mm5 movd %mm1, 8*12(%esi) /* LS part of tmt12 */ punpckhwd %mm4, %mm3 movd %mm5, 8*8+4(%esi) /* MS part of tmt8 */ punpckhdq %mm5, %mm0 /* tmt10 */ movd %mm3, 8*12+4(%esi) /* MS part of tmt12 */ punpckhdq %mm3, %mm1 /* tmt14 */ /* transpose - M1 parts */ movq (%esi), %mm7 movq 8*2(%esi), %mm2 movq %mm7, %mm6 movq 8*4(%esi), %mm5 punpcklwd %mm2, %mm7 movq 8*6(%esi), %mm4 punpckhwd %mm2, %mm6 /* free mm2 */ movq %mm5, %mm3 punpcklwd %mm4, %mm5 punpckhwd %mm4, %mm3 /* free mm4 */ movq %mm7, %mm2 movq %mm6, %mm4 punpckldq %mm5, %mm7 /* tmt0 */ punpckhdq %mm5, %mm2 /* tmt2 ; free mm5 */ /* shuffle the rest of the data, and write it with 2 mmword writes */ punpckldq %mm3, %mm6 /* tmt4 */ /* moved from next block */ movq %mm2, %mm5 /* duplicate tmt2 */ punpckhdq %mm3, %mm4 /* tmt6 ; free mm3 */ /* moved from next block */ movq %mm0, %mm3 /* duplicate tmt10 */ /* column 0: odd part (after transpose) *moved up to prev block * movq %mm0, %mm3 duplicate tmt10 * movq %mm2, %mm5 duplicate tmt2 */ psubsw %mm4, %mm0 /* V110 */ paddsw %mm4, %mm3 /* V113 ; free mm4 */ movq %mm0, %mm4 /* duplicate V110 */ paddsw %mm1, %mm2 /* V111 */ pmulhw x539f539f539f539f, %mm0 /* 21407-> V117 */ psubsw %mm1, %mm5 /* V112 ; free mm1 */ psubsw %mm5, %mm4 /* V116 */ movq %mm2, %mm1 /* duplicate V111 */ pmulhw x4546454645464546, %mm5 /* 17734-> V119 */ psubsw %mm3, %mm2 /* V114 */ pmulhw x61f861f861f861f8, %mm4 /* 25080-> V120 */ paddsw %mm3, %mm1 /* V115 ; free mm3 */ pmulhw x5a825a825a825a82, %mm2 /* 23170-> V118 */ psllw $2, %mm0 /* t266 */ movq %mm1, (%esi) /* save V115 */ psllw $1, %mm5 /* t268 */ psubsw %mm4, %mm5 /* V122 */ psubsw %mm0, %mm4 /* V121 ; free mm0 */ psllw $1, %mm5 /* t270 */ psubsw %mm1, %mm5 /* V123 ; free mm1 */ psllw $2, %mm2 /* t272 */ psubsw %mm5, %mm2 /* V124 (keep V123) */ psllw $1, %mm4 /* t274 */ movq %mm5, 8*2(%esi) /* save V123 ; free mm5 */ paddsw %mm2, %mm4 /* V125 (keep V124) */ /* column 0: even part (after transpose) */ movq 8*12(%esi), %mm0 /* tmt12 */ movq %mm6, %mm3 /* duplicate tmt4 */ psubsw %mm0, %mm6 /* V100 */ paddsw %mm0, %mm3 /* V101 ; free mm0 */ pmulhw x5a825a825a825a82, %mm6 /* 23170 ->V102 */ movq %mm7, %mm5 /* duplicate tmt0 */ movq 8*8(%esi), %mm1 /* tmt8 */ paddsw %mm1, %mm7 /* V103 */ psubsw %mm1, %mm5 /* V104 ; free mm1 */ movq %mm7, %mm0 /* duplicate V103 */ psllw $2, %mm6 /* t245 */ paddsw %mm3, %mm7 /* V106 */ movq %mm5, %mm1 /* duplicate V104 */ psubsw %mm3, %mm6 /* V105 */ psubsw %mm3, %mm0 /* V109; free mm3 */ paddsw %mm6, %mm5 /* V107 */ psubsw %mm6, %mm1 /* V108 ; free mm6 */ /* column 0: output butterfly (after transform) */ movq %mm1, %mm3 /* duplicate V108 */ paddsw %mm2, %mm1 /* out4 */ psraw $4, %mm1 psubsw %mm2, %mm3 /* out10 ; free mm2 */ psraw $4, %mm3 movq %mm0, %mm6 /* duplicate V109 */ movq %mm1, 8*4(%esi) /* out4 ; free mm1 */ psubsw %mm4, %mm0 /* out6 */ movq %mm3, 8*10(%esi) /* out10 ; free mm3 */ psraw $4, %mm0 paddsw %mm4, %mm6 /* out8 ; free mm4 */ movq %mm7, %mm1 /* duplicate V106 */ movq %mm0, 8*6(%esi) /* out6 ; free mm0 */ psraw $4, %mm6 movq (%esi), %mm4 /* V115 */ movq %mm6, 8*8(%esi) /* out8 ; free mm6 */ movq %mm5, %mm2 /* duplicate V107 */ movq 8*2(%esi), %mm3 /* V123 */ paddsw %mm4, %mm7 /* out0 */ /* moved up from next block */ movq scratch3, %mm0 psraw $4, %mm7 /* moved up from next block */ movq scratch5, %mm6 psubsw %mm4, %mm1 /* out14 ; free mm4 */ paddsw %mm3, %mm5 /* out2 */ psraw $4, %mm1 movq %mm7, (%esi) /* out0 ; free mm7 */ psraw $4, %mm5 movq %mm1, 8*14(%esi) /* out14 ; free mm1 */ psubsw %mm3, %mm2 /* out12 ; free mm3 */ movq %mm5, 8*2(%esi) /* out2 ; free mm5 */ psraw $4, %mm2 /* moved up to the prev block */ movq scratch7, %mm4 /* moved up to the prev block */ psraw $4, %mm0 movq %mm2, 8*12(%esi) /* out12 ; free mm2 */ /* moved up to the prev block */ psraw $4, %mm6 /* move back the data to its correct place * moved up to the prev block * movq scratch3, %mm0 * movq scratch5, %mm6 * movq scratch7, %mm4 * psraw $4, %mm0 * psraw $4, %mm6 */ movq scratch1, %mm1 psraw $4, %mm4 movq %mm0, 8*3(%esi) /* out3 */ psraw $4, %mm1 movq %mm6, 8*5(%esi) /* out5 */ movq %mm4, 8*7(%esi) /* out7 */ movq %mm1, 8(%esi) /* out1 */ popl %edi popl %esi popl %edx popl %ecx popl %ebx movl %ebp,%esp popl %ebp ret .Lfe1: .size IDCT_mmx,.Lfe1-IDCT_mmx #endif /* i386 && USE_MMX */ smpeg-0.4.5+cvs20030824.orig/video/COPYRIGHT0100644000175000017500000000206406761142240017734 0ustar hoseheadhosehead/* * Copyright (c) 1995 The Regents of the University of California. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement is * hereby granted, provided that the above copyright notice and the following * two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */