Projects
Essentials
xvid
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 6
View file
xvidcore.changes
Changed
@@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Sat May 10 00:00:00 UTC 2014 - Manfred.Tremmel@iiv.de + +- Update to xvid 1.3.3 (release) + +------------------------------------------------------------------- Mon Mar 12 09:33:21 UTC 2012 - toddrme2178@gmail.com - Cleaned up spec file formatting
View file
xvidcore.spec
Changed
@@ -1,5 +1,5 @@ Name: xvidcore -Version: 1.3.2 +Version: 1.3.3 %define soname 4 Release: 1 License: GPL-2.0+
View file
xvidcore-1.3.2.tar.bz2/build/generic/missing
Deleted
@@ -1,376 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. - -scriptversion=2009-04-28.21; # UTC - -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, -# 2008, 2009 Free Software Foundation, Inc. -# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 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, see <http://www.gnu.org/licenses/>. - -# 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=: -sed_output='s/.* --output =\(^ *\).*/\1/p' -sed_minuso='s/.* -o \(^ *\).*/\1/p' - -# 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 - -msg="missing on your system" - -case $1 in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - # Exit code 63 means version mismatch. This often happens - # when the user try to use an ancient version of a tool on - # a file that requires a minimum version. In this case we - # we should proceed has if the program had been absent, or - # if --run hadn't been passed. - if test $? = 63; then - run=: - msg="probably too old" - fi - ;; - - -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' - autom4te touch the output file, or create a stub one - 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 - -Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and -\`g' are ignored when checking the name. - -Send bug reports to <bug-automake@gnu.org>." - exit $? - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing $scriptversion (GNU Automake)" - exit $? - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - -esac - -# normalize program name to check for. -program=`echo "$1" | sed ' - s/^gnu-//; t - s/^gnu//; t - s/^g//; t'` - -# Now exit if we have it, but it failed. Also exit now if we -# don't have it and --version was passed (most likely to detect -# the program). This is about non-GNU programs, so use $1 not -# $program. -case $1 in - lex*|yacc*) - # Not GNU programs, they don't have --version. - ;; - - tar*) - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - exit 1 - fi - ;; - - *) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - # Could not run --version or --help. This is probably someone - # running `$TOOL --version' or `$TOOL --help' to check whether - # $TOOL exists and not knowing $TOOL uses missing. - exit 1 - fi - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case $program in - aclocal*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. 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 $msg. 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 $msg. 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/^ *ACM_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 $msg. 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 - ;; - - autom4te*) - echo 1>&2 "\ -WARNING: \`$1' is needed, but is $msg. - You might have modified some files without having the - proper tools for further handling them. - You can get \`$1' as part of \`Autoconf' from any GNU - archive site." - - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo "#! /bin/sh" - echo "# Created by GNU Automake missing as a replacement of" - echo "# $ $@" - echo "exit 0" - chmod +x $file - exit 1 - fi - ;; - - bison*|yacc*) - echo 1>&2 "\ -WARNING: \`$1' $msg. 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 test $# -ne 1; then - eval LASTARG="\${$#}" - case $LASTARG in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if test ! -f y.tab.h; then - echo >y.tab.h - fi - if test ! -f y.tab.c; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex*|flex*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. 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 test $# -ne 1; then - eval LASTARG="\${$#}" - case $LASTARG in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if test ! -f lex.yy.c; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. 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 "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit $? - fi - ;; - - makeinfo*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. 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." - # The file to touch is that specified with -o ... - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -z "$file"; then - # ... or it is the one specified with @setfilename ... - infile=`echo "$*" | sed 's/.* \(^ *\) *$/\1/'` - file=`sed -n ' - /^@setfilename/{ - s/.* \(^ *\) *$/\1/ - p - q - }' $infile` - # ... or it is derived from the source name (dir/f.texi becomes f.info) - test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.^.*$,,'`.info - fi - # If the file does not exist, the user really needs makeinfo; - # let's fail without touching anything. - test -f $file || exit 1 - touch $file - ;; - - tar*) - shift - - # 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 "$@" && exit 0 - fi - if (gtar --version > /dev/null 2>&1); then - gtar "$@" && exit 0 - fi - firstarg="$1" - if shift; then - case $firstarg in - *o*) - firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - case $firstarg in - *h*) - firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" "$@" && 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 is $msg. - 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 prerequisites 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 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End:
View file
xvidcore-1.3.2.tar.bz2/ChangeLog -> xvidcore-1.3.3.tar.bz2/ChangeLog
Changed
@@ -1,5 +1,164 @@ # Note that this ChangeLog covers only changes to the release branch +2014-03-05 08:37 Isibaar + + * xvidcore/examples/xvid_encraw.c: Help info about zones usage and + various fixes for compiler warnings - Patch by Elio Blanca + +2014-02-11 14:48 Isibaar + + * xvidcore/examples/xvid_encraw.c: Improved help texts and defaults + handling. Patch by Elio Blanca. + +2014-02-09 16:51 Isibaar + + * xvidcore/examples/Makefile, xvidcore/examples/xvid_encraw.c: + Better environment detection for Makefile - Patch by Elio Blanca + +2014-02-07 16:00 Isibaar + + * xvidcore/examples/xvid_encraw.c: Fix out of bound access to + framestats struct. Thanks to Elio Blanca. + +2013-02-18 16:24 Isibaar + + * xvidcore/build/generic/configure.in: bring version number in + configure.in in sync with rest of code + +2013-01-29 19:12 Isibaar + + * xvidcore/build/generic/configure.in: Patch for QNX support by + Mike Gorchak + +2012-10-04 14:26 Isibaar + + * xvidcore/build/generic/configure.in: remove obsolete + '-mno-cygwin' option for gcc version >= 4 + +2012-06-21 09:55 Isibaar + + * xvidcore/examples/xvid_encraw.c: Fixed bug in PGM header parser - + thanks to Jim Bennett! + +2012-02-22 19:00 Isibaar + + * xvidcore/dshow/src/CXvidDecoder.cpp, + xvidcore/dshow/src/CXvidDecoder.h, xvidcore/dshow/src/config.c, + xvidcore/dshow/src/config.h, xvidcore/dshow/src/resource.h, + xvidcore/dshow/src/xvid.ax.rc: Ported tray icon patch from HEAD + branch + +2011-12-30 13:04 Isibaar + + * xvidcore/src/global.h: #define MIN/MAX macros only when not yet + otherwise defined... + +2011-11-09 14:12 Isibaar + + * xvidcore/src/plugins/plugin_lumimasking.c: Reverted change to + max_quant calculation. Users prefer the former behavior... + +2011-11-04 15:23 Isibaar + + * xvidcore/src/utils/mbtransquant.c, xvidcore/src/xvid.c, + xvidcore/src/xvid.h: Fix for possible overflow in trellis + quant... + +2011-10-25 10:57 Isibaar + + * xvidcore/src/xvid.c, xvidcore/src/xvid.h: Ramp up version + number... + +2011-10-25 10:53 Isibaar + + * xvidcore/src/motion/estimation_bvop.c: Fix for encoder crash that + is possible with the following combination of encoder options: + Turbo, VHQ for B-VOPs and Qpel... + +2011-10-06 18:05 Isibaar + + * xvidcore/src/plugins/plugin_lumimasking.c: Make sure max_quant is + at least frame_quant+2 for lumi/variance masking + +2011-09-19 09:32 Isibaar + + * xvidcore/build/generic/Makefile, + xvidcore/build/generic/configure.in, + xvidcore/build/generic/platform.inc.in: Install symlinks for + shared library. Patch by Andres Mejia. + +2011-09-19 08:18 Isibaar + + * xvidcore/build/generic/configure.in: Remove rhapsody OS case. + Patch by Ryan Schmidt. + +2011-09-16 12:34 Isibaar + + * xvidcore/build/generic/configure.in: Double check for pthread on + MinGW. Patch by Motofumi Oka. + +2011-09-15 10:36 Isibaar + + * xvidcore/build/generic/Makefile, + xvidcore/build/generic/platform.inc.in: install xvidcore.dll to + under Cygwin. Patch by Motofumi Oka. + +2011-09-15 09:34 Isibaar + + * xvidcore/build/generic/configure.in: Try to autodetect name + mangling variations for WIN64 cross-compiling. Patch by Motofumi + Oka. + +2011-09-14 15:08 Isibaar + + * xvidcore/build/generic/configure.in: removed obsolete -mno-cygwin + +2011-09-14 10:45 Isibaar + + * xvidcore/build/generic/configure.in: platform-independent gcc + versio check - patch by Motofumi Oka + +2011-08-19 16:20 Isibaar + + * xvidcore/build/generic/configure.in, + xvidcore/build/generic/platform.inc.in: User-supplied LDFLAGS. + Patch by Ryan Schmidt and the MacPorts project. + +2011-07-28 07:48 Isibaar + + * xvidcore/build/generic/configure.in: Added support for GNU Hurd + as target_os + +2011-05-23 07:47 Isibaar + + * xvidcore/src/xvid.c: removed deprecated call to idct_int32_init() + +2011-05-21 16:55 Isibaar + + * xvidcore/ChangeLog: Updated ChangeLog + +2011-05-19 12:48 Isibaar + + * xvidcore/dshow/src/CAbout.cpp, + xvidcore/dshow/src/CXvidDecoder.cpp, + xvidcore/dshow/src/Configure.cpp: autoprops property set also for + .cpp files + +2011-05-19 12:24 Isibaar + + * xvidcore/dshow/src/CXvidDecoder.cpp: Added #ifdef ENABLE_MFT + check + +2011-05-19 12:23 Isibaar + + * xvidcore/dshow/dshow.vcproj: Added special configurations for + MFT-enabled builds + +2011-05-19 08:27 Isibaar + + * xvidcore/build/generic/Makefile: Don't include platform.inc on + make clean - Patch by Fabian Greffrath + 2011-05-18 16:13 Isibaar * xvidcore/dshow/src/CXvidDecoder.cpp, xvidcore/dshow/src/config.c,
View file
xvidcore-1.3.2.tar.bz2/README -> xvidcore-1.3.3.tar.bz2/README
Changed
@@ -4,13 +4,14 @@ Xvid is a high performance and high quality MPEG-4 video de-/encoding solution. -The Xvid package currently consists of three parts: +The Xvid package currently consists of four parts: -- xvidcore: the main MPEG-4 de-/encoding library, and simple example - programs +- xvidcore: the main MPEG-4 de-/encoding library. + +- examples: xvid_decraw and xvid_encraw de-/encoder example programs. - dshow: windows direct show decoder filter which links against xvidcore to allow MPEG-4 playback on Windows based OS. -- vfw: video for windows GUI +- vfw: video for windows GUI. 2) Documentation @@ -24,6 +25,6 @@ ------------ - Xvid is licensed as a whole under the terms of the Xvid license - described in the file LICENSE This is true for all files belonging + described in the file LICENSE. This is true for all files belonging to Xvid except for those which specifically carry a different license header. \ No newline at end of file
View file
xvidcore-1.3.2.tar.bz2/build/generic/Makefile -> xvidcore-1.3.3.tar.bz2/build/generic/Makefile
Changed
@@ -141,16 +141,29 @@ #----------------------------------------------------------------------------- install: $(BUILD_DIR)/$(STATIC_LIB) $(BUILD_DIR)/$(SHARED_LIB) - @echo " D: $(libdir)" - @$(INSTALL) -d $(DESTDIR)$(libdir) - @echo " I: $(libdir)/$(SHARED_LIB)" - @$(INSTALL) -m 644 $(BUILD_DIR)/$(SHARED_LIB) $(DESTDIR)$(libdir)/$(SHARED_LIB) - @echo " I: $(libdir)/$(STATIC_LIB)" - @$(INSTALL) -m 644 $(BUILD_DIR)/$(STATIC_LIB) $(DESTDIR)$(libdir)/$(STATIC_LIB) @echo " D: $(includedir)" @$(INSTALL) -d $(DESTDIR)$(includedir) @echo " I: $(includedir)/xvid.h" @$(INSTALL) -m 644 $(SRC_DIR)/xvid.h $(DESTDIR)$(includedir)/xvid.h + @echo " D: $(libdir)" + @$(INSTALL) -d $(DESTDIR)$(libdir) + @echo " I: $(libdir)/$(STATIC_LIB)" + @$(INSTALL) -m 644 $(BUILD_DIR)/$(STATIC_LIB) $(DESTDIR)$(libdir)/$(STATIC_LIB) +ifeq ($(SHARED_EXTENSION),dll) + @echo " I: $(libdir)/$(SHARED_LIB).a" + @$(INSTALL) -m 644 $(BUILD_DIR)/$(SHARED_LIB).a $(DESTDIR)$(libdir)/$(SHARED_LIB).a + @echo " D: $(bindir)" + @$(INSTALL) -d $(DESTDIR)$(bindir) + @echo " I: $(bindir)/$(SHARED_LIB)" + @$(INSTALL) -m 755 $(BUILD_DIR)/$(SHARED_LIB) $(DESTDIR)$(bindir)/$(SHARED_LIB) +else + @echo " I: $(libdir)/$(SHARED_LIB)" + @$(INSTALL) -m 644 $(BUILD_DIR)/$(SHARED_LIB) $(DESTDIR)$(libdir)/$(SHARED_LIB) + @test -z "$(SO_API_MAJOR_LINK)" || \ + $(LN_S) $(SHARED_LIB) $(DESTDIR)$(libdir)/$(SO_API_MAJOR_LINK) + @test -z "$(SO_LINK)" || \ + $(LN_S) $(SHARED_LIB) $(DESTDIR)$(libdir)/$(SO_LINK) +endif #----------------------------------------------------------------------------- # Platorm specific file -- dumb rules for people executing make before
View file
xvidcore-1.3.2.tar.bz2/build/generic/config.guess -> xvidcore-1.3.3.tar.bz2/build/generic/config.guess
Changed
@@ -1,14 +1,12 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 -# Free Software Foundation, Inc. +# Copyright 1992-2013 Free Software Foundation, Inc. -timestamp='2010-08-21' +timestamp='2013-06-10' # 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 +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -17,26 +15,22 @@ # 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., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program; if not, see <http://www.gnu.org/licenses/>. # # 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. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to <config-patches@gnu.org> and include a ChangeLog -# entry. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). # -# 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. +# Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# +# Please send patches with a ChangeLog entry to config-patches@gnu.org. + me=`echo "$0" | sed -e 's,.*/,,'` @@ -56,9 +50,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free -Software Foundation, Inc. +Copyright 1992-2013 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." @@ -92,7 +84,7 @@ exit 1 fi -trap 'exit 1' HUP INT TERM +trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires @@ -106,7 +98,7 @@ set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" HUP INT PIPE TERM ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || @@ -140,12 +132,43 @@ UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include <features.h> + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + ;; +esac + +case "${UNAME_MACHINE}" in + i?86) + test -z "$VENDOR" && VENDOR=pc + ;; + *) + test -z "$VENDOR" && VENDOR=unknown + ;; +esac +test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse + # 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*, + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward @@ -181,7 +204,7 @@ fi ;; *) - os=netbsd + os=netbsd ;; esac # The OS release @@ -202,21 +225,25 @@ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-${VENDOR}-bitrig${UNAME_RELEASE} + exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + echo ${UNAME_MACHINE_ARCH}-${VENDOR}-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + echo ${UNAME_MACHINE}-${VENDOR}-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + echo ${UNAME_MACHINE}-${VENDOR}-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} + echo powerpc-${VENDOR}-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + echo ${UNAME_MACHINE}-${VENDOR}-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in @@ -224,7 +251,7 @@ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on @@ -270,7 +297,10 @@ # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^PVTX//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit ;; + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; 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 @@ -281,13 +311,13 @@ echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 + echo m68k-${VENDOR}-sysv4 exit ;; *:AamigaOoSs:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos + echo ${UNAME_MACHINE}-${VENDOR}-amigaos exit ;; *:MmorphOoSs:*:*) - echo ${UNAME_MACHINE}-unknown-morphos + echo ${UNAME_MACHINE}-${VENDOR}-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition @@ -296,13 +326,13 @@ echo s390-ibm-zvmoe exit ;; *:OS400:*:*) - echo powerpc-ibm-os400 + echo powerpc-ibm-os400 exit ;; arm:RISC*:1.012*:*|arm:riscix:1.012*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) - echo arm-unknown-riscos + arm*:riscos:*:*|arm*:RISCOS:*:*) + echo arm-${VENDOR}-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp @@ -395,23 +425,23 @@ # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atariste:*MiNT:*:* | atariste:*mint:*:* | atariste:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atariste:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; + echo m68k-${VENDOR}-mint${UNAME_RELEASE} + exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; @@ -481,8 +511,8 @@ echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` + # 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 || \ @@ -495,7 +525,7 @@ else echo i586-dg-dgux${UNAME_RELEASE} fi - exit ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; @@ -595,52 +625,52 @@ 9000/6780-90-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" ;; + 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" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac + esac ;; + esac fi if "${HP_ARCH}" = "" ; then eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + sed 's/^ //' << EOF >$dummy.c - #define _HPUX_SOURCE - #include <stdlib.h> - #include <unistd.h> + #define _HPUX_SOURCE + #include <stdlib.h> + #include <unistd.h> - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); + 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); - } + 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 -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa @@ -721,9 +751,9 @@ exit ;; i*86:OSF1:*:*) if -x /usr/sbin/sysversion ; then - echo ${UNAME_MACHINE}-unknown-osf1mk + echo ${UNAME_MACHINE}-${VENDOR}-osf1mk else - echo ${UNAME_MACHINE}-unknown-osf1 + echo ${UNAME_MACHINE}-${VENDOR}-osf1 fi exit ;; parisc*:Lites*:*:*) @@ -731,22 +761,22 @@ exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.^.*$/.X/' exit ;; @@ -770,57 +800,62 @@ exit ;; F3001: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 ;; + 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 ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} + echo sparc-${VENDOR}-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + echo ${UNAME_MACHINE}-${VENDOR}-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/-(.*//'` ;; + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/-(.*//'` ;; + echo x86_64-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/-(.*//'` ;; *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/-(.*//'` ;; + echo ${UNAME_PROCESSOR}-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/-(.*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; + i*:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) - case ${UNAME_MACHINE} in + case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix${UNAME_RELEASE} + echo x86_64-${VENDOR}-interix${UNAME_RELEASE} exit ;; IA64) - echo ia64-unknown-interix${UNAME_RELEASE} + echo ia64-${VENDOR}-interix${UNAME_RELEASE} exit ;; esac ;; 34586:Windows_95:* | 34586:Windows_98:* | 34586:Windows_NT:*) @@ -839,25 +874,32 @@ echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin + echo x86_64-${VENDOR}-cygwin exit ;; p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin + echo powerpcle-${VENDOR}-cygwin exit ;; prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/^.*//'` + echo powerpcle-${VENDOR}-solaris2`echo ${UNAME_RELEASE}|sed -e 's/^.*//'` exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,-/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,-/.*$,,'`-${VENDOR}-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^^/*/,,' | tr 'A-Z' 'a-z'``echo ${UNAME_RELEASE}|sed -e 's/-(.*//'`-gnu + echo ${UNAME_MACHINE}-${VENDOR}-`echo ${UNAME_SYSTEM} | sed 's,^^/*/,,' | tr 'A-Z' 'a-z'``echo ${UNAME_RELEASE}|sed -e 's/-(.*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; + aarch64:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} + exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -867,52 +909,56 @@ EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; - esac + esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} else - echo ${UNAME_MACHINE}-unknown-linux-gnueabi + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}eabi + else + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}eabihf + fi fi exit ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; cris:Linux:*:*) - echo cris-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) - echo frv-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; i*86:Linux:*:*) - LIBC=gnu - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build @@ -931,54 +977,63 @@ #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + test x"${CPU}" != x && { echo "${CPU}-${VENDOR}-linux-${LIBC}"; exit; } ;; + or1k:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} + exit ;; or32:Linux:*:*) - echo or32-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-gnu + echo sparc-${VENDOR}-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-${VENDOR}-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # 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 ;; + PA7*) echo hppa1.1-${VENDOR}-linux-${LIBC} ;; + PA8*) echo hppa2.0-${VENDOR}-linux-${LIBC} ;; + *) echo hppa-${VENDOR}-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-${VENDOR}-linux-${LIBC} exit ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-${VENDOR}-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-${VENDOR}-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-${VENDOR}-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; tile*:Linux:*:*) - echo ${UNAME_MACHINE}-tilera-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu + echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -987,11 +1042,11 @@ echo i386-sequent-sysv4 exit ;; 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, + # 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. + # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) @@ -1000,16 +1055,16 @@ echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop + echo ${UNAME_MACHINE}-${VENDOR}-stop exit ;; i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos + echo ${UNAME_MACHINE}-${VENDOR}-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.01*:* | i*86:LynxOS:4.02*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} + echo i386-${VENODR}-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp @@ -1023,13 +1078,13 @@ fi exit ;; i*86:*:5:678*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. + # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + echo ${UNAME_MACHINE}-${VENDOR}-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then @@ -1051,13 +1106,13 @@ exit ;; 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 i586. + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp - exit ;; + exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; @@ -1068,7 +1123,7 @@ 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 + echo i860-${VENODR}-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) @@ -1092,8 +1147,8 @@ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 334??:*:4.0:* | 334??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ @@ -1105,19 +1160,19 @@ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} + echo m68k-${VENDOR}-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} + echo sparc-${VENDOR}-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} + echo rs6000-${VENDOR}-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.01*:* | PowerPC:LynxOS:4.02*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} + echo powerpc-${VENDOR}-lynxos${UNAME_RELEASE} exit ;; SMBES:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} @@ -1136,10 +1191,10 @@ echo ns32k-sni-sysv fi exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says <Richard.M.Bartel@ccMail.Census.GOV> - echo i586-unisys-sysv4 - exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> + echo i586-unisys-sysv4 + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes <hewes@openmarket.com>. # How about differentiating between stratus architectures? -djm @@ -1165,11 +1220,11 @@ exit ;; R34000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if -d /usr/nec ; then - echo mips-nec-sysv${UNAME_RELEASE} + echo mips-nec-sysv${UNAME_RELEASE} else - echo mips-unknown-sysv${UNAME_RELEASE} + echo mips-${VENDOR}-sysv${UNAME_RELEASE} fi - exit ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; @@ -1182,6 +1237,9 @@ BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; + x86_64:Haiku:*:*) + echo x86_64-${VENDOR}-haiku + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; @@ -1208,19 +1266,21 @@ exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - i386) - eval $set_cc_for_build - if "$CC_FOR_BUILD" != 'no_compiler_found' ; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - UNAME_PROCESSOR="x86_64" - fi - fi ;; - unknown) UNAME_PROCESSOR=powerpc ;; - esac + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if "$CC_FOR_BUILD" != 'no_compiler_found' ; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:0123456789*:*) @@ -1234,7 +1294,10 @@ *:QNX:*:4*) echo i386-pc-qnx exit ;; - NSE-?:NONSTOP_KERNEL:*:*) + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} + exit ;; + NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) @@ -1258,13 +1321,13 @@ else UNAME_MACHINE="$cputype" fi - echo ${UNAME_MACHINE}-unknown-plan9 + echo ${UNAME_MACHINE}-${VENDOR}-plan9 exit ;; *:TOPS-10:*:*) - echo pdp10-unknown-tops10 + echo pdp10-${VENDOR}-tops10 exit ;; *:TENEX:*:*) - echo pdp10-unknown-tenex + echo pdp10-${VENDOR}-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 @@ -1273,19 +1336,19 @@ echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) - echo pdp10-unknown-tops20 + echo pdp10-${VENDOR}-tops20 exit ;; *:ITS:*:*) - echo pdp10-unknown-its + echo pdp10-${VENDOR}-its exit ;; SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} + echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/-(.*//'` + echo ${UNAME_MACHINE}-${VENDOR}-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/-(.*//'` exit ;; *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` + UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; @@ -1303,11 +1366,11 @@ i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; + x86_64:VMkernel:*:*) + echo ${UNAME_MACHINE}-${VENDOR}-esx + exit ;; esac -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - eval $set_cc_for_build cat >$dummy.c <<EOF #ifdef _SEQUENT_ @@ -1325,11 +1388,11 @@ #include <sys/param.h> printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 - "4" + "4" #else - "" + "" #endif - ); exit (0); + ); exit (0); #endif #endif
View file
xvidcore-1.3.2.tar.bz2/build/generic/config.sub -> xvidcore-1.3.3.tar.bz2/build/generic/config.sub
Changed
@@ -1,38 +1,31 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 -# Free Software Foundation, Inc. +# Copyright 1992-2013 Free Software Foundation, Inc. -timestamp='2010-09-11' +timestamp='2013-04-24' -# 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 +# 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 3 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. +# 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., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program; if not, see <http://www.gnu.org/licenses/>. # # 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. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches to <config-patches@gnu.org>. Submit a context -# diff and a properly formatted GNU ChangeLog entry. +# Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -75,9 +68,7 @@ version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free -Software Foundation, Inc. +Copyright 1992-2013 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." @@ -125,13 +116,17 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\(^-*-^-*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\(^-*-^-*\)$/\1/'` ;; + android-linux) + os=-linux-android + basic_machine=`echo $1 | sed 's/^\(.*\)-\(^-*-^-*\)$/\1/'`-unknown + ;; *) basic_machine=`echo $1 | sed 's/-^-*$//'` if $basic_machine != $1 @@ -154,12 +149,12 @@ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c123* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze) + -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; - -bluegene*) - os=-cnk + -bluegene*) + os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= @@ -175,10 +170,10 @@ os=-chorusos basic_machine=$1 ;; - -chorusrdb) - os=-chorusrdb + -chorusrdb) + os=-chorusrdb basic_machine=$1 - ;; + ;; -hiux*) os=-hiuxwe2 ;; @@ -223,6 +218,12 @@ -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; -lynx*) os=-lynxos ;; @@ -247,20 +248,27 @@ # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ + | aarch64 | aarch64_be \ | alpha | alphaev4-8 | alphaev56 | alphaev678 | alphapca567 \ | alpha64 | alpha64ev4-8 | alpha64ev56 | alpha64ev678 | alpha64pca567 \ | am33_2.0 \ - | arc | arm | armble | armelb | armv2345 | armv345lb | avr | avr32 \ + | arc | arceb \ + | arm | armble | armelb | armv2-8 | armv3-8lb | armv7arm \ + | avr | avr32 \ + | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ + | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.01 | hppa2.0 | hppa2.0nw | hppa64 \ + | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ + | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -278,30 +286,32 @@ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ - | nios | nios2 \ + | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ - | or32 \ + | open8 \ + | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ - | rx \ + | rl78 | rx \ | score \ | sh | sh1234 | sh24a | sh24aeb | sh23e | sh34eb | sheb | shbe | shle | sh1234le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu | strongarm \ - | tahoe | thumb | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ - | v850 | v850e \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ - | x86 | xc16x | xscale | xscaleebl | xstormy16 | xtensa \ + | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; @@ -314,8 +324,7 @@ c6x) basic_machine=tic6x-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12 | picochip) - # Motorola 68HC11/12. + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; @@ -325,6 +334,21 @@ basic_machine=mt-unknown ;; + strongarm | thumb | xscale) + basic_machine=arm-unknown + ;; + xgate) + basic_machine=$basic_machine-unknown + os=-none + ;; + xscaleeb) + basic_machine=armeb-unknown + ;; + + xscaleel) + basic_machine=armel-unknown + ;; + # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. @@ -339,11 +363,13 @@ # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ + | aarch64-* | aarch64_be-* \ | alpha-* | alphaev4-8-* | alphaev56-* | alphaev678-* \ | alpha64-* | alpha64ev4-8-* | alpha64ev56-* | alpha64ev678-* \ - | alphapca567-* | alpha64pca567-* | arc-* \ + | alphapca567-* | alpha64pca567-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ + | be32-* | be64-* \ | bfin-* | bs2000-* \ | c123* | c30-* | cjt90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ @@ -352,12 +378,15 @@ | f3001-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.01-* | hppa2.0-* | hppa2.0nw-* | hppa64-* \ + | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ + | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m6800123460-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -375,31 +404,34 @@ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ - | romp-* | rs6000-* | rx-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh1234-* | sh24a-* | sh24aeb-* | sh23e-* | sh34eb-* | sheb-* | shbe-* \ | shle-* | sh1234le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile-* | tilegx-* \ + | tile*-* \ | tron-* \ | ubicom32-* \ - | v850-* | v850e-* | vax-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscaleebl-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) @@ -424,7 +456,7 @@ basic_machine=a29k-amd os=-udi ;; - abacus) + abacus) basic_machine=abacus-unknown ;; adobe68k) @@ -507,7 +539,7 @@ basic_machine=c90-cray os=-unicos ;; - cegcc) + cegcc) basic_machine=arm-unknown os=-cegcc ;; @@ -539,7 +571,7 @@ basic_machine=craynv-cray os=-unicosmp ;; - cr16) + cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; @@ -697,7 +729,6 @@ i370-ibm* | ibm*) basic_machine=i370-ibm ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 @@ -755,9 +786,13 @@ basic_machine=ns32k-utek os=-sysv ;; - microblaze) + microblaze*) basic_machine=microblaze-xilinx ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; mingw32) basic_machine=i386-pc os=-mingw32 @@ -794,10 +829,18 @@ ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; + msys) + basic_machine=i386-pc + os=-msys + ;; mvs) basic_machine=i370-ibm os=-mvs ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; ncr3000) basic_machine=i486-ncr os=-sysv4 @@ -862,10 +905,10 @@ np1) basic_machine=np1-gould ;; - neo-tandem) + neo-tandem) basic_machine=neo-tandem ;; - nse-tandem) + nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) @@ -950,9 +993,10 @@ ;; power) basic_machine=power-ibm ;; - ppc) basic_machine=powerpc-unknown + ppc | ppcbe) basic_machine=powerpc-unknown ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^^-*-//'` + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^^-*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown @@ -977,7 +1021,11 @@ basic_machine=i586-unknown os=-pw32 ;; - rdos) + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) basic_machine=i386-pc os=-rdos ;; @@ -1046,6 +1094,9 @@ basic_machine=i860-stratus os=-sysv4 ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo $basic_machine | sed 's/^^-*-//'` + ;; sun2) basic_machine=m68000-sun ;; @@ -1102,13 +1153,8 @@ basic_machine=t90-cray os=-unicos ;; - # This must be matched before tile*. - tilegx*) - basic_machine=tilegx-unknown - os=-linux-gnu - ;; tile*) - basic_machine=tile-unknown + basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) @@ -1178,6 +1224,9 @@ xps | xps100) basic_machine=xps100-honeywell ;; + xscale-* | xscaleebl-*) + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; ymp) basic_machine=ymp-cray os=-unicos @@ -1275,11 +1324,11 @@ if x"$os" != x"" then case $os in - # First match some system type aliases - # that might get confused with valid system types. + # First match some system type aliases + # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. - -auroraux) - os=-auroraux + -auroraux) + os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` @@ -1303,21 +1352,21 @@ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos34*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* \ + | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-uclibc* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ @@ -1364,7 +1413,7 @@ -opened*) os=-openedition ;; - -os400*) + -os400*) os=-os400 ;; -wince*) @@ -1413,7 +1462,7 @@ -sinix*) os=-sysv4 ;; - -tpf*) + -tpf*) os=-tpf ;; -triton*) @@ -1449,17 +1498,14 @@ -aros*) os=-aros ;; - -kaos*) - os=-kaos - ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; - -nacl*) - ;; + -nacl*) + ;; -none) ;; *) @@ -1482,10 +1528,10 @@ # system, and we'll never get to this point. case $basic_machine in - score-*) + score-*) os=-elf ;; - spu-*) + spu-*) os=-elf ;; *-acorn) @@ -1497,8 +1543,11 @@ arm*-semi) os=-aout ;; - c4x-* | tic4x-*) - os=-coff + c4x-* | tic4x-*) + os=-coff + ;; + hexagon-*) + os=-elf ;; tic54x-*) os=-coff @@ -1527,14 +1576,11 @@ ;; m68000-sun) os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 ;; m68*-cisco) os=-aout ;; - mep-*) + mep-*) os=-elf ;; mips*-cisco) @@ -1543,6 +1589,9 @@ mips*-*) os=-elf ;; + or1k-*) + os=-elf + ;; or32-*) os=-coff ;; @@ -1561,7 +1610,7 @@ *-ibm) os=-aix ;; - *-knuth) + *-knuth) os=-mmixware ;; *-wec)
View file
xvidcore-1.3.2.tar.bz2/build/generic/configure -> xvidcore-1.3.3.tar.bz2/build/generic/configure
Changed
@@ -1,13 +1,11 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for Xvid 1.3.2. +# Generated by GNU Autoconf 2.69 for Xvid 1.3.3. # # Report bugs to <xvid-devel@xvid.org>. # # -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -136,6 +134,31 @@ # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh @@ -169,7 +192,8 @@ else exitcode=1; echo positional parameters were not saved. fi -test x\$exitcode = x0 || exit 1" +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && @@ -214,21 +238,25 @@ if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi if test x$as_have_required = xno; then : @@ -331,6 +359,14 @@ } # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take @@ -452,6 +488,10 @@ chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec # 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 sensitive to this). @@ -486,16 +526,16 @@ # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -507,28 +547,8 @@ as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???sx*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%^_$as_cr_alnum%_%g'" @@ -560,8 +580,8 @@ # Identity of this package. PACKAGE_NAME='Xvid' PACKAGE_TARNAME='xvid' -PACKAGE_VERSION='1.3.2' -PACKAGE_STRING='Xvid 1.3.2' +PACKAGE_VERSION='1.3.3' +PACKAGE_STRING='Xvid 1.3.3' PACKAGE_BUGREPORT='xvid-devel@xvid.org' PACKAGE_URL='' @@ -607,6 +627,8 @@ LIBOBJS ALTIVEC_CFLAGS SHARED_LIB +SO_LINK +SO_API_MAJOR_LINK PRE_SHARED_LIB STATIC_LIB API_MINOR @@ -630,9 +652,10 @@ FEATURES ac_nasm ac_yasm +CPP +LN_S EGREP GREP -CPP AR RANLIB INSTALL_DATA @@ -1169,8 +1192,6 @@ if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_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 @@ -1256,7 +1277,7 @@ # 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 Xvid 1.3.2 to adapt to many kinds of systems. +\`configure' configures Xvid 1.3.3 to adapt to many kinds of systems. Usage: $0 OPTION... VAR=VALUE... @@ -1322,7 +1343,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Xvid 1.3.2:";; + short | recursive ) echo "Configuration of Xvid 1.3.3:";; esac cat <<\_ACEOF @@ -1413,10 +1434,10 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Xvid configure 1.3.2 -generated by GNU Autoconf 2.68 +Xvid configure 1.3.3 +generated by GNU Autoconf 2.69 -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1524,7 +1545,8 @@ main () { static int test_array 1 - 2 * !(($2) >= 0); -test_array 0 = 0 +test_array 0 = 0; +return test_array 0; ; return 0; @@ -1540,7 +1562,8 @@ main () { static int test_array 1 - 2 * !(($2) <= $ac_mid); -test_array 0 = 0 +test_array 0 = 0; +return test_array 0; ; return 0; @@ -1566,7 +1589,8 @@ main () { static int test_array 1 - 2 * !(($2) < 0); -test_array 0 = 0 +test_array 0 = 0; +return test_array 0; ; return 0; @@ -1582,7 +1606,8 @@ main () { static int test_array 1 - 2 * !(($2) >= $ac_mid); -test_array 0 = 0 +test_array 0 = 0; +return test_array 0; ; return 0; @@ -1616,7 +1641,8 @@ main () { static int test_array 1 - 2 * !(($2) <= $ac_mid); -test_array 0 = 0 +test_array 0 = 0; +return test_array 0; ; return 0; @@ -1871,7 +1897,7 @@ test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext + test -x conftest$ac_exeext }; then : ac_retval=0 else @@ -1893,8 +1919,8 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Xvid $as_me 1.3.2, which was -generated by GNU Autoconf 2.68. Invocation command line was +It was created by Xvid $as_me 1.3.3, which was +generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2504,7 +2530,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2544,7 +2570,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2597,7 +2623,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2638,7 +2664,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_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 @@ -2696,7 +2722,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2740,7 +2766,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3186,8 +3212,7 @@ /* end confdefs.h. */ #include <stdarg.h> #include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> +struct stat; /* 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); @@ -3311,7 +3336,7 @@ # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if as_fn_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. @@ -3386,7 +3411,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3426,7 +3451,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3478,7 +3503,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="${ac_tool_prefix}ar" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3518,7 +3543,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="ar" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3555,6 +3580,151 @@ +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } +fi + + + ARCHITECTURE="" @@ -3739,136 +3909,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : @@ -4276,7 +4316,7 @@ STATIC_EXTENSION="" OBJECT_EXTENSION="" case "$target_os" in - *bsd*|linux*|beos|irix*|solaris*) + *bsd*|linux*|beos|irix*|solaris*|gnu*|*qnx*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: .so .a .o" >&5 $as_echo ".so .a .o" >&6; } STATIC_EXTENSION="a" @@ -4290,7 +4330,7 @@ SHARED_EXTENSION="dll" OBJECT_EXTENSION="obj" ;; - darwin*|raphsody*) + darwin*) if test x"$macosx_module" = x"yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: .so .a .o" >&5 $as_echo ".so .a .o" >&6; } @@ -4319,12 +4359,16 @@ SPECIFIC_CFLAGS="" ALTIVEC_CFLAGS="" PRE_SHARED_LIB="" +SO_API_MAJOR_LINK="" +SO_LINK="" case "$target_os" in - linux*|solaris*) + linux*|solaris*|gnu*|*qnx*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)" SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR).\$(API_MINOR)" + SO_API_MAJOR_LINK="libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR)" + SO_LINK="libxvidcore.\$(SHARED_EXTENSION)" SPECIFIC_LDFLAGS="-Wl,-soname,libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR) -shared -Wl,--version-script=libxvidcore.ld -lc -lm" SPECIFIC_CFLAGS="-fPIC" ;; @@ -4333,6 +4377,8 @@ $as_echo "ok" >&6; } STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)" SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR).\$(API_MINOR)" + SO_API_MAJOR_LINK="libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR)" + SO_LINK="libxvidcore.\$(SHARED_EXTENSION)" SPECIFIC_LDFLAGS="-Wl,-soname,libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR) -shared -lc -lm" SPECIFIC_CFLAGS="-fPIC" ;; @@ -4341,10 +4387,10 @@ $as_echo "ok" >&6; } STATIC_LIB="xvidcore.\$(STATIC_EXTENSION)" SHARED_LIB="xvidcore.\$(SHARED_EXTENSION)" - SPECIFIC_LDFLAGS="-mno-cygwin -shared -Wl,--dll,--out-implib,\$@.a libxvidcore.def" + SPECIFIC_LDFLAGS="-shared -Wl,--dll,--out-implib,\$@.a libxvidcore.def" SPECIFIC_CFLAGS="-mno-cygwin" ;; - darwin*|raphsody*) + darwin*) STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)" SPECIFIC_CFLAGS="-fPIC -fno-common -no-cpp-precomp" if test x"$macosx_module" = x"no"; then @@ -4413,7 +4459,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "yes"; then ac_prog_rejected=yes continue @@ -4488,7 +4534,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "yes"; then ac_prog_rejected=yes continue @@ -4554,7 +4600,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for asm object format" >&5 $as_echo_n "checking for asm object format... " >&6; } case "$target_os" in - *bsd*|linux*|beos|irix*|solaris*) + *bsd*|linux*|beos|irix*|solaris*|gnu*|*qnx*) if test "$ARCHITECTURE" = "X86_64" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: elf64" >&5 $as_echo "elf64" >&6; } @@ -4577,8 +4623,16 @@ $as_echo "win32" >&6; } NASM_FORMAT="win32" fi - PREFIX="-DWINDOWS" - MARK_FUNCS="" + PREFIX="-DWINDOWS" + if test "$GCC" = "yes" ; then + echo 'int main(void) {return 0;}' > conftest.c + $CC -S -o conftest conftest.c + if test `$EGREP -c '_main:' conftest` -eq 0 ; then + PREFIX="$PREFIX -DNO_PREFIX" + fi + rm -f conftest* + fi + MARK_FUNCS="" ;; *darwin*) if test "$ARCHITECTURE" = "X86_64" ; then @@ -4731,7 +4785,105 @@ if test x"$pthread" = x"yes" ; then - ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" + case "$target_os" in + mingw32*) + ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" +if test "x$ac_cv_header_pthread_h" = xyes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthreadGC2" >&5 +$as_echo_n "checking for pthread_create in -lpthreadGC2... " >&6; } +if ${ac_cv_lib_pthreadGC2_pthread_create+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthreadGC2 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_create (); +int +main () +{ +return pthread_create (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pthreadGC2_pthread_create=yes +else + ac_cv_lib_pthreadGC2_pthread_create=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthreadGC2_pthread_create" >&5 +$as_echo "$ac_cv_lib_pthreadGC2_pthread_create" >&6; } +if test "x$ac_cv_lib_pthreadGC2_pthread_create" = xyes; then : + SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DHAVE_PTHREAD" + SPECIFIC_LDFLAGS="$SPECIFIC_LDFLAGS -lpthreadGC2" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 +$as_echo_n "checking for pthread_create in -lpthread... " >&6; } +if ${ac_cv_lib_pthread_pthread_create+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_create (); +int +main () +{ +return pthread_create (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pthread_pthread_create=yes +else + ac_cv_lib_pthread_pthread_create=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 +$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } +if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : + SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DHAVE_PTHREAD" + SPECIFIC_LDFLAGS="$SPECIFIC_LDFLAGS -lpthread" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Pthread not supported. No SMP support" >&5 +$as_echo "$as_me: WARNING: Pthread not supported. No SMP support" >&2;} +fi + +fi + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Pthread not supported. No SMP support" >&5 +$as_echo "$as_me: WARNING: Pthread not supported. No SMP support" >&2;} +fi + + + ;; + *) + ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" if test "x$ac_cv_header_pthread_h" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 $as_echo_n "checking for pthread_create in -lpthread... " >&6; } @@ -4771,18 +4923,62 @@ $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DHAVE_PTHREAD" - SPECIFIC_LDFLAGS="$SPECIFIC_LDFLAGS -lpthread" + SPECIFIC_LDFLAGS="$SPECIFIC_LDFLAGS -lpthread" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lc" >&5 +$as_echo_n "checking for pthread_create in -lc... " >&6; } +if ${ac_cv_lib_c_pthread_create+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_create (); +int +main () +{ +return pthread_create (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_c_pthread_create=yes +else + ac_cv_lib_c_pthread_create=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_pthread_create" >&5 +$as_echo "$ac_cv_lib_c_pthread_create" >&6; } +if test "x$ac_cv_lib_c_pthread_create" = xyes; then : + SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DHAVE_PTHREAD" + SPECIFIC_LDFLAGS="$SPECIFIC_LDFLAGS" else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Pthread not supported. No SMP support" >&5 $as_echo "$as_me: WARNING: Pthread not supported. No SMP support" >&2;} fi +fi + else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Pthread not supported. No SMP support" >&5 $as_echo "$as_me: WARNING: Pthread not supported. No SMP support" >&2;} fi + ;; + esac else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Pthread support disabled. No SMP support" >&5 $as_echo "$as_me: WARNING: Pthread support disabled. No SMP support" >&2;} @@ -4803,26 +4999,9 @@ if test "$GCC" = "yes" ; then -cat << EOF > test.c -#include <stdio.h> -int main(int argc, char **argv) -{ - if (*argv1 == 'M') { - printf("%d", __GNUC__); - } - if (*argv1 == 'm') { - printf("%d", __GNUC_MINOR__); - } - return 0; -} -EOF - $CC -o gcc-ver test.c - GCC_MAJOR=`./gcc-ver M` - GCC_MINOR=`./gcc-ver m` - - rm -f test.c - rm -f gcc-ver + GCC_MAJOR=`$CC -dumpversion | cut -d . -f 1` + GCC_MINOR=`$CC -dumpversion | cut -d . -f 2` # GCC 4.x if test "${GCC_MAJOR}" -gt 3 ; then @@ -4831,6 +5010,7 @@ CFLAGS=`echo $CFLAGS | sed s,'-fmove-all-movables','',g` CFLAGS=`echo $CFLAGS | sed s,'-fnew-ra','',g` CFLAGS=`echo $CFLAGS | sed s,'-fwritable-strings','',g` + SPECIFIC_CFLAGS=`echo $SPECIFIC_CFLAGS | sed s,'-mno-cygwin','',g` fi # GCC 3.4.x @@ -4870,6 +5050,10 @@ + + + + ac_config_files="$ac_config_files platform.inc" @@ -5317,16 +5501,16 @@ # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -5386,28 +5570,16 @@ as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???sx*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%^_$as_cr_alnum%_%g'" @@ -5428,8 +5600,8 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by Xvid $as_me 1.3.2, which was -generated by GNU Autoconf 2.68. Invocation command line was +This file was extended by Xvid $as_me 1.3.3, which was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -5481,11 +5653,11 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/\\""\`\$/\\\\&/g'`" ac_cs_version="\\ -Xvid config.status 1.3.2 -configured by $0, generated by GNU Autoconf 2.68, +Xvid config.status 1.3.3 +configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -5563,7 +5735,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL'
View file
xvidcore-1.3.2.tar.bz2/build/generic/configure.in -> xvidcore-1.3.3.tar.bz2/build/generic/configure.in
Changed
@@ -8,7 +8,7 @@ AC_PREREQ(2.50) -AC_INIT(Xvid, 1.3.2, xvid-devel@xvid.org) +AC_INIT(Xvid, 1.3.3, xvid-devel@xvid.org) AC_CONFIG_SRCDIR(configure.in) dnl Do not forget to increase that when needed. @@ -144,6 +144,18 @@ AC_CHECK_TOOL(AR, ar, ar-not-found) dnl ========================================================================== +dnl Check for the egrep program +dnl ========================================================================== + +AC_PROG_EGREP + +dnl ========================================================================== +dnl Check how the system supports symlinks. +dnl ========================================================================== + +AC_PROG_LN_S + +dnl ========================================================================== dnl dnl This part looks for: dnl @@ -237,7 +249,7 @@ STATIC_EXTENSION="" OBJECT_EXTENSION="" case "$target_os" in - *bsd*|linux*|beos|irix*|solaris*) + *bsd*|linux*|beos|irix*|solaris*|gnu*|*qnx*) AC_MSG_RESULT(.so .a .o) STATIC_EXTENSION="a" SHARED_EXTENSION="so" @@ -249,7 +261,7 @@ SHARED_EXTENSION="dll" OBJECT_EXTENSION="obj" ;; - darwin*|raphsody*) + darwin*) if test x"$macosx_module" = x"yes"; then AC_MSG_RESULT(.so .a .o) SHARED_EXTENSION="so" @@ -280,11 +292,15 @@ SPECIFIC_CFLAGS="" ALTIVEC_CFLAGS="" PRE_SHARED_LIB="" +SO_API_MAJOR_LINK="" +SO_LINK="" case "$target_os" in - linux*|solaris*) + linux*|solaris*|gnu*|*qnx*) AC_MSG_RESULT(ok) STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)" SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR).\$(API_MINOR)" + SO_API_MAJOR_LINK="libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR)" + SO_LINK="libxvidcore.\$(SHARED_EXTENSION)" SPECIFIC_LDFLAGS="-Wl,-soname,libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR) -shared -Wl,--version-script=libxvidcore.ld -lc -lm" SPECIFIC_CFLAGS="-fPIC" ;; @@ -292,6 +308,8 @@ AC_MSG_RESULT(ok) STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)" SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR).\$(API_MINOR)" + SO_API_MAJOR_LINK="libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR)" + SO_LINK="libxvidcore.\$(SHARED_EXTENSION)" SPECIFIC_LDFLAGS="-Wl,-soname,libxvidcore.\$(SHARED_EXTENSION).\$(API_MAJOR) -shared -lc -lm" SPECIFIC_CFLAGS="-fPIC" ;; @@ -299,10 +317,10 @@ AC_MSG_RESULT(ok) STATIC_LIB="xvidcore.\$(STATIC_EXTENSION)" SHARED_LIB="xvidcore.\$(SHARED_EXTENSION)" - SPECIFIC_LDFLAGS="-mno-cygwin -shared -Wl,--dll,--out-implib,\$@.a libxvidcore.def" + SPECIFIC_LDFLAGS="-shared -Wl,--dll,--out-implib,\$@.a libxvidcore.def" SPECIFIC_CFLAGS="-mno-cygwin" ;; - darwin*|raphsody*) + darwin*) STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)" SPECIFIC_CFLAGS="-fPIC -fno-common -no-cpp-precomp" if test x"$macosx_module" = x"no"; then @@ -419,7 +437,7 @@ if test "$found_nasm_comp_prog" = "yes" ; then AC_MSG_CHECKING(for asm object format) case "$target_os" in - *bsd*|linux*|beos|irix*|solaris*) + *bsd*|linux*|beos|irix*|solaris*|gnu*|*qnx*) if test "$ARCHITECTURE" = "X86_64" ; then AC_MSG_RESULT(elf64) NASM_FORMAT="elf64" @@ -438,8 +456,16 @@ AC_MSG_RESULT(win32) NASM_FORMAT="win32" fi - PREFIX="-DWINDOWS" - MARK_FUNCS="" + PREFIX="-DWINDOWS" + if test "$GCC" = "yes" ; then + echo 'int main(void) {return 0;}' > conftest.c + $CC -S -o conftest conftest.c + if test `$EGREP -c '_main:' conftest` -eq 0 ; then + PREFIX="$PREFIX -DNO_PREFIX" + fi + rm -f conftest* + fi + MARK_FUNCS="" ;; *darwin*) if test "$ARCHITECTURE" = "X86_64" ; then @@ -606,15 +632,40 @@ dnl ========================================================================== if test x"$pthread" = x"yes" ; then - AC_CHECK_HEADER( - pthread.h, - AC_CHECK_LIB( - pthread, - pthread_create, - SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DHAVE_PTHREAD" - SPECIFIC_LDFLAGS="$SPECIFIC_LDFLAGS -lpthread", - AC_MSG_WARN(Pthread not supported. No SMP support)), - AC_MSG_WARN(Pthread not supported. No SMP support)) + case "$target_os" in + mingw32*) + AC_CHECK_HEADER( + pthread.h, + AC_CHECK_LIB( + pthreadGC2, + pthread_create, + SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DHAVE_PTHREAD" + SPECIFIC_LDFLAGS="$SPECIFIC_LDFLAGS -lpthreadGC2", + AC_CHECK_LIB( + pthread, + pthread_create, + SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DHAVE_PTHREAD" + SPECIFIC_LDFLAGS="$SPECIFIC_LDFLAGS -lpthread", + AC_MSG_WARN(Pthread not supported. No SMP support))), + AC_MSG_WARN(Pthread not supported. No SMP support)) + ;; + *) + AC_CHECK_HEADER( + pthread.h, + AC_CHECK_LIB( + pthread, + pthread_create, + SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DHAVE_PTHREAD" + SPECIFIC_LDFLAGS="$SPECIFIC_LDFLAGS -lpthread", + AC_CHECK_LIB( + c, + pthread_create, + SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DHAVE_PTHREAD" + SPECIFIC_LDFLAGS="$SPECIFIC_LDFLAGS", + AC_MSG_WARN(Pthread not supported. No SMP support))), + AC_MSG_WARN(Pthread not supported. No SMP support)) + ;; + esac else AC_MSG_WARN(Pthread support disabled. No SMP support) fi @@ -649,26 +700,9 @@ dnl ========================================================================== if test "$GCC" = "yes" ; then -cat << EOF > test.c -#include <stdio.h> -int main(int argc, char **argv) -{ - if (*argv1 == 'M') { - printf("%d", __GNUC__); - } - if (*argv1 == 'm') { - printf("%d", __GNUC_MINOR__); - } - return 0; -} -EOF - $CC -o gcc-ver test.c - - GCC_MAJOR=`./gcc-ver M` - GCC_MINOR=`./gcc-ver m` - rm -f test.c - rm -f gcc-ver + GCC_MAJOR=`$CC -dumpversion | cut -d . -f 1` + GCC_MINOR=`$CC -dumpversion | cut -d . -f 2` # GCC 4.x if test "${GCC_MAJOR}" -gt 3 ; then @@ -677,6 +711,7 @@ CFLAGS=`echo $CFLAGS | sed s,'-fmove-all-movables','',g` CFLAGS=`echo $CFLAGS | sed s,'-fnew-ra','',g` CFLAGS=`echo $CFLAGS | sed s,'-fwritable-strings','',g` + SPECIFIC_CFLAGS=`echo $SPECIFIC_CFLAGS | sed s,'-mno-cygwin','',g` fi # GCC 3.4.x @@ -707,16 +742,20 @@ AC_SUBST(ASSEMBLY_SOURCES) AC_SUBST(CC) AC_SUBST(CFLAGS) +AC_SUBST(LDFLAGS) AC_SUBST(SPECIFIC_LDFLAGS) AC_SUBST(SPECIFIC_CFLAGS) AC_SUBST(DCT_IA64_SOURCES) AC_SUBST(PPC_ALTIVEC_SOURCES) +AC_SUBST(LN_S) AC_SUBST(RANLIB) AC_SUBST(AR) AC_SUBST(API_MAJOR) AC_SUBST(API_MINOR) AC_SUBST(STATIC_LIB) AC_SUBST(PRE_SHARED_LIB) +AC_SUBST(SO_API_MAJOR_LINK) +AC_SUBST(SO_LINK) AC_SUBST(SHARED_LIB) AC_SUBST(ALTIVEC_CFLAGS)
View file
xvidcore-1.3.2.tar.bz2/build/generic/install-sh -> xvidcore-1.3.3.tar.bz2/build/generic/install-sh
Changed
@@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2010-02-06.18; # UTC +scriptversion=2011-11-20.07; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -35,7 +35,7 @@ # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it +# '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 @@ -156,6 +156,10 @@ -s) stripcmd=$stripprog;; -t) dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | =\(\)!) dst_arg=./$dst_arg;; + esac shift;; -T) no_target_directory=true;; @@ -186,6 +190,10 @@ fi shift # arg dst_arg=$arg + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | =\(\)!) dst_arg=./$dst_arg;; + esac done fi @@ -194,7 +202,7 @@ echo "$0: no input file specified." >&2 exit 1 fi - # It's OK to call `install-sh -d' without argument. + # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi @@ -232,9 +240,9 @@ for src do - # Protect names starting with `-'. + # Protect names problematic for 'test' and other utilities. case $src in - -*) src=./$src;; + -* | =\(\)!) src=./$src;; esac if test -n "$dir_arg"; then @@ -256,12 +264,7 @@ echo "$0: no destination specified." >&2 exit 1 fi - dst=$dst_arg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst;; - esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. @@ -351,7 +354,7 @@ if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writeable bit of parent directory when it shouldn't. + # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in @@ -389,7 +392,7 @@ case $dstdir in /*) prefix='/';; - -*) prefix='./';; + -=\(\)!*) prefix='./';; *) prefix='';; esac @@ -407,7 +410,7 @@ for d do - test -z "$d" && continue + test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then
View file
xvidcore-1.3.2.tar.bz2/build/generic/platform.inc.in -> xvidcore-1.3.3.tar.bz2/build/generic/platform.inc.in
Changed
@@ -33,6 +33,7 @@ SPECIFIC_CFLAGS=@SPECIFIC_CFLAGS@ ALTIVEC_CFLAGS=@ALTIVEC_CFLAGS@ CFLAGS=@CFLAGS@ +LDFLAGS=@LDFLAGS@ # ============================================================================ # Assembler @@ -57,9 +58,11 @@ # ============================================================================ INSTALL=@INSTALL@ +LN_S=@LN_S@ DESTDIR= prefix=@prefix@ exec_prefix=@exec_prefix@ +bindir=@bindir@ libdir=@libdir@ includedir=@includedir@ @@ -79,3 +82,5 @@ STATIC_LIB=@STATIC_LIB@ SHARED_LIB=@SHARED_LIB@ PRE_SHARED_LIB=@PRE_SHARED_LIB@ +SO_API_MAJOR_LINK=@SO_API_MAJOR_LINK@ +SO_LINK=@SO_LINK@
View file
xvidcore-1.3.2.tar.bz2/dshow/src/CXvidDecoder.cpp -> xvidcore-1.3.3.tar.bz2/dshow/src/CXvidDecoder.cpp
Changed
@@ -1,2323 +1,2329 @@ -/***************************************************************************** - * - * XVID MPEG-4 VIDEO CODEC - * - Xvid Decoder part of the DShow Filter - - * - * Copyright(C) 2002-2011 Peter Ross <pross@xvid.org> - * 2003-2011 Michael Militzer <michael@xvid.org> - * - * 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 - * - * $Id: CXvidDecoder.cpp 2006 2011-05-19 12:48:59Z Isibaar $ - * - ****************************************************************************/ - - /* - this requires the directx sdk - place these paths at the top of the Tools|Options|Directories list - - headers: - C:\DX90SDK\Include - C:\DX90SDK\Samples\C++\DirectShow\BaseClasses - - C:\DX90SDK\Samples\C++\DirectShow\BaseClasses\Release - C:\DX90SDK\Samples\C++\DirectShow\BaseClasses\Debug -*/ - -#ifdef ENABLE_MFT -#define XVID_USE_MFT -#endif - -#define XVID_USE_TRAYICON - -#include <windows.h> - -#include <streams.h> -#include <initguid.h> -#include <olectl.h> -#if (1100 > _MSC_VER) -#include <olectlid.h> -#endif -#include <dvdmedia.h> // VIDEOINFOHEADER2 - -#if defined(XVID_USE_MFT) -#define MFT_UNIQUE_METHOD_NAMES -#include <mftransform.h> -#include <mfapi.h> -#include <mferror.h> -#include <shlwapi.h> -#endif - -#include <shellapi.h> - -#include <xvid.h> // Xvid API - -#include "resource.h" - -#include "IXvidDecoder.h" -#include "CXvidDecoder.h" -#include "CAbout.h" -#include "config.h" -#include "debug.h" - -static bool USE_IYUV; -static bool USE_YV12; -static bool USE_YUY2; -static bool USE_YVYU; -static bool USE_UYVY; -static bool USE_RGB32; -static bool USE_RGB24; -static bool USE_RG555; -static bool USE_RG565; - -const AMOVIESETUP_MEDIATYPE sudInputPinTypes = -{ - { &MEDIATYPE_Video, &CLSID_XVID }, - { &MEDIATYPE_Video, &CLSID_XVID_UC }, - { &MEDIATYPE_Video, &CLSID_DIVX }, - { &MEDIATYPE_Video, &CLSID_DIVX_UC }, - { &MEDIATYPE_Video, &CLSID_DX50 }, - { &MEDIATYPE_Video, &CLSID_DX50_UC }, - { &MEDIATYPE_Video, &CLSID_3IVX }, - { &MEDIATYPE_Video, &CLSID_3IVX_UC }, - { &MEDIATYPE_Video, &CLSID_3IV0 }, - { &MEDIATYPE_Video, &CLSID_3IV0_UC }, - { &MEDIATYPE_Video, &CLSID_3IV1 }, - { &MEDIATYPE_Video, &CLSID_3IV1_UC }, - { &MEDIATYPE_Video, &CLSID_3IV2 }, - { &MEDIATYPE_Video, &CLSID_3IV2_UC }, - { &MEDIATYPE_Video, &CLSID_LMP4 }, - { &MEDIATYPE_Video, &CLSID_LMP4_UC }, - { &MEDIATYPE_Video, &CLSID_RMP4 }, - { &MEDIATYPE_Video, &CLSID_RMP4_UC }, - { &MEDIATYPE_Video, &CLSID_SMP4 }, - { &MEDIATYPE_Video, &CLSID_SMP4_UC }, - { &MEDIATYPE_Video, &CLSID_HDX4 }, - { &MEDIATYPE_Video, &CLSID_HDX4_UC }, - { &MEDIATYPE_Video, &CLSID_MP4V }, - { &MEDIATYPE_Video, &CLSID_MP4V_UC }, -}; - -const AMOVIESETUP_MEDIATYPE sudOutputPinTypes = -{ - { &MEDIATYPE_Video, &MEDIASUBTYPE_NULL } -}; - - -const AMOVIESETUP_PIN psudPins = -{ - { - L"Input", // String pin name - FALSE, // Is it rendered - FALSE, // Is it an output - FALSE, // Allowed none - FALSE, // Allowed many - &CLSID_NULL, // Connects to filter - L"Output", // Connects to pin - sizeof(sudInputPinTypes) / sizeof(AMOVIESETUP_MEDIATYPE), // Number of types - &sudInputPinTypes0 // The pin details - }, - { - L"Output", // String pin name - FALSE, // Is it rendered - TRUE, // Is it an output - FALSE, // Allowed none - FALSE, // Allowed many - &CLSID_NULL, // Connects to filter - L"Input", // Connects to pin - sizeof(sudOutputPinTypes) / sizeof(AMOVIESETUP_MEDIATYPE), // Number of types - sudOutputPinTypes // The pin details - } -}; - - -const AMOVIESETUP_FILTER sudXvidDecoder = -{ - &CLSID_XVID, // Filter CLSID - XVID_NAME_L, // Filter name - MERIT_PREFERRED+2, // Its merit - sizeof(psudPins) / sizeof(AMOVIESETUP_PIN), // Number of pins - psudPins // Pin details -}; - - -// List of class IDs and creator functions for the class factory. This -// provides the link between the OLE entry point in the DLL and an object -// being created. The class factory will call the static CreateInstance - -CFactoryTemplate g_Templates = -{ - { - XVID_NAME_L, - &CLSID_XVID, - CXvidDecoder::CreateInstance, - NULL, - &sudXvidDecoder - }, - { - XVID_NAME_L L"About", - &CLSID_CABOUT, - CAbout::CreateInstance - } - -}; - -/* note: g_cTemplates must be global; used by strmbase.lib(dllentry.cpp,dllsetup.cpp) */ -int g_cTemplates = sizeof(g_Templates) / sizeof(CFactoryTemplate); - -#ifdef XVID_USE_TRAYICON -extern HINSTANCE g_xvid_hInst; - -static int GUI_Page = 0; -static int Tray_Icon = 0; -extern "C" void CALLBACK Configure(HWND hWndParent, HINSTANCE hInstParent, LPSTR lpCmdLine, int nCmdShow ); - -LRESULT CALLBACK msg_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - switch ( uMsg ) - { - case WM_ICONMESSAGE: - switch(lParam) - { - case WM_LBUTTONDBLCLK: - if (!GUI_Page) { - GUI_Page = 1; - Configure(hwnd, g_xvid_hInst, "", 1); - GUI_Page = 0; - } - break; - default: - return DefWindowProc(hwnd, uMsg, wParam, lParam); - }; - break; - - case WM_DESTROY: - NOTIFYICONDATA nid; - ZeroMemory(&nid,sizeof(NOTIFYICONDATA)); - - nid.cbSize = NOTIFYICONDATA_V1_SIZE; - nid.hWnd = hwnd; - nid.uID = 1456; - - Shell_NotifyIcon(NIM_DELETE, &nid); - Tray_Icon = 0; - default: - return DefWindowProc(hwnd, uMsg, wParam, lParam); - } - - return TRUE; /* ok */ -} -#endif - -STDAPI DllRegisterServer() -{ -#if defined(XVID_USE_MFT) - int inputs_num = sizeof(sudInputPinTypes) / sizeof(AMOVIESETUP_MEDIATYPE); - int outputs_num = sizeof(sudOutputPinTypes) / sizeof(AMOVIESETUP_MEDIATYPE); - MFT_REGISTER_TYPE_INFO * mft_bs = new MFT_REGISTER_TYPE_INFOinputs_num; - MFT_REGISTER_TYPE_INFO * mft_csp = new MFT_REGISTER_TYPE_INFOoutputs_num; - - { - int i; - for(i=0;i<inputs_num;i++) { - mft_bsi.guidMajorType = *sudInputPinTypesi.clsMajorType; - mft_bsi.guidSubtype = *sudInputPinTypesi.clsMinorType; - } - for(i=0;i<outputs_num;i++) { - mft_cspi.guidMajorType = *sudOutputPinTypesi.clsMajorType; - mft_cspi.guidSubtype = *sudOutputPinTypesi.clsMinorType; // MFT and AM GUIDs really the same? - } - } - - /* Register the MFT decoder */ - MFTRegister(CLSID_XVID, // CLSID - MFT_CATEGORY_VIDEO_DECODER, // Category - const_cast<LPWSTR>(XVID_NAME_L), // Friendly name - 0, // Flags - inputs_num, // Number of input types - mft_bs, // Input types - outputs_num, // Number of output types - mft_csp, // Output types - NULL // Attributes (optional) - ); - - delete mft_bs; - delete mft_csp; -#endif /* XVID_USE_MFT */ - - return AMovieDllRegisterServer2( TRUE ); -} - - -STDAPI DllUnregisterServer() -{ -#if defined(XVID_USE_MFT) - MFTUnregister(CLSID_XVID); -#endif - return AMovieDllRegisterServer2( FALSE ); -} - - -/* create instance */ - -CUnknown * WINAPI CXvidDecoder::CreateInstance(LPUNKNOWN punk, HRESULT *phr) -{ - CXvidDecoder * pNewObject = new CXvidDecoder(punk, phr); - if (pNewObject == NULL) - { - *phr = E_OUTOFMEMORY; - } - return pNewObject; -} - - -/* query interfaces */ - -STDMETHODIMP CXvidDecoder::NonDelegatingQueryInterface(REFIID riid, void **ppv) -{ - CheckPointer(ppv, E_POINTER); - - if (riid == IID_IXvidDecoder) - { - return GetInterface((IXvidDecoder *) this, ppv); - } - - if (riid == IID_ISpecifyPropertyPages) - { - return GetInterface((ISpecifyPropertyPages *) this, ppv); - } - -#if defined(XVID_USE_MFT) - if (riid == IID_IMFTransform) - { - return GetInterface((IMFTransform *) this, ppv); - } -#endif - - return CVideoTransformFilter::NonDelegatingQueryInterface(riid, ppv); -} - - - -/* constructor */ - -CXvidDecoder::CXvidDecoder(LPUNKNOWN punk, HRESULT *phr) : - CVideoTransformFilter(NAME("CXvidDecoder"), punk, CLSID_XVID), m_hdll (NULL) -{ - DPRINTF("Constructor"); - - xvid_decore_func = NULL; // Hmm, some strange errors appearing if I try to initialize... - xvid_global_func = NULL; // ...this in constructor's init-list. So, they assigned here. - -#if defined(XVID_USE_MFT) - InitializeCriticalSection(&m_mft_lock); - m_pInputType = NULL; - m_pOutputType = NULL; - m_rtFrame = 0; - m_duration = 0; - m_discont = 0; - m_frameRate.Denominator = 1; - m_frameRate.Numerator = 1; -#endif - - LoadRegistryInfo(); - - *phr = OpenLib(); -} - -HRESULT CXvidDecoder::OpenLib() -{ - DPRINTF("OpenLib"); - - if (m_hdll != NULL) - return E_UNEXPECTED; // Seems, that library already opened. - - xvid_gbl_init_t init; - memset(&init, 0, sizeof(init)); - init.version = XVID_VERSION; - init.cpu_flags = g_config.cpu; - - xvid_gbl_info_t info; - memset(&info, 0, sizeof(info)); - info.version = XVID_VERSION; - - m_hdll = LoadLibrary(XVID_DLL_NAME); - if (m_hdll == NULL) { - DPRINTF("dll load failed"); - MessageBox(0, XVID_DLL_NAME " not found","Error", MB_TOPMOST); - return E_FAIL; - } - - xvid_global_func = (int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global"); - if (xvid_global_func == NULL) { - FreeLibrary(m_hdll); - m_hdll = NULL; - MessageBox(0, "xvid_global() not found", "Error", MB_TOPMOST); - return E_FAIL; - } - - xvid_decore_func = (int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_decore"); - if (xvid_decore_func == NULL) { - xvid_global_func = NULL; - FreeLibrary(m_hdll); - m_hdll = NULL; - MessageBox(0, "xvid_decore() not found", "Error", MB_TOPMOST); - return E_FAIL; - } - - if (xvid_global_func(0, XVID_GBL_INIT, &init, NULL) < 0) - { - xvid_global_func = NULL; - xvid_decore_func = NULL; - FreeLibrary(m_hdll); - m_hdll = NULL; - MessageBox(0, "xvid_global() failed", "Error", MB_TOPMOST); - return E_FAIL; - } - - if (xvid_global_func(0, XVID_GBL_INFO, &info, NULL) < 0) - { - xvid_global_func = NULL; - xvid_decore_func = NULL; - FreeLibrary(m_hdll); - m_hdll = NULL; - MessageBox(0, "xvid_global() failed", "Error", MB_TOPMOST); - return E_FAIL; - } - - memset(&m_create, 0, sizeof(m_create)); - m_create.version = XVID_VERSION; - m_create.handle = NULL; - /* Decoder threads */ - if (g_config.cpu & XVID_CPU_FORCE) { - m_create.num_threads = g_config.num_threads; - } - else { - m_create.num_threads = info.num_threads; /* Autodetect */ - g_config.num_threads = info.num_threads; - } - - memset(&m_frame, 0, sizeof(m_frame)); - m_frame.version = XVID_VERSION; - - USE_IYUV = false; - USE_YV12 = false; - USE_YUY2 = false; - USE_YVYU = false; - USE_UYVY = false; - USE_RGB32 = false; - USE_RGB24 = false; - USE_RG555 = false; - USE_RG565 = false; - - switch ( g_config.nForceColorspace ) - { - case FORCE_NONE: - USE_IYUV = true; - USE_YV12 = true; - USE_YUY2 = true; - USE_YVYU = true; - USE_UYVY = true; - USE_RGB32 = true; - USE_RGB24 = true; - USE_RG555 = true; - USE_RG565 = true; - break; - case FORCE_YV12: - USE_IYUV = true; - USE_YV12 = true; - break; - case FORCE_YUY2: - USE_YUY2 = true; - break; - case FORCE_RGB24: - USE_RGB24 = true; - break; - case FORCE_RGB32: - USE_RGB32 = true; - break; - } - - switch (g_config.aspect_ratio) - { - case 0: - case 1: - break; - case 2: - ar_x = 4; - ar_y = 3; - break; - case 3: - ar_x = 16; - ar_y = 9; - break; - case 4: - ar_x = 47; - ar_y = 20; - break; - } - - return S_OK; -} - -void CXvidDecoder::CloseLib() -{ - DPRINTF("CloseLib"); - - if ((m_create.handle != NULL) && (xvid_decore_func != NULL)) - { - xvid_decore_func(m_create.handle, XVID_DEC_DESTROY, 0, 0); - m_create.handle = NULL; - } - - if (m_hdll != NULL) { - FreeLibrary(m_hdll); - m_hdll = NULL; - } - xvid_decore_func = NULL; - xvid_global_func = NULL; -} - -/* destructor */ - -CXvidDecoder::~CXvidDecoder() -{ - DPRINTF("Destructor"); - -#ifdef XVID_USE_TRAYICON - if (Tray_Icon) { /* Destroy tray icon */ - NOTIFYICONDATA nid; - ZeroMemory(&nid,sizeof(NOTIFYICONDATA)); - - nid.cbSize = NOTIFYICONDATA_V1_SIZE; - nid.hWnd = MSG_hwnd; - nid.uID = 1456; - - Shell_NotifyIcon(NIM_DELETE, &nid); - Tray_Icon = 0; - } -#endif - - /* Close xvidcore library */ - CloseLib(); - -#if defined(XVID_USE_MFT) - DeleteCriticalSection(&m_mft_lock); -#endif -} - - - -/* check input type */ - -HRESULT CXvidDecoder::CheckInputType(const CMediaType * mtIn) -{ - DPRINTF("CheckInputType"); - BITMAPINFOHEADER * hdr; - - ar_x = ar_y = 0; - - if (*mtIn->Type() != MEDIATYPE_Video) - { - DPRINTF("Error: Unknown Type"); - CloseLib(); - return VFW_E_TYPE_NOT_ACCEPTED; - } - - if (m_hdll == NULL) - { - HRESULT hr = OpenLib(); - - if (FAILED(hr) || (m_hdll == NULL)) // Paranoid checks. - return VFW_E_TYPE_NOT_ACCEPTED; - } - - if (*mtIn->FormatType() == FORMAT_VideoInfo) - { - VIDEOINFOHEADER * vih = (VIDEOINFOHEADER *) mtIn->Format(); - hdr = &vih->bmiHeader; - } - else if (*mtIn->FormatType() == FORMAT_VideoInfo2) - { - VIDEOINFOHEADER2 * vih2 = (VIDEOINFOHEADER2 *) mtIn->Format(); - hdr = &vih2->bmiHeader; - if (g_config.aspect_ratio == 0 || g_config.aspect_ratio == 1) { - ar_x = vih2->dwPictAspectRatioX; - ar_y = vih2->dwPictAspectRatioY; - } - DPRINTF("VIDEOINFOHEADER2 AR: %d:%d", ar_x, ar_y); - } - else if (*mtIn->FormatType() == FORMAT_MPEG2Video) { - MPEG2VIDEOINFO * mpgvi = (MPEG2VIDEOINFO*)mtIn->Format(); - VIDEOINFOHEADER2 * vih2 = &mpgvi->hdr; - hdr = &vih2->bmiHeader; - if (g_config.aspect_ratio == 0 || g_config.aspect_ratio == 1) { - ar_x = vih2->dwPictAspectRatioX; - ar_y = vih2->dwPictAspectRatioY; - } - DPRINTF("VIDEOINFOHEADER2 AR: %d:%d", ar_x, ar_y); - - /* haali media splitter reports VOL information in the format header */ - - if (mpgvi->cbSequenceHeader>0) { - - xvid_dec_stats_t stats; - memset(&stats, 0, sizeof(stats)); - stats.version = XVID_VERSION; - - if (m_create.handle == NULL) { - if (xvid_decore_func == NULL) - return E_FAIL; - if (xvid_decore_func(0, XVID_DEC_CREATE, &m_create, 0) < 0) { - DPRINTF("*** XVID_DEC_CREATE error"); - return E_FAIL; - } - } - - m_frame.general = 0; - m_frame.bitstream = (void*)mpgvi->dwSequenceHeader; - m_frame.length = mpgvi->cbSequenceHeader; - m_frame.output.csp = XVID_CSP_NULL; - - int ret = 0; - if ((ret=xvid_decore_func(m_create.handle, XVID_DEC_DECODE, &m_frame, &stats)) >= 0) { - /* honour video dimensions reported in VOL header */ - if (stats.type == XVID_TYPE_VOL) { - hdr->biWidth = stats.data.vol.width; - hdr->biHeight = stats.data.vol.height; - } - } - if (ret == XVID_ERR_MEMORY) return E_FAIL; - } - } - else - { - DPRINTF("Error: Unknown FormatType"); - CloseLib(); - return VFW_E_TYPE_NOT_ACCEPTED; - } - if (hdr->biHeight < 0) - { - DPRINTF("colorspace: inverted input format not supported"); - } - - m_create.width = hdr->biWidth; - m_create.height = hdr->biHeight; - - switch(hdr->biCompression) - { - case FOURCC_mp4v : - case FOURCC_MP4V : - case FOURCC_lmp4 : - case FOURCC_LMP4 : - case FOURCC_rmp4 : - case FOURCC_RMP4 : - case FOURCC_smp4 : - case FOURCC_SMP4 : - case FOURCC_hdx4 : - case FOURCC_HDX4 : - if (!(g_config.supported_4cc & SUPPORT_MP4V)) { - CloseLib(); - return VFW_E_TYPE_NOT_ACCEPTED; - } - break; - case FOURCC_divx : - case FOURCC_DIVX : - case FOURCC_dx50 : - case FOURCC_DX50 : - if (!(g_config.supported_4cc & SUPPORT_DIVX)) { - CloseLib(); - return VFW_E_TYPE_NOT_ACCEPTED; - } - break; - case FOURCC_3ivx : - case FOURCC_3IVX : - case FOURCC_3iv0 : - case FOURCC_3IV0 : - case FOURCC_3iv1 : - case FOURCC_3IV1 : - case FOURCC_3iv2 : - case FOURCC_3IV2 : - if (!(g_config.supported_4cc & SUPPORT_3IVX)) { - CloseLib(); - return VFW_E_TYPE_NOT_ACCEPTED; - } - case FOURCC_xvid : - case FOURCC_XVID : - break; - - - default : - DPRINTF("Unknown fourcc: 0x%08x (%c%c%c%c)", - hdr->biCompression, - (hdr->biCompression)&0xff, - (hdr->biCompression>>8)&0xff, - (hdr->biCompression>>16)&0xff, - (hdr->biCompression>>24)&0xff); - CloseLib(); - return VFW_E_TYPE_NOT_ACCEPTED; - } - - m_create.fourcc = hdr->biCompression; - - return S_OK; -} - - -/* get list of supported output colorspaces */ - - -HRESULT CXvidDecoder::GetMediaType(int iPosition, CMediaType *mtOut) -{ - BITMAPINFOHEADER * bmih; - DPRINTF("GetMediaType"); - - if (m_pInput->IsConnected() == FALSE) - { - return E_UNEXPECTED; - } - - if (!g_config.videoinfo_compat) { - VIDEOINFOHEADER2 * vih = (VIDEOINFOHEADER2 *) mtOut->ReallocFormatBuffer(sizeof(VIDEOINFOHEADER2)); - if (vih == NULL) return E_OUTOFMEMORY; - - ZeroMemory(vih, sizeof (VIDEOINFOHEADER2)); - bmih = &(vih->bmiHeader); - mtOut->SetFormatType(&FORMAT_VideoInfo2); - - if (ar_x != 0 && ar_y != 0) { - vih->dwPictAspectRatioX = ar_x; - vih->dwPictAspectRatioY = ar_y; - forced_ar = true; - } else { // just to be safe - vih->dwPictAspectRatioX = m_create.width; - vih->dwPictAspectRatioY = abs(m_create.height); - forced_ar = false; - } - } else { - - VIDEOINFOHEADER * vih = (VIDEOINFOHEADER *) mtOut->ReallocFormatBuffer(sizeof(VIDEOINFOHEADER)); - if (vih == NULL) return E_OUTOFMEMORY; - - ZeroMemory(vih, sizeof (VIDEOINFOHEADER)); - bmih = &(vih->bmiHeader); - mtOut->SetFormatType(&FORMAT_VideoInfo); - } - - bmih->biSize = sizeof(BITMAPINFOHEADER); - bmih->biWidth = m_create.width; - bmih->biHeight = m_create.height; - bmih->biPlanes = 1; - - if (iPosition < 0) return E_INVALIDARG; - - switch(iPosition) - { - - case 0: -if ( USE_YUY2 ) -{ - bmih->biCompression = MEDIASUBTYPE_YUY2.Data1; - bmih->biBitCount = 16; - mtOut->SetSubtype(&MEDIASUBTYPE_YUY2); - break; -} - case 1 : -if ( USE_YVYU ) -{ - bmih->biCompression = MEDIASUBTYPE_YVYU.Data1; - bmih->biBitCount = 16; - mtOut->SetSubtype(&MEDIASUBTYPE_YVYU); - break; -} - case 2 : -if ( USE_UYVY ) -{ - bmih->biCompression = MEDIASUBTYPE_UYVY.Data1; - bmih->biBitCount = 16; - mtOut->SetSubtype(&MEDIASUBTYPE_UYVY); - break; -} - case 3 : - if ( USE_IYUV ) -{ - bmih->biCompression = CLSID_MEDIASUBTYPE_IYUV.Data1; - bmih->biBitCount = 12; - mtOut->SetSubtype(&CLSID_MEDIASUBTYPE_IYUV); - break; -} - case 4 : -if ( USE_YV12 ) -{ - bmih->biCompression = MEDIASUBTYPE_YV12.Data1; - bmih->biBitCount = 12; - mtOut->SetSubtype(&MEDIASUBTYPE_YV12); - break; -} - case 5 : -if ( USE_RGB32 ) -{ - bmih->biCompression = BI_RGB; - bmih->biBitCount = 32; - mtOut->SetSubtype(&MEDIASUBTYPE_RGB32); - break; -} - case 6 : -if ( USE_RGB24 ) -{ - bmih->biCompression = BI_RGB; - bmih->biBitCount = 24; - mtOut->SetSubtype(&MEDIASUBTYPE_RGB24); - break; -} - case 7 : -if ( USE_RG555 ) -{ - bmih->biCompression = BI_RGB; - bmih->biBitCount = 16; - mtOut->SetSubtype(&MEDIASUBTYPE_RGB555); - break; -} - case 8 : -if ( USE_RG565 ) -{ - bmih->biCompression = BI_RGB; - bmih->biBitCount = 16; - mtOut->SetSubtype(&MEDIASUBTYPE_RGB565); - break; -} - default : - return VFW_S_NO_MORE_ITEMS; - } - - bmih->biSizeImage = GetBitmapSize(bmih); - - mtOut->SetType(&MEDIATYPE_Video); - mtOut->SetTemporalCompression(FALSE); - mtOut->SetSampleSize(bmih->biSizeImage); - - return S_OK; -} - - -/* (internal function) change colorspace */ -#define CALC_BI_STRIDE(width,bitcount) ((((width * bitcount) + 31) & ~31) >> 3) - -HRESULT CXvidDecoder::ChangeColorspace(GUID subtype, GUID formattype, void * format, int noflip) -{ - DWORD biWidth; - - if (formattype == FORMAT_VideoInfo) - { - VIDEOINFOHEADER * vih = (VIDEOINFOHEADER * )format; - biWidth = vih->bmiHeader.biWidth; - out_stride = CALC_BI_STRIDE(vih->bmiHeader.biWidth, vih->bmiHeader.biBitCount); - rgb_flip = (vih->bmiHeader.biHeight < 0 ? 0 : XVID_CSP_VFLIP); - } - else if (formattype == FORMAT_VideoInfo2) - { - VIDEOINFOHEADER2 * vih2 = (VIDEOINFOHEADER2 * )format; - biWidth = vih2->bmiHeader.biWidth; - out_stride = CALC_BI_STRIDE(vih2->bmiHeader.biWidth, vih2->bmiHeader.biBitCount); - rgb_flip = (vih2->bmiHeader.biHeight < 0 ? 0 : XVID_CSP_VFLIP); - } - else - { - return S_FALSE; - } - - if (noflip) rgb_flip = 0; - - if (subtype == CLSID_MEDIASUBTYPE_IYUV) - { - DPRINTF("IYUV"); - rgb_flip = 0; - m_frame.output.csp = XVID_CSP_I420; - out_stride = CALC_BI_STRIDE(biWidth, 8); /* planar format fix */ - } - else if (subtype == MEDIASUBTYPE_YV12) - { - DPRINTF("YV12"); - rgb_flip = 0; - m_frame.output.csp = XVID_CSP_YV12; - out_stride = CALC_BI_STRIDE(biWidth, 8); /* planar format fix */ - } - else if (subtype == MEDIASUBTYPE_YUY2) - { - DPRINTF("YUY2"); - rgb_flip = 0; - m_frame.output.csp = XVID_CSP_YUY2; - } - else if (subtype == MEDIASUBTYPE_YVYU) - { - DPRINTF("YVYU"); - rgb_flip = 0; - m_frame.output.csp = XVID_CSP_YVYU; - } - else if (subtype == MEDIASUBTYPE_UYVY) - { - DPRINTF("UYVY"); - rgb_flip = 0; - m_frame.output.csp = XVID_CSP_UYVY; - } - else if (subtype == MEDIASUBTYPE_RGB32) - { - DPRINTF("RGB32"); - m_frame.output.csp = rgb_flip | XVID_CSP_BGRA; - } - else if (subtype == MEDIASUBTYPE_RGB24) - { - DPRINTF("RGB24"); - m_frame.output.csp = rgb_flip | XVID_CSP_BGR; - } - else if (subtype == MEDIASUBTYPE_RGB555) - { - DPRINTF("RGB555"); - m_frame.output.csp = rgb_flip | XVID_CSP_RGB555; - } - else if (subtype == MEDIASUBTYPE_RGB565) - { - DPRINTF("RGB565"); - m_frame.output.csp = rgb_flip | XVID_CSP_RGB565; - } - else if (subtype == GUID_NULL) - { - m_frame.output.csp = XVID_CSP_NULL; - } - else - { - return S_FALSE; - } - - return S_OK; -} - - -/* set output colorspace */ - -HRESULT CXvidDecoder::SetMediaType(PIN_DIRECTION direction, const CMediaType *pmt) -{ - DPRINTF("SetMediaType"); - - if (direction == PINDIR_OUTPUT) - { - return ChangeColorspace(*pmt->Subtype(), *pmt->FormatType(), pmt->Format(), 0); - } - - return S_OK; -} - - -/* check input<->output compatiblity */ - -HRESULT CXvidDecoder::CheckTransform(const CMediaType *mtIn, const CMediaType *mtOut) -{ - DPRINTF("CheckTransform"); - - return S_OK; -} - -/* input/output pin connection complete */ - -HRESULT CXvidDecoder::CompleteConnect(PIN_DIRECTION direction, IPin *pReceivePin) -{ - DPRINTF("CompleteConnect"); - -#ifdef XVID_USE_TRAYICON - if ((direction == PINDIR_OUTPUT) && (Tray_Icon == 0)) - { - WNDCLASSEX wc; - - wc.cbSize = sizeof(WNDCLASSEX); - wc.lpfnWndProc = msg_proc; - wc.style = CS_HREDRAW | CS_VREDRAW; - wc.cbWndExtra = 0; - wc.cbClsExtra = 0; - wc.hInstance = (HINSTANCE) g_xvid_hInst; - wc.hbrBackground = (HBRUSH) GetStockObject(NULL_BRUSH); - wc.lpszMenuName = NULL; - wc.lpszClassName = "XVID_MSG_WINDOW"; - wc.hIcon = NULL; - wc.hIconSm = NULL; - wc.hCursor = NULL; - RegisterClassEx(&wc); - - MSG_hwnd = CreateWindowEx(0, "XVID_MSG_WINDOW", NULL, 0, CW_USEDEFAULT, - CW_USEDEFAULT, 0, 0, HWND_MESSAGE, NULL, (HINSTANCE) g_xvid_hInst, NULL); - - /* display the tray icon */ - NOTIFYICONDATA nid; - ZeroMemory(&nid,sizeof(NOTIFYICONDATA)); - - nid.cbSize = NOTIFYICONDATA_V1_SIZE; - nid.hWnd = MSG_hwnd; - nid.uID = 1456; - nid.uCallbackMessage = WM_ICONMESSAGE; - nid.hIcon = LoadIcon(g_xvid_hInst, MAKEINTRESOURCE(IDI_ICON)); - strcpy_s(nid.szTip, 19, "Xvid Video Decoder"); - nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; - - Shell_NotifyIcon(NIM_ADD, &nid); - - DestroyIcon(nid.hIcon); - Tray_Icon = 1; - } -#endif - - return S_OK; -} - -/* input/output pin disconnected */ -HRESULT CXvidDecoder::BreakConnect(PIN_DIRECTION direction) -{ - DPRINTF("BreakConnect"); - - return S_OK; -} - -/* alloc output buffer */ - -HRESULT CXvidDecoder::DecideBufferSize(IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest) -{ - DPRINTF("DecideBufferSize"); - HRESULT result; - ALLOCATOR_PROPERTIES ppropActual; - - if (m_pInput->IsConnected() == FALSE) - { - return E_UNEXPECTED; - } - - ppropInputRequest->cBuffers = 1; - ppropInputRequest->cbBuffer = m_create.width * m_create.height * 4; - // cbAlign causes problems with the resize filter */ - // ppropInputRequest->cbAlign = 16; - ppropInputRequest->cbPrefix = 0; - - result = pAlloc->SetProperties(ppropInputRequest, &ppropActual); - if (result != S_OK) - { - return result; - } - - if (ppropActual.cbBuffer < ppropInputRequest->cbBuffer) - { - return E_FAIL; - } - - return S_OK; -} - - -/* decode frame */ - -HRESULT CXvidDecoder::Transform(IMediaSample *pIn, IMediaSample *pOut) -{ - DPRINTF("Transform"); - xvid_dec_stats_t stats; - int length; - - memset(&stats, 0, sizeof(stats)); - stats.version = XVID_VERSION; - - if (m_create.handle == NULL) - { - if (xvid_decore_func == NULL) - return E_FAIL; - - if (xvid_decore_func(0, XVID_DEC_CREATE, &m_create, 0) < 0) - { - DPRINTF("*** XVID_DEC_CREATE error"); - return E_FAIL; - } - } - - AM_MEDIA_TYPE * mtOut; - pOut->GetMediaType(&mtOut); - if (mtOut != NULL) - { - HRESULT result; - - result = ChangeColorspace(mtOut->subtype, mtOut->formattype, mtOut->pbFormat, 0); - DeleteMediaType(mtOut); - - if (result != S_OK) - { - DPRINTF("*** ChangeColorspace error"); - return result; - } - } - - m_frame.length = pIn->GetActualDataLength(); - if (pIn->GetPointer((BYTE**)&m_frame.bitstream) != S_OK) - { - return S_FALSE; - } - - if (pOut->GetPointer((BYTE**)&m_frame.output.plane0) != S_OK) - { - return S_FALSE; - } - - m_frame.general = XVID_LOWDELAY; - - if (pIn->IsDiscontinuity() == S_OK) - m_frame.general |= XVID_DISCONTINUITY; - - if (g_config.nDeblock_Y) - m_frame.general |= XVID_DEBLOCKY; - - if (g_config.nDeblock_UV) - m_frame.general |= XVID_DEBLOCKUV; - - if (g_config.nDering_Y) - m_frame.general |= XVID_DERINGY; - - if (g_config.nDering_UV) - m_frame.general |= XVID_DERINGUV; - - if (g_config.nFilmEffect) - m_frame.general |= XVID_FILMEFFECT; - - m_frame.brightness = g_config.nBrightness; - - m_frame.output.csp &= ~XVID_CSP_VFLIP; - m_frame.output.csp |= rgb_flip^(g_config.nFlipVideo ? XVID_CSP_VFLIP : 0); - m_frame.output.stride0 = out_stride; - - // Paranoid check. - if (xvid_decore_func == NULL) - return E_FAIL; - - -repeat : - - if (pIn->IsPreroll() != S_OK) - { - length = xvid_decore_func(m_create.handle, XVID_DEC_DECODE, &m_frame, &stats); - - if (length == XVID_ERR_MEMORY) - return E_FAIL; - else if (length < 0) - { - DPRINTF("*** XVID_DEC_DECODE"); - return S_FALSE; - } else - if (g_config.aspect_ratio == 0 || g_config.aspect_ratio == 1 && forced_ar == false) { - - if (stats.type != XVID_TYPE_NOTHING) { /* dont attempt to set vmr aspect ratio if no frame was returned by decoder */ - // inspired by minolta! works for VMR 7 + 9 - IMediaSample2 *pOut2 = NULL; - AM_SAMPLE2_PROPERTIES outProp2; - if (SUCCEEDED(pOut->QueryInterface(IID_IMediaSample2, (void **)&pOut2)) && - SUCCEEDED(pOut2->GetProperties(FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, tStart), (PBYTE)&outProp2))) - { - CMediaType mtOut2 = m_pOutput->CurrentMediaType(); - VIDEOINFOHEADER2* vihOut2 = (VIDEOINFOHEADER2*)mtOut2.Format(); - - if (*mtOut2.FormatType() == FORMAT_VideoInfo2 && - vihOut2->dwPictAspectRatioX != ar_x && vihOut2->dwPictAspectRatioY != ar_y) - { - vihOut2->dwPictAspectRatioX = ar_x; - vihOut2->dwPictAspectRatioY = ar_y; - pOut2->SetMediaType(&mtOut2); - m_pOutput->SetMediaType(&mtOut2); - } - pOut2->Release(); - } - } - } - } - else - { /* Preroll frame - won't be displayed */ - int tmp = m_frame.output.csp; - int tmp_gen = m_frame.general; - - m_frame.output.csp = XVID_CSP_NULL; - - /* Disable postprocessing to speed-up seeking */ - m_frame.general &= ~XVID_DEBLOCKY; - m_frame.general &= ~XVID_DEBLOCKUV; - /*m_frame.general &= ~XVID_DERING;*/ - m_frame.general &= ~XVID_FILMEFFECT; - - length = xvid_decore_func(m_create.handle, XVID_DEC_DECODE, &m_frame, &stats); - if (length == XVID_ERR_MEMORY) - return E_FAIL; - else if (length < 0) - { - DPRINTF("*** XVID_DEC_DECODE"); - return S_FALSE; - } - - m_frame.output.csp = tmp; - m_frame.general = tmp_gen; - } - - if (stats.type == XVID_TYPE_NOTHING && length > 0) { - DPRINTF(" B-Frame decoder lag"); - return S_FALSE; - } - - - if (stats.type == XVID_TYPE_VOL) - { - if (stats.data.vol.width != m_create.width || - stats.data.vol.height != m_create.height) - { - DPRINTF("TODO: auto-resize"); - return S_FALSE; - } - - pOut->SetSyncPoint(TRUE); - - if (g_config.aspect_ratio == 0 || g_config.aspect_ratio == 1) { /* auto */ - int par_x, par_y; - if (stats.data.vol.par == XVID_PAR_EXT) { - par_x = stats.data.vol.par_width; - par_y = stats.data.vol.par_height; - } else { - par_x = PARSstats.data.vol.par-10; - par_y = PARSstats.data.vol.par-11; - } - - ar_x = par_x * stats.data.vol.width; - ar_y = par_y * stats.data.vol.height; - } - - m_frame.bitstream = (BYTE*)m_frame.bitstream + length; - m_frame.length -= length; - goto repeat; - } - - if (pIn->IsPreroll() == S_OK) { - return S_FALSE; - } - - return S_OK; -} - - -/* get property page list */ - -STDMETHODIMP CXvidDecoder::GetPages(CAUUID * pPages) -{ - DPRINTF("GetPages"); - - pPages->cElems = 1; - pPages->pElems = (GUID *)CoTaskMemAlloc(pPages->cElems * sizeof(GUID)); - if (pPages->pElems == NULL) - { - return E_OUTOFMEMORY; - } - pPages->pElems0 = CLSID_CABOUT; - - return S_OK; -} - - -/* cleanup pages */ - -STDMETHODIMP CXvidDecoder::FreePages(CAUUID * pPages) -{ - DPRINTF("FreePages"); - CoTaskMemFree(pPages->pElems); - return S_OK; -} - -/*=============================================================================== -// MFT Interface -//=============================================================================*/ -#if defined(XVID_USE_MFT) -#include <limits.h> // _I64_MAX -#define INVALID_TIME _I64_MAX - -HRESULT CXvidDecoder::MFTGetStreamLimits(DWORD *pdwInputMinimum, DWORD *pdwInputMaximum, DWORD *pdwOutputMinimum, DWORD *pdwOutputMaximum) -{ - DPRINTF("(MFT)GetStreamLimits"); - - if ((pdwInputMinimum == NULL) || (pdwInputMaximum == NULL) || (pdwOutputMinimum == NULL) || (pdwOutputMaximum == NULL)) - return E_POINTER; - - /* Just a fixed number of streams allowed */ - *pdwInputMinimum = *pdwInputMaximum = 1; - *pdwOutputMinimum = *pdwOutputMaximum = 1; - - return S_OK; -} - -HRESULT CXvidDecoder::MFTGetStreamCount(DWORD *pcInputStreams, DWORD *pcOutputStreams) -{ - DPRINTF("(MFT)GetStreamCount"); - - if ((pcInputStreams == NULL) || (pcOutputStreams == NULL)) - return E_POINTER; - - /* We have a fixed number of streams */ - *pcInputStreams = 1; - *pcOutputStreams = 1; - - return S_OK; -} - -HRESULT CXvidDecoder::MFTGetStreamIDs(DWORD dwInputIDArraySize, DWORD *pdwInputIDs, DWORD dwOutputIDArraySize, DWORD *pdwOutputIDs) -{ - DPRINTF("(MFT)GetStreamIDs"); - return E_NOTIMPL; /* We have fixed number of streams, so stream ID match stream index */ -} - -HRESULT CXvidDecoder::MFTGetInputStreamInfo(DWORD dwInputStreamID, MFT_INPUT_STREAM_INFO *pStreamInfo) -{ - DPRINTF("(MFT)GetInputStreamInfo"); - - if (pStreamInfo == NULL) - return E_POINTER; - - if (dwInputStreamID != 0) - return MF_E_INVALIDSTREAMNUMBER; - - EnterCriticalSection(&m_mft_lock); - - pStreamInfo->dwFlags = MFT_INPUT_STREAM_WHOLE_SAMPLES | MFT_INPUT_STREAM_SINGLE_SAMPLE_PER_BUFFER; - pStreamInfo->hnsMaxLatency = 0; - - pStreamInfo->cbSize = 1; /* Need atleast 1 byte input */ - pStreamInfo->cbMaxLookahead = 0; - pStreamInfo->cbAlignment = 1; - - LeaveCriticalSection(&m_mft_lock); - return S_OK; -} - -HRESULT CXvidDecoder::MFTGetOutputStreamInfo(DWORD dwOutputStreamID, MFT_OUTPUT_STREAM_INFO *pStreamInfo) -{ - DPRINTF("(MFT)GetOutputStreamInfo"); - - if (pStreamInfo == NULL) - return E_POINTER; - - if (dwOutputStreamID != 0) - return MF_E_INVALIDSTREAMNUMBER; - - EnterCriticalSection(&m_mft_lock); - - pStreamInfo->dwFlags = MFT_OUTPUT_STREAM_WHOLE_SAMPLES | MFT_OUTPUT_STREAM_SINGLE_SAMPLE_PER_BUFFER | MFT_OUTPUT_STREAM_FIXED_SAMPLE_SIZE | MFT_OUTPUT_STREAM_DISCARDABLE; - - if (m_pOutputType == NULL) { - pStreamInfo->cbSize = 0; - pStreamInfo->cbAlignment = 0; - } - else { - pStreamInfo->cbSize = m_create.width * abs(m_create.height) * 4; // XXX - pStreamInfo->cbAlignment = 1; - } - - LeaveCriticalSection(&m_mft_lock); - return S_OK; -} - -HRESULT CXvidDecoder::GetAttributes(IMFAttributes** pAttributes) -{ - DPRINTF("(MFT)GetAttributes"); - return E_NOTIMPL; /* We don't support any attributes */ -} - -HRESULT CXvidDecoder::GetInputStreamAttributes(DWORD dwInputStreamID, IMFAttributes **ppAttributes) -{ - DPRINTF("(MFT)GetInputStreamAttributes"); - return E_NOTIMPL; /* We don't support any attributes */ -} - -HRESULT CXvidDecoder::GetOutputStreamAttributes(DWORD dwOutputStreamID, IMFAttributes **ppAttributes) -{ - DPRINTF("(MFT)GetOutputStreamAttributes"); - return E_NOTIMPL; /* We don't support any attributes */ -} - -HRESULT CXvidDecoder::MFTDeleteInputStream(DWORD dwStreamID) -{ - DPRINTF("(MFT)DeleteInputStream"); - return E_NOTIMPL; /* We have a fixed number of streams */ -} - -HRESULT CXvidDecoder::MFTAddInputStreams(DWORD cStreams, DWORD *adwStreamIDs) -{ - DPRINTF("(MFT)AddInputStreams"); - return E_NOTIMPL; /* We have a fixed number of streams */ -} - -HRESULT CXvidDecoder::MFTGetInputAvailableType(DWORD dwInputStreamID, DWORD dwTypeIndex, IMFMediaType **ppType) -{ - DPRINTF("(MFT)GetInputAvailableType"); - - if (dwInputStreamID != 0) - return MF_E_INVALIDSTREAMNUMBER; - - DWORD i = 0; - GUID *bs_guid_table8; - - bs_guid_tablei++ = (GUID *)&CLSID_XVID; - bs_guid_tablei++ = (GUID *)&CLSID_XVID_UC; - - if (g_config.supported_4cc & SUPPORT_3IVX) { - bs_guid_tablei++ = (GUID *)&CLSID_3IVX; - bs_guid_tablei++ = (GUID *)&CLSID_3IVX_UC; - bs_guid_tablei++ = (GUID *)&CLSID_3IV0; - bs_guid_tablei++ = (GUID *)&CLSID_3IV0_UC; - bs_guid_tablei++ = (GUID *)&CLSID_3IV1; - bs_guid_tablei++ = (GUID *)&CLSID_3IV1_UC; - bs_guid_tablei++ = (GUID *)&CLSID_3IV2; - bs_guid_tablei++ = (GUID *)&CLSID_3IV2_UC; - } - if (g_config.supported_4cc & SUPPORT_DIVX) { - bs_guid_tablei++ = (GUID *)&CLSID_DIVX; - bs_guid_tablei++ = (GUID *)&CLSID_DIVX_UC; - bs_guid_tablei++ = (GUID *)&CLSID_DX50; - bs_guid_tablei++ = (GUID *)&CLSID_DX50_UC; - } - if (g_config.supported_4cc & SUPPORT_MP4V) { - bs_guid_tablei++ = (GUID *)&CLSID_MP4V; - bs_guid_tablei++ = (GUID *)&CLSID_MP4V_UC; - bs_guid_tablei++ = (GUID *)&CLSID_LMP4; - bs_guid_tablei++ = (GUID *)&CLSID_LMP4_UC; - bs_guid_tablei++ = (GUID *)&CLSID_RMP4; - bs_guid_tablei++ = (GUID *)&CLSID_RMP4_UC; - bs_guid_tablei++ = (GUID *)&CLSID_SMP4; - bs_guid_tablei++ = (GUID *)&CLSID_SMP4_UC; - bs_guid_tablei++ = (GUID *)&CLSID_HDX4; - bs_guid_tablei++ = (GUID *)&CLSID_HDX4_UC; - } - - const GUID *subtype; - if (dwTypeIndex < i) { - subtype = bs_guid_tabledwTypeIndex; - } - else { - return MF_E_NO_MORE_TYPES; - } - - EnterCriticalSection(&m_mft_lock); - - HRESULT hr = S_OK; - - if (ppType) { - IMFMediaType *pInputType = NULL; - hr = MFCreateMediaType(&pInputType); - - if (SUCCEEDED(hr)) - hr = pInputType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video); - - if (SUCCEEDED(hr)) - hr = pInputType->SetGUID(MF_MT_SUBTYPE, *subtype); - - if (SUCCEEDED(hr)) { - *ppType = pInputType; - (*ppType)->AddRef(); - } - if (pInputType) pInputType->Release(); - } - - LeaveCriticalSection(&m_mft_lock); - - return hr; -} - -HRESULT CXvidDecoder::MFTGetOutputAvailableType(DWORD dwOutputStreamID, DWORD dwTypeIndex, IMFMediaType **ppType) -{ - DPRINTF("(MFT)GetOutputAvailableType"); - - if (ppType == NULL) - return E_INVALIDARG; - - if (dwOutputStreamID != 0) - return MF_E_INVALIDSTREAMNUMBER; - - if (dwTypeIndex < 0) return E_INVALIDARG; - - GUID csp; - int bitdepth = 8; - switch(dwTypeIndex) - { - case 0: -if ( USE_YUY2 ) -{ - csp = MFVideoFormat_YUY2; - bitdepth = 4; - break; -} - case 1 : -if ( USE_UYVY ) -{ - csp = MFVideoFormat_UYVY; - bitdepth = 4; - break; -} - case 2 : - if ( USE_IYUV ) -{ - csp = MFVideoFormat_IYUV; - bitdepth = 3; - break; -} - case 3 : -if ( USE_YV12 ) -{ - csp = MFVideoFormat_YV12; - bitdepth = 3; - break; -} - case 4 : -if ( USE_RGB32 ) -{ - csp = MFVideoFormat_RGB32; - bitdepth = 8; - break; -} - case 5 : -if ( USE_RGB24 ) -{ - csp = MFVideoFormat_RGB24; - bitdepth = 6; - break; -} - case 6 : -if ( USE_RG555 ) -{ - csp = MFVideoFormat_RGB555; - bitdepth = 4; - break; -} - case 7 : -if ( USE_RG565 ) -{ - csp = MFVideoFormat_RGB565; - bitdepth = 4; - break; -} - default : - return MF_E_NO_MORE_TYPES; - } - - if (m_pInputType == NULL) - return MF_E_TRANSFORM_TYPE_NOT_SET; - - EnterCriticalSection(&m_mft_lock); - - HRESULT hr = S_OK; - - IMFMediaType *pOutputType = NULL; - hr = MFCreateMediaType(&pOutputType); - - if (SUCCEEDED(hr)) { - hr = pOutputType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video); - } - - if (SUCCEEDED(hr)) { - hr = pOutputType->SetGUID(MF_MT_SUBTYPE, csp); - } - - if (SUCCEEDED(hr)) { - hr = pOutputType->SetUINT32(MF_MT_FIXED_SIZE_SAMPLES, TRUE); - } - - if (SUCCEEDED(hr)) { - hr = pOutputType->SetUINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, TRUE); - } - - if (SUCCEEDED(hr)) { - hr = pOutputType->SetUINT32(MF_MT_SAMPLE_SIZE, (m_create.height * m_create.width * bitdepth)>>1); - } - - if (SUCCEEDED(hr)) { - hr = MFSetAttributeSize(pOutputType, MF_MT_FRAME_SIZE, m_create.width, m_create.height); - } - - if (SUCCEEDED(hr)) { - hr = MFSetAttributeRatio(pOutputType, MF_MT_FRAME_RATE, m_frameRate.Numerator, m_frameRate.Denominator); - } - - if (SUCCEEDED(hr)) { - hr = pOutputType->SetUINT32(MF_MT_INTERLACE_MODE, MFVideoInterlace_Progressive); - } - - if (SUCCEEDED(hr)) { - hr = MFSetAttributeRatio(pOutputType, MF_MT_PIXEL_ASPECT_RATIO, ar_x, ar_y); - } - - if (SUCCEEDED(hr)) { - *ppType = pOutputType; - (*ppType)->AddRef(); - } - - if (pOutputType) pOutputType->Release(); - - LeaveCriticalSection(&m_mft_lock); - return hr; -} - -HRESULT CXvidDecoder::MFTSetInputType(DWORD dwInputStreamID, IMFMediaType *pType, DWORD dwFlags) -{ - DPRINTF("(MFT)SetInputType"); - - if (dwInputStreamID != 0) - return MF_E_INVALIDSTREAMNUMBER; - - if (dwFlags & ~MFT_SET_TYPE_TEST_ONLY) - return E_INVALIDARG; - - EnterCriticalSection(&m_mft_lock); - - HRESULT hr = S_OK; - - /* Actually set the type or just test it? */ - BOOL bReallySet = ((dwFlags & MFT_SET_TYPE_TEST_ONLY) == 0); - - /* If we have samples pending the type can't be changed right now */ - if (HasPendingOutput()) - hr = MF_E_TRANSFORM_CANNOT_CHANGE_MEDIATYPE_WHILE_PROCESSING; - - if (SUCCEEDED(hr)) { - if (pType) { // /* Check the type */ - hr = OnCheckInputType(pType); - } - } - - if (SUCCEEDED(hr)) { - if (bReallySet) { /* Set the type if needed */ - hr = OnSetInputType(pType); - } - } - - LeaveCriticalSection(&m_mft_lock); - return hr; -} - -HRESULT CXvidDecoder::MFTSetOutputType(DWORD dwOutputStreamID, IMFMediaType *pType, DWORD dwFlags) -{ - DPRINTF("(MFT)SetOutputType"); - - if (dwOutputStreamID != 0) - return MF_E_INVALIDSTREAMNUMBER; - - if (dwFlags & ~MFT_SET_TYPE_TEST_ONLY) - return E_INVALIDARG; - - HRESULT hr = S_OK; - - EnterCriticalSection(&m_mft_lock); - - /* Actually set the type or just test it? */ - BOOL bReallySet = ((dwFlags & MFT_SET_TYPE_TEST_ONLY) == 0); - - /* If we have samples pending the type can't be changed right now */ - if (HasPendingOutput()) - hr = MF_E_TRANSFORM_CANNOT_CHANGE_MEDIATYPE_WHILE_PROCESSING; - - if (SUCCEEDED(hr)) { - if (pType) { /* Check the type */ - AM_MEDIA_TYPE *am; - hr = MFCreateAMMediaTypeFromMFMediaType(pType, GUID_NULL, &am); - - if (SUCCEEDED(hr)) { - if (FAILED(ChangeColorspace(am->subtype, am->formattype, am->pbFormat, 1))) { - DPRINTF("(MFT)InternalCheckOutputType (MF_E_INVALIDTYPE)"); - return MF_E_INVALIDTYPE; - } - - CoTaskMemFree(am->pbFormat); - CoTaskMemFree(am); - } - } - } - - if (SUCCEEDED(hr)) { - if (bReallySet) { /* Set the type if needed */ - hr = OnSetOutputType(pType); - } - } -#ifdef XVID_USE_TRAYICON - if (SUCCEEDED(hr) && Tray_Icon == 0) /* Create message passing window */ - { - WNDCLASSEX wc; - - wc.cbSize = sizeof(WNDCLASSEX); - wc.lpfnWndProc = msg_proc; - wc.style = CS_HREDRAW | CS_VREDRAW; - wc.cbWndExtra = 0; - wc.cbClsExtra = 0; - wc.hInstance = (HINSTANCE) g_xvid_hInst; - wc.hbrBackground = (HBRUSH) GetStockObject(NULL_BRUSH); - wc.lpszMenuName = NULL; - wc.lpszClassName = "XVID_MSG_WINDOW"; - wc.hIcon = NULL; - wc.hIconSm = NULL; - wc.hCursor = NULL; - RegisterClassEx(&wc); - - MSG_hwnd = CreateWindowEx(0, "XVID_MSG_WINDOW", NULL, 0, CW_USEDEFAULT, - CW_USEDEFAULT, 0, 0, HWND_MESSAGE, NULL, (HINSTANCE) g_xvid_hInst, NULL); - - /* display the tray icon */ - NOTIFYICONDATA nid; - ZeroMemory(&nid,sizeof(NOTIFYICONDATA)); - - nid.cbSize = NOTIFYICONDATA_V1_SIZE; - nid.hWnd = MSG_hwnd; - nid.uID = 1456; - nid.uCallbackMessage = WM_ICONMESSAGE; - nid.hIcon = LoadIcon(g_xvid_hInst, MAKEINTRESOURCE(IDI_ICON)); - strcpy_s(nid.szTip, 19, "Xvid Video Decoder"); - nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; - - Shell_NotifyIcon(NIM_ADD, &nid); - - DestroyIcon(nid.hIcon); - Tray_Icon = 1; - } -#endif - - LeaveCriticalSection(&m_mft_lock); - return hr; -} - -HRESULT CXvidDecoder::MFTGetInputCurrentType(DWORD dwInputStreamID, IMFMediaType **ppType) -{ - DPRINTF("(MFT)GetInputCurrentType"); - - if (ppType == NULL) - return E_POINTER; - - if (dwInputStreamID != 0) - return MF_E_INVALIDSTREAMNUMBER; - - EnterCriticalSection(&m_mft_lock); - - HRESULT hr = S_OK; - - if (!m_pInputType) - hr = MF_E_TRANSFORM_TYPE_NOT_SET; - - if (SUCCEEDED(hr)) { - *ppType = m_pInputType; - (*ppType)->AddRef(); - } - - LeaveCriticalSection(&m_mft_lock); - return hr; -} - -HRESULT CXvidDecoder::MFTGetOutputCurrentType(DWORD dwOutputStreamID, IMFMediaType **ppType) -{ - DPRINTF("(MFT)GetOutputCurrentType"); - - if (ppType == NULL) - return E_POINTER; - - if (dwOutputStreamID != 0) - return MF_E_INVALIDSTREAMNUMBER; - - EnterCriticalSection(&m_mft_lock); - - HRESULT hr = S_OK; - - if (!m_pOutputType) - hr = MF_E_TRANSFORM_TYPE_NOT_SET; - - if (SUCCEEDED(hr)) { - *ppType = m_pOutputType; - (*ppType)->AddRef(); - } - - LeaveCriticalSection(&m_mft_lock); - return hr; -} - -HRESULT CXvidDecoder::MFTGetInputStatus(DWORD dwInputStreamID, DWORD *pdwFlags) -{ - DPRINTF("(MFT)GetInputStatus"); - - if (pdwFlags == NULL) - return E_POINTER; - - if (dwInputStreamID != 0) - return MF_E_INVALIDSTREAMNUMBER; - - EnterCriticalSection(&m_mft_lock); - - /* If there's pending output sampels we don't accept new - input data until ProcessOutput() or Flush() was called */ - if (!HasPendingOutput()) { - *pdwFlags = MFT_INPUT_STATUS_ACCEPT_DATA; - } - else { - *pdwFlags = 0; - } - - LeaveCriticalSection(&m_mft_lock); - - return S_OK; -} - -HRESULT CXvidDecoder::MFTGetOutputStatus(DWORD *pdwFlags) -{ - DPRINTF("(MFT)GetOutputStatus"); - - if (pdwFlags == NULL) - return E_POINTER; - - EnterCriticalSection(&m_mft_lock); - - /* We can render an output sample only after we - have decoded one */ - if (HasPendingOutput()) { - *pdwFlags = MFT_OUTPUT_STATUS_SAMPLE_READY; - } - else { - *pdwFlags = 0; - } - - LeaveCriticalSection(&m_mft_lock); - - return S_OK; -} - -HRESULT CXvidDecoder::MFTSetOutputBounds(LONGLONG hnsLowerBound, LONGLONG hnsUpperBound) -{ - DPRINTF("(MFT)SetOutputBounds"); - return E_NOTIMPL; -} - -HRESULT CXvidDecoder::MFTProcessEvent(DWORD dwInputStreamID, IMFMediaEvent *pEvent) -{ - DPRINTF("(MFT)ProcessEvent"); - return E_NOTIMPL; /* We don't handle any stream events */ -} - -HRESULT CXvidDecoder::MFTProcessMessage(MFT_MESSAGE_TYPE eMessage, ULONG_PTR ulParam) -{ - DPRINTF("(MFT)ProcessMessage"); - HRESULT hr = S_OK; - - EnterCriticalSection(&m_mft_lock); - - switch (eMessage) - { - case MFT_MESSAGE_COMMAND_FLUSH: - if (m_create.handle != NULL) { - DPRINTF("(MFT)CommandFlush"); - - xvid_dec_stats_t stats; - int used_bytes; - - memset(&stats, 0, sizeof(stats)); - stats.version = XVID_VERSION; - - int csp = m_frame.output.csp; - - m_frame.output.csp = XVID_CSP_INTERNAL; - m_frame.bitstream = NULL; - m_frame.length = -1; - m_frame.general = XVID_LOWDELAY; - - do { - used_bytes = xvid_decore_func(m_create.handle, XVID_DEC_DECODE, &m_frame, &stats); - } while(used_bytes>=0 && stats.type <= 0); - - m_frame.output.csp = csp; - m_frame.output.plane1 = NULL; /* Don't display flushed samples */ - - //m_timestamp = INVALID_TIME; - //m_timelength = INVALID_TIME; - //m_rtFrame = 0; - } - break; - - case MFT_MESSAGE_COMMAND_DRAIN: - m_discont = 1; /* Set discontinuity flag */ - m_rtFrame = 0; - break; - - case MFT_MESSAGE_SET_D3D_MANAGER: - hr = E_NOTIMPL; - break; - - case MFT_MESSAGE_NOTIFY_BEGIN_STREAMING: - case MFT_MESSAGE_NOTIFY_END_STREAMING: - break; - - case MFT_MESSAGE_NOTIFY_START_OF_STREAM: - case MFT_MESSAGE_NOTIFY_END_OF_STREAM: - break; - } - - LeaveCriticalSection(&m_mft_lock); - - return hr; -} - -HRESULT CXvidDecoder::MFTProcessInput(DWORD dwInputStreamID, IMFSample *pSample, DWORD dwFlags) -{ - DPRINTF("(MFT)ProcessInput"); - - if (pSample == NULL) - return E_POINTER; - - if (dwInputStreamID != 0) - return MF_E_INVALIDSTREAMNUMBER; - - if (dwFlags != 0) - return E_INVALIDARG; - - if (!m_pInputType || !m_pOutputType) { - return MF_E_NOTACCEPTING; /* Must have set input and output types */ - } - else if (HasPendingOutput()) { - return MF_E_NOTACCEPTING; /* We still have output samples to render */ - } - - xvid_dec_stats_t stats; - int length; - - memset(&stats, 0, sizeof(stats)); - stats.version = XVID_VERSION; - - if (m_create.handle == NULL) - { - if (xvid_decore_func == NULL) - return E_FAIL; - if (xvid_decore_func(0, XVID_DEC_CREATE, &m_create, 0) < 0) - { - DPRINTF("*** XVID_DEC_CREATE error"); - return E_FAIL; - } - } - - EnterCriticalSection(&m_mft_lock); - - HRESULT hr = S_OK; - IMFMediaBuffer *pBuffer; - - if (SUCCEEDED(hr)) { - hr = pSample->ConvertToContiguousBuffer(&pBuffer); - } - - if (SUCCEEDED(hr)) { - hr = pBuffer->Lock((BYTE**)&m_frame.bitstream, NULL, (DWORD *)&m_frame.length); - } - - m_frame.general = XVID_LOWDELAY; - - if (m_discont == 1) { - m_frame.general |= XVID_DISCONTINUITY; - m_discont = 0; - } - - if (g_config.nDeblock_Y) - m_frame.general |= XVID_DEBLOCKY; - - if (g_config.nDeblock_UV) - m_frame.general |= XVID_DEBLOCKUV; - - if (g_config.nDering_Y) - m_frame.general |= XVID_DERINGY; - - if (g_config.nDering_UV) - m_frame.general |= XVID_DERINGUV; - - if (g_config.nFilmEffect) - m_frame.general |= XVID_FILMEFFECT; - - m_frame.brightness = g_config.nBrightness; - - m_frame.output.csp &= ~XVID_CSP_VFLIP; - m_frame.output.csp |= rgb_flip^(g_config.nFlipVideo ? XVID_CSP_VFLIP : 0); - - int csp = m_frame.output.csp; - m_frame.output.csp = XVID_CSP_INTERNAL; - - // Paranoid check. - if (xvid_decore_func == NULL) { - hr = E_FAIL; - goto END_LOOP; - } - -repeat : - length = xvid_decore_func(m_create.handle, XVID_DEC_DECODE, &m_frame, &stats); - - if (length == XVID_ERR_MEMORY) { - hr = E_FAIL; - goto END_LOOP; - } - else if (length < 0) - { - DPRINTF("*** XVID_DEC_DECODE"); - goto END_LOOP; - } - - if (stats.type == XVID_TYPE_NOTHING && length > 0) { - DPRINTF(" B-Frame decoder lag"); - m_frame.output.plane1 = NULL; - goto END_LOOP; - } - - if (stats.type == XVID_TYPE_VOL) - { - if (stats.data.vol.width != m_create.width || - stats.data.vol.height != m_create.height) - { - DPRINTF("TODO: auto-resize"); - m_frame.output.plane1 = NULL; - hr = E_FAIL; - } - - if (g_config.aspect_ratio == 0 || g_config.aspect_ratio == 1) { /* auto */ - int par_x, par_y; - if (stats.data.vol.par == XVID_PAR_EXT) { - par_x = stats.data.vol.par_width; - par_y = stats.data.vol.par_height; - } else { - par_x = PARSstats.data.vol.par-10; - par_y = PARSstats.data.vol.par-11; - } - - ar_x = par_x * stats.data.vol.width; - ar_y = par_y * stats.data.vol.height; - } - - m_frame.bitstream = (BYTE*)m_frame.bitstream + length; - m_frame.length -= length; - goto repeat; - } - -END_LOOP: - m_frame.output.csp = csp; - - if (pBuffer) { - pBuffer->Unlock(); - pBuffer->Release(); - } - - if (SUCCEEDED(hr)) { - /* Try to get a timestamp */ - if (FAILED(pSample->GetSampleTime(&m_timestamp))) - m_timestamp = INVALID_TIME; - - if (FAILED(pSample->GetSampleDuration(&m_timelength))) { - m_timelength = INVALID_TIME; - } - if (m_timestamp != INVALID_TIME && stats.type == XVID_TYPE_IVOP) { - m_rtFrame = m_timestamp; - } - } - - LeaveCriticalSection(&m_mft_lock); - - return hr; -} - -HRESULT CXvidDecoder::MFTProcessOutput(DWORD dwFlags, DWORD cOutputBufferCount, MFT_OUTPUT_DATA_BUFFER *pOutputSamples, DWORD *pdwStatus) -{ - DPRINTF("(MFT)ProcessOutput"); - - /* Preroll in MFT ?? - Flags ?? -> TODO... */ - if (dwFlags != 0) - return E_INVALIDARG; - - if (pOutputSamples == NULL || pdwStatus == NULL) - return E_POINTER; - - if (cOutputBufferCount != 1) /* Must be exactly one output buffer */ - return E_INVALIDARG; - - if (pOutputSamples0.pSample == NULL) /* Must have a sample */ - return E_INVALIDARG; - - if (!HasPendingOutput()) { /* If there's no sample we need to decode one first */ - return MF_E_TRANSFORM_NEED_MORE_INPUT; - } - - EnterCriticalSection(&m_mft_lock); - - HRESULT hr = S_OK; - - BYTE *Dst = NULL; - DWORD buffer_size; - - IMFMediaBuffer *pOutput = NULL; - - if (SUCCEEDED(hr)) { - hr = pOutputSamples0.pSample->GetBufferByIndex(0, &pOutput); /* Get output buffer */ - } - - if (SUCCEEDED(hr)) { - hr = pOutput->GetMaxLength(&buffer_size); - } - - if (SUCCEEDED(hr)) - hr = pOutput->Lock(&Dst, NULL, NULL); - - if (SUCCEEDED(hr)) { - xvid_gbl_convert_t convert; - - memset(&convert, 0, sizeof(convert)); - convert.version = XVID_VERSION; - - convert.input.csp = XVID_CSP_INTERNAL; - convert.input.plane0 = m_frame.output.plane0; - convert.input.plane1 = m_frame.output.plane1; - convert.input.plane2 = m_frame.output.plane2; - convert.input.stride0 = m_frame.output.stride0; - convert.input.stride1 = m_frame.output.stride1; - convert.input.stride2 = m_frame.output.stride2; - - convert.output.csp = m_frame.output.csp; - convert.output.plane0 = Dst; - convert.output.stride0 = out_stride; - - convert.width = m_create.width; - convert.height = m_create.height; - convert.interlacing = 0; - - if (m_frame.output.plane1 != NULL && Dst != NULL && xvid_global_func != NULL) - if (xvid_global_func(0, XVID_GBL_CONVERT, &convert, NULL) < 0) /* CSP convert into output buffer */ - hr = E_FAIL; - - m_frame.output.plane1 = NULL; - } - - *pdwStatus = 0; - - if (SUCCEEDED(hr)) { - if (SUCCEEDED(hr)) - hr = pOutputSamples0.pSample->SetUINT32(MFSampleExtension_CleanPoint, TRUE); // key frame - - if (SUCCEEDED(hr)) { /* Set timestamp of output sample */ - if (m_timestamp != INVALID_TIME) - hr = pOutputSamples0.pSample->SetSampleTime(m_timestamp); - else - hr = pOutputSamples0.pSample->SetSampleTime(m_rtFrame); - - if (m_timelength != INVALID_TIME) - hr = pOutputSamples0.pSample->SetSampleDuration(m_timelength); - else - hr = pOutputSamples0.pSample->SetSampleDuration(m_duration); - - m_rtFrame += m_duration; - } - - if (SUCCEEDED(hr)) - hr = pOutput->SetCurrentLength(m_create.width * abs(m_create.height) * 4); // XXX - } - - if (pOutput) { - pOutput->Unlock(); - pOutput->Release(); - } - - LeaveCriticalSection(&m_mft_lock); - - return hr; -} - -HRESULT CXvidDecoder::OnCheckInputType(IMFMediaType *pmt) -{ - DPRINTF("(MFT)CheckInputType"); - - HRESULT hr = S_OK; - - /* Check if input type is already set. Reject any type that is not identical */ - if (m_pInputType) { - DWORD dwFlags = 0; - if (S_OK == m_pInputType->IsEqual(pmt, &dwFlags)) { - return S_OK; - } - else { - return MF_E_INVALIDTYPE; - } - } - - GUID majortype = {0}, subtype = {0}; - UINT32 width = 0, height = 0; - - hr = pmt->GetMajorType(&majortype); - - if (SUCCEEDED(hr)) { - if (majortype != MFMediaType_Video) { /* Must be Video */ - hr = MF_E_INVALIDTYPE; - } - } - - if (m_hdll == NULL) { - HRESULT hr = OpenLib(); - - if (FAILED(hr) || (m_hdll == NULL)) // Paranoid checks. - hr = MF_E_INVALIDTYPE; - } - - if (SUCCEEDED(hr)) { - hr = MFGetAttributeSize(pmt, MF_MT_FRAME_SIZE, &width, &height); - } - - /* Check the frame size */ - if (SUCCEEDED(hr)) { - if (width > 4096 || height > 4096) { - hr = MF_E_INVALIDTYPE; - } - } - m_create.width = width; - m_create.height = height; - - if (SUCCEEDED(hr)) { - if (g_config.aspect_ratio == 0 || g_config.aspect_ratio == 1) { - hr = MFGetAttributeRatio(pmt, MF_MT_PIXEL_ASPECT_RATIO, (UINT32*)&ar_x, (UINT32*)&ar_y); - } - } - - /* TODO1: Make sure there really is a frame rate after all! - TODO2: Use the framerate for something! */ - MFRatio fps = {0}; - if (SUCCEEDED(hr)) { - hr = MFGetAttributeRatio(pmt, MF_MT_FRAME_RATE, (UINT32*)&fps.Numerator, (UINT32*)&fps.Denominator); - } - - if (SUCCEEDED(hr)) { - hr = pmt->GetGUID(MF_MT_SUBTYPE, &subtype); - } - - if (subtype == CLSID_MP4V || subtype == CLSID_MP4V_UC || - subtype == CLSID_LMP4 || subtype == CLSID_LMP4_UC || - subtype == CLSID_RMP4 || subtype == CLSID_RMP4_UC || - subtype == CLSID_SMP4 || subtype == CLSID_SMP4_UC || - subtype == CLSID_HDX4 || subtype == CLSID_HDX4_UC) { - if (!(g_config.supported_4cc & SUPPORT_MP4V)) { - CloseLib(); - hr = MF_E_INVALIDTYPE; - } - else m_create.fourcc = FOURCC_MP4V; - } - else if (subtype == CLSID_DIVX || subtype == CLSID_DIVX_UC) { - if (!(g_config.supported_4cc & SUPPORT_DIVX)) { - CloseLib(); - hr = MF_E_INVALIDTYPE; - } - else m_create.fourcc = FOURCC_DIVX; - } - else if (subtype == CLSID_DX50 || subtype == CLSID_DX50_UC) { - if (!(g_config.supported_4cc & SUPPORT_DIVX)) { - CloseLib(); - hr = MF_E_INVALIDTYPE; - } - else m_create.fourcc = FOURCC_DX50; - } - else if (subtype == CLSID_3IVX || subtype == CLSID_3IVX_UC || - subtype == CLSID_3IV0 || subtype == CLSID_3IV0_UC || - subtype == CLSID_3IV1 || subtype == CLSID_3IV1_UC || - subtype == CLSID_3IV2 || subtype == CLSID_3IV2_UC) { - if (!(g_config.supported_4cc & SUPPORT_3IVX)) { - CloseLib(); - hr = MF_E_INVALIDTYPE; - } - else m_create.fourcc = FOURCC_3IVX; - } - else if (subtype == CLSID_XVID || subtype == CLSID_XVID_UC) { - m_create.fourcc = FOURCC_XVID; - } - else { - DPRINTF("Unknown subtype!"); - CloseLib(); - hr = MF_E_INVALIDTYPE; - } - - /* haali media splitter reports VOL information in the format header */ - if (SUCCEEDED(hr)) - { - UINT32 cbSeqHeader = 0; - - (void)pmt->GetBlobSize(MF_MT_MPEG_SEQUENCE_HEADER, &cbSeqHeader); - - if (cbSeqHeader>0) { - xvid_dec_stats_t stats; - memset(&stats, 0, sizeof(stats)); - stats.version = XVID_VERSION; - - if (m_create.handle == NULL) { - if (xvid_decore_func == NULL) - hr = E_FAIL; - if (xvid_decore_func(0, XVID_DEC_CREATE, &m_create, 0) < 0) { - DPRINTF("*** XVID_DEC_CREATE error"); - hr = E_FAIL; - } - } - - if (SUCCEEDED(hr)) { - (void)pmt->GetAllocatedBlob(MF_MT_MPEG_SEQUENCE_HEADER, (UINT8 **)&m_frame.bitstream, (UINT32 *)&m_frame.length); - m_frame.general = 0; - m_frame.output.csp = XVID_CSP_NULL; - - int ret = 0; - if ((ret=xvid_decore_func(m_create.handle, XVID_DEC_DECODE, &m_frame, &stats)) >= 0) { - /* honour video dimensions reported in VOL header */ - if (stats.type == XVID_TYPE_VOL) { - m_create.width = stats.data.vol.width; - m_create.height = stats.data.vol.height; - } - } - - if (ret == XVID_ERR_MEMORY) hr = E_FAIL; - CoTaskMemFree(m_frame.bitstream); - } - } - } - - return hr; -} - -HRESULT CXvidDecoder::OnSetInputType(IMFMediaType *pmt) -{ - HRESULT hr = S_OK; - UINT32 w, h; - - if (m_pInputType) m_pInputType->Release(); - - hr = MFGetAttributeSize(pmt, MF_MT_FRAME_SIZE, &w, &h); - m_create.width = w; m_create.height = h; - - if (SUCCEEDED(hr)) - hr = MFGetAttributeRatio(pmt, MF_MT_FRAME_RATE, (UINT32*)&m_frameRate.Numerator, (UINT32*)&m_frameRate.Denominator); - - if (SUCCEEDED(hr)) { /* Store frame duration, derived from the frame rate */ - hr = MFFrameRateToAverageTimePerFrame(m_frameRate.Numerator, m_frameRate.Denominator, &m_duration); - } - - if (SUCCEEDED(hr)) { - m_pInputType = pmt; - m_pInputType->AddRef(); - } - - return hr; -} - -HRESULT CXvidDecoder::OnSetOutputType(IMFMediaType *pmt) -{ - if (m_pOutputType) m_pOutputType->Release(); - - m_pOutputType = pmt; - m_pOutputType->AddRef(); - - return S_OK; -} - -#endif /* XVID_USE_MFT */ +/***************************************************************************** + * + * XVID MPEG-4 VIDEO CODEC + * - Xvid Decoder part of the DShow Filter - + * + * Copyright(C) 2002-2011 Peter Ross <pross@xvid.org> + * 2003-2012 Michael Militzer <michael@xvid.org> + * + * 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 + * + * $Id: CXvidDecoder.cpp 2059 2012-02-22 19:00:26Z Isibaar $ + * + ****************************************************************************/ + + /* + this requires the directx sdk + place these paths at the top of the Tools|Options|Directories list + + headers: + C:\DX90SDK\Include + C:\DX90SDK\Samples\C++\DirectShow\BaseClasses + + C:\DX90SDK\Samples\C++\DirectShow\BaseClasses\Release + C:\DX90SDK\Samples\C++\DirectShow\BaseClasses\Debug +*/ + +#ifdef ENABLE_MFT +#define XVID_USE_MFT +#endif + +#include <windows.h> + +#include <streams.h> +#include <initguid.h> +#include <olectl.h> +#if (1100 > _MSC_VER) +#include <olectlid.h> +#endif +#include <dvdmedia.h> // VIDEOINFOHEADER2 + +#if defined(XVID_USE_MFT) +#define MFT_UNIQUE_METHOD_NAMES +#include <mftransform.h> +#include <mfapi.h> +#include <mferror.h> +#include <shlwapi.h> +#endif + +#include <shellapi.h> + +#include <xvid.h> // Xvid API + +#include "resource.h" + +#include "IXvidDecoder.h" +#include "CXvidDecoder.h" +#include "CAbout.h" +#include "config.h" +#include "debug.h" + +static bool USE_IYUV; +static bool USE_YV12; +static bool USE_YUY2; +static bool USE_YVYU; +static bool USE_UYVY; +static bool USE_RGB32; +static bool USE_RGB24; +static bool USE_RG555; +static bool USE_RG565; + +const AMOVIESETUP_MEDIATYPE sudInputPinTypes = +{ + { &MEDIATYPE_Video, &CLSID_XVID }, + { &MEDIATYPE_Video, &CLSID_XVID_UC }, + { &MEDIATYPE_Video, &CLSID_DIVX }, + { &MEDIATYPE_Video, &CLSID_DIVX_UC }, + { &MEDIATYPE_Video, &CLSID_DX50 }, + { &MEDIATYPE_Video, &CLSID_DX50_UC }, + { &MEDIATYPE_Video, &CLSID_3IVX }, + { &MEDIATYPE_Video, &CLSID_3IVX_UC }, + { &MEDIATYPE_Video, &CLSID_3IV0 }, + { &MEDIATYPE_Video, &CLSID_3IV0_UC }, + { &MEDIATYPE_Video, &CLSID_3IV1 }, + { &MEDIATYPE_Video, &CLSID_3IV1_UC }, + { &MEDIATYPE_Video, &CLSID_3IV2 }, + { &MEDIATYPE_Video, &CLSID_3IV2_UC }, + { &MEDIATYPE_Video, &CLSID_LMP4 }, + { &MEDIATYPE_Video, &CLSID_LMP4_UC }, + { &MEDIATYPE_Video, &CLSID_RMP4 }, + { &MEDIATYPE_Video, &CLSID_RMP4_UC }, + { &MEDIATYPE_Video, &CLSID_SMP4 }, + { &MEDIATYPE_Video, &CLSID_SMP4_UC }, + { &MEDIATYPE_Video, &CLSID_HDX4 }, + { &MEDIATYPE_Video, &CLSID_HDX4_UC }, + { &MEDIATYPE_Video, &CLSID_MP4V }, + { &MEDIATYPE_Video, &CLSID_MP4V_UC }, +}; + +const AMOVIESETUP_MEDIATYPE sudOutputPinTypes = +{ + { &MEDIATYPE_Video, &MEDIASUBTYPE_NULL } +}; + + +const AMOVIESETUP_PIN psudPins = +{ + { + L"Input", // String pin name + FALSE, // Is it rendered + FALSE, // Is it an output + FALSE, // Allowed none + FALSE, // Allowed many + &CLSID_NULL, // Connects to filter + L"Output", // Connects to pin + sizeof(sudInputPinTypes) / sizeof(AMOVIESETUP_MEDIATYPE), // Number of types + &sudInputPinTypes0 // The pin details + }, + { + L"Output", // String pin name + FALSE, // Is it rendered + TRUE, // Is it an output + FALSE, // Allowed none + FALSE, // Allowed many + &CLSID_NULL, // Connects to filter + L"Input", // Connects to pin + sizeof(sudOutputPinTypes) / sizeof(AMOVIESETUP_MEDIATYPE), // Number of types + sudOutputPinTypes // The pin details + } +}; + + +const AMOVIESETUP_FILTER sudXvidDecoder = +{ + &CLSID_XVID, // Filter CLSID + XVID_NAME_L, // Filter name + MERIT_PREFERRED+2, // Its merit + sizeof(psudPins) / sizeof(AMOVIESETUP_PIN), // Number of pins + psudPins // Pin details +}; + + +// List of class IDs and creator functions for the class factory. This +// provides the link between the OLE entry point in the DLL and an object +// being created. The class factory will call the static CreateInstance + +CFactoryTemplate g_Templates = +{ + { + XVID_NAME_L, + &CLSID_XVID, + CXvidDecoder::CreateInstance, + NULL, + &sudXvidDecoder + }, + { + XVID_NAME_L L"About", + &CLSID_CABOUT, + CAbout::CreateInstance + } + +}; + +/* note: g_cTemplates must be global; used by strmbase.lib(dllentry.cpp,dllsetup.cpp) */ +int g_cTemplates = sizeof(g_Templates) / sizeof(CFactoryTemplate); + +extern HINSTANCE g_xvid_hInst; + +static int GUI_Page = 0; +static int Tray_Icon = 0; +extern "C" void CALLBACK Configure(HWND hWndParent, HINSTANCE hInstParent, LPSTR lpCmdLine, int nCmdShow ); + +LRESULT CALLBACK msg_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch ( uMsg ) + { + case WM_ICONMESSAGE: + switch(lParam) + { + case WM_LBUTTONDBLCLK: + if (!GUI_Page) { + GUI_Page = 1; + Configure(hwnd, g_xvid_hInst, "", 1); + GUI_Page = 0; + } + break; + default: + return DefWindowProc(hwnd, uMsg, wParam, lParam); + }; + break; + + case WM_DESTROY: + NOTIFYICONDATA nid; + ZeroMemory(&nid,sizeof(NOTIFYICONDATA)); + + nid.cbSize = NOTIFYICONDATA_V1_SIZE; + nid.hWnd = hwnd; + nid.uID = 1456; + + Shell_NotifyIcon(NIM_DELETE, &nid); + Tray_Icon = 0; + default: + return DefWindowProc(hwnd, uMsg, wParam, lParam); + } + + return TRUE; /* ok */ +} + +STDAPI DllRegisterServer() +{ +#if defined(XVID_USE_MFT) + int inputs_num = sizeof(sudInputPinTypes) / sizeof(AMOVIESETUP_MEDIATYPE); + int outputs_num = sizeof(sudOutputPinTypes) / sizeof(AMOVIESETUP_MEDIATYPE); + MFT_REGISTER_TYPE_INFO * mft_bs = new MFT_REGISTER_TYPE_INFOinputs_num; + MFT_REGISTER_TYPE_INFO * mft_csp = new MFT_REGISTER_TYPE_INFOoutputs_num; + + { + int i; + for(i=0;i<inputs_num;i++) { + mft_bsi.guidMajorType = *sudInputPinTypesi.clsMajorType; + mft_bsi.guidSubtype = *sudInputPinTypesi.clsMinorType; + } + for(i=0;i<outputs_num;i++) { + mft_cspi.guidMajorType = *sudOutputPinTypesi.clsMajorType; + mft_cspi.guidSubtype = *sudOutputPinTypesi.clsMinorType; // MFT and AM GUIDs really the same? + } + } + + /* Register the MFT decoder */ + MFTRegister(CLSID_XVID, // CLSID + MFT_CATEGORY_VIDEO_DECODER, // Category + const_cast<LPWSTR>(XVID_NAME_L), // Friendly name + 0, // Flags + inputs_num, // Number of input types + mft_bs, // Input types + outputs_num, // Number of output types + mft_csp, // Output types + NULL // Attributes (optional) + ); + + delete mft_bs; + delete mft_csp; +#endif /* XVID_USE_MFT */ + + return AMovieDllRegisterServer2( TRUE ); +} + + +STDAPI DllUnregisterServer() +{ +#if defined(XVID_USE_MFT) + MFTUnregister(CLSID_XVID); +#endif + return AMovieDllRegisterServer2( FALSE ); +} + + +/* create instance */ + +CUnknown * WINAPI CXvidDecoder::CreateInstance(LPUNKNOWN punk, HRESULT *phr) +{ + CXvidDecoder * pNewObject = new CXvidDecoder(punk, phr); + if (pNewObject == NULL) + { + *phr = E_OUTOFMEMORY; + } + return pNewObject; +} + + +/* query interfaces */ + +STDMETHODIMP CXvidDecoder::NonDelegatingQueryInterface(REFIID riid, void **ppv) +{ + CheckPointer(ppv, E_POINTER); + + if (riid == IID_IXvidDecoder) + { + return GetInterface((IXvidDecoder *) this, ppv); + } + + if (riid == IID_ISpecifyPropertyPages) + { + return GetInterface((ISpecifyPropertyPages *) this, ppv); + } + +#if defined(XVID_USE_MFT) + if (riid == IID_IMFTransform) + { + return GetInterface((IMFTransform *) this, ppv); + } +#endif + + return CVideoTransformFilter::NonDelegatingQueryInterface(riid, ppv); +} + + + +/* constructor */ + +CXvidDecoder::CXvidDecoder(LPUNKNOWN punk, HRESULT *phr) : + CVideoTransformFilter(NAME("CXvidDecoder"), punk, CLSID_XVID), m_hdll (NULL) +{ + DPRINTF("Constructor"); + + xvid_decore_func = NULL; // Hmm, some strange errors appearing if I try to initialize... + xvid_global_func = NULL; // ...this in constructor's init-list. So, they assigned here. + +#if defined(XVID_USE_MFT) + InitializeCriticalSection(&m_mft_lock); + m_pInputType = NULL; + m_pOutputType = NULL; + m_rtFrame = 0; + m_duration = 0; + m_discont = 0; + m_frameRate.Denominator = 1; + m_frameRate.Numerator = 1; +#endif + + LoadRegistryInfo(); + + *phr = OpenLib(); + + { + TCHAR lpFilenameMAX_PATH; + int sLen = GetModuleFileName(NULL, lpFilename, MAX_PATH); +#ifdef _UNICODE + if ((sLen >= 11) && (_wcsnicmp(&(lpFilenamesLen - 11), TEXT("dllhost.exe"), 11) == 0)) { +#else + if ((sLen >= 11) && (_strnicmp(&(lpFilenamesLen - 11), TEXT("dllhost.exe"), 11) == 0)) { +#endif + if (Tray_Icon == 0) Tray_Icon = -1; // create no tray icon upon thumbnail generation + } + else + if (Tray_Icon == -1) Tray_Icon = 0; // can show tray icon + } + +} + +HRESULT CXvidDecoder::OpenLib() +{ + DPRINTF("OpenLib"); + + if (m_hdll != NULL) + return E_UNEXPECTED; // Seems, that library already opened. + + xvid_gbl_init_t init; + memset(&init, 0, sizeof(init)); + init.version = XVID_VERSION; + init.cpu_flags = g_config.cpu; + + xvid_gbl_info_t info; + memset(&info, 0, sizeof(info)); + info.version = XVID_VERSION; + + m_hdll = LoadLibrary(XVID_DLL_NAME); + if (m_hdll == NULL) { + DPRINTF("dll load failed"); + MessageBox(0, XVID_DLL_NAME " not found","Error", MB_TOPMOST); + return E_FAIL; + } + + xvid_global_func = (int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global"); + if (xvid_global_func == NULL) { + FreeLibrary(m_hdll); + m_hdll = NULL; + MessageBox(0, "xvid_global() not found", "Error", MB_TOPMOST); + return E_FAIL; + } + + xvid_decore_func = (int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_decore"); + if (xvid_decore_func == NULL) { + xvid_global_func = NULL; + FreeLibrary(m_hdll); + m_hdll = NULL; + MessageBox(0, "xvid_decore() not found", "Error", MB_TOPMOST); + return E_FAIL; + } + + if (xvid_global_func(0, XVID_GBL_INIT, &init, NULL) < 0) + { + xvid_global_func = NULL; + xvid_decore_func = NULL; + FreeLibrary(m_hdll); + m_hdll = NULL; + MessageBox(0, "xvid_global() failed", "Error", MB_TOPMOST); + return E_FAIL; + } + + if (xvid_global_func(0, XVID_GBL_INFO, &info, NULL) < 0) + { + xvid_global_func = NULL; + xvid_decore_func = NULL; + FreeLibrary(m_hdll); + m_hdll = NULL; + MessageBox(0, "xvid_global() failed", "Error", MB_TOPMOST); + return E_FAIL; + } + + memset(&m_create, 0, sizeof(m_create)); + m_create.version = XVID_VERSION; + m_create.handle = NULL; + /* Decoder threads */ + if (g_config.cpu & XVID_CPU_FORCE) { + m_create.num_threads = g_config.num_threads; + } + else { + m_create.num_threads = info.num_threads; /* Autodetect */ + g_config.num_threads = info.num_threads; + } + + memset(&m_frame, 0, sizeof(m_frame)); + m_frame.version = XVID_VERSION; + + USE_IYUV = false; + USE_YV12 = false; + USE_YUY2 = false; + USE_YVYU = false; + USE_UYVY = false; + USE_RGB32 = false; + USE_RGB24 = false; + USE_RG555 = false; + USE_RG565 = false; + + switch ( g_config.nForceColorspace ) + { + case FORCE_NONE: + USE_IYUV = true; + USE_YV12 = true; + USE_YUY2 = true; + USE_YVYU = true; + USE_UYVY = true; + USE_RGB32 = true; + USE_RGB24 = true; + USE_RG555 = true; + USE_RG565 = true; + break; + case FORCE_YV12: + USE_IYUV = true; + USE_YV12 = true; + break; + case FORCE_YUY2: + USE_YUY2 = true; + break; + case FORCE_RGB24: + USE_RGB24 = true; + break; + case FORCE_RGB32: + USE_RGB32 = true; + break; + } + + switch (g_config.aspect_ratio) + { + case 0: + case 1: + break; + case 2: + ar_x = 4; + ar_y = 3; + break; + case 3: + ar_x = 16; + ar_y = 9; + break; + case 4: + ar_x = 47; + ar_y = 20; + break; + } + + return S_OK; +} + +void CXvidDecoder::CloseLib() +{ + DPRINTF("CloseLib"); + + if ((m_create.handle != NULL) && (xvid_decore_func != NULL)) + { + xvid_decore_func(m_create.handle, XVID_DEC_DESTROY, 0, 0); + m_create.handle = NULL; + } + + if (m_hdll != NULL) { + FreeLibrary(m_hdll); + m_hdll = NULL; + } + xvid_decore_func = NULL; + xvid_global_func = NULL; +} + +/* destructor */ + +CXvidDecoder::~CXvidDecoder() +{ + DPRINTF("Destructor"); + + if (Tray_Icon > 0) { /* Destroy tray icon */ + NOTIFYICONDATA nid; + ZeroMemory(&nid,sizeof(NOTIFYICONDATA)); + + nid.cbSize = NOTIFYICONDATA_V1_SIZE; + nid.hWnd = MSG_hwnd; + nid.uID = 1456; + + Shell_NotifyIcon(NIM_DELETE, &nid); + Tray_Icon = 0; + } + + /* Close xvidcore library */ + CloseLib(); + +#if defined(XVID_USE_MFT) + DeleteCriticalSection(&m_mft_lock); +#endif +} + + + +/* check input type */ + +HRESULT CXvidDecoder::CheckInputType(const CMediaType * mtIn) +{ + DPRINTF("CheckInputType"); + BITMAPINFOHEADER * hdr; + + ar_x = ar_y = 0; + + if (*mtIn->Type() != MEDIATYPE_Video) + { + DPRINTF("Error: Unknown Type"); + CloseLib(); + return VFW_E_TYPE_NOT_ACCEPTED; + } + + if (m_hdll == NULL) + { + HRESULT hr = OpenLib(); + + if (FAILED(hr) || (m_hdll == NULL)) // Paranoid checks. + return VFW_E_TYPE_NOT_ACCEPTED; + } + + if (*mtIn->FormatType() == FORMAT_VideoInfo) + { + VIDEOINFOHEADER * vih = (VIDEOINFOHEADER *) mtIn->Format(); + hdr = &vih->bmiHeader; + } + else if (*mtIn->FormatType() == FORMAT_VideoInfo2) + { + VIDEOINFOHEADER2 * vih2 = (VIDEOINFOHEADER2 *) mtIn->Format(); + hdr = &vih2->bmiHeader; + if (g_config.aspect_ratio == 0 || g_config.aspect_ratio == 1) { + ar_x = vih2->dwPictAspectRatioX; + ar_y = vih2->dwPictAspectRatioY; + } + DPRINTF("VIDEOINFOHEADER2 AR: %d:%d", ar_x, ar_y); + } + else if (*mtIn->FormatType() == FORMAT_MPEG2Video) { + MPEG2VIDEOINFO * mpgvi = (MPEG2VIDEOINFO*)mtIn->Format(); + VIDEOINFOHEADER2 * vih2 = &mpgvi->hdr; + hdr = &vih2->bmiHeader; + if (g_config.aspect_ratio == 0 || g_config.aspect_ratio == 1) { + ar_x = vih2->dwPictAspectRatioX; + ar_y = vih2->dwPictAspectRatioY; + } + DPRINTF("VIDEOINFOHEADER2 AR: %d:%d", ar_x, ar_y); + + /* haali media splitter reports VOL information in the format header */ + + if (mpgvi->cbSequenceHeader>0) { + + xvid_dec_stats_t stats; + memset(&stats, 0, sizeof(stats)); + stats.version = XVID_VERSION; + + if (m_create.handle == NULL) { + if (xvid_decore_func == NULL) + return E_FAIL; + if (xvid_decore_func(0, XVID_DEC_CREATE, &m_create, 0) < 0) { + DPRINTF("*** XVID_DEC_CREATE error"); + return E_FAIL; + } + } + + m_frame.general = 0; + m_frame.bitstream = (void*)mpgvi->dwSequenceHeader; + m_frame.length = mpgvi->cbSequenceHeader; + m_frame.output.csp = XVID_CSP_NULL; + + int ret = 0; + if ((ret=xvid_decore_func(m_create.handle, XVID_DEC_DECODE, &m_frame, &stats)) >= 0) { + /* honour video dimensions reported in VOL header */ + if (stats.type == XVID_TYPE_VOL) { + hdr->biWidth = stats.data.vol.width; + hdr->biHeight = stats.data.vol.height; + } + } + if (ret == XVID_ERR_MEMORY) return E_FAIL; + } + } + else + { + DPRINTF("Error: Unknown FormatType"); + CloseLib(); + return VFW_E_TYPE_NOT_ACCEPTED; + } + if (hdr->biHeight < 0) + { + DPRINTF("colorspace: inverted input format not supported"); + } + + m_create.width = hdr->biWidth; + m_create.height = hdr->biHeight; + + switch(hdr->biCompression) + { + case FOURCC_mp4v : + case FOURCC_MP4V : + case FOURCC_lmp4 : + case FOURCC_LMP4 : + case FOURCC_rmp4 : + case FOURCC_RMP4 : + case FOURCC_smp4 : + case FOURCC_SMP4 : + case FOURCC_hdx4 : + case FOURCC_HDX4 : + if (!(g_config.supported_4cc & SUPPORT_MP4V)) { + CloseLib(); + return VFW_E_TYPE_NOT_ACCEPTED; + } + break; + case FOURCC_divx : + case FOURCC_DIVX : + case FOURCC_dx50 : + case FOURCC_DX50 : + if (!(g_config.supported_4cc & SUPPORT_DIVX)) { + CloseLib(); + return VFW_E_TYPE_NOT_ACCEPTED; + } + break; + case FOURCC_3ivx : + case FOURCC_3IVX : + case FOURCC_3iv0 : + case FOURCC_3IV0 : + case FOURCC_3iv1 : + case FOURCC_3IV1 : + case FOURCC_3iv2 : + case FOURCC_3IV2 : + if (!(g_config.supported_4cc & SUPPORT_3IVX)) { + CloseLib(); + return VFW_E_TYPE_NOT_ACCEPTED; + } + case FOURCC_xvid : + case FOURCC_XVID : + break; + + + default : + DPRINTF("Unknown fourcc: 0x%08x (%c%c%c%c)", + hdr->biCompression, + (hdr->biCompression)&0xff, + (hdr->biCompression>>8)&0xff, + (hdr->biCompression>>16)&0xff, + (hdr->biCompression>>24)&0xff); + CloseLib(); + return VFW_E_TYPE_NOT_ACCEPTED; + } + + m_create.fourcc = hdr->biCompression; + + return S_OK; +} + + +/* get list of supported output colorspaces */ + + +HRESULT CXvidDecoder::GetMediaType(int iPosition, CMediaType *mtOut) +{ + BITMAPINFOHEADER * bmih; + DPRINTF("GetMediaType"); + + if (m_pInput->IsConnected() == FALSE) + { + return E_UNEXPECTED; + } + + if (!g_config.videoinfo_compat) { + VIDEOINFOHEADER2 * vih = (VIDEOINFOHEADER2 *) mtOut->ReallocFormatBuffer(sizeof(VIDEOINFOHEADER2)); + if (vih == NULL) return E_OUTOFMEMORY; + + ZeroMemory(vih, sizeof (VIDEOINFOHEADER2)); + bmih = &(vih->bmiHeader); + mtOut->SetFormatType(&FORMAT_VideoInfo2); + + if (ar_x != 0 && ar_y != 0) { + vih->dwPictAspectRatioX = ar_x; + vih->dwPictAspectRatioY = ar_y; + forced_ar = true; + } else { // just to be safe + vih->dwPictAspectRatioX = m_create.width; + vih->dwPictAspectRatioY = abs(m_create.height); + forced_ar = false; + } + } else { + + VIDEOINFOHEADER * vih = (VIDEOINFOHEADER *) mtOut->ReallocFormatBuffer(sizeof(VIDEOINFOHEADER)); + if (vih == NULL) return E_OUTOFMEMORY; + + ZeroMemory(vih, sizeof (VIDEOINFOHEADER)); + bmih = &(vih->bmiHeader); + mtOut->SetFormatType(&FORMAT_VideoInfo); + } + + bmih->biSize = sizeof(BITMAPINFOHEADER); + bmih->biWidth = m_create.width; + bmih->biHeight = m_create.height; + bmih->biPlanes = 1; + + if (iPosition < 0) return E_INVALIDARG; + + switch(iPosition) + { + + case 0: +if ( USE_YUY2 ) +{ + bmih->biCompression = MEDIASUBTYPE_YUY2.Data1; + bmih->biBitCount = 16; + mtOut->SetSubtype(&MEDIASUBTYPE_YUY2); + break; +} + case 1 : +if ( USE_YVYU ) +{ + bmih->biCompression = MEDIASUBTYPE_YVYU.Data1; + bmih->biBitCount = 16; + mtOut->SetSubtype(&MEDIASUBTYPE_YVYU); + break; +} + case 2 : +if ( USE_UYVY ) +{ + bmih->biCompression = MEDIASUBTYPE_UYVY.Data1; + bmih->biBitCount = 16; + mtOut->SetSubtype(&MEDIASUBTYPE_UYVY); + break; +} + case 3 : + if ( USE_IYUV ) +{ + bmih->biCompression = CLSID_MEDIASUBTYPE_IYUV.Data1; + bmih->biBitCount = 12; + mtOut->SetSubtype(&CLSID_MEDIASUBTYPE_IYUV); + break; +} + case 4 : +if ( USE_YV12 ) +{ + bmih->biCompression = MEDIASUBTYPE_YV12.Data1; + bmih->biBitCount = 12; + mtOut->SetSubtype(&MEDIASUBTYPE_YV12); + break; +} + case 5 : +if ( USE_RGB32 ) +{ + bmih->biCompression = BI_RGB; + bmih->biBitCount = 32; + mtOut->SetSubtype(&MEDIASUBTYPE_RGB32); + break; +} + case 6 : +if ( USE_RGB24 ) +{ + bmih->biCompression = BI_RGB; + bmih->biBitCount = 24; + mtOut->SetSubtype(&MEDIASUBTYPE_RGB24); + break; +} + case 7 : +if ( USE_RG555 ) +{ + bmih->biCompression = BI_RGB; + bmih->biBitCount = 16; + mtOut->SetSubtype(&MEDIASUBTYPE_RGB555); + break; +} + case 8 : +if ( USE_RG565 ) +{ + bmih->biCompression = BI_RGB; + bmih->biBitCount = 16; + mtOut->SetSubtype(&MEDIASUBTYPE_RGB565); + break; +} + default : + return VFW_S_NO_MORE_ITEMS; + } + + bmih->biSizeImage = GetBitmapSize(bmih); + + mtOut->SetType(&MEDIATYPE_Video); + mtOut->SetTemporalCompression(FALSE); + mtOut->SetSampleSize(bmih->biSizeImage); + + return S_OK; +} + + +/* (internal function) change colorspace */ +#define CALC_BI_STRIDE(width,bitcount) ((((width * bitcount) + 31) & ~31) >> 3) + +HRESULT CXvidDecoder::ChangeColorspace(GUID subtype, GUID formattype, void * format, int noflip) +{ + DWORD biWidth; + + if (formattype == FORMAT_VideoInfo) + { + VIDEOINFOHEADER * vih = (VIDEOINFOHEADER * )format; + biWidth = vih->bmiHeader.biWidth; + out_stride = CALC_BI_STRIDE(vih->bmiHeader.biWidth, vih->bmiHeader.biBitCount); + rgb_flip = (vih->bmiHeader.biHeight < 0 ? 0 : XVID_CSP_VFLIP); + } + else if (formattype == FORMAT_VideoInfo2) + { + VIDEOINFOHEADER2 * vih2 = (VIDEOINFOHEADER2 * )format; + biWidth = vih2->bmiHeader.biWidth; + out_stride = CALC_BI_STRIDE(vih2->bmiHeader.biWidth, vih2->bmiHeader.biBitCount); + rgb_flip = (vih2->bmiHeader.biHeight < 0 ? 0 : XVID_CSP_VFLIP); + } + else + { + return S_FALSE; + } + + if (noflip) rgb_flip = 0; + + if (subtype == CLSID_MEDIASUBTYPE_IYUV) + { + DPRINTF("IYUV"); + rgb_flip = 0; + m_frame.output.csp = XVID_CSP_I420; + out_stride = CALC_BI_STRIDE(biWidth, 8); /* planar format fix */ + } + else if (subtype == MEDIASUBTYPE_YV12) + { + DPRINTF("YV12"); + rgb_flip = 0; + m_frame.output.csp = XVID_CSP_YV12; + out_stride = CALC_BI_STRIDE(biWidth, 8); /* planar format fix */ + } + else if (subtype == MEDIASUBTYPE_YUY2) + { + DPRINTF("YUY2"); + rgb_flip = 0; + m_frame.output.csp = XVID_CSP_YUY2; + } + else if (subtype == MEDIASUBTYPE_YVYU) + { + DPRINTF("YVYU"); + rgb_flip = 0; + m_frame.output.csp = XVID_CSP_YVYU; + } + else if (subtype == MEDIASUBTYPE_UYVY) + { + DPRINTF("UYVY"); + rgb_flip = 0; + m_frame.output.csp = XVID_CSP_UYVY; + } + else if (subtype == MEDIASUBTYPE_RGB32) + { + DPRINTF("RGB32"); + m_frame.output.csp = rgb_flip | XVID_CSP_BGRA; + } + else if (subtype == MEDIASUBTYPE_RGB24) + { + DPRINTF("RGB24"); + m_frame.output.csp = rgb_flip | XVID_CSP_BGR; + } + else if (subtype == MEDIASUBTYPE_RGB555) + { + DPRINTF("RGB555"); + m_frame.output.csp = rgb_flip | XVID_CSP_RGB555; + } + else if (subtype == MEDIASUBTYPE_RGB565) + { + DPRINTF("RGB565"); + m_frame.output.csp = rgb_flip | XVID_CSP_RGB565; + } + else if (subtype == GUID_NULL) + { + m_frame.output.csp = XVID_CSP_NULL; + } + else + { + return S_FALSE; + } + + return S_OK; +} + + +/* set output colorspace */ + +HRESULT CXvidDecoder::SetMediaType(PIN_DIRECTION direction, const CMediaType *pmt) +{ + DPRINTF("SetMediaType"); + + if (direction == PINDIR_OUTPUT) + { + return ChangeColorspace(*pmt->Subtype(), *pmt->FormatType(), pmt->Format(), 0); + } + + return S_OK; +} + + +/* check input<->output compatiblity */ + +HRESULT CXvidDecoder::CheckTransform(const CMediaType *mtIn, const CMediaType *mtOut) +{ + DPRINTF("CheckTransform"); + + return S_OK; +} + +/* input/output pin connection complete */ + +HRESULT CXvidDecoder::CompleteConnect(PIN_DIRECTION direction, IPin *pReceivePin) +{ + DPRINTF("CompleteConnect"); + + if ((direction == PINDIR_OUTPUT) && (Tray_Icon == 0)&& (g_config.bTrayIcon != 0)) + { + WNDCLASSEX wc; + + wc.cbSize = sizeof(WNDCLASSEX); + wc.lpfnWndProc = msg_proc; + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.cbWndExtra = 0; + wc.cbClsExtra = 0; + wc.hInstance = (HINSTANCE) g_xvid_hInst; + wc.hbrBackground = (HBRUSH) GetStockObject(NULL_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName = "XVID_MSG_WINDOW"; + wc.hIcon = NULL; + wc.hIconSm = NULL; + wc.hCursor = NULL; + RegisterClassEx(&wc); + + MSG_hwnd = CreateWindowEx(0, "XVID_MSG_WINDOW", NULL, 0, CW_USEDEFAULT, + CW_USEDEFAULT, 0, 0, HWND_MESSAGE, NULL, (HINSTANCE) g_xvid_hInst, NULL); + + /* display the tray icon */ + NOTIFYICONDATA nid; + ZeroMemory(&nid,sizeof(NOTIFYICONDATA)); + + nid.cbSize = NOTIFYICONDATA_V1_SIZE; + nid.hWnd = MSG_hwnd; + nid.uID = 1456; + nid.uCallbackMessage = WM_ICONMESSAGE; + nid.hIcon = LoadIcon(g_xvid_hInst, MAKEINTRESOURCE(IDI_ICON)); + strcpy_s(nid.szTip, 19, "Xvid Video Decoder"); + nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; + + Shell_NotifyIcon(NIM_ADD, &nid); + + DestroyIcon(nid.hIcon); + Tray_Icon = 1; + } + + return S_OK; +} + +/* input/output pin disconnected */ +HRESULT CXvidDecoder::BreakConnect(PIN_DIRECTION direction) +{ + DPRINTF("BreakConnect"); + + return S_OK; +} + +/* alloc output buffer */ + +HRESULT CXvidDecoder::DecideBufferSize(IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest) +{ + DPRINTF("DecideBufferSize"); + HRESULT result; + ALLOCATOR_PROPERTIES ppropActual; + + if (m_pInput->IsConnected() == FALSE) + { + return E_UNEXPECTED; + } + + ppropInputRequest->cBuffers = 1; + ppropInputRequest->cbBuffer = m_create.width * m_create.height * 4; + // cbAlign causes problems with the resize filter */ + // ppropInputRequest->cbAlign = 16; + ppropInputRequest->cbPrefix = 0; + + result = pAlloc->SetProperties(ppropInputRequest, &ppropActual); + if (result != S_OK) + { + return result; + } + + if (ppropActual.cbBuffer < ppropInputRequest->cbBuffer) + { + return E_FAIL; + } + + return S_OK; +} + + +/* decode frame */ + +HRESULT CXvidDecoder::Transform(IMediaSample *pIn, IMediaSample *pOut) +{ + DPRINTF("Transform"); + xvid_dec_stats_t stats; + int length; + + memset(&stats, 0, sizeof(stats)); + stats.version = XVID_VERSION; + + if (m_create.handle == NULL) + { + if (xvid_decore_func == NULL) + return E_FAIL; + + if (xvid_decore_func(0, XVID_DEC_CREATE, &m_create, 0) < 0) + { + DPRINTF("*** XVID_DEC_CREATE error"); + return E_FAIL; + } + } + + AM_MEDIA_TYPE * mtOut; + pOut->GetMediaType(&mtOut); + if (mtOut != NULL) + { + HRESULT result; + + result = ChangeColorspace(mtOut->subtype, mtOut->formattype, mtOut->pbFormat, 0); + DeleteMediaType(mtOut); + + if (result != S_OK) + { + DPRINTF("*** ChangeColorspace error"); + return result; + } + } + + m_frame.length = pIn->GetActualDataLength(); + if (pIn->GetPointer((BYTE**)&m_frame.bitstream) != S_OK) + { + return S_FALSE; + } + + if (pOut->GetPointer((BYTE**)&m_frame.output.plane0) != S_OK) + { + return S_FALSE; + } + + m_frame.general = XVID_LOWDELAY; + + if (pIn->IsDiscontinuity() == S_OK) + m_frame.general |= XVID_DISCONTINUITY; + + if (g_config.nDeblock_Y) + m_frame.general |= XVID_DEBLOCKY; + + if (g_config.nDeblock_UV) + m_frame.general |= XVID_DEBLOCKUV; + + if (g_config.nDering_Y) + m_frame.general |= XVID_DERINGY; + + if (g_config.nDering_UV) + m_frame.general |= XVID_DERINGUV; + + if (g_config.nFilmEffect) + m_frame.general |= XVID_FILMEFFECT; + + m_frame.brightness = g_config.nBrightness; + + m_frame.output.csp &= ~XVID_CSP_VFLIP; + m_frame.output.csp |= rgb_flip^(g_config.nFlipVideo ? XVID_CSP_VFLIP : 0); + m_frame.output.stride0 = out_stride; + + // Paranoid check. + if (xvid_decore_func == NULL) + return E_FAIL; + + +repeat : + + if (pIn->IsPreroll() != S_OK) + { + length = xvid_decore_func(m_create.handle, XVID_DEC_DECODE, &m_frame, &stats); + + if (length == XVID_ERR_MEMORY) + return E_FAIL; + else if (length < 0) + { + DPRINTF("*** XVID_DEC_DECODE"); + return S_FALSE; + } else + if (g_config.aspect_ratio == 0 || g_config.aspect_ratio == 1 && forced_ar == false) { + + if (stats.type != XVID_TYPE_NOTHING) { /* dont attempt to set vmr aspect ratio if no frame was returned by decoder */ + // inspired by minolta! works for VMR 7 + 9 + IMediaSample2 *pOut2 = NULL; + AM_SAMPLE2_PROPERTIES outProp2; + if (SUCCEEDED(pOut->QueryInterface(IID_IMediaSample2, (void **)&pOut2)) && + SUCCEEDED(pOut2->GetProperties(FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, tStart), (PBYTE)&outProp2))) + { + CMediaType mtOut2 = m_pOutput->CurrentMediaType(); + VIDEOINFOHEADER2* vihOut2 = (VIDEOINFOHEADER2*)mtOut2.Format(); + + if (*mtOut2.FormatType() == FORMAT_VideoInfo2 && + vihOut2->dwPictAspectRatioX != ar_x && vihOut2->dwPictAspectRatioY != ar_y) + { + vihOut2->dwPictAspectRatioX = ar_x; + vihOut2->dwPictAspectRatioY = ar_y; + pOut2->SetMediaType(&mtOut2); + m_pOutput->SetMediaType(&mtOut2); + } + pOut2->Release(); + } + } + } + } + else + { /* Preroll frame - won't be displayed */ + int tmp = m_frame.output.csp; + int tmp_gen = m_frame.general; + + m_frame.output.csp = XVID_CSP_NULL; + + /* Disable postprocessing to speed-up seeking */ + m_frame.general &= ~XVID_DEBLOCKY; + m_frame.general &= ~XVID_DEBLOCKUV; + /*m_frame.general &= ~XVID_DERING;*/ + m_frame.general &= ~XVID_FILMEFFECT; + + length = xvid_decore_func(m_create.handle, XVID_DEC_DECODE, &m_frame, &stats); + if (length == XVID_ERR_MEMORY) + return E_FAIL; + else if (length < 0) + { + DPRINTF("*** XVID_DEC_DECODE"); + return S_FALSE; + } + + m_frame.output.csp = tmp; + m_frame.general = tmp_gen; + } + + if (stats.type == XVID_TYPE_NOTHING && length > 0) { + DPRINTF(" B-Frame decoder lag"); + return S_FALSE; + } + + + if (stats.type == XVID_TYPE_VOL) + { + if (stats.data.vol.width != m_create.width || + stats.data.vol.height != m_create.height) + { + DPRINTF("TODO: auto-resize"); + return S_FALSE; + } + + pOut->SetSyncPoint(TRUE); + + if (g_config.aspect_ratio == 0 || g_config.aspect_ratio == 1) { /* auto */ + int par_x, par_y; + if (stats.data.vol.par == XVID_PAR_EXT) { + par_x = stats.data.vol.par_width; + par_y = stats.data.vol.par_height; + } else { + par_x = PARSstats.data.vol.par-10; + par_y = PARSstats.data.vol.par-11; + } + + ar_x = par_x * stats.data.vol.width; + ar_y = par_y * stats.data.vol.height; + } + + m_frame.bitstream = (BYTE*)m_frame.bitstream + length; + m_frame.length -= length; + goto repeat; + } + + if (pIn->IsPreroll() == S_OK) { + return S_FALSE; + } + + return S_OK; +} + + +/* get property page list */ + +STDMETHODIMP CXvidDecoder::GetPages(CAUUID * pPages) +{ + DPRINTF("GetPages"); + + pPages->cElems = 1; + pPages->pElems = (GUID *)CoTaskMemAlloc(pPages->cElems * sizeof(GUID)); + if (pPages->pElems == NULL) + { + return E_OUTOFMEMORY; + } + pPages->pElems0 = CLSID_CABOUT; + + return S_OK; +} + + +/* cleanup pages */ + +STDMETHODIMP CXvidDecoder::FreePages(CAUUID * pPages) +{ + DPRINTF("FreePages"); + CoTaskMemFree(pPages->pElems); + return S_OK; +} + +/*=============================================================================== +// MFT Interface +//=============================================================================*/ +#if defined(XVID_USE_MFT) +#include <limits.h> // _I64_MAX +#define INVALID_TIME _I64_MAX + +HRESULT CXvidDecoder::MFTGetStreamLimits(DWORD *pdwInputMinimum, DWORD *pdwInputMaximum, DWORD *pdwOutputMinimum, DWORD *pdwOutputMaximum) +{ + DPRINTF("(MFT)GetStreamLimits"); + + if ((pdwInputMinimum == NULL) || (pdwInputMaximum == NULL) || (pdwOutputMinimum == NULL) || (pdwOutputMaximum == NULL)) + return E_POINTER; + + /* Just a fixed number of streams allowed */ + *pdwInputMinimum = *pdwInputMaximum = 1; + *pdwOutputMinimum = *pdwOutputMaximum = 1; + + return S_OK; +} + +HRESULT CXvidDecoder::MFTGetStreamCount(DWORD *pcInputStreams, DWORD *pcOutputStreams) +{ + DPRINTF("(MFT)GetStreamCount"); + + if ((pcInputStreams == NULL) || (pcOutputStreams == NULL)) + return E_POINTER; + + /* We have a fixed number of streams */ + *pcInputStreams = 1; + *pcOutputStreams = 1; + + return S_OK; +} + +HRESULT CXvidDecoder::MFTGetStreamIDs(DWORD dwInputIDArraySize, DWORD *pdwInputIDs, DWORD dwOutputIDArraySize, DWORD *pdwOutputIDs) +{ + DPRINTF("(MFT)GetStreamIDs"); + return E_NOTIMPL; /* We have fixed number of streams, so stream ID match stream index */ +} + +HRESULT CXvidDecoder::MFTGetInputStreamInfo(DWORD dwInputStreamID, MFT_INPUT_STREAM_INFO *pStreamInfo) +{ + DPRINTF("(MFT)GetInputStreamInfo"); + + if (pStreamInfo == NULL) + return E_POINTER; + + if (dwInputStreamID != 0) + return MF_E_INVALIDSTREAMNUMBER; + + EnterCriticalSection(&m_mft_lock); + + pStreamInfo->dwFlags = MFT_INPUT_STREAM_WHOLE_SAMPLES | MFT_INPUT_STREAM_SINGLE_SAMPLE_PER_BUFFER; + pStreamInfo->hnsMaxLatency = 0; + + pStreamInfo->cbSize = 1; /* Need atleast 1 byte input */ + pStreamInfo->cbMaxLookahead = 0; + pStreamInfo->cbAlignment = 1; + + LeaveCriticalSection(&m_mft_lock); + return S_OK; +} + +HRESULT CXvidDecoder::MFTGetOutputStreamInfo(DWORD dwOutputStreamID, MFT_OUTPUT_STREAM_INFO *pStreamInfo) +{ + DPRINTF("(MFT)GetOutputStreamInfo"); + + if (pStreamInfo == NULL) + return E_POINTER; + + if (dwOutputStreamID != 0) + return MF_E_INVALIDSTREAMNUMBER; + + EnterCriticalSection(&m_mft_lock); + + pStreamInfo->dwFlags = MFT_OUTPUT_STREAM_WHOLE_SAMPLES | MFT_OUTPUT_STREAM_SINGLE_SAMPLE_PER_BUFFER | MFT_OUTPUT_STREAM_FIXED_SAMPLE_SIZE | MFT_OUTPUT_STREAM_DISCARDABLE; + + if (m_pOutputType == NULL) { + pStreamInfo->cbSize = 0; + pStreamInfo->cbAlignment = 0; + } + else { + pStreamInfo->cbSize = m_create.width * abs(m_create.height) * 4; // XXX + pStreamInfo->cbAlignment = 1; + } + + LeaveCriticalSection(&m_mft_lock); + return S_OK; +} + +HRESULT CXvidDecoder::GetAttributes(IMFAttributes** pAttributes) +{ + DPRINTF("(MFT)GetAttributes"); + return E_NOTIMPL; /* We don't support any attributes */ +} + +HRESULT CXvidDecoder::GetInputStreamAttributes(DWORD dwInputStreamID, IMFAttributes **ppAttributes) +{ + DPRINTF("(MFT)GetInputStreamAttributes"); + return E_NOTIMPL; /* We don't support any attributes */ +} + +HRESULT CXvidDecoder::GetOutputStreamAttributes(DWORD dwOutputStreamID, IMFAttributes **ppAttributes) +{ + DPRINTF("(MFT)GetOutputStreamAttributes"); + return E_NOTIMPL; /* We don't support any attributes */ +} + +HRESULT CXvidDecoder::MFTDeleteInputStream(DWORD dwStreamID) +{ + DPRINTF("(MFT)DeleteInputStream"); + return E_NOTIMPL; /* We have a fixed number of streams */ +} + +HRESULT CXvidDecoder::MFTAddInputStreams(DWORD cStreams, DWORD *adwStreamIDs) +{ + DPRINTF("(MFT)AddInputStreams"); + return E_NOTIMPL; /* We have a fixed number of streams */ +} + +HRESULT CXvidDecoder::MFTGetInputAvailableType(DWORD dwInputStreamID, DWORD dwTypeIndex, IMFMediaType **ppType) +{ + DPRINTF("(MFT)GetInputAvailableType"); + + if (dwInputStreamID != 0) + return MF_E_INVALIDSTREAMNUMBER; + + DWORD i = 0; + GUID *bs_guid_table8; + + bs_guid_tablei++ = (GUID *)&CLSID_XVID; + bs_guid_tablei++ = (GUID *)&CLSID_XVID_UC; + + if (g_config.supported_4cc & SUPPORT_3IVX) { + bs_guid_tablei++ = (GUID *)&CLSID_3IVX; + bs_guid_tablei++ = (GUID *)&CLSID_3IVX_UC; + bs_guid_tablei++ = (GUID *)&CLSID_3IV0; + bs_guid_tablei++ = (GUID *)&CLSID_3IV0_UC; + bs_guid_tablei++ = (GUID *)&CLSID_3IV1; + bs_guid_tablei++ = (GUID *)&CLSID_3IV1_UC; + bs_guid_tablei++ = (GUID *)&CLSID_3IV2; + bs_guid_tablei++ = (GUID *)&CLSID_3IV2_UC; + } + if (g_config.supported_4cc & SUPPORT_DIVX) { + bs_guid_tablei++ = (GUID *)&CLSID_DIVX; + bs_guid_tablei++ = (GUID *)&CLSID_DIVX_UC; + bs_guid_tablei++ = (GUID *)&CLSID_DX50; + bs_guid_tablei++ = (GUID *)&CLSID_DX50_UC; + } + if (g_config.supported_4cc & SUPPORT_MP4V) { + bs_guid_tablei++ = (GUID *)&CLSID_MP4V; + bs_guid_tablei++ = (GUID *)&CLSID_MP4V_UC; + bs_guid_tablei++ = (GUID *)&CLSID_LMP4; + bs_guid_tablei++ = (GUID *)&CLSID_LMP4_UC; + bs_guid_tablei++ = (GUID *)&CLSID_RMP4; + bs_guid_tablei++ = (GUID *)&CLSID_RMP4_UC; + bs_guid_tablei++ = (GUID *)&CLSID_SMP4; + bs_guid_tablei++ = (GUID *)&CLSID_SMP4_UC; + bs_guid_tablei++ = (GUID *)&CLSID_HDX4; + bs_guid_tablei++ = (GUID *)&CLSID_HDX4_UC; + } + + const GUID *subtype; + if (dwTypeIndex < i) { + subtype = bs_guid_tabledwTypeIndex; + } + else { + return MF_E_NO_MORE_TYPES; + } + + EnterCriticalSection(&m_mft_lock); + + HRESULT hr = S_OK; + + if (ppType) { + IMFMediaType *pInputType = NULL; + hr = MFCreateMediaType(&pInputType); + + if (SUCCEEDED(hr)) + hr = pInputType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video); + + if (SUCCEEDED(hr)) + hr = pInputType->SetGUID(MF_MT_SUBTYPE, *subtype); + + if (SUCCEEDED(hr)) { + *ppType = pInputType; + (*ppType)->AddRef(); + } + if (pInputType) pInputType->Release(); + } + + LeaveCriticalSection(&m_mft_lock); + + return hr; +} + +HRESULT CXvidDecoder::MFTGetOutputAvailableType(DWORD dwOutputStreamID, DWORD dwTypeIndex, IMFMediaType **ppType) +{ + DPRINTF("(MFT)GetOutputAvailableType"); + + if (ppType == NULL) + return E_INVALIDARG; + + if (dwOutputStreamID != 0) + return MF_E_INVALIDSTREAMNUMBER; + + if (dwTypeIndex < 0) return E_INVALIDARG; + + GUID csp; + int bitdepth = 8; + switch(dwTypeIndex) + { + case 0: +if ( USE_YUY2 ) +{ + csp = MFVideoFormat_YUY2; + bitdepth = 4; + break; +} + case 1 : +if ( USE_UYVY ) +{ + csp = MFVideoFormat_UYVY; + bitdepth = 4; + break; +} + case 2 : + if ( USE_IYUV ) +{ + csp = MFVideoFormat_IYUV; + bitdepth = 3; + break; +} + case 3 : +if ( USE_YV12 ) +{ + csp = MFVideoFormat_YV12; + bitdepth = 3; + break; +} + case 4 : +if ( USE_RGB32 ) +{ + csp = MFVideoFormat_RGB32; + bitdepth = 8; + break; +} + case 5 : +if ( USE_RGB24 ) +{ + csp = MFVideoFormat_RGB24; + bitdepth = 6; + break; +} + case 6 : +if ( USE_RG555 ) +{ + csp = MFVideoFormat_RGB555; + bitdepth = 4; + break; +} + case 7 : +if ( USE_RG565 ) +{ + csp = MFVideoFormat_RGB565; + bitdepth = 4; + break; +} + default : + return MF_E_NO_MORE_TYPES; + } + + if (m_pInputType == NULL) + return MF_E_TRANSFORM_TYPE_NOT_SET; + + EnterCriticalSection(&m_mft_lock); + + HRESULT hr = S_OK; + + IMFMediaType *pOutputType = NULL; + hr = MFCreateMediaType(&pOutputType); + + if (SUCCEEDED(hr)) { + hr = pOutputType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video); + } + + if (SUCCEEDED(hr)) { + hr = pOutputType->SetGUID(MF_MT_SUBTYPE, csp); + } + + if (SUCCEEDED(hr)) { + hr = pOutputType->SetUINT32(MF_MT_FIXED_SIZE_SAMPLES, TRUE); + } + + if (SUCCEEDED(hr)) { + hr = pOutputType->SetUINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, TRUE); + } + + if (SUCCEEDED(hr)) { + hr = pOutputType->SetUINT32(MF_MT_SAMPLE_SIZE, (m_create.height * m_create.width * bitdepth)>>1); + } + + if (SUCCEEDED(hr)) { + hr = MFSetAttributeSize(pOutputType, MF_MT_FRAME_SIZE, m_create.width, m_create.height); + } + + if (SUCCEEDED(hr)) { + hr = MFSetAttributeRatio(pOutputType, MF_MT_FRAME_RATE, m_frameRate.Numerator, m_frameRate.Denominator); + } + + if (SUCCEEDED(hr)) { + hr = pOutputType->SetUINT32(MF_MT_INTERLACE_MODE, MFVideoInterlace_Progressive); + } + + if (SUCCEEDED(hr)) { + hr = MFSetAttributeRatio(pOutputType, MF_MT_PIXEL_ASPECT_RATIO, ar_x, ar_y); + } + + if (SUCCEEDED(hr)) { + *ppType = pOutputType; + (*ppType)->AddRef(); + } + + if (pOutputType) pOutputType->Release(); + + LeaveCriticalSection(&m_mft_lock); + return hr; +} + +HRESULT CXvidDecoder::MFTSetInputType(DWORD dwInputStreamID, IMFMediaType *pType, DWORD dwFlags) +{ + DPRINTF("(MFT)SetInputType"); + + if (dwInputStreamID != 0) + return MF_E_INVALIDSTREAMNUMBER; + + if (dwFlags & ~MFT_SET_TYPE_TEST_ONLY) + return E_INVALIDARG; + + EnterCriticalSection(&m_mft_lock); + + HRESULT hr = S_OK; + + /* Actually set the type or just test it? */ + BOOL bReallySet = ((dwFlags & MFT_SET_TYPE_TEST_ONLY) == 0); + + /* If we have samples pending the type can't be changed right now */ + if (HasPendingOutput()) + hr = MF_E_TRANSFORM_CANNOT_CHANGE_MEDIATYPE_WHILE_PROCESSING; + + if (SUCCEEDED(hr)) { + if (pType) { // /* Check the type */ + hr = OnCheckInputType(pType); + } + } + + if (SUCCEEDED(hr)) { + if (bReallySet) { /* Set the type if needed */ + hr = OnSetInputType(pType); + } + } + + LeaveCriticalSection(&m_mft_lock); + return hr; +} + +HRESULT CXvidDecoder::MFTSetOutputType(DWORD dwOutputStreamID, IMFMediaType *pType, DWORD dwFlags) +{ + DPRINTF("(MFT)SetOutputType"); + + if (dwOutputStreamID != 0) + return MF_E_INVALIDSTREAMNUMBER; + + if (dwFlags & ~MFT_SET_TYPE_TEST_ONLY) + return E_INVALIDARG; + + HRESULT hr = S_OK; + + EnterCriticalSection(&m_mft_lock); + + /* Actually set the type or just test it? */ + BOOL bReallySet = ((dwFlags & MFT_SET_TYPE_TEST_ONLY) == 0); + + /* If we have samples pending the type can't be changed right now */ + if (HasPendingOutput()) + hr = MF_E_TRANSFORM_CANNOT_CHANGE_MEDIATYPE_WHILE_PROCESSING; + + if (SUCCEEDED(hr)) { + if (pType) { /* Check the type */ + AM_MEDIA_TYPE *am; + hr = MFCreateAMMediaTypeFromMFMediaType(pType, GUID_NULL, &am); + + if (SUCCEEDED(hr)) { + if (FAILED(ChangeColorspace(am->subtype, am->formattype, am->pbFormat, 1))) { + DPRINTF("(MFT)InternalCheckOutputType (MF_E_INVALIDTYPE)"); + return MF_E_INVALIDTYPE; + } + + CoTaskMemFree(am->pbFormat); + CoTaskMemFree(am); + } + } + } + + if (SUCCEEDED(hr)) { + if (bReallySet) { /* Set the type if needed */ + hr = OnSetOutputType(pType); + } + } + + if (SUCCEEDED(hr) && (Tray_Icon == 0) && (g_config.bTrayIcon != 0)) /* Create message passing window */ + { + WNDCLASSEX wc; + + wc.cbSize = sizeof(WNDCLASSEX); + wc.lpfnWndProc = msg_proc; + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.cbWndExtra = 0; + wc.cbClsExtra = 0; + wc.hInstance = (HINSTANCE) g_xvid_hInst; + wc.hbrBackground = (HBRUSH) GetStockObject(NULL_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName = "XVID_MSG_WINDOW"; + wc.hIcon = NULL; + wc.hIconSm = NULL; + wc.hCursor = NULL; + RegisterClassEx(&wc); + + MSG_hwnd = CreateWindowEx(0, "XVID_MSG_WINDOW", NULL, 0, CW_USEDEFAULT, + CW_USEDEFAULT, 0, 0, HWND_MESSAGE, NULL, (HINSTANCE) g_xvid_hInst, NULL); + + /* display the tray icon */ + NOTIFYICONDATA nid; + ZeroMemory(&nid,sizeof(NOTIFYICONDATA)); + + nid.cbSize = NOTIFYICONDATA_V1_SIZE; + nid.hWnd = MSG_hwnd; + nid.uID = 1456; + nid.uCallbackMessage = WM_ICONMESSAGE; + nid.hIcon = LoadIcon(g_xvid_hInst, MAKEINTRESOURCE(IDI_ICON)); + strcpy_s(nid.szTip, 19, "Xvid Video Decoder"); + nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; + + Shell_NotifyIcon(NIM_ADD, &nid); + + DestroyIcon(nid.hIcon); + Tray_Icon = 1; + } + + LeaveCriticalSection(&m_mft_lock); + return hr; +} + +HRESULT CXvidDecoder::MFTGetInputCurrentType(DWORD dwInputStreamID, IMFMediaType **ppType) +{ + DPRINTF("(MFT)GetInputCurrentType"); + + if (ppType == NULL) + return E_POINTER; + + if (dwInputStreamID != 0) + return MF_E_INVALIDSTREAMNUMBER; + + EnterCriticalSection(&m_mft_lock); + + HRESULT hr = S_OK; + + if (!m_pInputType) + hr = MF_E_TRANSFORM_TYPE_NOT_SET; + + if (SUCCEEDED(hr)) { + *ppType = m_pInputType; + (*ppType)->AddRef(); + } + + LeaveCriticalSection(&m_mft_lock); + return hr; +} + +HRESULT CXvidDecoder::MFTGetOutputCurrentType(DWORD dwOutputStreamID, IMFMediaType **ppType) +{ + DPRINTF("(MFT)GetOutputCurrentType"); + + if (ppType == NULL) + return E_POINTER; + + if (dwOutputStreamID != 0) + return MF_E_INVALIDSTREAMNUMBER; + + EnterCriticalSection(&m_mft_lock); + + HRESULT hr = S_OK; + + if (!m_pOutputType) + hr = MF_E_TRANSFORM_TYPE_NOT_SET; + + if (SUCCEEDED(hr)) { + *ppType = m_pOutputType; + (*ppType)->AddRef(); + } + + LeaveCriticalSection(&m_mft_lock); + return hr; +} + +HRESULT CXvidDecoder::MFTGetInputStatus(DWORD dwInputStreamID, DWORD *pdwFlags) +{ + DPRINTF("(MFT)GetInputStatus"); + + if (pdwFlags == NULL) + return E_POINTER; + + if (dwInputStreamID != 0) + return MF_E_INVALIDSTREAMNUMBER; + + EnterCriticalSection(&m_mft_lock); + + /* If there's pending output sampels we don't accept new + input data until ProcessOutput() or Flush() was called */ + if (!HasPendingOutput()) { + *pdwFlags = MFT_INPUT_STATUS_ACCEPT_DATA; + } + else { + *pdwFlags = 0; + } + + LeaveCriticalSection(&m_mft_lock); + + return S_OK; +} + +HRESULT CXvidDecoder::MFTGetOutputStatus(DWORD *pdwFlags) +{ + DPRINTF("(MFT)GetOutputStatus"); + + if (pdwFlags == NULL) + return E_POINTER; + + EnterCriticalSection(&m_mft_lock); + + /* We can render an output sample only after we + have decoded one */ + if (HasPendingOutput()) { + *pdwFlags = MFT_OUTPUT_STATUS_SAMPLE_READY; + } + else { + *pdwFlags = 0; + } + + LeaveCriticalSection(&m_mft_lock); + + return S_OK; +} + +HRESULT CXvidDecoder::MFTSetOutputBounds(LONGLONG hnsLowerBound, LONGLONG hnsUpperBound) +{ + DPRINTF("(MFT)SetOutputBounds"); + return E_NOTIMPL; +} + +HRESULT CXvidDecoder::MFTProcessEvent(DWORD dwInputStreamID, IMFMediaEvent *pEvent) +{ + DPRINTF("(MFT)ProcessEvent"); + return E_NOTIMPL; /* We don't handle any stream events */ +} + +HRESULT CXvidDecoder::MFTProcessMessage(MFT_MESSAGE_TYPE eMessage, ULONG_PTR ulParam) +{ + DPRINTF("(MFT)ProcessMessage"); + HRESULT hr = S_OK; + + EnterCriticalSection(&m_mft_lock); + + switch (eMessage) + { + case MFT_MESSAGE_COMMAND_FLUSH: + if (m_create.handle != NULL) { + DPRINTF("(MFT)CommandFlush"); + + xvid_dec_stats_t stats; + int used_bytes; + + memset(&stats, 0, sizeof(stats)); + stats.version = XVID_VERSION; + + int csp = m_frame.output.csp; + + m_frame.output.csp = XVID_CSP_INTERNAL; + m_frame.bitstream = NULL; + m_frame.length = -1; + m_frame.general = XVID_LOWDELAY; + + do { + used_bytes = xvid_decore_func(m_create.handle, XVID_DEC_DECODE, &m_frame, &stats); + } while(used_bytes>=0 && stats.type <= 0); + + m_frame.output.csp = csp; + m_frame.output.plane1 = NULL; /* Don't display flushed samples */ + + //m_timestamp = INVALID_TIME; + //m_timelength = INVALID_TIME; + //m_rtFrame = 0; + } + break; + + case MFT_MESSAGE_COMMAND_DRAIN: + m_discont = 1; /* Set discontinuity flag */ + m_rtFrame = 0; + break; + + case MFT_MESSAGE_SET_D3D_MANAGER: + hr = E_NOTIMPL; + break; + + case MFT_MESSAGE_NOTIFY_BEGIN_STREAMING: + case MFT_MESSAGE_NOTIFY_END_STREAMING: + break; + + case MFT_MESSAGE_NOTIFY_START_OF_STREAM: + case MFT_MESSAGE_NOTIFY_END_OF_STREAM: + break; + } + + LeaveCriticalSection(&m_mft_lock); + + return hr; +} + +HRESULT CXvidDecoder::MFTProcessInput(DWORD dwInputStreamID, IMFSample *pSample, DWORD dwFlags) +{ + DPRINTF("(MFT)ProcessInput"); + + if (pSample == NULL) + return E_POINTER; + + if (dwInputStreamID != 0) + return MF_E_INVALIDSTREAMNUMBER; + + if (dwFlags != 0) + return E_INVALIDARG; + + if (!m_pInputType || !m_pOutputType) { + return MF_E_NOTACCEPTING; /* Must have set input and output types */ + } + else if (HasPendingOutput()) { + return MF_E_NOTACCEPTING; /* We still have output samples to render */ + } + + xvid_dec_stats_t stats; + int length; + + memset(&stats, 0, sizeof(stats)); + stats.version = XVID_VERSION; + + if (m_create.handle == NULL) + { + if (xvid_decore_func == NULL) + return E_FAIL; + if (xvid_decore_func(0, XVID_DEC_CREATE, &m_create, 0) < 0) + { + DPRINTF("*** XVID_DEC_CREATE error"); + return E_FAIL; + } + } + + EnterCriticalSection(&m_mft_lock); + + HRESULT hr = S_OK; + IMFMediaBuffer *pBuffer; + + if (SUCCEEDED(hr)) { + hr = pSample->ConvertToContiguousBuffer(&pBuffer); + } + + if (SUCCEEDED(hr)) { + hr = pBuffer->Lock((BYTE**)&m_frame.bitstream, NULL, (DWORD *)&m_frame.length); + } + + m_frame.general = XVID_LOWDELAY; + + if (m_discont == 1) { + m_frame.general |= XVID_DISCONTINUITY; + m_discont = 0; + } + + if (g_config.nDeblock_Y) + m_frame.general |= XVID_DEBLOCKY; + + if (g_config.nDeblock_UV) + m_frame.general |= XVID_DEBLOCKUV; + + if (g_config.nDering_Y) + m_frame.general |= XVID_DERINGY; + + if (g_config.nDering_UV) + m_frame.general |= XVID_DERINGUV; + + if (g_config.nFilmEffect) + m_frame.general |= XVID_FILMEFFECT; + + m_frame.brightness = g_config.nBrightness; + + m_frame.output.csp &= ~XVID_CSP_VFLIP; + m_frame.output.csp |= rgb_flip^(g_config.nFlipVideo ? XVID_CSP_VFLIP : 0); + + int csp = m_frame.output.csp; + m_frame.output.csp = XVID_CSP_INTERNAL; + + // Paranoid check. + if (xvid_decore_func == NULL) { + hr = E_FAIL; + goto END_LOOP; + } + +repeat : + length = xvid_decore_func(m_create.handle, XVID_DEC_DECODE, &m_frame, &stats); + + if (length == XVID_ERR_MEMORY) { + hr = E_FAIL; + goto END_LOOP; + } + else if (length < 0) + { + DPRINTF("*** XVID_DEC_DECODE"); + goto END_LOOP; + } + + if (stats.type == XVID_TYPE_NOTHING && length > 0) { + DPRINTF(" B-Frame decoder lag"); + m_frame.output.plane1 = NULL; + goto END_LOOP; + } + + if (stats.type == XVID_TYPE_VOL) + { + if (stats.data.vol.width != m_create.width || + stats.data.vol.height != m_create.height) + { + DPRINTF("TODO: auto-resize"); + m_frame.output.plane1 = NULL; + hr = E_FAIL; + } + + if (g_config.aspect_ratio == 0 || g_config.aspect_ratio == 1) { /* auto */ + int par_x, par_y; + if (stats.data.vol.par == XVID_PAR_EXT) { + par_x = stats.data.vol.par_width; + par_y = stats.data.vol.par_height; + } else { + par_x = PARSstats.data.vol.par-10; + par_y = PARSstats.data.vol.par-11; + } + + ar_x = par_x * stats.data.vol.width; + ar_y = par_y * stats.data.vol.height; + } + + m_frame.bitstream = (BYTE*)m_frame.bitstream + length; + m_frame.length -= length; + goto repeat; + } + +END_LOOP: + m_frame.output.csp = csp; + + if (pBuffer) { + pBuffer->Unlock(); + pBuffer->Release(); + } + + if (SUCCEEDED(hr)) { + /* Try to get a timestamp */ + if (FAILED(pSample->GetSampleTime(&m_timestamp))) + m_timestamp = INVALID_TIME; + + if (FAILED(pSample->GetSampleDuration(&m_timelength))) { + m_timelength = INVALID_TIME; + } + if (m_timestamp != INVALID_TIME && stats.type == XVID_TYPE_IVOP) { + m_rtFrame = m_timestamp; + } + } + + LeaveCriticalSection(&m_mft_lock); + + return hr; +} + +HRESULT CXvidDecoder::MFTProcessOutput(DWORD dwFlags, DWORD cOutputBufferCount, MFT_OUTPUT_DATA_BUFFER *pOutputSamples, DWORD *pdwStatus) +{ + DPRINTF("(MFT)ProcessOutput"); + + /* Preroll in MFT ?? + Flags ?? -> TODO... */ + if (dwFlags != 0) + return E_INVALIDARG; + + if (pOutputSamples == NULL || pdwStatus == NULL) + return E_POINTER; + + if (cOutputBufferCount != 1) /* Must be exactly one output buffer */ + return E_INVALIDARG; + + if (pOutputSamples0.pSample == NULL) /* Must have a sample */ + return E_INVALIDARG; + + if (!HasPendingOutput()) { /* If there's no sample we need to decode one first */ + return MF_E_TRANSFORM_NEED_MORE_INPUT; + } + + EnterCriticalSection(&m_mft_lock); + + HRESULT hr = S_OK; + + BYTE *Dst = NULL; + DWORD buffer_size; + + IMFMediaBuffer *pOutput = NULL; + + if (SUCCEEDED(hr)) { + hr = pOutputSamples0.pSample->GetBufferByIndex(0, &pOutput); /* Get output buffer */ + } + + if (SUCCEEDED(hr)) { + hr = pOutput->GetMaxLength(&buffer_size); + } + + if (SUCCEEDED(hr)) + hr = pOutput->Lock(&Dst, NULL, NULL); + + if (SUCCEEDED(hr)) { + xvid_gbl_convert_t convert; + + memset(&convert, 0, sizeof(convert)); + convert.version = XVID_VERSION; + + convert.input.csp = XVID_CSP_INTERNAL; + convert.input.plane0 = m_frame.output.plane0; + convert.input.plane1 = m_frame.output.plane1; + convert.input.plane2 = m_frame.output.plane2; + convert.input.stride0 = m_frame.output.stride0; + convert.input.stride1 = m_frame.output.stride1; + convert.input.stride2 = m_frame.output.stride2; + + convert.output.csp = m_frame.output.csp; + convert.output.plane0 = Dst; + convert.output.stride0 = out_stride; + + convert.width = m_create.width; + convert.height = m_create.height; + convert.interlacing = 0; + + if (m_frame.output.plane1 != NULL && Dst != NULL && xvid_global_func != NULL) + if (xvid_global_func(0, XVID_GBL_CONVERT, &convert, NULL) < 0) /* CSP convert into output buffer */ + hr = E_FAIL; + + m_frame.output.plane1 = NULL; + } + + *pdwStatus = 0; + + if (SUCCEEDED(hr)) { + if (SUCCEEDED(hr)) + hr = pOutputSamples0.pSample->SetUINT32(MFSampleExtension_CleanPoint, TRUE); // key frame + + if (SUCCEEDED(hr)) { /* Set timestamp of output sample */ + if (m_timestamp != INVALID_TIME) + hr = pOutputSamples0.pSample->SetSampleTime(m_timestamp); + else + hr = pOutputSamples0.pSample->SetSampleTime(m_rtFrame); + + if (m_timelength != INVALID_TIME) + hr = pOutputSamples0.pSample->SetSampleDuration(m_timelength); + else + hr = pOutputSamples0.pSample->SetSampleDuration(m_duration); + + m_rtFrame += m_duration; + } + + if (SUCCEEDED(hr)) + hr = pOutput->SetCurrentLength(m_create.width * abs(m_create.height) * 4); // XXX + } + + if (pOutput) { + pOutput->Unlock(); + pOutput->Release(); + } + + LeaveCriticalSection(&m_mft_lock); + + return hr; +} + +HRESULT CXvidDecoder::OnCheckInputType(IMFMediaType *pmt) +{ + DPRINTF("(MFT)CheckInputType"); + + HRESULT hr = S_OK; + + /* Check if input type is already set. Reject any type that is not identical */ + if (m_pInputType) { + DWORD dwFlags = 0; + if (S_OK == m_pInputType->IsEqual(pmt, &dwFlags)) { + return S_OK; + } + else { + return MF_E_INVALIDTYPE; + } + } + + GUID majortype = {0}, subtype = {0}; + UINT32 width = 0, height = 0; + + hr = pmt->GetMajorType(&majortype); + + if (SUCCEEDED(hr)) { + if (majortype != MFMediaType_Video) { /* Must be Video */ + hr = MF_E_INVALIDTYPE; + } + } + + if (m_hdll == NULL) { + HRESULT hr = OpenLib(); + + if (FAILED(hr) || (m_hdll == NULL)) // Paranoid checks. + hr = MF_E_INVALIDTYPE; + } + + if (SUCCEEDED(hr)) { + hr = MFGetAttributeSize(pmt, MF_MT_FRAME_SIZE, &width, &height); + } + + /* Check the frame size */ + if (SUCCEEDED(hr)) { + if (width > 4096 || height > 4096) { + hr = MF_E_INVALIDTYPE; + } + } + m_create.width = width; + m_create.height = height; + + if (SUCCEEDED(hr)) { + if (g_config.aspect_ratio == 0 || g_config.aspect_ratio == 1) { + hr = MFGetAttributeRatio(pmt, MF_MT_PIXEL_ASPECT_RATIO, (UINT32*)&ar_x, (UINT32*)&ar_y); + } + } + + /* TODO1: Make sure there really is a frame rate after all! + TODO2: Use the framerate for something! */ + MFRatio fps = {0}; + if (SUCCEEDED(hr)) { + hr = MFGetAttributeRatio(pmt, MF_MT_FRAME_RATE, (UINT32*)&fps.Numerator, (UINT32*)&fps.Denominator); + } + + if (SUCCEEDED(hr)) { + hr = pmt->GetGUID(MF_MT_SUBTYPE, &subtype); + } + + if (subtype == CLSID_MP4V || subtype == CLSID_MP4V_UC || + subtype == CLSID_LMP4 || subtype == CLSID_LMP4_UC || + subtype == CLSID_RMP4 || subtype == CLSID_RMP4_UC || + subtype == CLSID_SMP4 || subtype == CLSID_SMP4_UC || + subtype == CLSID_HDX4 || subtype == CLSID_HDX4_UC) { + if (!(g_config.supported_4cc & SUPPORT_MP4V)) { + CloseLib(); + hr = MF_E_INVALIDTYPE; + } + else m_create.fourcc = FOURCC_MP4V; + } + else if (subtype == CLSID_DIVX || subtype == CLSID_DIVX_UC) { + if (!(g_config.supported_4cc & SUPPORT_DIVX)) { + CloseLib(); + hr = MF_E_INVALIDTYPE; + } + else m_create.fourcc = FOURCC_DIVX; + } + else if (subtype == CLSID_DX50 || subtype == CLSID_DX50_UC) { + if (!(g_config.supported_4cc & SUPPORT_DIVX)) { + CloseLib(); + hr = MF_E_INVALIDTYPE; + } + else m_create.fourcc = FOURCC_DX50; + } + else if (subtype == CLSID_3IVX || subtype == CLSID_3IVX_UC || + subtype == CLSID_3IV0 || subtype == CLSID_3IV0_UC || + subtype == CLSID_3IV1 || subtype == CLSID_3IV1_UC || + subtype == CLSID_3IV2 || subtype == CLSID_3IV2_UC) { + if (!(g_config.supported_4cc & SUPPORT_3IVX)) { + CloseLib(); + hr = MF_E_INVALIDTYPE; + } + else m_create.fourcc = FOURCC_3IVX; + } + else if (subtype == CLSID_XVID || subtype == CLSID_XVID_UC) { + m_create.fourcc = FOURCC_XVID; + } + else { + DPRINTF("Unknown subtype!"); + CloseLib(); + hr = MF_E_INVALIDTYPE; + } + + /* haali media splitter reports VOL information in the format header */ + if (SUCCEEDED(hr)) + { + UINT32 cbSeqHeader = 0; + + (void)pmt->GetBlobSize(MF_MT_MPEG_SEQUENCE_HEADER, &cbSeqHeader); + + if (cbSeqHeader>0) { + xvid_dec_stats_t stats; + memset(&stats, 0, sizeof(stats)); + stats.version = XVID_VERSION; + + if (m_create.handle == NULL) { + if (xvid_decore_func == NULL) + hr = E_FAIL; + if (xvid_decore_func(0, XVID_DEC_CREATE, &m_create, 0) < 0) { + DPRINTF("*** XVID_DEC_CREATE error"); + hr = E_FAIL; + } + } + + if (SUCCEEDED(hr)) { + (void)pmt->GetAllocatedBlob(MF_MT_MPEG_SEQUENCE_HEADER, (UINT8 **)&m_frame.bitstream, (UINT32 *)&m_frame.length); + m_frame.general = 0; + m_frame.output.csp = XVID_CSP_NULL; + + int ret = 0; + if ((ret=xvid_decore_func(m_create.handle, XVID_DEC_DECODE, &m_frame, &stats)) >= 0) { + /* honour video dimensions reported in VOL header */ + if (stats.type == XVID_TYPE_VOL) { + m_create.width = stats.data.vol.width; + m_create.height = stats.data.vol.height; + } + } + + if (ret == XVID_ERR_MEMORY) hr = E_FAIL; + CoTaskMemFree(m_frame.bitstream); + } + } + } + + return hr; +} + +HRESULT CXvidDecoder::OnSetInputType(IMFMediaType *pmt) +{ + HRESULT hr = S_OK; + UINT32 w, h; + + if (m_pInputType) m_pInputType->Release(); + + hr = MFGetAttributeSize(pmt, MF_MT_FRAME_SIZE, &w, &h); + m_create.width = w; m_create.height = h; + + if (SUCCEEDED(hr)) + hr = MFGetAttributeRatio(pmt, MF_MT_FRAME_RATE, (UINT32*)&m_frameRate.Numerator, (UINT32*)&m_frameRate.Denominator); + + if (SUCCEEDED(hr)) { /* Store frame duration, derived from the frame rate */ + hr = MFFrameRateToAverageTimePerFrame(m_frameRate.Numerator, m_frameRate.Denominator, &m_duration); + } + + if (SUCCEEDED(hr)) { + m_pInputType = pmt; + m_pInputType->AddRef(); + } + + return hr; +} + +HRESULT CXvidDecoder::OnSetOutputType(IMFMediaType *pmt) +{ + if (m_pOutputType) m_pOutputType->Release(); + + m_pOutputType = pmt; + m_pOutputType->AddRef(); + + return S_OK; +} + +#endif /* XVID_USE_MFT */
View file
xvidcore-1.3.2.tar.bz2/dshow/src/CXvidDecoder.h -> xvidcore-1.3.3.tar.bz2/dshow/src/CXvidDecoder.h
Changed
@@ -3,7 +3,7 @@ * XVID MPEG-4 VIDEO CODEC * - XviD Decoder part of the DShow Filter - * - * Copyright(C) 2002-2010 Peter Ross <pross@xvid.org> + * Copyright(C) 2002-2012 Peter Ross <pross@xvid.org> * * 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 @@ -19,7 +19,7 @@ * along with this program ; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: CXvidDecoder.h 1985 2011-05-18 09:02:35Z Isibaar $ + * $Id: CXvidDecoder.h 2059 2012-02-22 19:00:26Z Isibaar $ * ****************************************************************************/ @@ -193,13 +193,9 @@ UINT64 m_duration; #endif -#ifdef XVID_USE_TRAYICON HWND MSG_hwnd; /* message handler window */ }; #define WM_ICONMESSAGE (WM_USER + 1) -#else -}; -#endif static const int PARS2 = { {1, 1},
View file
xvidcore-1.3.2.tar.bz2/dshow/src/config.c -> xvidcore-1.3.3.tar.bz2/dshow/src/config.c
Changed
@@ -1,283 +1,296 @@ -/***************************************************************************** - * - * XVID MPEG-4 VIDEO CODEC - * - Configuration processing - - * - * Copyright(C) 2002-2011 Peter Ross <pross@xvid.org> - * - * 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 - * - * $Id: config.c 1995 2011-05-18 16:13:23Z Isibaar $ - * - ****************************************************************************/ - -#include <windows.h> -#include <commctrl.h> -#include <xvid.h> -#include "config.h" -#include "debug.h" -#include "resource.h" - - -// ----------------------------------------- -// global config structure -CONFIG g_config; - - - -void LoadRegistryInfo() -{ - HKEY hKey; - DWORD size; - RegOpenKeyEx(XVID_REG_KEY, XVID_REG_SUBKEY, 0, KEY_READ, &hKey); - - // Set the default post-processing settings - REG_GET_N("Brightness", g_config.nBrightness, 0) - REG_GET_N("Deblock_Y", g_config.nDeblock_Y, 0) - REG_GET_N("Deblock_UV", g_config.nDeblock_UV, 0) - REG_GET_N("Dering_Y", g_config.nDering_Y, 0) - REG_GET_N("Dering_UV", g_config.nDering_UV, 0) - REG_GET_N("FilmEffect", g_config.nFilmEffect, 0) - REG_GET_N("ForceColorspace", g_config.nForceColorspace, 0) - REG_GET_N("FlipVideo", g_config.nFlipVideo, 0) - REG_GET_N("Supported_4CC", g_config.supported_4cc, 0) - REG_GET_N("Videoinfo_Compat", g_config.videoinfo_compat, 0) - REG_GET_N("Decoder_Aspect_Ratio", g_config.aspect_ratio, 0) - REG_GET_N("num_threads", g_config.num_threads, 0) - REG_GET_N("cpu_flags", g_config.cpu, 0) - - RegCloseKey(hKey); -} - -void SaveRegistryInfo() -{ - HKEY hKey; - DWORD dispo; - - if (RegCreateKeyEx( - XVID_REG_KEY, - XVID_REG_SUBKEY, - 0, - XVID_REG_CLASS, - REG_OPTION_NON_VOLATILE, - KEY_WRITE, - 0, - &hKey, - &dispo) != ERROR_SUCCESS) - { - OutputDebugString("Couldn't create XVID_REG_SUBKEY"); - return; - } - - REG_SET_N("Brightness", g_config.nBrightness); - REG_SET_N("Deblock_Y", g_config.nDeblock_Y); - REG_SET_N("Deblock_UV", g_config.nDeblock_UV); - REG_SET_N("Dering_Y", g_config.nDering_Y); - REG_SET_N("Dering_UV", g_config.nDering_UV); - REG_SET_N("FilmEffect", g_config.nFilmEffect); - REG_SET_N("ForceColorspace", g_config.nForceColorspace); - REG_SET_N("FlipVideo", g_config.nFlipVideo); - REG_SET_N("Supported_4CC", g_config.supported_4cc); - REG_SET_N("Videoinfo_Compat", g_config.videoinfo_compat); - REG_SET_N("Decoder_Aspect_Ratio", g_config.aspect_ratio); - REG_SET_N("num_threads", g_config.num_threads); - - RegCloseKey(hKey); -} - - - -INT_PTR CALLBACK adv_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - HWND hBrightness; - - switch ( uMsg ) - { - case WM_DESTROY: - { - LPARAM nForceColorspace; - LPARAM aspect_ratio; - - nForceColorspace = SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_GETCURSEL, 0, 0); - if ( g_config.nForceColorspace != nForceColorspace ) - { - MessageBox(0, "You have changed the output colorspace.\r\nClose the movie and open it for the new colorspace to take effect.", "Xvid DShow", MB_TOPMOST); - } - g_config.nForceColorspace = (int) nForceColorspace; - - aspect_ratio = SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_GETCURSEL, 0, 0); - if ( g_config.aspect_ratio != aspect_ratio ) - { - MessageBox(0, "You have changed the default aspect ratio.\r\nClose the movie and open it for the new aspect ratio to take effect.", "Xvid DShow", MB_TOPMOST); - } - g_config.aspect_ratio = (int) aspect_ratio; - SaveRegistryInfo(); - } - break; - - case WM_INITDIALOG: - { - xvid_gbl_info_t info; - char core100; - HINSTANCE m_hdll; - - memset(&info, 0, sizeof(info)); - info.version = XVID_VERSION; - - m_hdll = LoadLibrary(XVID_DLL_NAME); - if (m_hdll != NULL) { - - ((int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global")) - (0, XVID_GBL_INFO, &info, NULL); - - wsprintf(core, "Xvid MPEG-4 Video Codec v%d.%d.%d", - XVID_VERSION_MAJOR(info.actual_version), - XVID_VERSION_MINOR(info.actual_version), - XVID_VERSION_PATCH(info.actual_version)); - - FreeLibrary(m_hdll); - } else { - wsprintf(core, "xvidcore.dll not found!"); - } - - SetDlgItemText(hwnd, IDC_CORE, core); - } - - // Load Force Colorspace Box - SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"No Force"); - SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"YV12"); - SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"YUY2"); - SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"RGB24"); - SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"RGB32"); - - // Select Colorspace - SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0); - - hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); - SendMessage(hBrightness, TBM_SETRANGE, (WPARAM)TRUE, (LPARAM)MAKELONG(-96, 96)); - SendMessage(hBrightness, TBM_SETTICFREQ, (WPARAM)16, (LPARAM)0); - SendMessage(hBrightness, TBM_SETPOS, (WPARAM)TRUE, (LPARAM) g_config.nBrightness); - - // Load Aspect Ratio Box - SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"Auto (MPEG-4 first)"); - SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"Auto (external first)"); - SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"4:3"); - SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"16:9"); - SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"2.35:1"); - - // Select Aspect Ratio - SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_SETCURSEL, g_config.aspect_ratio, 0); - - - // Load Buttons - SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_Y), BM_SETCHECK, g_config.nDeblock_Y, 0); - SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_UV), BM_SETCHECK, g_config.nDeblock_UV, 0); - SendMessage(GetDlgItem(hwnd, IDC_DERINGY), BM_SETCHECK, g_config.nDering_Y, 0); - SendMessage(GetDlgItem(hwnd, IDC_DERINGUV), BM_SETCHECK, g_config.nDering_UV, 0); - SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, g_config.nFilmEffect, 0); - SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, g_config.nFlipVideo, 0); - - // 4CC checkbuttons - SendMessage(GetDlgItem(hwnd, IDC_DIVX), BM_SETCHECK, g_config.supported_4cc & SUPPORT_DIVX, 0); - SendMessage(GetDlgItem(hwnd, IDC_3IVX), BM_SETCHECK, g_config.supported_4cc & SUPPORT_3IVX, 0); - SendMessage(GetDlgItem(hwnd, IDC_MP4V), BM_SETCHECK, g_config.supported_4cc & SUPPORT_MP4V, 0); - SendMessage(GetDlgItem(hwnd, IDC_COMPAT), BM_SETCHECK, g_config.videoinfo_compat, 0); - - EnableWindow(GetDlgItem(hwnd,IDC_DERINGY),g_config.nDeblock_Y); - EnableWindow(GetDlgItem(hwnd,IDC_DERINGUV),g_config.nDeblock_UV); - - EnableWindow(GetDlgItem(hwnd, IDC_USE_AR), !g_config.videoinfo_compat); - - // Set Date & Time of Compilation - DPRINTF("(%s %s)", __DATE__, __TIME__); - break; - - case WM_COMMAND: - switch ( wParam ) - { - case IDC_RESET: - ZeroMemory(&g_config, sizeof(CONFIG)); - hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); - SendMessage(hBrightness, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) g_config.nBrightness); - // Load Buttons - SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_Y), BM_SETCHECK, g_config.nDeblock_Y, 0); - SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_UV), BM_SETCHECK, g_config.nDeblock_UV, 0); - SendMessage(GetDlgItem(hwnd, IDC_DERINGY), BM_SETCHECK, g_config.nDering_Y, 0); - SendMessage(GetDlgItem(hwnd, IDC_DERINGUV), BM_SETCHECK, g_config.nDering_UV, 0); - SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, g_config.nFilmEffect, 0); - SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, g_config.nFlipVideo, 0); - g_config.nForceColorspace = 0; - SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0); - g_config.aspect_ratio = 0; - SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_SETCURSEL, g_config.aspect_ratio, 0); - break; - case IDC_DEBLOCK_Y: - g_config.nDeblock_Y = !g_config.nDeblock_Y; - break; - case IDC_DEBLOCK_UV: - g_config.nDeblock_UV = !g_config.nDeblock_UV; - break; - case IDC_DERINGY: - g_config.nDering_Y = !g_config.nDering_Y; - break; - case IDC_DERINGUV: - g_config.nDering_UV = !g_config.nDering_UV; - break; - case IDC_FILMEFFECT: - g_config.nFilmEffect = !g_config.nFilmEffect; - break; - case IDC_FLIPVIDEO: - g_config.nFlipVideo = !g_config.nFlipVideo; - break; - case IDC_DIVX: - g_config.supported_4cc ^= SUPPORT_DIVX; - break; - case IDC_3IVX: - g_config.supported_4cc ^= SUPPORT_3IVX; - break; - case IDC_MP4V: - g_config.supported_4cc ^= SUPPORT_MP4V; - break; - case IDC_COMPAT: - g_config.videoinfo_compat = !g_config.videoinfo_compat; - break; - default : - return FALSE; - } - EnableWindow(GetDlgItem(hwnd,IDC_DERINGY),g_config.nDeblock_Y); - EnableWindow(GetDlgItem(hwnd,IDC_DERINGUV),g_config.nDeblock_UV); - - EnableWindow(GetDlgItem(hwnd, IDC_USE_AR), !g_config.videoinfo_compat); - - SaveRegistryInfo(); - - - break; - case WM_NOTIFY: - hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); - g_config.nBrightness = (int) SendMessage(hBrightness, TBM_GETPOS, (WPARAM)NULL, (LPARAM)NULL); - SaveRegistryInfo(); - break; - default : - return FALSE; - } - - return TRUE; /* ok */ -} - - - - - +/***************************************************************************** + * + * XVID MPEG-4 VIDEO CODEC + * - Configuration processing - + * + * Copyright(C) 2002-2012 Peter Ross <pross@xvid.org> + * + * 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 + * + * $Id: config.c 2059 2012-02-22 19:00:26Z Isibaar $ + * + ****************************************************************************/ + +#include <windows.h> +#include <commctrl.h> +#include <xvid.h> +#include "config.h" +#include "debug.h" +#include "resource.h" + + +// ----------------------------------------- +// global config structure +CONFIG g_config; + + + +void LoadRegistryInfo() +{ + HKEY hKey; + DWORD size; + RegOpenKeyEx(XVID_REG_KEY, XVID_REG_SUBKEY, 0, KEY_READ, &hKey); + + // Set the default post-processing settings + REG_GET_N("Brightness", g_config.nBrightness, 0) + REG_GET_N("Deblock_Y", g_config.nDeblock_Y, 0) + REG_GET_N("Deblock_UV", g_config.nDeblock_UV, 0) + REG_GET_N("Dering_Y", g_config.nDering_Y, 0) + REG_GET_N("Dering_UV", g_config.nDering_UV, 0) + REG_GET_N("FilmEffect", g_config.nFilmEffect, 0) + REG_GET_N("ForceColorspace", g_config.nForceColorspace, 0) + REG_GET_N("FlipVideo", g_config.nFlipVideo, 0) + REG_GET_N("Supported_4CC", g_config.supported_4cc, 0) + REG_GET_N("Videoinfo_Compat", g_config.videoinfo_compat, 0) + REG_GET_N("Decoder_Aspect_Ratio", g_config.aspect_ratio, 0) + REG_GET_N("num_threads", g_config.num_threads, 0) + REG_GET_N("cpu_flags", g_config.cpu, 0) + REG_GET_N("Tray_Icon", g_config.bTrayIcon, 1); + + RegCloseKey(hKey); +} + +void SaveRegistryInfo() +{ + HKEY hKey; + DWORD dispo; + + if (RegCreateKeyEx( + XVID_REG_KEY, + XVID_REG_SUBKEY, + 0, + XVID_REG_CLASS, + REG_OPTION_NON_VOLATILE, + KEY_WRITE, + 0, + &hKey, + &dispo) != ERROR_SUCCESS) + { + OutputDebugString("Couldn't create XVID_REG_SUBKEY"); + return; + } + + REG_SET_N("Brightness", g_config.nBrightness); + REG_SET_N("Deblock_Y", g_config.nDeblock_Y); + REG_SET_N("Deblock_UV", g_config.nDeblock_UV); + REG_SET_N("Dering_Y", g_config.nDering_Y); + REG_SET_N("Dering_UV", g_config.nDering_UV); + REG_SET_N("FilmEffect", g_config.nFilmEffect); + REG_SET_N("ForceColorspace", g_config.nForceColorspace); + REG_SET_N("FlipVideo", g_config.nFlipVideo); + REG_SET_N("Supported_4CC", g_config.supported_4cc); + REG_SET_N("Videoinfo_Compat", g_config.videoinfo_compat); + REG_SET_N("Decoder_Aspect_Ratio", g_config.aspect_ratio); + REG_SET_N("num_threads", g_config.num_threads); + REG_SET_N("Tray_Icon", g_config.bTrayIcon); + + RegCloseKey(hKey); +} + + + +INT_PTR CALLBACK adv_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + HWND hBrightness; + + switch ( uMsg ) + { + case WM_DESTROY: + { + LPARAM nForceColorspace; + LPARAM aspect_ratio; + + nForceColorspace = SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_GETCURSEL, 0, 0); + if ( g_config.nForceColorspace != nForceColorspace ) + { + MessageBox(0, "You have changed the output colorspace.\r\nClose the movie and open it for the new colorspace to take effect.", "Xvid DShow", MB_TOPMOST); + } + g_config.nForceColorspace = (int) nForceColorspace; + + aspect_ratio = SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_GETCURSEL, 0, 0); + if ( g_config.aspect_ratio != aspect_ratio ) + { + MessageBox(0, "You have changed the default aspect ratio.\r\nClose the movie and open it for the new aspect ratio to take effect.", "Xvid DShow", MB_TOPMOST); + } + g_config.aspect_ratio = (int) aspect_ratio; + SaveRegistryInfo(); + } + break; + + case WM_INITDIALOG: + { + xvid_gbl_info_t info; + char core100; + HINSTANCE m_hdll; + + memset(&info, 0, sizeof(info)); + info.version = XVID_VERSION; + + m_hdll = LoadLibrary(XVID_DLL_NAME); + if (m_hdll != NULL) { + + ((int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global")) + (0, XVID_GBL_INFO, &info, NULL); + + wsprintf(core, "Xvid MPEG-4 Video Codec v%d.%d.%d", + XVID_VERSION_MAJOR(info.actual_version), + XVID_VERSION_MINOR(info.actual_version), + XVID_VERSION_PATCH(info.actual_version)); + + FreeLibrary(m_hdll); + } else { + wsprintf(core, "xvidcore.dll not found!"); + } + + SetDlgItemText(hwnd, IDC_CORE, core); + } + + // Load Force Colorspace Box + SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"No Force"); + SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"YV12"); + SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"YUY2"); + SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"RGB24"); + SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"RGB32"); + + // Select Colorspace + SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0); + + hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); + SendMessage(hBrightness, TBM_SETRANGE, (WPARAM)TRUE, (LPARAM)MAKELONG(-96, 96)); + SendMessage(hBrightness, TBM_SETTICFREQ, (WPARAM)16, (LPARAM)0); + SendMessage(hBrightness, TBM_SETPOS, (WPARAM)TRUE, (LPARAM) g_config.nBrightness); + + // Load Aspect Ratio Box + SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"Auto (MPEG-4 first)"); + SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"Auto (external first)"); + SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"4:3"); + SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"16:9"); + SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"2.35:1"); + + // Select Aspect Ratio + SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_SETCURSEL, g_config.aspect_ratio, 0); + + + // Load Buttons + SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_Y), BM_SETCHECK, g_config.nDeblock_Y, 0); + SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_UV), BM_SETCHECK, g_config.nDeblock_UV, 0); + SendMessage(GetDlgItem(hwnd, IDC_DERINGY), BM_SETCHECK, g_config.nDering_Y, 0); + SendMessage(GetDlgItem(hwnd, IDC_DERINGUV), BM_SETCHECK, g_config.nDering_UV, 0); + SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, g_config.nFilmEffect, 0); + SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, g_config.nFlipVideo, 0); + + // 4CC checkbuttons + SendMessage(GetDlgItem(hwnd, IDC_DIVX), BM_SETCHECK, g_config.supported_4cc & SUPPORT_DIVX, 0); + SendMessage(GetDlgItem(hwnd, IDC_3IVX), BM_SETCHECK, g_config.supported_4cc & SUPPORT_3IVX, 0); + SendMessage(GetDlgItem(hwnd, IDC_MP4V), BM_SETCHECK, g_config.supported_4cc & SUPPORT_MP4V, 0); + SendMessage(GetDlgItem(hwnd, IDC_COMPAT), BM_SETCHECK, g_config.videoinfo_compat, 0); + + + // TrayIcon + SendMessage(GetDlgItem(hwnd, IDC_TRAYICON), BM_SETCHECK, g_config.bTrayIcon, 0); + + EnableWindow(GetDlgItem(hwnd,IDC_DERINGY),g_config.nDeblock_Y); + EnableWindow(GetDlgItem(hwnd,IDC_DERINGUV),g_config.nDeblock_UV); + + EnableWindow(GetDlgItem(hwnd, IDC_USE_AR), !g_config.videoinfo_compat); + + // Set Date & Time of Compilation + DPRINTF("(%s %s)", __DATE__, __TIME__); + break; + + case WM_COMMAND: + switch ( wParam ) + { + case IDC_RESET: + ZeroMemory(&g_config, sizeof(CONFIG)); + g_config.bTrayIcon = 1; + + hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); + SendMessage(hBrightness, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) g_config.nBrightness); + + // Load Buttons + SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_Y), BM_SETCHECK, g_config.nDeblock_Y, 0); + SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_UV), BM_SETCHECK, g_config.nDeblock_UV, 0); + SendMessage(GetDlgItem(hwnd, IDC_DERINGY), BM_SETCHECK, g_config.nDering_Y, 0); + SendMessage(GetDlgItem(hwnd, IDC_DERINGUV), BM_SETCHECK, g_config.nDering_UV, 0); + SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, g_config.nFilmEffect, 0); + SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, g_config.nFlipVideo, 0); + g_config.nForceColorspace = 0; + SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0); + g_config.aspect_ratio = 0; + SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_SETCURSEL, g_config.aspect_ratio, 0); + SendMessage(GetDlgItem(hwnd, IDC_TRAYICON), CB_SETCURSEL, g_config.bTrayIcon, 0); + break; + case IDC_DEBLOCK_Y: + g_config.nDeblock_Y = !g_config.nDeblock_Y; + break; + case IDC_DEBLOCK_UV: + g_config.nDeblock_UV = !g_config.nDeblock_UV; + break; + case IDC_DERINGY: + g_config.nDering_Y = !g_config.nDering_Y; + break; + case IDC_DERINGUV: + g_config.nDering_UV = !g_config.nDering_UV; + break; + case IDC_FILMEFFECT: + g_config.nFilmEffect = !g_config.nFilmEffect; + break; + case IDC_FLIPVIDEO: + g_config.nFlipVideo = !g_config.nFlipVideo; + break; + case IDC_DIVX: + g_config.supported_4cc ^= SUPPORT_DIVX; + break; + case IDC_3IVX: + g_config.supported_4cc ^= SUPPORT_3IVX; + break; + case IDC_MP4V: + g_config.supported_4cc ^= SUPPORT_MP4V; + break; + case IDC_COMPAT: + g_config.videoinfo_compat = !g_config.videoinfo_compat; + break; + case IDC_TRAYICON: + g_config.bTrayIcon = !g_config.bTrayIcon; + break; + default : + return FALSE; + } + EnableWindow(GetDlgItem(hwnd,IDC_DERINGY),g_config.nDeblock_Y); + EnableWindow(GetDlgItem(hwnd,IDC_DERINGUV),g_config.nDeblock_UV); + + EnableWindow(GetDlgItem(hwnd, IDC_USE_AR), !g_config.videoinfo_compat); + + SaveRegistryInfo(); + + + break; + case WM_NOTIFY: + hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); + g_config.nBrightness = (int) SendMessage(hBrightness, TBM_GETPOS, (WPARAM)NULL, (LPARAM)NULL); + SaveRegistryInfo(); + break; + default : + return FALSE; + } + + return TRUE; /* ok */ +} + + + + +
View file
xvidcore-1.3.2.tar.bz2/dshow/src/config.h -> xvidcore-1.3.3.tar.bz2/dshow/src/config.h
Changed
@@ -3,7 +3,7 @@ * XVID MPEG-4 VIDEO CODEC * - Configuration processing header file - * - * Copyright(C) 2002-2011 Peter Ross <pross@xvid.org> + * Copyright(C) 2002-2012 Peter Ross <pross@xvid.org> * * 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 @@ -19,7 +19,7 @@ * along with this program ; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: config.h 1995 2011-05-18 16:13:23Z Isibaar $ + * $Id: config.h 2059 2012-02-22 19:00:26Z Isibaar $ * ****************************************************************************/ @@ -67,6 +67,7 @@ int aspect_ratio; int num_threads; DWORD cpu; + int bTrayIcon; } CONFIG;
View file
xvidcore-1.3.2.tar.bz2/dshow/src/resource.h -> xvidcore-1.3.3.tar.bz2/dshow/src/resource.h
Changed
@@ -1,42 +1,43 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by xvid.ax.rc -// -#define VERSION_RES_MINOR_VER 0 -#define VERSION_RES_BUILD 0 -#define VER_DEBUG 0 -#define IDS_ABOUT 1 -#define VERSION_RES_MAJOR_VER 8 -#define IDD_ABOUT 102 -#define IDB_LOGO 103 -#define IDI_ICON 104 -#define IDC_BRIGHTNESS 1002 -#define IDC_DEBLOCK_UV 1003 -#define IDC_DEBLOCK_Y 1004 -#define IDC_FLIPVIDEO 1005 -#define IDC_COLORSPACE 1006 -#define IDC_RESET 1007 -#define IDC_FILMEFFECT 1008 -#define IDC_DERING 1009 -#define IDC_DERINGY 1009 -#define IDC_DIVX 1010 -#define IDC_COMPAT 1011 -#define IDC_MP4V 1012 -#define IDC_3IVX 1013 -#define IDC_DERINGUV 1014 -#define IDC_USE_AR 1015 -#define IDC_CORE 1016 -#define VERSION_RES_LANGUAGE 0x409 -#define VERSION_RES_CHARSET 1252 -#define IDC_STATIC -1 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 106 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1017 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by xvid.ax.rc +// +#define VERSION_RES_MINOR_VER 0 +#define VERSION_RES_BUILD 0 +#define VER_DEBUG 0 +#define IDS_ABOUT 1 +#define VERSION_RES_MAJOR_VER 8 +#define IDD_ABOUT 102 +#define IDB_LOGO 103 +#define IDI_ICON 104 +#define IDC_BRIGHTNESS 1002 +#define IDC_DEBLOCK_UV 1003 +#define IDC_DEBLOCK_Y 1004 +#define IDC_FLIPVIDEO 1005 +#define IDC_COLORSPACE 1006 +#define IDC_RESET 1007 +#define IDC_FILMEFFECT 1008 +#define IDC_DERING 1009 +#define IDC_DERINGY 1009 +#define IDC_DIVX 1010 +#define IDC_COMPAT 1011 +#define IDC_MP4V 1012 +#define IDC_3IVX 1013 +#define IDC_DERINGUV 1014 +#define IDC_USE_AR 1015 +#define IDC_CORE 1016 +#define IDC_TRAYICON 1017 +#define VERSION_RES_LANGUAGE 0x409 +#define VERSION_RES_CHARSET 1252 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 106 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1018 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif
View file
xvidcore-1.3.2.tar.bz2/dshow/src/xvid.ax.rc -> xvidcore-1.3.3.tar.bz2/dshow/src/xvid.ax.rc
Changed
@@ -29,7 +29,7 @@ // Dialog // -IDD_ABOUT DIALOG DISCARDABLE 0, 0, 216, 267 +IDD_ABOUT DIALOG DISCARDABLE 0, 0, 216, 296 STYLE WS_CHILD FONT 8, "MS Shell Dlg" BEGIN @@ -62,7 +62,7 @@ GROUPBOX "Other MPEG-4 video support",IDC_STATIC,7,187,202,29 CONTROL "Other",IDC_MP4V,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, 160,198,38,13 - PUSHBUTTON "Reset",IDC_RESET,79,252,50,12 + PUSHBUTTON "Reset",IDC_RESET,79,282,50,12 LTEXT "Output Colourspace",IDC_STATIC,136,151,67,9 CONTROL "Dering (UV)",IDC_DERINGUV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,98,123,53,10 @@ -71,6 +71,9 @@ 233,109,8 COMBOBOX IDC_USE_AR,135,230,68,95,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "Display Tray-Icon when playing back Xvid video",IDC_TRAYICON, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,21,260,182,13 + GROUPBOX "GUI Options",IDC_STATIC,7,250,202,29 END
View file
xvidcore-1.3.2.tar.bz2/examples/Makefile -> xvidcore-1.3.3.tar.bz2/examples/Makefile
Changed
@@ -8,9 +8,16 @@ include ../build/generic/platform.inc +# is make running into windows? +ifdef SYSTEMROOT + EXTRALIBS = -lole32 -lavifil32 -lpthread -lm +else + EXTRALIBS = -lpthread -lc -lm +endif + HDIR = -I../src CFLAGS = -g $(ARCHITECTURE) $(BUS) $(ENDIANNESS) $(FEATURES) $(SPECIFIC_CFLAGS) -LDFLAGS = -lc -lm ../build/generic/=build/$(STATIC_LIB) -lpthread +LDFLAGS = ../build/generic/=build/$(STATIC_LIB) $(EXTRALIBS) SOURCES= xvid_encraw.c xvid_decraw.c xvid_bench.c OBJECTS=$(SOURCES:.c=.o)
View file
xvidcore-1.3.2.tar.bz2/examples/xvid_encraw.c -> xvidcore-1.3.3.tar.bz2/examples/xvid_encraw.c
Changed
@@ -6,7 +6,7 @@ * Copyright(C) 2002-2003 Christoph Lampert <gruel@web.de> * 2002-2003 Edouard Gomez <ed.gomez@free.fr> * 2003 Peter Ross <pross@xvid.org> - * 2003-2010 Michael Militzer <isibaar@xvid.org> + * 2003-2014 Michael Militzer <isibaar@xvid.org> * * 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 @@ -22,7 +22,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: xvid_encraw.c 1985 2011-05-18 09:02:35Z Isibaar $ + * $Id: xvid_encraw.c 2083 2014-04-08 20:20:17Z Isibaar $ * ****************************************************************************/ @@ -40,10 +40,10 @@ ************************************************************************/ #include <stdio.h> -//#include <io.h> #include <stdlib.h> #include <string.h> #include <math.h> +#include <ctype.h> #ifndef WIN32 #include <sys/time.h> #else @@ -126,7 +126,13 @@ #define MAX_ZONES 64 #define MAX_ENC_INSTANCES 4 +#define MAX_XDIM 4096 +#define MAX_YDIM 4096 #define DEFAULT_QUANT 400 +#define DEFAULT_BITRATE 700000 /* bitrate expressed in bps, not kbps */ +#define DEFAULT_INTERLACING 1 /* 1:BFF, 2:TFF */ +#define DEFAULT_SSIM 2 +#define DEFAULT_PROGRESS 10 /* show progress every 10 frames by default */ typedef struct { @@ -187,9 +193,7 @@ static int ARG_NUM_APP_THREADS = 1; static int ARG_CPU_FLAGS = 0; -static int ARG_STATS = 0; static int ARG_SSIM = -1; -static int ARG_PSNRHVSM = 0; static char* ARG_SSIM_PATH = NULL; static int ARG_DUMP = 0; static int ARG_LUMIMASKING = 0; @@ -219,21 +223,12 @@ static int ARG_BQRATIO = 150; static int ARG_BQOFFSET = 100; static int ARG_MAXBFRAMES = 2; -static int ARG_PACKED = 1; static int ARG_DEBUG = 0; -static int ARG_VOPDEBUG = 0; -static int ARG_TRELLIS = 1; static int ARG_QTYPE = 0; static int ARG_QMATRIX = 0; -static int ARG_GMC = 0; static int ARG_INTERLACING = 0; -static int ARG_QPEL = 0; -static int ARG_TURBO = 0; static int ARG_VHQMODE = 1; -static int ARG_BVHQ = 0; static int ARG_QMETRIC = 0; -static int ARG_CLOSED_GOP = 1; -static int ARG_CHROMAME = 1; static int ARG_PAR = 1; static int ARG_PARHEIGHT; static int ARG_PARWIDTH; @@ -258,12 +253,25 @@ static int ARG_VBVPEAKRATE = 0; static int ARG_THREADS = 0; static int ARG_SLICES = 1; -static int ARG_VFR = 0; static int ARG_PROGRESS = 0; static int ARG_COLORSPACE = XVID_CSP_YV12; /* the path where to save output */ static char filepath256 = "./"; +/* on/off options */ +static int ARG_USE_ASSEMBLER = 1; +static int ARG_TURBO = 0; +static int ARG_BVHQ = 0; +static int ARG_QPEL = 0; +static int ARG_GMC = 0; +static int ARG_PACKED = 1; +static int ARG_CLOSED_GOP = 1; +static int ARG_STATS = 0; +static int ARG_PSNRHVSM = 0; +static int ARG_VOPDEBUG = 0; +static int ARG_CHROMAME = 1; +static int ARG_TRELLIS = 1; + static unsigned char qmatrix_intra64; static unsigned char qmatrix_inter64; @@ -345,7 +353,7 @@ int input_num = 0; int totalsize = 0; - int use_assembler = 1; + int use_assembler = ARG_USE_ASSEMBLER; int i; printf("xvid_encraw - raw mpeg4 bitstream encoder "); @@ -396,7 +404,7 @@ ARG_BITRATE *= 1000; } else - ARG_BITRATE = 700000; + ARG_BITRATE = DEFAULT_BITRATE; } else if (strcmp("-size", argvi) == 0 && i < argc - 1) { i++; ARG_TARGETSIZE = atoi(argvi); @@ -445,6 +453,8 @@ ARG_PACKED = 2; } else if (strcmp("-nochromame", argvi) == 0) { ARG_CHROMAME = 0; + } else if (strcmp("-chromame", argvi) == 0) { + ARG_CHROMAME = 1; } else if (strcmp("-threads", argvi) == 0 && i < argc -1) { i++; ARG_THREADS = atoi(argvi); @@ -581,14 +591,18 @@ ARG_INPUTFILE = argvi; } else if (strcmp("-stats", argvi) == 0) { ARG_STATS = 1; + } else if (strcmp("-nostats", argvi) == 0) { + ARG_STATS = 0; } else if (strcmp("-ssim", argvi) == 0) { - ARG_SSIM = 2; + ARG_SSIM = DEFAULT_SSIM; if ((i < argc - 1) && (*argvi+1 != '-')) { i++; ARG_SSIM = atoi(argvi); } } else if (strcmp("-psnrhvsm", argvi) == 0) { ARG_PSNRHVSM = 1; + } else if (strcmp("-nopsnrhvsm", argvi) == 0) { + ARG_PSNRHVSM = 0; } else if (strcmp("-ssim_file", argvi) == 0 && i < argc -1) { i++; ARG_SSIM_PATH = argvi; @@ -679,22 +693,34 @@ #endif } else if (strcmp("-vop_debug", argvi) == 0) { ARG_VOPDEBUG = 1; + } else if (strcmp("-novop_debug", argvi) == 0) { + ARG_VOPDEBUG = 0; + } else if (strcmp("-trellis", argvi) == 0) { + ARG_TRELLIS = 1; } else if (strcmp("-notrellis", argvi) == 0) { ARG_TRELLIS = 0; } else if (strcmp("-bvhq", argvi) == 0) { ARG_BVHQ = 1; + } else if (strcmp("-nobvhq", argvi) == 0) { + ARG_BVHQ = 0; } else if (strcmp("-qpel", argvi) == 0) { ARG_QPEL = 1; + } else if (strcmp("-noqpel", argvi) == 0) { + ARG_QPEL = 0; } else if (strcmp("-turbo", argvi) == 0) { ARG_TURBO = 1; + } else if (strcmp("-noturbo", argvi) == 0) { + ARG_TURBO = 0; } else if (strcmp("-gmc", argvi) == 0) { ARG_GMC = 1; + } else if (strcmp("-nogmc", argvi) == 0) { + ARG_GMC = 0; } else if (strcmp("-interlaced", argvi) == 0) { if ((i < argc - 1) && (*argvi+1 != '-')) { i++; ARG_INTERLACING = atoi(argvi); } else { - ARG_INTERLACING = 1; + ARG_INTERLACING = DEFAULT_INTERLACING; } } else if (strcmp("-noclosed_gop", argvi) == 0) { ARG_CLOSED_GOP = 0; @@ -752,9 +778,40 @@ if (ARG_PROGRESS > 0) i++; else - ARG_PROGRESS = 10; + ARG_PROGRESS = DEFAULT_PROGRESS; } else if (strcmp("-help", argvi) == 0) { - usage(); + if (i < argc - 1 && strcmp("zones", argvi+1) == 0) { + fprintf(stderr, "Zones options\n\ +NB: You can define up to %d zones using the -zones option as described below.\n\ +\n\ + -zones start,mode,value,options/start,mode,value,options...\n\ +\n\ + Parameters of a zone use the comma (,) as a delimiter. Multiple zones are\n\ + separated by a slash (/). The end of each zone is defined by either the start\n\ + of the following zone or the last frame of the input file.\n\ +\n\ + start : start frame of the zone\n\ + mode : weight zone = w, quantizer zone = q\n\ + value : depending on mode either the zone's weight or quantizer\n\ + options : enable certain encoder features for the zone. Each feature is\n\ + represented by a single letter. An integer number stands for\n\ + b-frame sensitivity. To enable multiple features at the same time\n\ + combine the appropriate symbols without any delimiting characters.\n\ + K = begin with keyframe\n\ + O = enable chroma optimizer\n\ + G = greyscale encoding\n\ + C = cartoon mode\n\ + integer = b-frame sensitivity\n\ +\n\ + Example:\n\ + to create a first zone starting at frame 0 with weight 1.0, all options\n\ + enabled and b-frame sensitivity -5, and a second zone starting at frame 1000\n\ + with constant quant 4 and no options enabled you would use the -zones option\n\ + like this:\n\ +\n\ + -zones 0,w,1.0,-5KOGC/1000,q,4\n\n", MAX_ZONES); + } else + usage(); return (0); } else { usage(); @@ -767,7 +824,7 @@ * Arguments checking ****************************************************************************/ - if (XDIM <= 0 || XDIM >= 4096 || YDIM <= 0 || YDIM >= 4096) { + if (XDIM <= 0 || XDIM >= MAX_XDIM || YDIM <= 0 || YDIM >= MAX_YDIM) { fprintf(stderr, "Trying to retrieve width and height from input header\n"); if (!ARG_INPUTTYPE) @@ -776,7 +833,7 @@ if (ARG_QUALITY < 0 ) { ARG_QUALITY = 0; - } else if (ARG_QUALITY >= ME_ELEMENTS) { + } else if (ARG_QUALITY >= (int) ME_ELEMENTS) { ARG_QUALITY = ME_ELEMENTS - 1; } @@ -869,20 +926,20 @@ if (avi_info.fccHandler != MAKEFOURCC('Y', 'V', '1', '2')) { LONG size; fprintf(stderr, "Non YV12 input colorspace %c%c%c%c! Attempting conversion...\n", - avi_info.fccHandler%256, (avi_info.fccHandler>>8)%256, (avi_info.fccHandler>>16)%256, - (avi_info.fccHandler>>24)%256); + (char)avi_info.fccHandler%256, (char)(avi_info.fccHandler>>8)%256, (char)(avi_info.fccHandler>>16)%256, + (char)(avi_info.fccHandler>>24)%256); size = sizeof(myBitmapInfoHeader); AVIStreamReadFormat(avi_in_stream, 0, &myBitmapInfoHeader, &size); if (size==0) fprintf(stderr, "AVIStreamReadFormat read 0 bytes.\n"); else { - fprintf(stderr, "AVIStreamReadFormat read %d bytes.\n", size); - fprintf(stderr, "width = %d, height = %d, planes = %d\n", myBitmapInfoHeader.biWidth, - myBitmapInfoHeader.biHeight, myBitmapInfoHeader.biPlanes); + fprintf(stderr, "AVIStreamReadFormat read %d bytes.\n", (int)size); + fprintf(stderr, "width = %d, height = %d, planes = %d\n", (int)myBitmapInfoHeader.biWidth, + (int)myBitmapInfoHeader.biHeight, myBitmapInfoHeader.biPlanes); fprintf(stderr, "Compression = %c%c%c%c, %d\n", - myBitmapInfoHeader.biCompression%256, (myBitmapInfoHeader.biCompression>>8)%256, - (myBitmapInfoHeader.biCompression>>16)%256, (myBitmapInfoHeader.biCompression>>24)%256, - myBitmapInfoHeader.biCompression); + (char)myBitmapInfoHeader.biCompression%256, (char)(myBitmapInfoHeader.biCompression>>8)%256, + (char)(myBitmapInfoHeader.biCompression>>16)%256, (char)(myBitmapInfoHeader.biCompression>>24)%256, + (int)myBitmapInfoHeader.biCompression); fprintf(stderr, "Bits Per Pixel = %d\n", myBitmapInfoHeader.biBitCount); myBitmapInfoHeader.biCompression = MAKEFOURCC('Y', 'V', '1', '2'); myBitmapInfoHeader.biBitCount = 12; @@ -936,7 +993,6 @@ #endif { FILE *in_file = fopen(ARG_INPUTFILE, "rb"); - int pos = 0; if (in_file == NULL) { fprintf(stderr, "Error opening input file %s\n", ARG_INPUTFILE); return (-1); @@ -1063,7 +1119,7 @@ totalenctime = MAX(totalenctime, enc_datak.totalenctime); for (i=0; i < 3; i++) totalPSNRi += enc_datak.totalPSNRi; - for (i=0; i < 8; i++) { + for (i=0; i < 7; i++) { int l; framestatsi.count += enc_datak.framestatsi.count; framestatsi.size += enc_datak.framestatsi.size; @@ -1187,7 +1243,6 @@ int result; int output_num; - int nvop_counter; int m4v_size; int key; int stats_type; @@ -1210,7 +1265,6 @@ PAVIFILE avi_in = NULL; PAVISTREAM avi_in_stream = NULL; PGETFRAME get_frame = NULL; - BITMAPINFOHEADER myBitmapInfoHeader; #else #define get_frame NULL #endif @@ -1221,6 +1275,7 @@ AVISTREAMINFO myAVIStreamInfo; #endif #if defined(XVID_AVI_INPUT) || defined(XVID_AVI_OUTPUT) + BITMAPINFOHEADER myBitmapInfoHeader; if (ARG_NUM_APP_THREADS > 1) CoInitializeEx(0, COINIT_MULTITHREADED); AVIFileInit(); @@ -1268,20 +1323,20 @@ if (avi_info.fccHandler != MAKEFOURCC('Y', 'V', '1', '2')) { LONG size; fprintf(stderr, "Non YV12 input colorspace %c%c%c%c! Attempting conversion...\n", - avi_info.fccHandler%256, (avi_info.fccHandler>>8)%256, (avi_info.fccHandler>>16)%256, - (avi_info.fccHandler>>24)%256); + (char)avi_info.fccHandler%256, (char)(avi_info.fccHandler>>8)%256, (char)(avi_info.fccHandler>>16)%256, + (char)(avi_info.fccHandler>>24)%256); size = sizeof(myBitmapInfoHeader); AVIStreamReadFormat(avi_in_stream, 0, &myBitmapInfoHeader, &size); if (size==0) fprintf(stderr, "AVIStreamReadFormat read 0 bytes.\n"); else { - fprintf(stderr, "AVIStreamReadFormat read %d bytes.\n", size); - fprintf(stderr, "width = %d, height = %d, planes = %d\n", myBitmapInfoHeader.biWidth, - myBitmapInfoHeader.biHeight, myBitmapInfoHeader.biPlanes); + fprintf(stderr, "AVIStreamReadFormat read %d bytes.\n", (int)size); + fprintf(stderr, "width = %d, height = %d, planes = %d\n", (int)myBitmapInfoHeader.biWidth, + (int)myBitmapInfoHeader.biHeight, myBitmapInfoHeader.biPlanes); fprintf(stderr, "Compression = %c%c%c%c, %d\n", - myBitmapInfoHeader.biCompression%256, (myBitmapInfoHeader.biCompression>>8)%256, - (myBitmapInfoHeader.biCompression>>16)%256, (myBitmapInfoHeader.biCompression>>24)%256, - myBitmapInfoHeader.biCompression); + (char)myBitmapInfoHeader.biCompression%256, (char)(myBitmapInfoHeader.biCompression>>8)%256, + (char)(myBitmapInfoHeader.biCompression>>16)%256, (char)(myBitmapInfoHeader.biCompression>>24)%256, + (int)myBitmapInfoHeader.biCompression); fprintf(stderr, "Bits Per Pixel = %d\n", myBitmapInfoHeader.biBitCount); myBitmapInfoHeader.biCompression = MAKEFOURCC('Y', 'V', '1', '2'); myBitmapInfoHeader.biBitCount = 12; @@ -1411,12 +1466,12 @@ myAVIStreamInfo.dwQuality = 10000; SetRect(&myAVIStreamInfo.rcFrame, 0, 0, XDIM, YDIM); - if (avierr=AVIFileOpen(&myAVIFile, ARG_AVIOUTPUTFILE, OF_CREATE|OF_WRITE, NULL)) { + if ((avierr=AVIFileOpen(&myAVIFile, ARG_AVIOUTPUTFILE, OF_CREATE|OF_WRITE, NULL))) { fprintf(stderr, "AVIFileOpen failed opening output file %s, error code %d\n", ARG_AVIOUTPUTFILE, avierr); goto release_all; } - if (avierr=AVIFileCreateStream(myAVIFile, &myAVIStream, &myAVIStreamInfo)) { + if ((avierr=AVIFileCreateStream(myAVIFile, &myAVIStream, &myAVIStreamInfo))) { fprintf(stderr, "AVIFileCreateStream failed, error code %d\n", avierr); goto release_all; } @@ -1429,7 +1484,7 @@ myBitmapInfoHeader.biCompression = MAKEFOURCC('X', 'V', 'I', 'D'); myBitmapInfoHeader.biBitCount = 12; myBitmapInfoHeader.biSizeImage = 6*XDIM*YDIM; - if (avierr=AVIStreamSetFormat(myAVIStream, 0, &myBitmapInfoHeader, sizeof(BITMAPINFOHEADER))) { + if ((avierr=AVIStreamSetFormat(myAVIStream, 0, &myBitmapInfoHeader, sizeof(BITMAPINFOHEADER)))) { fprintf(stderr, "AVIStreamSetFormat failed, error code %d\n", avierr); goto release_all; } @@ -1482,8 +1537,6 @@ input_num = 0; /* input frame counter */ output_num = start_num; /* output frame counter */ - nvop_counter = 0; - do { char *type; @@ -1812,107 +1865,151 @@ fprintf(stderr, "xvid_encraw built at %s on %s\n", __TIME__, __DATE__); fprintf(stderr, "Usage : xvid_encraw OPTIONS\n\n"); fprintf(stderr, "Input options:\n"); - fprintf(stderr, " -i string : input filename (stdin)\n"); + fprintf(stderr, " -i string : input filename (stdin)\n"); #ifdef XVID_AVI_INPUT - fprintf(stderr, " -type integer: input data type (yuv=0, pgm=1, avi/avs=2)\n"); + fprintf(stderr, " -type integer : input data type (yuv=0, pgm=1, avi/avs=2) ("); #else - fprintf(stderr, " -type integer: input data type (yuv=0, pgm=1)\n"); + fprintf(stderr, " -type integer : input data type (yuv=0, pgm=1) ("); #endif - fprintf(stderr, " -w integer: frame width (1.2048)\n"); - fprintf(stderr, " -h integer: frame height (1.2048)\n"); - fprintf(stderr, " -csp string : colorspace of raw input file i420, yv12 (default)\n"); - fprintf(stderr, " -frames integer: number of frames to encode\n"); - fprintf(stderr, "\n"); + fprintf(stderr, "%d)\n", ARG_INPUTTYPE); + fprintf(stderr, " -w integer : frame width (1.%d)\n", MAX_XDIM); + fprintf(stderr, " -h integer : frame height (1.%d)\n", MAX_YDIM); + fprintf(stderr, " -csp string : colorspace of raw input file i420%s, yv12%s\n", (ARG_COLORSPACE == XVID_CSP_I420)?" (default)":"", (ARG_COLORSPACE == XVID_CSP_YV12)?" (default)":""); + fprintf(stderr, " -frames integer : number of frames to encode ("); + if (ARG_MAXFRAMENR==-1) + fprintf(stderr, "all)"); + else + fprintf(stderr, "%d)", ARG_MAXFRAMENR); + fprintf(stderr, "\n\n"); fprintf(stderr, "Output options:\n"); - fprintf(stderr, " -dump : save decoder output\n"); - fprintf(stderr, " -save : save an Elementary Stream file per frame\n"); - fprintf(stderr, " -o string : save an Elementary Stream for the complete sequence\n"); + fprintf(stderr, " -dump : save decoder output\n"); + fprintf(stderr, " -save : save an Elementary Stream file per frame\n"); + fprintf(stderr, " -o string : save an Elementary Stream for the complete sequence\n"); #ifdef XVID_AVI_OUTPUT - fprintf(stderr, " -avi string: save an AVI file for the complete sequence\n"); + fprintf(stderr, " -avi string : save an AVI file for the complete sequence\n"); +#endif +#ifdef XVID_MKV_OUTPUT + fprintf(stderr, " -mkv string : save a MKV file for the complete sequence\n"); #endif - fprintf(stderr, " -mkv string: save a MKV file for the complete sequence\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "BFrames options:\n"); - fprintf(stderr, " -max_bframes integer: max bframes (2)\n"); - fprintf(stderr, " -bquant_ratio integer: bframe quantizer ratio (150)\n"); - fprintf(stderr, " -bquant_offset integer: bframe quantizer offset (100)\n"); fprintf(stderr, "\n"); fprintf(stderr, "Rate control options:\n"); - fprintf(stderr, " -framerate float : target framerate (auto)\n"); - fprintf(stderr, " -bitrate integer : target bitrate in kbps (700)\n"); - fprintf(stderr, " -size integer : target size in kilobytes\n"); - fprintf(stderr, " -single : single pass mode (default)\n"); - fprintf(stderr, " -cq float : single pass constant quantizer\n"); - fprintf(stderr, " -pass1 filename : twopass mode (first pass)\n"); - fprintf(stderr, " -full1pass : perform full first pass\n"); - fprintf(stderr, " -pass2 filename : twopass mode (2nd pass)\n"); - fprintf(stderr, " -zq starting_frame float : bitrate zone; quant\n"); - fprintf(stderr, " -zw starting_frame float : bitrate zone; weight\n"); - fprintf(stderr, " -max_key_interval integer : maximum keyframe interval (300)\n"); - fprintf(stderr, "\n"); + fprintf(stderr, " -framerate float : target framerate (auto)\n"); + fprintf(stderr, " -bitrate integer : target bitrate in kbps (%d)\n", DEFAULT_BITRATE/1000); + fprintf(stderr, " -size integer : target size in kilobytes\n"); + fprintf(stderr, " -single : single pass mode%s\n", (ARG_SINGLE)?" (default)":""); + fprintf(stderr, " -cq float : single pass constant quantizer\n"); + fprintf(stderr, " -pass1 filename : twopass mode (first pass)\n"); + fprintf(stderr, " -full1pass : perform full quality first pass (disabled)\n"); + fprintf(stderr, " -pass2 filename : twopass mode (2nd pass)\n"); + fprintf(stderr, " -max_key_interval integer : maximum keyframe interval (%d)\n", ARG_MAXKEYINTERVAL); + fprintf(stderr, " -zones zones : use `-help zones' for usage guidelines\n"); + fprintf(stderr, " -zq starting_frame float : bitrate zone; quant\n"); + fprintf(stderr, " -zw starting_frame float : bitrate zone; weight\n"); + fprintf(stderr, "\n"); fprintf(stderr, "Single Pass options:\n"); - fprintf(stderr, "-reaction integer : reaction delay factor (16)\n"); - fprintf(stderr, "-averaging integer : averaging period (100)\n"); - fprintf(stderr, "-smoother integer : smoothing buffer (100)\n"); + fprintf(stderr, " -reaction integer : reaction delay factor (%d)\n", ARG_REACTION); + fprintf(stderr, " -averaging integer : averaging period (%d)\n", ARG_AVERAGING); + fprintf(stderr, " -smoother integer : smoothing buffer (%d)\n", ARG_SMOOTHER); fprintf(stderr, "\n"); fprintf(stderr, "Second Pass options:\n"); - fprintf(stderr, "-kboost integer : I frame boost (10)\n"); - fprintf(stderr, "-kthresh integer : I frame reduction threshold (1)\n"); - fprintf(stderr, "-kreduction integer : I frame reduction amount (20)\n"); - fprintf(stderr, "-ostrength integer : overflow control strength (5)\n"); - fprintf(stderr, "-oimprove integer : max overflow improvement (5)\n"); - fprintf(stderr, "-odegrade integer : max overflow degradation (5)\n"); - fprintf(stderr, "-chigh integer : high bitrate scenes degradation (0)\n"); - fprintf(stderr, "-clow integer : low bitrate scenes improvement (0)\n"); - fprintf(stderr, "-overhead integer : container frame overhead (0)\n"); - fprintf(stderr, "-vbvsize integer : use vbv buffer size\n"); - fprintf(stderr, "-vbvmax integer : vbv max bitrate\n"); - fprintf(stderr, "-vbvpeak integer : vbv peak bitrate over 1 second\n"); + fprintf(stderr, " -kboost integer : I frame boost (%d)\n", ARG_KBOOST); + fprintf(stderr, " -kthresh integer : I frame reduction threshold (%d)\n", ARG_KTHRESH); + fprintf(stderr, " -kreduction integer : I frame reduction amount (%d)\n", ARG_KREDUCTION); + fprintf(stderr, " -ostrength integer : overflow control strength (%d)\n", ARG_OVERSTRENGTH); + fprintf(stderr, " -oimprove integer : max overflow improvement (%d)\n", ARG_OVERIMPROVE); + fprintf(stderr, " -odegrade integer : max overflow degradation (%d)\n", ARG_OVERDEGRADE); + fprintf(stderr, " -chigh integer : high bitrate scenes degradation (%d)\n", ARG_CHIGH); + fprintf(stderr, " -clow integer : low bitrate scenes improvement (%d)\n", ARG_CLOW); + fprintf(stderr, " -overhead integer : container frame overhead (%d)\n", ARG_OVERHEAD); + fprintf(stderr, " -vbvsize integer : use vbv buffer size\n"); + fprintf(stderr, " -vbvmax integer : vbv max bitrate\n"); + fprintf(stderr, " -vbvpeak integer : vbv peak bitrate over 1 second\n"); + fprintf(stderr, "\n"); + fprintf(stderr, "BFrames options:\n"); + fprintf(stderr, " -max_bframes integer : max bframes (%d)\n", ARG_MAXBFRAMES); + fprintf(stderr, " -bquant_ratio integer : bframe quantizer ratio (%d)\n", ARG_BQRATIO); + fprintf(stderr, " -bquant_offset integer : bframe quantizer offset (%d)\n", ARG_BQOFFSET); fprintf(stderr, "\n"); fprintf(stderr, "Other options\n"); - fprintf(stderr, " -noasm : do not use assembly optmized code\n"); - fprintf(stderr, " -turbo : use turbo presets for higher encoding speed\n"); - fprintf(stderr, " -quality integer : quality (0..%d) (6)\n", ME_ELEMENTS - 1); - fprintf(stderr, " -vhqmode integer : level of R-D optimizations (0..4) (1)\n"); - fprintf(stderr, " -bvhq : use R-D optimizations for B-frames\n"); - fprintf(stderr, " -metric integer : distortion metric for R-D opt (PSNR:0, PSNRHVSM: 1)\n"); - fprintf(stderr, " -qpel : use quarter pixel ME\n"); - fprintf(stderr, " -gmc : use global motion compensation\n"); - fprintf(stderr, " -qtype integer : quantization type (H263:0, MPEG4:1) (0)\n"); - fprintf(stderr, " -qmatrix filename : use custom MPEG4 quantization matrix\n"); - fprintf(stderr, " -interlaced integer : interlaced encoding (BFF:1, TFF:2) (1)\n"); - fprintf(stderr, " -nopacked : Disable packed mode\n"); - fprintf(stderr, " -noclosed_gop : Disable closed GOP mode\n"); - fprintf(stderr, " -masking integer : HVS masking mode (None:0, Lumi:1, Variance:2) (0)\n"); - fprintf(stderr, " -stats : print stats about encoded frames\n"); - fprintf(stderr, " -ssim integer : prints ssim for every frame (accurate: 0 fast: 4) (2)\n"); - fprintf(stderr, " -ssim_file filename : outputs the ssim stats into a file\n"); - fprintf(stderr, " -psnrhvsm : prints PSNRHVSM metric for every frame\n"); - fprintf(stderr, " -debug : activates xvidcore internal debugging output\n"); - fprintf(stderr, " -vop_debug : print some info directly into encoded frames\n"); - fprintf(stderr, " -nochromame : Disable chroma motion estimation\n"); - fprintf(stderr, " -notrellis : Disable trellis quantization\n"); - fprintf(stderr, " -imin integer : Minimum I Quantizer (1..31) (2)\n"); - fprintf(stderr, " -imax integer : Maximum I quantizer (1..31) (31)\n"); - fprintf(stderr, " -bmin integer : Minimum B Quantizer (1..31) (2)\n"); - fprintf(stderr, " -bmax integer : Maximum B quantizer (1..31) (31)\n"); - fprintf(stderr, " -pmin integer : Minimum P Quantizer (1..31) (2)\n"); - fprintf(stderr, " -pmax integer : Maximum P quantizer (1..31) (31)\n"); - fprintf(stderr, " -drop integer : Frame Drop Ratio (0..100) (0)\n"); - fprintf(stderr, " -start integer : Starting frame number\n"); - fprintf(stderr, " -threads integer : Number of threads\n"); - fprintf(stderr, " -slices integer : Number of slices\n"); - fprintf(stderr, " -progress integer : Show progress updates every n frames (10)\n"); - fprintf(stderr, " -par integer:integer : Set Pixel Aspect Ratio.\n"); - fprintf(stderr, " 1 = 1:1\n"); - fprintf(stderr, " 2 = 12:11 (4:3 PAL)\n"); - fprintf(stderr, " 3 = 10:11 (4:3 NTSC)\n"); - fprintf(stderr, " 4 = 16:11 (16:9 PAL)\n"); - fprintf(stderr, " 5 = 40:33 (16:9 NTSC)\n"); - fprintf(stderr, " other = custom (width:height)\n"); - fprintf(stderr, " -help : prints this help message\n"); + if (ARG_USE_ASSEMBLER) + fprintf(stderr, " -noasm : do not use assembly optimized code (use)\n"); + else + fprintf(stderr, " -asm : use assembly optimized code (don't use)\n"); + if (ARG_TURBO) + fprintf(stderr, " -noturbo : do not use turbo presets for higher encoding speed (use)\n"); + else + fprintf(stderr, " -turbo : use turbo presets for higher encoding speed (don't use)\n"); + fprintf(stderr, " -quality integer : quality (0..%d) (%d)\n", ME_ELEMENTS - 1, ARG_QUALITY); + fprintf(stderr, " -vhqmode integer : level of R-D optimizations (0..4) (%d)\n", ARG_VHQMODE); + if (ARG_BVHQ) + fprintf(stderr, " -nobvhq : do not use R-D optimizations for B-frames (use)\n"); + else + fprintf(stderr, " -bvhq : use R-D optimizations for B-frames (don't use)\n"); + fprintf(stderr, " -metric integer : distortion metric for R-D opt (PSNR:0, PSNRHVSM:1) (%d)\n", ARG_QMETRIC); + if (ARG_QPEL) + fprintf(stderr, " -noqpel : do not use quarter pixel ME (use)\n"); + else + fprintf(stderr, " -qpel : use quarter pixel ME (don't use)\n"); + if (ARG_GMC) + fprintf(stderr, " -nogmc : do not use global motion compensation (use)\n"); + else + fprintf(stderr, " -gmc : use global motion compensation (don't use)\n"); + fprintf(stderr, " -qtype integer : quantization type (H263:0, MPEG4:1) (%d)\n", ARG_QTYPE); + fprintf(stderr, " -qmatrix filename : use custom MPEG4 quantization matrix\n"); + fprintf(stderr, " -interlaced integer : interlaced encoding (BFF:1, TFF:2) (%d)\n", DEFAULT_INTERLACING); + if (ARG_PACKED) + fprintf(stderr, " -nopacked : disable packed B-frames mode (enabled)\n"); + else + fprintf(stderr, " -packed : enable packed B-frames mode (disabled)\n"); + if (ARG_CLOSED_GOP) + fprintf(stderr, " -noclosed_gop : disable closed GOP mode (enabled)\n"); + else + fprintf(stderr, " -closed_gop : enable closed GOP mode (disabled)\n"); + fprintf(stderr, " -masking integer : HVS masking mode (None:0, Lumi:1, Variance:2) (%d)\n", ARG_LUMIMASKING); + if (ARG_STATS) + fprintf(stderr, " -nostats : do not print stats about encoded frames (print)\n"); + else + fprintf(stderr, " -stats : print stats about encoded frames (don't print)\n"); + fprintf(stderr, " -ssim integer : print ssim for every frame (accurate: 0 fast: 4) (%d)\n", DEFAULT_SSIM); + fprintf(stderr, " -ssim_file filename : output the ssim stats into a file\n"); + if (ARG_PSNRHVSM) + fprintf(stderr, " -nopsnrhvsm : do not print PSNRHVSM metric for every frame (print)\n"); + else + fprintf(stderr, " -psnrhvsm : print PSNRHVSM metric for every frame (don't print)\n"); + fprintf(stderr, " -debug integer : activate xvidcore internal debugging output (don't activate)\n"); + if (ARG_VOPDEBUG) + fprintf(stderr, " -novop_debug : do not print debug info directly into encoded frames (print)\n"); + else + fprintf(stderr, " -vop_debug : print some info directly into encoded frames (don't print)\n"); + if (ARG_CHROMAME) + fprintf(stderr, " -nochromame : disable chroma motion estimation (enabled)\n"); + else + fprintf(stderr, " -chromame : enable chroma motion estimation (disabled)\n"); + if (ARG_TRELLIS) + fprintf(stderr, " -notrellis : disable trellis quantization (enabled)\n"); + else + fprintf(stderr, " -trellis : enable trellis quantization (disabled)\n"); + fprintf(stderr, " -imin integer : minimum I Quantizer (1..31) (%d)\n", ARG_QUANTS0); + fprintf(stderr, " -imax integer : maximum I quantizer (1..31) (%d)\n", ARG_QUANTS1); + fprintf(stderr, " -bmin integer : minimum B Quantizer (1..31) (%d)\n", ARG_QUANTS4); + fprintf(stderr, " -bmax integer : maximum B quantizer (1..31) (%d)\n", ARG_QUANTS5); + fprintf(stderr, " -pmin integer : minimum P Quantizer (1..31) (%d)\n", ARG_QUANTS2); + fprintf(stderr, " -pmax integer : maximum P quantizer (1..31) (%d)\n", ARG_QUANTS3); + fprintf(stderr, " -drop integer : frame Drop Ratio (0..100) (%d)\n", ARG_FRAMEDROP); + fprintf(stderr, " -start integer : starting frame number (%d)\n", ARG_STARTFRAMENR); + fprintf(stderr, " -threads integer : number of threads (auto)\n"); + fprintf(stderr, " -slices integer : number of slices (%d)\n", ARG_SLICES); + fprintf(stderr, " -progress integer : show progress updates every n frames (%d)\n", DEFAULT_PROGRESS); + fprintf(stderr, " -par integer:integer : set Pixel Aspect Ratio (%d)\n", ARG_PAR); + fprintf(stderr, " 1 = 1:1\n"); + fprintf(stderr, " 2 = 12:11 (4:3 PAL)\n"); + fprintf(stderr, " 3 = 10:11 (4:3 NTSC)\n"); + fprintf(stderr, " 4 = 16:11 (16:9 PAL)\n"); + fprintf(stderr, " 5 = 40:33 (16:9 NTSC)\n"); + fprintf(stderr, " other = custom (width:height)\n"); + fprintf(stderr, " -help : print this help message\n"); fprintf(stderr, "\n"); - fprintf(stderr, "NB: You can define %d zones repeating the -zqw option as needed.\n", MAX_ZONES); + fprintf(stderr, "NB: You can define up to %d zones via both the -zones and the -zqw options as needed.\n", MAX_ZONES); } /***************************************************************************** @@ -1936,6 +2033,7 @@ return (1); fscanf(handle, "%d %d %d", &xsize, &ysize, &depth); + fread(&dummy, 1, 1, handle); if ((xsize > 4096) || (ysize > 4096*3/2) || (depth != 255)) { fprintf(stderr, "%d %d %d\n", xsize, ysize, depth); return (2); @@ -1953,7 +2051,6 @@ unsigned char *image) { int i; - char dummy; unsigned char *y = image; unsigned char *u = image + XDIM * YDIM; @@ -1974,9 +2071,6 @@ v += XDIM / 2; } - /* I don't know why, but this seems needed */ - fread(&dummy, 1, 1, handle); - return (0); } #else @@ -2038,6 +2132,7 @@ /* sample plugin */ +#if 0 int rawenc_debug(void *handle, int opt, @@ -2077,7 +2172,7 @@ return XVID_ERR_FAIL; } - +#endif #define FRAMERATE_INCR 1001
View file
xvidcore-1.3.2.tar.bz2/src/global.h -> xvidcore-1.3.3.tar.bz2/src/global.h
Changed
@@ -19,7 +19,7 @@ * along with this program ; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: global.h 1985 2011-05-18 09:02:35Z Isibaar $ + * $Id: global.h 2057 2011-12-30 13:04:28Z Isibaar $ * ****************************************************************************/ @@ -251,8 +251,12 @@ /* useful macros */ +#ifndef MIN #define MIN(X, Y) ((X)<(Y)?(X):(Y)) +#endif +#ifndef MAX #define MAX(X, Y) ((X)>(Y)?(X):(Y)) +#endif /* #define ABS(X) (((X)>0)?(X):-(X)) */ #define SIGN(X) (((X)>0)?1:-1) #define CLIP(X,AMIN,AMAX) (((X)<(AMIN)) ? (AMIN) : ((X)>(AMAX)) ? (AMAX) : (X))
View file
xvidcore-1.3.2.tar.bz2/src/motion/estimation_bvop.c -> xvidcore-1.3.3.tar.bz2/src/motion/estimation_bvop.c
Changed
@@ -21,7 +21,7 @@ * along with this program ; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: estimation_bvop.c 1985 2011-05-18 09:02:35Z Isibaar $ + * $Id: estimation_bvop.c 2050 2011-10-25 10:53:24Z Isibaar $ * ****************************************************************************/ @@ -809,6 +809,26 @@ if (Data->iMinSAD0 < *best_sad) *best_sad = Data->iMinSAD0; } +static void +SearchInterpolate_final_fast(const int x, const int y, + const uint32_t MotionFlags, + const MBParam * const pParam, + int32_t * const best_sad, + SearchData * const Data) +{ + /* qpel refinement */ + if (Data->qpel) { + Data->qpel_precision = 1; + get_range(&Data->min_dx, &Data->max_dx, &Data->min_dy, &Data->max_dy, + x, y, 4, pParam->width, pParam->height, Data->iFcode, 2); + + Data->currentQMV0.x = 2 * Data->currentMV0.x; + Data->currentQMV0.y = 2 * Data->currentMV0.y; + Data->currentQMV1.x = 2 * Data->currentMV1.x; + Data->currentQMV1.y = 2 * Data->currentMV1.y; + } +} + static void ModeDecision_BVOP_SAD(const SearchData * const Data_d, const SearchData * const Data_b, @@ -1083,9 +1103,13 @@ &Data_i, Data_f.currentMV0, Data_b.currentMV0); if (((Data_i.iMinSAD0 < best_sad +(best_sad>>3)) && !(frame->motion_flags&XVID_ME_FAST_MODEINTERPOLATE)) - || Data_i.iMinSAD0 <= best_sad) + || Data_i.iMinSAD0 <= best_sad) { SearchInterpolate_final(i, j, frame->motion_flags, pParam, &best_sad, &Data_i); + } + else { + SearchInterpolate_final_fast(i, j, frame->motion_flags, pParam, &best_sad, &Data_i); + } if (Data_d.iMinSAD0 <= 2*best_sad) if ((!(frame->motion_flags&XVID_ME_SKIP_DELTASEARCH) && (best_sad > 750))
View file
xvidcore-1.3.2.tar.bz2/src/plugins/plugin_lumimasking.c -> xvidcore-1.3.3.tar.bz2/src/plugins/plugin_lumimasking.c
Changed
@@ -21,7 +21,7 @@ * along with this program ; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: plugin_lumimasking.c 1985 2011-05-18 09:02:35Z Isibaar $ + * $Id: plugin_lumimasking.c 2056 2011-11-09 14:12:10Z Isibaar $ * ****************************************************************************/
View file
xvidcore-1.3.2.tar.bz2/src/utils/mbtransquant.c -> xvidcore-1.3.3.tar.bz2/src/utils/mbtransquant.c
Changed
@@ -21,7 +21,7 @@ * along with this program ; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: mbtransquant.c 1985 2011-05-18 09:02:35Z Isibaar $ + * $Id: mbtransquant.c 2053 2011-11-04 15:23:46Z Isibaar $ * ****************************************************************************/ @@ -782,7 +782,7 @@ u = ((u + iCSF_Roundindex) * iCSF_Coeffindex) >> 16; - return (((Lambda*u*u)>>4) + 4*Lambda*dQ*dQ) / 5; + return Lambda*((((u*u)>>4) + 4*(dQ*dQ))/5); } /* this routine has been strippen of all debug code */
View file
xvidcore-1.3.2.tar.bz2/src/xvid.c -> xvidcore-1.3.3.tar.bz2/src/xvid.c
Changed
@@ -3,8 +3,8 @@ * XVID MPEG-4 VIDEO CODEC * - Native API implementation - * - * Copyright(C) 2001-2011 Peter Ross <pross@xvid.org> - * 2002-2011 Michael Militzer <isibaar@xvid.org> + * Copyright(C) 2001-2014 Peter Ross <pross@xvid.org> + * 2002-2014 Michael Militzer <isibaar@xvid.org> * * 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 @@ -20,7 +20,7 @@ * along with this program ; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: xvid.c 2011 2011-05-23 07:47:37Z Isibaar $ + * $Id: xvid.c 2082 2014-04-08 20:19:42Z Isibaar $ * ****************************************************************************/ @@ -367,7 +367,7 @@ /* Quantization related functions */ quant_h263_intra = quant_h263_intra_mmx; - quant_h263_inter = quant_h263_inter_mmx; + quant_h263_inter = quant_h263_inter_mmx; dequant_h263_intra = dequant_h263_intra_mmx; dequant_h263_inter = dequant_h263_inter_mmx; quant_mpeg_intra = quant_mpeg_intra_mmx; @@ -699,7 +699,7 @@ return XVID_ERR_VERSION; info->actual_version = XVID_VERSION; - info->build = "xvid-1.3.2"; + info->build = "xvid-1.3.3"; info->cpu_flags = detect_cpu_flags(); info->num_threads = 0; /* single-thread */
View file
xvidcore-1.3.2.tar.bz2/src/xvid.h -> xvidcore-1.3.3.tar.bz2/src/xvid.h
Changed
@@ -3,7 +3,7 @@ * XVID MPEG-4 VIDEO CODEC * - Xvid Main header file - * - * Copyright(C) 2001-2011 Peter Ross <pross@xvid.org> + * Copyright(C) 2001-2014 Peter Ross <pross@xvid.org> * * 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 @@ -19,7 +19,7 @@ * along with this program ; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: xvid.h 1985 2011-05-18 09:02:35Z Isibaar $ + * $Id: xvid.h 2082 2014-04-08 20:19:42Z Isibaar $ * ****************************************************************************/ @@ -57,7 +57,7 @@ #define XVID_API_MAJOR(a) (((a)>>16) & 0xff) #define XVID_API_MINOR(a) (((a)>> 0) & 0xff) -#define XVID_VERSION XVID_MAKE_VERSION(1,3,2) +#define XVID_VERSION XVID_MAKE_VERSION(1,3,3) #define XVID_API XVID_MAKE_API(4, 3) /* Bitstream Version @@ -71,7 +71,7 @@ * doesnt hurt but not increasing it could cause difficulty for decoders in the * future */ -#define XVID_BS_VERSION 64 +#define XVID_BS_VERSION 65 /***************************************************************************** * error codes
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.