lame-svn-r6525-trunk-lame/0000755000175000017500000000000015140361611014656 5ustar fabianfabianlame-svn-r6525-trunk-lame/depcomp0000755000175000017500000005602014527137260016247 0ustar fabianfabian#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2021 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # 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 Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: lame-svn-r6525-trunk-lame/Makefile.MSVC0000644000175000017500000004264413717230716017110 0ustar fabianfabian# Makefile.MSVC: MSVC Makefile for LAME # # 2000-2010 Robert Hegemann # dedicated to the LAME project https://lame.sourceforge.io/ ############################################################################### #__ readme ____________________________________________________________________ # nmake -f Makefile.MSVC # -> build lame, but not mp3x # -> use Robert's code modifications # -> assume MSVC 6.0 compiler available # -> assume NASM available # -> assemble MMX code with NASM # -> no compiler warnings # -> use single precision float # # passing arguments, one can modify the default behaviour: # COMP= -> use MS compiler # WARN= -> give verbose compiler warnings # ASM= -> no NASM nor MMX # MMX= -> do not assemble MMX code # CFG= -> disable Robert's modifications # CPU=P1 -> optimize for Pentium instead of P II/III # CPU=P2 -> optimize for Pentium II/III, you need a PII or better # CPU=P3 -> optimize for Pentium III, you need a PIII or better # GTK=YES -> have GTK, adds mp3x to default targets # PREC= -> use double instead of single float # SNDFILE= -> do not use LibSndfile for reading input files # # Example: # nmake -f Makefile.MSVC CPU=P1 GTK=YES #____________________________________________________________________ readme __ # targets <-> DOS filenames T_LAME = lame.exe T_MP3X = mp3x.exe T_MP3RTP = mp3rtp.exe T_DLL = libmp3lame.dll T_LIB_DYNAMIC = libmp3lame.lib T_LIB_STATIC = libmp3lame-static.lib T_LEGACY_DLL = lame_enc.dll TARGET_DIR = .\output\ # default targets PGM = $(T_LAME) # some default settings ! IF "$(MSVCVER)" != "" COMP = MS ! IF "$(MSVCVER)" == "Win64" ! IF "$(ASM)" == "" ASM = NO # or it could be ML64 if we want to use it... GTK = NO ! ENDIF ! ENDIF ! ELSE ! IF "$(COMP)" == "" COMP = MSVC ! ENDIF ! ENDIF ! IF "$(ASM)" == "" ASM = YES ! ENDIF ! IF "$(MMX)" == "" MMX = YES ! ENDIF ! IF "$(CFG)" == "" CFG = RH ! ENDIF ! IF "$(CPU)" == "" CPU = P2auto !if "$(PROCESSOR_LEVEL)"=="6" CPU = P6 !endif ! ENDIF ! IF "$(WARN)" == "" WARN = OFF ! ENDIF ! IF "$(PREC)" == "" PREC = SINGLE ! ENDIF ! IF "$(SNDFILE)" == "" SNDFILE = NO ! ENDIF OFF = win32 MACHINE = /machine:I386 LIB_OPTS = /nologo $(MACHINE) ! MESSAGE ---------------------------------------------------------------------- ! IF "$(CFG)" == "" ! MESSAGE building LAME ! ELSE ! MESSAGE building LAME featuring $(CFG) ! ENDIF ! IF "$(ASM)" == "YES" ! MESSAGE + ASM ! IF "$(MMX)" == "YES" ! MESSAGE + MMX ! ENDIF ! ENDIF ! IF "$(GTK)" == "YES" ! MESSAGE + GTK ! ENDIF ! IF "$(COMP)" == "INTEL" ! MESSAGE using INTEL COMPILER ! IF "$(CPU)" == "P1" ! MESSAGE + optimizing for Pentium (MMX) ! ELSE ! IF "$(CPU)" == "P2" ! MESSAGE + you need a Pentium II or better ! ELSE ! IF "$(CPU)" == "P3" ! MESSAGE + you need a Pentium III or better ! ELSE ! MESSAGE + optimizing for Pentium II/III ! ENDIF ! ENDIF ! ENDIF ! ELSE ! IF "$(MSVCVER)" == "6.0" ! MESSAGE + using MSVC 6.0 32-Bit Compiler ! IF "$(CPU)" == "P1" ! MESSAGE + optimizing for Pentium (MMX) (may slow down PIII a few percent) ! ELSE ! MESSAGE + optimizing for Pentium II/III ! ENDIF ! ELSEIF "$(MSVCVER)" == "8.0" ! MESSAGE + using MSVC 8.0 32-Bit Compiler ! IF "$(CPU)" == "P1" ! MESSAGE + optimizing for Pentium (MMX) (may slow down PIII a few percent) ! ELSE ! MESSAGE + optimizing for Pentium II/III ! ENDIF ! ELSE ! IF "$(MSVCVER)" == "Win64" ! MESSAGE + using MS 64-Bit Compiler ! ELSE ! MESSAGE using MS COMPILER ! IF "$(CPU)" == "P1" ! MESSAGE + optimizing for Pentium (MMX) (may slow down PIII a few percent) ! ELSE ! MESSAGE + optimizing for Pentium II/III ! ENDIF ! ENDIF ! ENDIF ! ENDIF ! IF "$(PREC)" == "SINGLE" ! MESSAGE + using Single precision ! ENDIF ! IF "$(SNDFILE)" == "YES" ! MESSAGE + using LibSndfile reading input files ! ENDIF ! MESSAGE ---------------------------------------------------------------------- ! IF "$(COMP)" != "INTEL" ! IF "$(COMP)" != "BCC" #__ Microsoft C options _______________________________________________________ # # /O2 maximize speed # /Ob inline expansion # /Og enable global optimizations # /Oi enable intrinsic functions # /Ot favor code speed # /Oy enable frame pointer omission # /G5 Pentium optimization # /G6 Pentium II/III optimization # /GA optimize for Windows Application # /GF enable read-only string pooling # /Gf enable string spooling # /Gs disable stack checking calls # /Gy separate functions for linker # /QIfdiv generate code for Pentium FDIV fix # /QI0f generate code for Pentium 0x0f erratum fix # # remarks: # - aliasing options seem to break code # - try to get the Intel compiler demonstration code! # ICL produces faster code. # debugging options # CC_OPTS = /nologo /Zi /Ge /GZ # LN_OPTS = /nologo /debug:full /debugtype:cv /fixed:no # profiling options # CC_OPTS = /nologo /Zi /O2b2gity /G6As /DNDEBUG # LN_OPTS = /nologo /debug:full /debugtype:cv /fixed:no /profile # release options ! IF "$(MSVCVER)" == "Win64" CC_OPTS = /nologo /DWin64 /O2b2ity /GAy /Gs1024 /Zp8 /GL /GS- /Zi ! ELSEIF "$(MSVCVER)" == "8.0" CC_OPTS = /nologo /O2 /Wp64 /Oi /GL /arch:SSE /fp:precise ! ELSEif "$(CPU)"=="P6" CC_OPTS = /nologo /O2 /Ob2 /GAy /Gs1024 /Zp8 /Zi !else CC_OPTS = /nologo /O2 /Ob2 /GAy /Gs1024 /QIfdiv /QI0f /YX ! ENDIF ! IF "$(MSVCVER)" == "6.0" ! IF "$(CPU)" == "P1" CC_OPTS = $(CC_OPTS) /G5 ! ELSE CC_OPTS = $(CC_OPTS) /G6 ! ENDIF ! ENDIF ! IF "$(WARN)" == "OFF" CC_OPTS = $(CC_OPTS) /w ! ELSE CC_OPTS = $(CC_OPTS) /W$(WARN) ! ENDIF ! IF "$(PREC)" == "SINGLE" CC_OPTS = $(CC_OPTS) /DFLOAT8=float /DREAL_IS_FLOAT=1 ! ENDIF # temporary remove NDEBUG, see configure.in #CC_OPTS = $(CC_OPTS) /DNDEBUG /MT CC_OPTS = $(CC_OPTS) /MT LN_OPTS = /nologo /pdb:none LN_DLL = /nologo /DLL CC_OUT = /Fo LN_OUT = /OUT: CC = cl LN = link #_______________________________________________________ Microsoft C options __ ! ELSE #__ Borland BCC options _______________________________________________________ # # first draft, DLL not working, generates very slow code! BCCINST = C:/Borland/BCC55 CC_OPTS = -pc -q -ff -fp -jb -j1 -tWC -tWM -O2 -OS -I$(BCCINST)/include -DNDEBUG -DWIN32 # dll >> -tWD LN_OPTS = -lGn -lGi -lap -lx -L$(BCCINST)/lib # dll >> -Tpd ! IF "$(CPU)" == "P1" CC_OPTS = $(CC_OPTS) -5 ! ELSE CC_OPTS = $(CC_OPTS) -6 ! ENDIF ! IF "$(WARN)" == "OFF" CC_OPTS = $(CC_OPTS) -w- ! ELSE CC_OPTS = $(CC_OPTS) ! ENDIF LN_DLL = #$(CCINST)/lib/cw32R.lib LN_OUT = -e CC_OUT = -o CC = bcc32 LN = bcc32 OFF = obj ! ENDIF #_______________________________________________________ Borland BCC options __ ! ELSE #__ Intel 4.5 options _________________________________________________________ # # /YX enable automatic precompiled header file creation/usage # /Ox maximum optimization same as /O2 without /Gfy # /O2 same as /Gfsy /Ob1gyti # /Gd 1) make cdecl the default calling convention # /G5 2) optimized for Pentium # /G6 3) optimized for Pentium II/III # /GA assume single threaded # /Gs[n] disable stack checks for functions with , 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 . # 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 case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." 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 # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=https://www.perl.org/ flex_URL=https://github.com/westes/flex gnu_software_URL=https://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: lame-svn-r6525-trunk-lame/compile0000755000175000017500000001635014527137260016252 0ustar fabianfabian#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2021 Free Software Foundation, Inc. # Written by Tom Tromey . # # 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 . # 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. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN* | MSYS*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: lame-svn-r6525-trunk-lame/config.rpath0000755000175000017500000004401211553554607017204 0ustar fabianfabian#! /bin/sh # Output a system dependent set of variables, describing how to set the # run time search path of shared libraries in an executable. # # Copyright 1996-2010 Free Software Foundation, Inc. # Taken from GNU libtool, 2001 # Originally by Gordon Matzigkeit , 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # # The first argument passed to this file is the canonical host specification, # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld # should be set by the caller. # # The set of defined variables is at the end of this script. # Known limitations: # - On IRIX 6.5 with CC="cc", the run time search patch must not be longer # than 256 bytes, otherwise the compiler driver will dump core. The only # known workaround is to choose shorter directory names for the build # directory and/or the installation directory. # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a shrext=.so host="$1" host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # Code taken from libtool.m4's _LT_CC_BASENAME. for cc_temp in $CC""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'` # Code taken from libtool.m4's _LT_COMPILER_PIC. wl= if test "$GCC" = yes; then wl='-Wl,' else case "$host_os" in aix*) wl='-Wl,' ;; darwin*) case $cc_basename in xlc*) wl='-Wl,' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) ;; hpux9* | hpux10* | hpux11*) wl='-Wl,' ;; irix5* | irix6* | nonstopux*) wl='-Wl,' ;; newsos6) ;; linux* | k*bsd*-gnu) case $cc_basename in ecc*) wl='-Wl,' ;; icc* | ifort*) wl='-Wl,' ;; lf95*) wl='-Wl,' ;; pgcc | pgf77 | pgf90) wl='-Wl,' ;; ccc*) wl='-Wl,' ;; como) wl='-lopt=' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) wl='-Wl,' ;; esac ;; esac ;; osf3* | osf4* | osf5*) wl='-Wl,' ;; rdos*) ;; solaris*) wl='-Wl,' ;; sunos4*) wl='-Qoption ld ' ;; sysv4 | sysv4.2uw2* | sysv4.3*) wl='-Wl,' ;; sysv4*MP*) ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) wl='-Wl,' ;; unicos*) wl='-Wl,' ;; uts4*) ;; esac fi # Code taken from libtool.m4's _LT_LINKER_SHLIBS. hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no case "$host_os" in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. # Unlike libtool, we use -rpath here, not --rpath, since the documented # option of GNU ld is called -rpath, not --rpath. hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' case "$host_os" in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no fi ;; amigaos*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we cannot use # them. ld_shlibs=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then : else ld_shlibs=no fi ;; interix[3-9]*) hardcode_direct=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; gnu* | linux* | k*bsd*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; netbsd*) ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs=no elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' else ld_shlibs=no fi ;; esac ;; sunos4*) hardcode_direct=yes ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then hardcode_libdir_flag_spec= fi else case "$host_os" in aix3*) # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac fi hardcode_direct=yes hardcode_libdir_separator=':' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac fi # Begin _LT_AC_SYS_LIBPATH_AIX. echo 'int main () { return 0; }' > conftest.c ${CC} ${LDFLAGS} conftest.c -o conftest aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` fi if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib" fi rm -f conftest.c conftest # End _LT_AC_SYS_LIBPATH_AIX. if test "$aix_use_runtimelinking" = yes; then hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' else hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" fi fi ;; amigaos*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # see comment about different semantics on the GNU ld section ld_shlibs=no ;; bsdi[45]*) ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' libext=lib ;; darwin* | rhapsody*) hardcode_direct=no if test "$GCC" = yes ; then : else case $cc_basename in xlc*) ;; *) ld_shlibs=no ;; esac fi ;; dgux*) hardcode_libdir_flag_spec='-L$libdir' ;; freebsd1*) ld_shlibs=no ;; freebsd2.2*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; freebsd2*) hardcode_direct=yes hardcode_minus_L=yes ;; freebsd* | dragonfly*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; hpux9*) hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; hpux10*) if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no ;; *) hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; netbsd*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; newsos6) hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then hardcode_libdir_flag_spec='${wl}-rpath,$libdir' else case "$host_os" in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) hardcode_libdir_flag_spec='-R$libdir' ;; *) hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; osf3*) hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) if test "$GCC" = yes; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else # Both cc and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi hardcode_libdir_separator=: ;; solaris*) hardcode_libdir_flag_spec='-R$libdir' ;; sunos4*) hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes ;; sysv4) case $host_vendor in sni) hardcode_direct=yes # is this really true??? ;; siemens) hardcode_direct=no ;; motorola) hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac ;; sysv4.3*) ;; sysv4*MP*) if test -d /usr/nec; then ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) ;; sysv5* | sco3.2v5* | sco5v6*) hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator=':' ;; uts4*) hardcode_libdir_flag_spec='-L$libdir' ;; *) ld_shlibs=no ;; esac fi # Check dynamic linker characteristics # Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER. # Unlike libtool.m4, here we don't care about _all_ names of the library, but # only about the one the linker finds when passed -lNAME. This is the last # element of library_names_spec in libtool.m4, or possibly two of them if the # linker has special search rules. library_names_spec= # the last element of library_names_spec in libtool.m4 libname_spec='lib$name' case "$host_os" in aix3*) library_names_spec='$libname.a' ;; aix[4-9]*) library_names_spec='$libname$shrext' ;; amigaos*) library_names_spec='$libname.a' ;; beos*) library_names_spec='$libname$shrext' ;; bsdi[45]*) library_names_spec='$libname$shrext' ;; cygwin* | mingw* | pw32* | cegcc*) shrext=.dll library_names_spec='$libname.dll.a $libname.lib' ;; darwin* | rhapsody*) shrext=.dylib library_names_spec='$libname$shrext' ;; dgux*) library_names_spec='$libname$shrext' ;; freebsd1*) ;; freebsd* | dragonfly*) case "$host_os" in freebsd[123]*) library_names_spec='$libname$shrext$versuffix' ;; *) library_names_spec='$libname$shrext' ;; esac ;; gnu*) library_names_spec='$libname$shrext' ;; hpux9* | hpux10* | hpux11*) case $host_cpu in ia64*) shrext=.so ;; hppa*64*) shrext=.sl ;; *) shrext=.sl ;; esac library_names_spec='$libname$shrext' ;; interix[3-9]*) library_names_spec='$libname$shrext' ;; irix5* | irix6* | nonstopux*) library_names_spec='$libname$shrext' case "$host_os" in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; *) libsuff= shlibsuff= ;; esac ;; esac ;; linux*oldld* | linux*aout* | linux*coff*) ;; linux* | k*bsd*-gnu) library_names_spec='$libname$shrext' ;; knetbsd*-gnu) library_names_spec='$libname$shrext' ;; netbsd*) library_names_spec='$libname$shrext' ;; newsos6) library_names_spec='$libname$shrext' ;; nto-qnx*) library_names_spec='$libname$shrext' ;; openbsd*) library_names_spec='$libname$shrext$versuffix' ;; os2*) libname_spec='$name' shrext=.dll library_names_spec='$libname.a' ;; osf3* | osf4* | osf5*) library_names_spec='$libname$shrext' ;; rdos*) ;; solaris*) library_names_spec='$libname$shrext' ;; sunos4*) library_names_spec='$libname$shrext$versuffix' ;; sysv4 | sysv4.3*) library_names_spec='$libname$shrext' ;; sysv4*MP*) library_names_spec='$libname$shrext' ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) library_names_spec='$libname$shrext' ;; uts4*) library_names_spec='$libname$shrext' ;; esac sed_quote_subst='s/\(["`$\\]\)/\\\1/g' escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` shlibext=`echo "$shrext" | sed -e 's,^\.,,'` escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' </dev/null | grep -c ccc),0) # double is faster than float on Alpha CC_OPTS = -O4 -pedantic -Wall -fomit-frame-pointer -ffast-math -funroll-loops \ -mfp-regs -fschedule-insns -fschedule-insns2 \ -finline-functions \ # -DFLOAT=double # add "-mcpu=21164a -Wa,-m21164a" to optimize for 21164a (ev56) CPU ################################################################ #### else, use 'ccc' ################################################################ else # Compaq's C Compiler CC = ccc ################################################################ #### set 'CC_OPTS = -arch host -tune host' to generate/tune instructions for this machine #### 'CC_OPTS += -migrate -fast -inline speed -unroll 0' tweak to run as fast as possible :) #### 'CC_OPTS += -w0 -pedantic -Wall' set warning and linking flags ################################################################ CC_OPTS = -arch host -tune host CC_OPTS += -migrate -fast -inline speed -unroll 0 CC_OPTS += -w0 -pedantic -Wall ################################################################ #### to debug, uncomment ################################################################ # For Debugging #CC_OPTS += -g3 ################################################################ #### define __DECALPHA__ (i was getting re-declaration warnings #### in machine.h ################################################################ # Define DEC Alpha CPP_OPTS += -D__DECALPHA__ # standard Linux libm #LIBS = -lm # optimized libffm (free fast math library) #LIBS = -lffm # Compaq's fast math library LIBS = -lcpml endif # gcc or ccc? endif # alpha endif # linux ########################################################################## # FreeBSD ########################################################################## ifeq ($(UNAME),FreeBSD) # remove if you do not have GTK or do not want the GTK frame analyzer GTK = -DHAVE_GTK `gtk12-config --cflags` GTKLIBS = `gtk12-config --libs` # Comment out next 2 lines if you want to remove VBR histogram capability BRHIST_SWITCH = -DHAVE_TERMCAP -DHAVE_TERMCAP_H LIBTERMCAP = -lncurses endif ########################################################################## # OpenBSD ########################################################################## ifeq ($(UNAME),OpenBSD) # remove if you do not have GTK or do not want the GTK frame analyzer GTK = -DHAVE_GTK `gtk-config --cflags` GTKLIBS = `gtk-config --libs` # Comment out next 2 lines if you want to remove VBR histogram capability BRHIST_SWITCH = -DHAVE_TERMCAP -DHAVE_TERMCAP_H LIBTERMCAP = -lcurses endif ########################################################################## # SunOS ########################################################################## ifeq ($(UNAME),SunOS) CC = cc CC_OPTS = -O -xCC MAKEDEP = -xM # for gcc, use instead: # CC = gcc # CC_OPTS = -O # MAKEDEP = -M endif ########################################################################## # SGI ########################################################################## ifeq ($(UNAME),IRIX64) CC = cc CC_OPTS = -O3 -woff all #optonal: # GTK = -DHAVE_GTK `gtk-config --cflags` # GTKLIBS = `gtk-config --libs` # BRHIST_SWITCH = -DBRHIST -DHAVE_TERMCAP -DHAVE_TERMCAP_H # LIBTERMCAP = -lncurses endif ifeq ($(UNAME),IRIX) CC = cc CC_OPTS = -O3 -woff all endif ########################################################################## # Compaq Alpha running Dec Unix (OSF) ########################################################################## ifeq ($(UNAME),OSF1) CC = cc CC_OPTS = -fast -O3 -std -g3 -non_shared endif ########################################################################## # BeOS ########################################################################## ifeq ($(UNAME),BeOS) CC = $(BE_C_COMPILER) LIBS = ifeq ($(ARCH),BePC) CC_OPTS = -O9 -fomit-frame-pointer -march=pentium \ -mcpu=pentium -ffast-math -funroll-loops \ -fprofile-arcs -fbranch-probabilities else CC_OPTS = -opt all MAKEDEP = -make endif endif ########################################################################### # MOSXS (Rhapsody PPC) ########################################################################### ifeq ($(UNAME),Rhapsody) CC = cc LIBS = CC_OPTS = -O9 -ffast-math -funroll-loops -fomit-frame-pointer MAKEDEP = -make endif ########################################################################## # OS/2 ########################################################################## # Properly installed EMX runtime & development package is a prerequisite. # tools I used: make 3.76.1, uname 1.12, sed 2.05, PD-ksh 5.2.13 # ########################################################################## ifeq ($(UNAME),OS/2) SHELL=sh CC = gcc CC_OPTS = -O3 -D__OS2__ PGM = lame.exe LIBS = RANLIB = touch # I use the following for slightly better performance on my Pentium-II # using pgcc-2.91.66: # CC_OPTS = -O6 -ffast-math -funroll-loops -mpentiumpro -march=pentiumpro -D__OS2__ # for the unfortunates with a regular pentium (using pgcc): # CC_OPTS = -O6 -ffast-math -funroll-loops -mpentium -march=pentium -D__OS2__ # Comment out next 2 lines if you want to remove VBR histogram capability BRHIST_SWITCH = -DHAVE_TERMCAP -DHAVE_{NCURSES_}TERMCAP_H LIBTERMCAP = -lncurses # Uncomment & inspect the 2 GTK lines to use MP3x GTK frame analyzer. # Properly installed XFree86/devlibs & GTK+ is a prerequisite. # The following works for me using Xfree86/OS2 3.3.5 and GTK+ 1.2.3: # GTK = -DHAVE_GTK -IC:/XFree86/include/gtk12 -Zmt -D__ST_MT_ERRNO__ -IC:/XFree86/include/glib12 -IC:/XFree86/include # GTKLIBS = -LC:/XFree86/lib -Zmtd -Zsysv-signals -Zbin-files -lgtk12 -lgdk12 -lgmodule -lglib12 -lXext -lX11 -lshm -lbsd -lsocket -lm endif ########################################################################### # MSDOS/Windows ########################################################################### ifeq ($(UNAME),MSDOS) RM = CC_OPTS = \ -Wall -pipe -O3 -fomit-frame-pointer -ffast-math -funroll-loops \ -fschedule-insns2 -fmove-all-movables -freduce-all-givs \ -mcpu=pentium -march=pentium -mfancy-math-387 CC_OPTS += -D_cdecl=__cdecl PGM = lame.exe endif ########################################################################### # AmigaOS ########################################################################### # Type 'Make ARCH=PPC' for PowerUP and 'Make ARCH=WOS' for WarpOS # ########################################################################### ifeq ($(UNAME),AmigaOS) CC = gcc -noixemul CC_OPTS = -O3 -ffast-math -funroll-loops -m68020-60 -m68881 BRHIST_SWITCH = -DBRHIST MAKEDEP = -MM ifeq ($(ARCH),WOS) CC = ppc-amigaos-gcc -warpup CC_OPTS = -O3 -ffast-math -fomit-frame-pointer -funroll-loops \ -mmultiple -mcpu=603e AR = ppc-amigaos-ar RANLIB = ppc-amigaos-ranlib LIBS = endif ifeq ($(ARCH),PPC) CC = ppc-amigaos-gcc CC_OPTS = -O3 -ffast-math -fomit-frame-pointer -funroll-loops \ -mmultiple -mcpu=603e AR = ppc-amigaos-ar RANLIB = ppc-amigaos-ranlib LIBS = endif endif # 10/99 added -D__NO_MATH_INLINES to fix a bug in *all* versions of # gcc 2.8+ as of 10/99. ifeq ($(HAVE_NEWER_GLIBC),YES) CC_SWITCHES = else CC_SWITCHES = -D__NO_MATH_INLINES # only needed by some older glibc endif # temporary remove NDEBUG, see configure.in #CC_SWITCHES += -DNDEBUG $(CC_OPTS) $(SNDLIB) $(BRHIST_SWITCH) CC_SWITCHES += $(CC_OPTS) $(SNDLIB) $(BRHIST_SWITCH) frontend_sources = \ frontend/main.c \ frontend/amiga_mpega.c \ frontend/brhist.c \ frontend/get_audio.c \ frontend/lametime.c \ frontend/parse.c \ frontend/timestatus.c \ frontend/console.c \ lib_sources = \ libmp3lame/bitstream.c \ libmp3lame/encoder.c \ libmp3lame/fft.c \ libmp3lame/gain_analysis.c \ libmp3lame/id3tag.c \ libmp3lame/lame.c \ libmp3lame/newmdct.c \ libmp3lame/psymodel.c \ libmp3lame/quantize.c \ libmp3lame/quantize_pvt.c \ libmp3lame/set_get.c \ libmp3lame/vbrquantize.c \ libmp3lame/reservoir.c \ libmp3lame/tables.c \ libmp3lame/takehiro.c \ libmp3lame/util.c \ libmp3lame/mpglib_interface.c \ libmp3lame/VbrTag.c \ libmp3lame/version.c \ libmp3lame/presets.c \ libmp3lame/vector/xmm_quantize_sub.c \ mpglib/common.c \ mpglib/dct64_i386.c \ mpglib/decode_i386.c \ mpglib/layer1.c \ mpglib/layer2.c \ mpglib/layer3.c \ mpglib/tabinit.c \ mpglib/interface.c #ifeq ($(UNAME),MSDOS) # frontend_sources := $(subst /,\,$(frontend_sources)) # lib_sources := $(subst /,\,$(lib_sources)) #endif frontend_obj = $(frontend_sources:.c=.o) lib_obj = $(lib_sources:.c=.o) DEP = $(frontend_sources:.c=.d) $(lib_sources:.c=.d ) gtk_sources = frontend/gtkanal.c frontend/gpkplotting.c frontend/mp3x.c gtk_obj = $(gtk_sources:.c=.gtk.o) gtk_dep = $(gtk_sources:.c=.d) NASM = nasm ASFLAGS=-f $(NASM_FLAGS) -i libmp3lame/i386/ # for people with nasmw ifeq ($(UNAME),MSDOS) NASM = nasmw ASFLAGS=-f win32 -DWIN32 -i libmp3lame/i386/ endif %.o: %.nas $(NASM) $(ASFLAGS) $< -o $@ %.o: %.s gcc -c $< -o $@ #HAVE_NASM = YES ifeq ($(HAVE_NASM),YES) ## have NASM CC_SWITCHES += -DHAVE_NASM lib_obj += libmp3lame/i386/cpu_feat.o ## use MMX extension. you need nasm and MMX supported CPU. CC_SWITCHES += -DMMX_choose_table lib_obj += libmp3lame/i386/choose_table.o ## use 3DNow! extension. you need nasm and 3DNow! supported CPU. lib_obj += libmp3lame/i386/fft3dn.o ## use SSE extension. you need nasm and SSE supported CPU. lib_obj += libmp3lame/i386/fftsse.o ## not yet coded #CC_SWITCHES += -DUSE_FFTFPU #lib_obj += libmp3lame/i386/fftfpu.o endif # # Makefile rules---you probably won't have to modify below this line # %.o: %.c $(CC) $(CPP_OPTS) $(CC_SWITCHES) -c $< -o $@ %.d: %.c ifeq ($(NOUNIXCMD),YES) $(CC) $(MAKEDEP) $(CPP_OPTS) $(CC_SWITCHES) $< > $@ else $(SHELL) -ec '$(CC) $(MAKEDEP) $(CPP_OPTS) $(CC_SWITCHES) $< | sed '\''s;$*.o;& $@;g'\'' > $@' endif %.gtk.o: %.c $(CC) $(CPP_OPTS) $(CC_SWITCHES) $(GTK) -c $< -o $@ all: frontend/$(PGM) $(lib_sources) $(frontend_sources) $(gtk_sources) : config.h config.h: configMS.h ifeq ($(NOUNIXCMD),YES) copy configMS.h config.h else cp configMS.h config.h endif frontend/$(PGM): frontend/lame_main.o $(frontend_obj) $(MP3LIB) $(CC) $(CC_OPTS) -o frontend/$(PGM) frontend/lame_main.o $(frontend_obj) \ $(MP3LIB) $(LIBS) $(LIBSNDFILE) $(LIBTERMCAP) mp3x: $(frontend_obj) $(gtk_obj) $(MP3LIB) $(CC) $(CC_OPTS) -o frontend/mp3x $(frontend_obj) $(gtk_obj) \ $(MP3LIB) $(LIBS) $(LIBSNDFILE) $(LIBTERMCAP) $(GTKLIBS) mp3rtp: frontend/rtp.o frontend/mp3rtp.o $(frontend_obj) $(MP3LIB) $(CC) $(CC_OPTS) -o frontend/mp3rtp frontend/mp3rtp.o frontend/rtp.o $(frontend_obj) $(MP3LIB) \ $(LIBS) $(LIBSNDFILE) $(LIBTERMCAP) libmp3lame/libmp3lame.a: $(lib_obj) echo $(lib_obj) $(AR) cr libmp3lame/libmp3lame.a $(lib_obj) $(RANLIB) libmp3lame/libmp3lame.a #shared library. GNU specific? libmp3lame/libmp3lame.so: $(lib_obj) gcc -shared -Wl,-soname,libmp3lame/libmp3lame.so -o libmp3lame/libmp3lame.so $(lib_obj) install: frontend/$(PGM) #libmp3lame.a cp frontend/$(PGM) /usr/bin #cp libmp3lame.a /usr/lib #cp lame.h /usr/lib clean: ifeq ($(UNAME),MSDOS) -del $(subst /,\,$(frontend_obj)) -del $(subst /,\,$(lib_obj)) -del $(subst /,\,$(gtk_obj)) -del $(subst /,\,$(DEP)) -del frontend\$(PGM) -del frontend\main.o -del libmp3lame\libmp3lame.a else -$(RM) $(gtk_obj) $(frontend_obj) $(lib_obj) $(DEP) frontend/$(PGM) \ frontend/main.o frontend/lame libmp3lame/libmp3lame.a \ frontend/mp3x.o frontend/mp3x endif tags: TAGS TAGS: ${c_sources} etags -T ${c_sources} ifneq ($(MAKECMDGOALS),clean) -include $(DEP) endif # # testcase.mp3 is a 2926 byte file. The first number output by # wc is the number of bytes which differ between new output # and 'official' results. # # Because of compiler options and effects of roundoff, the # number of bytes which are different may not be zero, but # should be at most 30. # test: frontend/$(PGM) frontend/$(PGM) --nores testcase.wav testcase.new.mp3 cmp -l testcase.new.mp3 testcase.mp3 | wc -l lame-svn-r6525-trunk-lame/ACM/0000755000175000017500000000000015140361511015255 5ustar fabianfabianlame-svn-r6525-trunk-lame/ACM/AEncodeProperties.cpp0000644000175000017500000016200113515550363021345 0ustar fabianfabian/** * * Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows * * Copyright (c) 2002 Steve Lhomme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*! \author Steve Lhomme \version \$Id$ */ #if !defined(STRICT) #define STRICT #endif // !defined(STRICT) #include #include #include #include #ifdef _MSC_VER // no problem with unknown pragmas #pragma warning(disable: 4068) #endif #include "resource.h" #include #include "adebug.h" #include "AEncodeProperties.h" #include "ACM.h" //#include "AParameters/AParameters.h" #ifndef TTS_BALLOON #define TTS_BALLOON 0x40 #endif // TTS_BALLOON const unsigned int AEncodeProperties::the_Bitrates[18] = {320, 256, 224, 192, 160, 144, 128, 112, 96, 80, 64, 56, 48, 40, 32, 24, 16, 8 }; const unsigned int AEncodeProperties::the_MPEG1_Bitrates[14] = {320, 256, 224, 192, 160, 128, 112, 96, 80, 64, 56, 48, 40, 32 }; const unsigned int AEncodeProperties::the_MPEG2_Bitrates[14] = {160, 144, 128, 112, 96, 80, 64, 56, 48, 40, 32, 24, 16, 8}; const unsigned int AEncodeProperties::the_ChannelModes[3] = { STEREO, JOINT_STEREO, DUAL_CHANNEL }; //const char AEncodeProperties::the_Presets[][13] = {"None", "CD", "Studio", "Hi-Fi", "Phone", "Voice", "Radio", "Tape", "FM", "AM", "SW"}; //const LAME_QUALTIY_PRESET AEncodeProperties::the_Presets[] = {LQP_NOPRESET, LQP_R3MIX_QUALITY, LQP_NORMAL_QUALITY, LQP_LOW_QUALITY, LQP_HIGH_QUALITY, LQP_VERYHIGH_QUALITY, LQP_VOICE_QUALITY, LQP_PHONE, LQP_SW, LQP_AM, LQP_FM, LQP_VOICE, LQP_RADIO, LQP_TAPE, LQP_HIFI, LQP_CD, LQP_STUDIO}; //const unsigned int AEncodeProperties::the_SamplingFreqs[9] = { 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000 }; ToolTipItem AEncodeProperties::Tooltips[13]={ { IDC_CHECK_ENC_ABR, "Allow encoding with an average bitrate\r\ninstead of a constant one.\r\n\r\nIt can improve the quality for the same bitrate." }, { IDC_CHECK_COPYRIGHT, "Mark the encoded data as copyrighted." }, { IDC_CHECK_CHECKSUM, "Put a checksum in the encoded data.\r\n\r\nThis can make the file less sensitive to data loss." }, { IDC_CHECK_ORIGINAL, "Mark the encoded data as an original file." }, { IDC_CHECK_PRIVATE, "Mark the encoded data as private." }, { IDC_COMBO_ENC_STEREO, "Select the type of stereo mode used for encoding:\r\n\r\n- Stereo : the usual one\r\n- Joint-Stereo : mix both channel to achieve better compression\r\n- Dual Channel : treat both channel as separate" }, { IDC_STATIC_DECODING, "Decoding not supported for the moment by the codec." }, { IDC_CHECK_ENC_SMART, "Disable bitrate when there is too much compression.\r\n(default 1:15 ratio)" }, { IDC_STATIC_CONFIG_VERSION, "Version of this codec.\r\n\r\nvX.X.X is the version of the codec interface.\r\nX.XX is the version of the encoding engine." }, { IDC_SLIDER_AVERAGE_MIN, "Select the minimum Average Bitrate allowed." }, { IDC_SLIDER_AVERAGE_MAX, "Select the maximum Average Bitrate allowed." }, { IDC_SLIDER_AVERAGE_STEP, "Select the step of Average Bitrate between the min and max.\r\n\r\nA step of 5 between 152 and 165 means you have :\r\n165, 160 and 155" }, { IDC_SLIDER_AVERAGE_SAMPLE, "Check the resulting values of the (min,max,step) combination.\r\n\r\nUse the keyboard to navigate (right -> left)." }, }; //int AEncodeProperties::tst = 0; /* #pragma argsused static UINT CALLBACK DLLFindCallback( HWND hdlg, // handle to child dialog box UINT uiMsg, // message identifier WPARAM wParam, // message parameter LPARAM lParam // message parameter ) { UINT result = 0; switch (uiMsg) { case WM_NOTIFY: OFNOTIFY * info = (OFNOTIFY *)lParam; if (info->hdr.code == CDN_FILEOK) { result = 1; // by default we don't accept the file // Check if the selected file is a valid DLL with all the required functions ALameDLL * tstFile = new ALameDLL; if (tstFile != NULL) { if (tstFile->Load(info->lpOFN->lpstrFile)) { result = 0; } delete tstFile; } if (result == 1) { TCHAR output[250]; ::LoadString(AOut::GetInstance(),IDS_STRING_DLL_UNRECOGNIZED,output,250); AOut::MyMessageBox( output, MB_OK|MB_ICONEXCLAMATION, hdlg); SetWindowLong(hdlg, DWL_MSGRESULT , -100); } } } return result; } #pragma argsused static int CALLBACK BrowseFolderCallbackroc( HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData ) { AEncodeProperties * the_prop; the_prop = (AEncodeProperties *) lpData; if (uMsg == BFFM_INITIALIZED) { // char FolderName[MAX_PATH]; // SHGetPathFromIDList((LPITEMIDLIST) lParam,FolderName); //ADbg tst; //tst.OutPut("init folder to %s ",the_prop->GetOutputDirectory()); // CreateFile(); ::SendMessage(hwnd, BFFM_SETSELECTION, (WPARAM)TRUE, (LPARAM)the_prop->GetOutputDirectory()); }/* else if (uMsg == BFFM_SELCHANGED) { // verify that the folder is writable // ::SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM)0); // disable char FolderName[MAX_PATH]; SHGetPathFromIDList((LPITEMIDLIST) lParam, FolderName); // if (CreateFile(FolderName,STANDARD_RIGHTS_WRITE,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL) == INVALID_HANDLE_VALUE) if ((GetFileAttributes(FolderName) & FILE_ATTRIBUTE_DIRECTORY) != 0) ::SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM)1); // enable else ::SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM)0); // disable //ADbg tst; //tst.OutPut("change folder to %s ",FolderName); }* / return 0; } */ #pragma argsused static BOOL CALLBACK ConfigProc( HWND hwndDlg, // handle to dialog box UINT uMsg, // message WPARAM wParam, // first message parameter LPARAM lParam // second message parameter ) { BOOL bResult = FALSE; AEncodeProperties * the_prop; the_prop = (AEncodeProperties *) GetProp(hwndDlg, "AEncodeProperties-Config"); switch (uMsg) { case WM_COMMAND: if (the_prop != NULL) { bResult = the_prop->HandleDialogCommand( hwndDlg, wParam, lParam); } break; case WM_INITDIALOG: assert(the_prop == NULL); the_prop = (AEncodeProperties *) lParam; the_prop->my_debug.OutPut("there hwnd = 0x%08X",hwndDlg); assert(the_prop != NULL); SetProp(hwndDlg, "AEncodeProperties-Config", the_prop); the_prop->InitConfigDlg(hwndDlg); bResult = TRUE; break; case WM_HSCROLL: // check if it's the ABR sliders if ((HWND)lParam == GetDlgItem(hwndDlg,IDC_SLIDER_AVERAGE_MIN)) { the_prop->UpdateDlgFromSlides(hwndDlg); } else if ((HWND)lParam == GetDlgItem(hwndDlg,IDC_SLIDER_AVERAGE_MAX)) { the_prop->UpdateDlgFromSlides(hwndDlg); } else if ((HWND)lParam == GetDlgItem(hwndDlg,IDC_SLIDER_AVERAGE_STEP)) { the_prop->UpdateDlgFromSlides(hwndDlg); } else if ((HWND)lParam == GetDlgItem(hwndDlg,IDC_SLIDER_AVERAGE_SAMPLE)) { the_prop->UpdateDlgFromSlides(hwndDlg); } break; case WM_NOTIFY: if (TTN_GETDISPINFO == ((LPNMHDR)lParam)->code) { NMTTDISPINFO *lphdr = (NMTTDISPINFO *)lParam; UINT id = (lphdr->uFlags & TTF_IDISHWND) ? GetWindowLong((HWND)lphdr->hdr.idFrom, GWL_ID) : lphdr->hdr.idFrom; *lphdr->lpszText = 0; SendMessage(lphdr->hdr.hwndFrom, TTM_SETMAXTIPWIDTH, 0, 5000); for(int i=0; ilpszText = const_cast(AEncodeProperties::Tooltips[i].tip); } return TRUE; } break; default: bResult = FALSE; // will be treated by DefWindowProc } return bResult; } ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// /** \class AEncodeProperties */ const char * AEncodeProperties::GetChannelModeString(int a_channelID) const { assert(a_channelID < sizeof(the_ChannelModes)); switch (a_channelID) { case 0: return "Stereo"; case 1: return "Joint-stereo"; case 2: return "Dual Channel"; default: assert(a_channelID); return NULL; } } const int AEncodeProperties::GetBitrateString(char * string, int string_size, int a_bitrateID) const { assert(a_bitrateID < sizeof(the_Bitrates)); assert(string != NULL); if (string_size >= 4) return wsprintf(string,"%d",the_Bitrates[a_bitrateID]); else return -1; } const unsigned int AEncodeProperties::GetChannelModeValue() const { assert(nChannelIndex < sizeof(the_ChannelModes)); return the_ChannelModes[nChannelIndex]; } const unsigned int AEncodeProperties::GetBitrateValue() const { assert(nMinBitrateIndex < sizeof(the_Bitrates)); return the_Bitrates[nMinBitrateIndex]; } inline const int AEncodeProperties::GetBitrateValueMPEG2(DWORD & bitrate) const { int i; for (i=0;i=0;i--) { if (the_MPEG1_Bitrates[i] == the_Bitrates[nMinBitrateIndex]) { bitrate = the_MPEG1_Bitrates[i]; return 0; } else if (the_MPEG1_Bitrates[i] > the_Bitrates[nMinBitrateIndex]) { bitrate = the_MPEG1_Bitrates[i]; return 1; } } bitrate = 32; return 1; } /* const int AEncodeProperties::GetBitrateValue(DWORD & bitrate, const DWORD MPEG_Version) const { assert((MPEG_Version == MPEG1) || (MPEG_Version == MPEG2)); assert(nMinBitrateIndex < sizeof(the_Bitrates)); if (MPEG_Version == MPEG2) return GetBitrateValueMPEG2(bitrate); else return GetBitrateValueMPEG1(bitrate); } /* const char * AEncodeProperties::GetPresetModeString(const int a_presetID) const { assert(a_presetID < sizeof(the_Presets)); switch (a_presetID) { case 1: return "r3mix"; case 2: return "Normal"; case 3: return "Low"; case 4: return "High"; case 5: return "Very High"; case 6: return "Voice"; case 7: return "Phone"; case 8: return "SW"; case 9: return "AM"; case 10: return "FM"; case 11: return "Voice"; case 12: return "Radio"; case 13: return "Tape"; case 14: return "Hi-Fi"; case 15: return "CD"; case 16: return "Studio"; default: return "None"; } } const LAME_QUALTIY_PRESET AEncodeProperties::GetPresetModeValue() const { assert(nPresetIndex < sizeof(the_Presets)); return the_Presets[nPresetIndex]; } */ bool AEncodeProperties::Config(const HINSTANCE Hinstance, const HWND HwndParent) { //WM_INITDIALOG ? // remember the instance to retreive strings // hDllInstance = Hinstance; my_debug.OutPut("here"); int ret = ::DialogBoxParam(Hinstance, MAKEINTRESOURCE(IDD_CONFIG), HwndParent, ::ConfigProc, (LPARAM) this); /* if (ret == -1) { LPVOID lpMsgBuf; FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &lpMsgBuf, 0, NULL ); // Process any inserts in lpMsgBuf. // ... // Display the string. AOut::MyMessageBox( (LPCTSTR)lpMsgBuf, MB_OK | MB_ICONINFORMATION ); // Free the buffer. LocalFree( lpMsgBuf ); return false; } */ return true; } bool AEncodeProperties::InitConfigDlg(HWND HwndDlg) { // get all the required strings // TCHAR Version[5]; // LoadString(hDllInstance, IDS_STRING_VERSION, Version, 5); int i; // Add required channel modes SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_ENC_STEREO), CB_RESETCONTENT , NULL, NULL); for (i=0;i 320) AverageBitrate = 320; */ return true; } /* VBRMETHOD AEncodeProperties::GetVBRValue(DWORD & MaxBitrate, int & Quality, DWORD & AbrBitrate, BOOL & VBRHeader, const DWORD MPEG_Version) const { assert((MPEG_Version == MPEG1) || (MPEG_Version == MPEG2)); assert(nMaxBitrateIndex < sizeof(the_Bitrates)); if (mBRmode == BR_VBR) { MaxBitrate = the_Bitrates[nMaxBitrateIndex]; if (MPEG_Version == MPEG1) MaxBitrate = MaxBitrate>the_MPEG1_Bitrates[sizeof(the_MPEG1_Bitrates)/sizeof(unsigned int)-1]?MaxBitrate:the_MPEG1_Bitrates[sizeof(the_MPEG1_Bitrates)/sizeof(unsigned int)-1]; else MaxBitrate = MaxBitratethe_MPEG1_Bitrates[sizeof(the_MPEG1_Bitrates)/sizeof(unsigned int)-1]?MaxBitrate:the_MPEG1_Bitrates[sizeof(the_MPEG1_Bitrates)/sizeof(unsigned int)-1]; else MaxBitrate = MaxBitrateFirstChildElement("encodings"); std::string CurrentConfig = ""; if (CurrentNode->Attribute("default") != NULL) { CurrentConfig = *CurrentNode->Attribute("default"); } /* // output parameters TiXmlElement* iterateElmt = node->FirstChildElement("DLL"); if (iterateElmt != NULL) { const std::string * tmpname = iterateElmt->Attribute("location"); if (tmpname != NULL) { DllLocation = *tmpname; } } */ GetValuesFromKey(CurrentConfig, *CurrentNode); } else { /** \todo save the data in the file ! */ } } void AEncodeProperties::ParamsSave() { /* save the current parameters in the corresponding subkey HKEY OssKey; if (RegCreateKeyEx ( HKEY_LOCAL_MACHINE, "SOFTWARE\\MUKOLI\\out_lame", 0, "", REG_OPTION_NON_VOLATILE, KEY_WRITE , NULL, &OssKey, NULL ) == ERROR_SUCCESS) { if (RegSetValueEx(OssKey, "DLL Location", 0, REG_EXPAND_SZ, (CONST BYTE *)DllLocation, strlen(DllLocation)+1 ) != ERROR_SUCCESS) return; RegCloseKey(OssKey); } */ } /* void AEncodeProperties::DisplayVbrOptions(const HWND hDialog, const BRMode the_mode) { bool bVBR = false; bool bABR = false; switch ( the_mode ) { case BR_CBR: ::CheckRadioButton(hDialog, IDC_RADIO_BITRATE_CBR, IDC_RADIO_BITRATE_ABR, IDC_RADIO_BITRATE_CBR); break; case BR_VBR: ::CheckRadioButton(hDialog, IDC_RADIO_BITRATE_CBR, IDC_RADIO_BITRATE_ABR, IDC_RADIO_BITRATE_VBR); bVBR = true; break; case BR_ABR: ::CheckRadioButton(hDialog, IDC_RADIO_BITRATE_CBR, IDC_RADIO_BITRATE_ABR, IDC_RADIO_BITRATE_ABR); bABR = true; break; } if(bVBR|bABR) { ::SetWindowText(::GetDlgItem(hDialog,IDC_STATIC_MINBITRATE), "Min Bitrate"); } else { ::SetWindowText(::GetDlgItem(hDialog,IDC_STATIC_MINBITRATE), "Bitrate"); } ::EnableWindow(::GetDlgItem( hDialog, IDC_CHECK_XINGVBR), bVBR|bABR); ::EnableWindow(::GetDlgItem( hDialog, IDC_COMBO_MAXBITRATE), bVBR|bABR); ::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_MAXBITRATE), bVBR|bABR); ::EnableWindow(::GetDlgItem( hDialog, IDC_SLIDER_QUALITY), bVBR); ::EnableWindow(::GetDlgItem( hDialog, IDC_CONFIG_QUALITY), bVBR); ::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_VBRQUALITY), bVBR); ::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_VBRQUALITY_LOW), bVBR); ::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_VBRQUALITY_HIGH), bVBR); ::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_ABR), bABR); ::EnableWindow(::GetDlgItem( hDialog, IDC_EDIT_AVERAGE), bABR); } */ AEncodeProperties::AEncodeProperties(HMODULE hModule) :my_debug(ADbg(DEBUG_LEVEL_CREATION)), my_hModule(hModule) { std::string path = ""; // HMODULE htmp = LoadLibrary("out_lame.dll"); if (hModule != NULL) { char output[MAX_PATH]; ::GetModuleFileName(hModule, output, MAX_PATH); // ::FreeLibrary(htmp); path = output; } my_store_location = path.substr(0,path.find_last_of('\\')+1); my_store_location += "lame_acm.xml"; my_debug.OutPut("store path = %s",my_store_location.c_str()); //#ifdef OLD // ::OutputDebugString(my_store_location.c_str()); // make sure the XML file is present HANDLE hFile = ::CreateFile(my_store_location.c_str(), 0, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_ARCHIVE, NULL ); ::CloseHandle(hFile); //#endif // OLD my_debug.OutPut("AEncodeProperties creation completed (0x%08X)",this); } // Save the values to the right XML saved config void AEncodeProperties::SaveValuesToStringKey(const std::string & config_name) { // get the current data in the file to keep them if (my_stored_data.LoadFile(my_store_location)) { // check if the Node corresponding to the config_name already exist. TiXmlNode* node = my_stored_data.FirstChild("lame_acm"); if (node != NULL) { TiXmlElement* ConfigNode = node->FirstChildElement("encodings"); if (ConfigNode != NULL) { // look all the tags TiXmlElement* tmpNode = ConfigNode->FirstChildElement("config"); while (tmpNode != NULL) { const std::string * tmpname = tmpNode->Attribute("name"); if (tmpname->compare(config_name) == 0) { break; } tmpNode = tmpNode->NextSiblingElement("config"); } if (tmpNode == NULL) { // Create the node tmpNode = new TiXmlElement("config"); tmpNode->SetAttribute("name",config_name); // save data in the node SaveValuesToElement(tmpNode); ConfigNode->InsertEndChild(*tmpNode); } else { // save data in the node SaveValuesToElement(tmpNode); } // and save the file my_stored_data.SaveFile(my_store_location); } } } } void AEncodeProperties::GetValuesFromKey(const std::string & config_name, const TiXmlNode & parentNode) { TiXmlElement* tmpElt; TiXmlElement* iterateElmt; // find the config that correspond to CurrentConfig iterateElmt = parentNode.FirstChildElement("config"); while (iterateElmt != NULL) { const std::string * tmpname = iterateElmt->Attribute("name"); if ((tmpname != NULL) && (tmpname->compare(config_name) == 0)) { break; } iterateElmt = iterateElmt->NextSiblingElement("config"); } if (iterateElmt != NULL) { // get all the parameters saved in this Element const std::string * tmpname; // Smart output parameter tmpElt = iterateElmt->FirstChildElement("Smart"); if (tmpElt != NULL) { tmpname = tmpElt->Attribute("use"); if (tmpname != NULL) bSmartOutput = (tmpname->compare("true") == 0); tmpname = tmpElt->Attribute("ratio"); if (tmpname != NULL) SmartRatioMax = atof(tmpname->c_str()); } // Smart output parameter tmpElt = iterateElmt->FirstChildElement("ABR"); if (tmpElt != NULL) { tmpname = tmpElt->Attribute("use"); if (tmpname != NULL) bAbrOutput = (tmpname->compare("true") == 0); tmpname = tmpElt->Attribute("min"); if (tmpname != NULL) AverageBitrate_Min = atoi(tmpname->c_str()); tmpname = tmpElt->Attribute("max"); if (tmpname != NULL) AverageBitrate_Max = atoi(tmpname->c_str()); tmpname = tmpElt->Attribute("step"); if (tmpname != NULL) AverageBitrate_Step = atoi(tmpname->c_str()); } // Copyright parameter tmpElt = iterateElmt->FirstChildElement("Copyright"); if (tmpElt != NULL) { tmpname = tmpElt->Attribute("use"); if (tmpname != NULL) bCopyright = (tmpname->compare("true") == 0); } // Copyright parameter tmpElt = iterateElmt->FirstChildElement("CRC"); if (tmpElt != NULL) { tmpname = tmpElt->Attribute("use"); if (tmpname != NULL) bCRC = (tmpname->compare("true") == 0); } // Copyright parameter tmpElt = iterateElmt->FirstChildElement("Original"); if (tmpElt != NULL) { tmpname = tmpElt->Attribute("use"); if (tmpname != NULL) bOriginal = (tmpname->compare("true") == 0); } // Copyright parameter tmpElt = iterateElmt->FirstChildElement("Private"); if (tmpElt != NULL) { tmpname = tmpElt->Attribute("use"); if (tmpname != NULL) bPrivate = (tmpname->compare("true") == 0); } /* // Copyright parameter tmpElt = iterateElmt->FirstChildElement("Bit_reservoir"); if (tmpElt != NULL) { tmpname = tmpElt->Attribute("use"); if (tmpname != NULL) bNoBitRes = !(tmpname->compare("true") == 0); } // bitrates tmpElt = iterateElmt->FirstChildElement("bitrate"); tmpname = tmpElt->Attribute("min"); if (tmpname != NULL) { unsigned int uitmp = atoi(tmpname->c_str()); for (int i=0;iAttribute("max"); if (tmpname != NULL) { unsigned int uitmp = atoi(tmpname->c_str()); for (int i=0;iFirstChildElement("resampling"); if (tmpElt != NULL) { tmpname = tmpElt->Attribute("use"); if (tmpname != NULL) bResample = (tmpname->compare("true") == 0); unsigned int uitmp = atoi(tmpElt->Attribute("freq")->c_str()); for (int i=0;iFirstChildElement("VBR"); if (tmpElt != NULL) { tmpname = tmpElt->Attribute("use"); if (tmpname != NULL) { if (tmpname->compare("ABR") == 0) mBRmode = BR_ABR; else if (tmpname->compare("true") == 0) mBRmode = BR_VBR; else mBRmode = BR_CBR; } tmpname = tmpElt->Attribute("header"); if (tmpname != NULL) bXingFrame = (tmpname->compare("true") == 0); tmpname = tmpElt->Attribute("quality"); if (tmpname != NULL) { VbrQuality = atoi(tmpname->c_str()); } tmpname = tmpElt->Attribute("average"); if (tmpname != NULL) { AverageBitrate = atoi(tmpname->c_str()); } else { } } // output parameters tmpElt = iterateElmt->FirstChildElement("output"); if (tmpElt != NULL) { OutputDir = *tmpElt->Attribute("path"); } */ //#ifdef OLD // Channel mode parameter tmpElt = iterateElmt->FirstChildElement("Channel"); if (tmpElt != NULL) { const std::string * tmpStr = tmpElt->Attribute("mode"); if (tmpStr != NULL) { for (int i=0;icompare(GetChannelModeString(i)) == 0) { nChannelIndex = i; break; } } } /* tmpname = tmpElt->Attribute("force"); if (tmpname != NULL) bForceChannel = (tmpname->compare("true") == 0); */ } //#endif // OLD // Preset parameter /* tmpElt = iterateElmt->FirstChildElement("Preset"); if (tmpElt != NULL) { const std::string * tmpStr = tmpElt->Attribute("type"); for (int i=0;icompare(GetPresetModeString(i)) == 0) { nPresetIndex = i; break; } } } */ } } /** \todo save the parameters * / void AEncodeProperties::SaveParams(const HWND hParentWnd) { char string[MAX_PATH]; /* int nIdx = SendMessage(::GetDlgItem( hParentWnd ,IDC_COMBO_SETTINGS ), CB_GETCURSEL, NULL, NULL); ::SendMessage(::GetDlgItem( hParentWnd ,IDC_COMBO_SETTINGS ), CB_GETLBTEXT , nIdx, (LPARAM) string); * / }*/ bool AEncodeProperties::operator !=(const AEncodeProperties & the_instance) const { /* ::OutputDebugString(bCopyright != the_instance.bCopyright?"1":"-"); ::OutputDebugString(bCRC != the_instance.bCRC ?"2":"-"); ::OutputDebugString(bOriginal != the_instance.bOriginal ?"3":"-"); ::OutputDebugString(bPrivate != the_instance.bPrivate ?"4":"-"); ::OutputDebugString(bNoBitRes != the_instance.bNoBitRes ?"5":"-"); ::OutputDebugString(mBRmode != the_instance.mBRmode ?"6":"-"); ::OutputDebugString(bXingFrame != the_instance.bXingFrame?"7":"-"); ::OutputDebugString(bForceChannel != the_instance.bForceChannel?"8":"-"); ::OutputDebugString(bResample != the_instance.bResample ?"9":"-"); ::OutputDebugString(nChannelIndex != the_instance.nChannelIndex?"10":"-"); ::OutputDebugString(nMinBitrateIndex != the_instance.nMinBitrateIndex?"11":"-"); ::OutputDebugString(nMaxBitrateIndex != the_instance.nMaxBitrateIndex?"12":"-"); ::OutputDebugString(nPresetIndex != the_instance.nPresetIndex?"13":"-"); ::OutputDebugString(VbrQuality != the_instance.VbrQuality?"14":"-"); ::OutputDebugString(AverageBitrate != the_instance.AverageBitrate?"15":"-"); ::OutputDebugString(nSamplingFreqIndex != the_instance.nSamplingFreqIndex?"16":"-"); ::OutputDebugString(OutputDir.compare(the_instance.OutputDir) != 0?"17":"-"); std::string tmp = ""; char tmpI[10]; _itoa(AverageBitrate,tmpI,10); tmp += tmpI; tmp += " != "; _itoa(the_instance.AverageBitrate,tmpI,10); tmp += tmpI; ::OutputDebugString(tmp.c_str()); */ return ((bCopyright != the_instance.bCopyright) || (bCRC != the_instance.bCRC) || (bOriginal != the_instance.bOriginal) || (bPrivate != the_instance.bPrivate) || (bSmartOutput != the_instance.bSmartOutput) || (SmartRatioMax != the_instance.SmartRatioMax) || (bAbrOutput != the_instance.bAbrOutput) || (AverageBitrate_Min != the_instance.AverageBitrate_Min) || (AverageBitrate_Max != the_instance.AverageBitrate_Max) || (AverageBitrate_Step != the_instance.AverageBitrate_Step) || (bNoBitRes != the_instance.bNoBitRes) || (mBRmode != the_instance.mBRmode) || (bXingFrame != the_instance.bXingFrame) || (bForceChannel != the_instance.bForceChannel) || (bResample != the_instance.bResample) || (nChannelIndex != the_instance.nChannelIndex) || (nMinBitrateIndex != the_instance.nMinBitrateIndex) || (nMaxBitrateIndex != the_instance.nMaxBitrateIndex) || (nPresetIndex != the_instance.nPresetIndex) || (VbrQuality != the_instance.VbrQuality) // || (AverageBitrate != the_instance.AverageBitrate) || (nSamplingFreqIndex != the_instance.nSamplingFreqIndex) // || (OutputDir.compare(the_instance.OutputDir) != 0) ); } void AEncodeProperties::SelectSavedParams(const std::string the_string) { // get the values from the saved file if possible if (my_stored_data.LoadFile(my_store_location)) { TiXmlNode* node; node = my_stored_data.FirstChild("lame_acm"); TiXmlElement* CurrentNode = node->FirstChildElement("encodings"); if (CurrentNode != NULL) { CurrentNode->SetAttribute("default",the_string); GetValuesFromKey(the_string, *CurrentNode); my_stored_data.SaveFile(my_store_location); } } } inline void AEncodeProperties::SetAttributeBool(TiXmlElement * the_elt,const std::string & the_string, const bool the_value) const { if (the_value == false) the_elt->SetAttribute(the_string, "false"); else the_elt->SetAttribute(the_string, "true"); } void AEncodeProperties::SaveValuesToElement(TiXmlElement * the_element) const { // get all the parameters saved in this Element TiXmlElement * tmpElt; // Bit Reservoir parameter /* tmpElt = the_element->FirstChildElement("Bit_reservoir"); if (tmpElt == NULL) { tmpElt = new TiXmlElement("Bit_reservoir"); SetAttributeBool(tmpElt, "use", !bNoBitRes); the_element->InsertEndChild(*tmpElt); } else { SetAttributeBool(tmpElt, "use", !bNoBitRes); } */ // Copyright parameter tmpElt = the_element->FirstChildElement("Copyright"); if (tmpElt == NULL) { tmpElt = new TiXmlElement("Copyright"); SetAttributeBool( tmpElt, "use", bCopyright); the_element->InsertEndChild(*tmpElt); } else { SetAttributeBool( tmpElt, "use", bCopyright); } // Smart Output parameter tmpElt = the_element->FirstChildElement("Smart"); if (tmpElt == NULL) { tmpElt = new TiXmlElement("Smart"); SetAttributeBool( tmpElt, "use", bSmartOutput); tmpElt->SetAttribute("ratio", SmartRatioMax); the_element->InsertEndChild(*tmpElt); } else { SetAttributeBool( tmpElt, "use", bSmartOutput); tmpElt->SetAttribute("ratio", SmartRatioMax); } // Smart Output parameter tmpElt = the_element->FirstChildElement("ABR"); if (tmpElt == NULL) { tmpElt = new TiXmlElement("ABR"); SetAttributeBool( tmpElt, "use", bAbrOutput); tmpElt->SetAttribute("min", AverageBitrate_Min); tmpElt->SetAttribute("max", AverageBitrate_Max); tmpElt->SetAttribute("step", AverageBitrate_Step); the_element->InsertEndChild(*tmpElt); } else { SetAttributeBool( tmpElt, "use", bAbrOutput); tmpElt->SetAttribute("min", AverageBitrate_Min); tmpElt->SetAttribute("max", AverageBitrate_Max); tmpElt->SetAttribute("step", AverageBitrate_Step); } // CRC parameter tmpElt = the_element->FirstChildElement("CRC"); if (tmpElt == NULL) { tmpElt = new TiXmlElement("CRC"); SetAttributeBool( tmpElt, "use", bCRC); the_element->InsertEndChild(*tmpElt); } else { SetAttributeBool( tmpElt, "use", bCRC); } // Original parameter tmpElt = the_element->FirstChildElement("Original"); if (tmpElt == NULL) { tmpElt = new TiXmlElement("Original"); SetAttributeBool( tmpElt, "use", bOriginal); the_element->InsertEndChild(*tmpElt); } else { SetAttributeBool( tmpElt, "use", bOriginal); } // Private parameter tmpElt = the_element->FirstChildElement("Private"); if (tmpElt == NULL) { tmpElt = new TiXmlElement("Private"); SetAttributeBool( tmpElt, "use", bPrivate); the_element->InsertEndChild(*tmpElt); } else { SetAttributeBool( tmpElt, "use", bPrivate); } // Channel Mode parameter tmpElt = the_element->FirstChildElement("Channel"); if (tmpElt == NULL) { tmpElt = new TiXmlElement("Channel"); tmpElt->SetAttribute("mode", GetChannelModeString(nChannelIndex)); // SetAttributeBool( tmpElt, "force", bForceChannel); the_element->InsertEndChild(*tmpElt); } else { tmpElt->SetAttribute("mode", GetChannelModeString(nChannelIndex)); // SetAttributeBool( tmpElt, "force", bForceChannel); } /* // Preset parameter tmpElt = the_element->FirstChildElement("Preset"); if (tmpElt == NULL) { tmpElt = new TiXmlElement("Preset"); tmpElt->SetAttribute("type", GetPresetModeString(nPresetIndex)); the_element->InsertEndChild(*tmpElt); } else { tmpElt->SetAttribute("type", GetPresetModeString(nPresetIndex)); } // Bitrate parameter tmpElt = the_element->FirstChildElement("bitrate"); if (tmpElt == NULL) { tmpElt = new TiXmlElement("bitrate"); tmpElt->SetAttribute("min", the_Bitrates[nMinBitrateIndex]); tmpElt->SetAttribute("max", the_Bitrates[nMaxBitrateIndex]); the_element->InsertEndChild(*tmpElt); } else { tmpElt->SetAttribute("min", the_Bitrates[nMinBitrateIndex]); tmpElt->SetAttribute("max", the_Bitrates[nMaxBitrateIndex]); } // Output Directory parameter tmpElt = the_element->FirstChildElement("output"); if (tmpElt == NULL) { tmpElt = new TiXmlElement("output"); tmpElt->SetAttribute("path", OutputDir); the_element->InsertEndChild(*tmpElt); } else { tmpElt->SetAttribute("path", OutputDir); } */ /* // Resampling parameter tmpElt = the_element->FirstChildElement("resampling"); if (tmpElt == NULL) { tmpElt = new TiXmlElement("resampling"); SetAttributeBool( tmpElt, "use", bResample); tmpElt->SetAttribute("freq", the_SamplingFreqs[nSamplingFreqIndex]); the_element->InsertEndChild(*tmpElt); } else { SetAttributeBool( tmpElt, "use", bResample); tmpElt->SetAttribute("freq", the_SamplingFreqs[nSamplingFreqIndex]); } // VBR parameter tmpElt = the_element->FirstChildElement("VBR"); if (tmpElt == NULL) { tmpElt = new TiXmlElement("VBR"); if (mBRmode == BR_ABR) tmpElt->SetAttribute("use", "ABR"); else SetAttributeBool( tmpElt, "use", (mBRmode != BR_CBR)); SetAttributeBool( tmpElt, "header", bXingFrame); tmpElt->SetAttribute("quality", VbrQuality); tmpElt->SetAttribute("average", AverageBitrate); the_element->InsertEndChild(*tmpElt); } else { if (mBRmode == BR_ABR) tmpElt->SetAttribute("use", "ABR"); else SetAttributeBool( tmpElt, "use", (mBRmode != BR_CBR)); SetAttributeBool( tmpElt, "header", bXingFrame); tmpElt->SetAttribute("quality", VbrQuality); tmpElt->SetAttribute("average", AverageBitrate); } */ } bool AEncodeProperties::HandleDialogCommand(const HWND parentWnd, const WPARAM wParam, const LPARAM lParam) { UINT command; command = GET_WM_COMMAND_ID(wParam, lParam); switch (command) { case IDOK : { bool bShouldEnd = true; // save parameters char string[MAX_PATH]; // ::GetWindowText(::GetDlgItem( parentWnd, IDC_COMBO_SETTINGS), string, MAX_PATH); wsprintf(string,"Current"); // only the Current config is supported at the moment my_debug.OutPut("my_hModule = 0x%08X",my_hModule); /* AEncodeProperties tmpDlgProps(my_hModule); AEncodeProperties tmpSavedProps(my_hModule); //#ifdef OLD tmpDlgProps.UpdateValueFromDlg(parentWnd); tmpSavedProps.SelectSavedParams(string); tmpSavedProps.ParamsRestore(); // check if the values from the DLG are the same as the one saved in the config file // if yes, just do nothing /* if (tmpDlgProps != tmpSavedProps) { int save; if (strcmp(string,"Current") == 0) { // otherwise, prompt the user if he wants to overwrite the settings TCHAR tmpStr[250]; ::LoadString(AOut::GetInstance(),IDS_STRING_PROMPT_REPLACE_CURRENT,tmpStr,250); save = AOut::MyMessageBox( tmpStr, MB_OKCANCEL|MB_ICONQUESTION, parentWnd); } else { // otherwise, prompt the user if he wants to overwrite the settings TCHAR tmpStr[250]; ::LoadString(AOut::GetInstance(),IDS_STRING_PROMPT_REPLACE_SETING,tmpStr,250); TCHAR tmpDsp[500]; wsprintf(tmpDsp,tmpStr,string); save = AOut::MyMessageBox( tmpDsp, MB_YESNOCANCEL|MB_ICONQUESTION, parentWnd); } if (save == IDCANCEL) bShouldEnd = false; else if (save == IDNO) { // save the values in 'current' UpdateValueFromDlg(parentWnd); SaveValuesToStringKey("Current"); SelectSavedParams("Current"); } else { // do so and save in XML UpdateValueFromDlg(parentWnd); SaveValuesToStringKey(string); } } */ //#endif // OLD my_debug.OutPut("before : nChannelIndex %d, bCRC %d, bCopyright %d, bOriginal %d, bPrivate %d",nChannelIndex, bCRC, bCopyright, bOriginal, bPrivate); my_debug.OutPut("call UpdateValueFromDlg"); UpdateValueFromDlg(parentWnd); my_debug.OutPut("call SaveValuesToStringKey"); SaveValuesToStringKey("Current"); // only Current config is supported now // SaveParams(parentWnd); //my_debug.OutPut("call SelectSavedParams"); // SelectSavedParams(string); // UpdateDlgFromValue(parentWnd); my_debug.OutPut("finished saving"); if (bShouldEnd) { RemoveProp(parentWnd, "AEncodeProperties-Config"); EndDialog(parentWnd, true); } } break; case IDCANCEL: RemoveProp(parentWnd, "AEncodeProperties-Config"); EndDialog(parentWnd, false); break; /* case IDC_FIND_DLL: { OPENFILENAME file; char DllLocation[512]; wsprintf(DllLocation,"%s",GetDllLocation()); memset(&file, 0, sizeof(file)); file.lStructSize = sizeof(file); file.hwndOwner = parentWnd; file.Flags = OFN_FILEMUSTEXIST | OFN_NODEREFERENCELINKS | OFN_ENABLEHOOK | OFN_EXPLORER ; /// file.lpstrFile = AOut::the_AOut->DllLocation; file.lpstrFile = DllLocation; file.lpstrFilter = "Lame DLL (lame_enc.dll)\0LAME_ENC.DLL\0DLL (*.dll)\0*.DLL\0All (*.*)\0*.*\0"; file.nFilterIndex = 1; file.nMaxFile = sizeof(DllLocation); file.lpfnHook = DLLFindCallback; // use to validate the DLL chosen GetOpenFileName(&file); SetDllLocation(DllLocation); // use this filename if necessary } break; */ /* case IDC_BUTTON_OUTPUT: { #ifndef SIMPLE_FOLDER BROWSEINFO info; memset(&info,0,sizeof(info)); char FolderName[MAX_PATH]; info.hwndOwner = parentWnd; info.pszDisplayName = FolderName; info.lpfn = BrowseFolderCallbackroc; info.lParam = (LPARAM) this; // get the localised window title TCHAR output[250]; ::LoadString(AOut::GetInstance(),IDS_STRING_DIR_SELECT,output,250); info.lpszTitle = output; #ifdef BIF_EDITBOX info.ulFlags |= BIF_EDITBOX; #else // BIF_EDITBOX info.ulFlags |= 0x0010; #endif // BIF_EDITBOX #ifdef BIF_VALIDATE info.ulFlags |= BIF_VALIDATE; #else // BIF_VALIDATE info.ulFlags |= 0x0020; #endif // BIF_VALIDATE #ifdef BIF_NEWDIALOGSTYLE info.ulFlags |= BIF_NEWDIALOGSTYLE; #else // BIF_NEWDIALOGSTYLE info.ulFlags |= 0x0040; #endif // BIF_NEWDIALOGSTYLE ITEMIDLIST *item = SHBrowseForFolder(&info); if (item != NULL) { char tmpOutputDir[MAX_PATH]; wsprintf(tmpOutputDir,"%s",GetOutputDirectory()); SHGetPathFromIDList( item,tmpOutputDir ); SetOutputDirectory( tmpOutputDir ); ::SetWindowText(GetDlgItem( parentWnd, IDC_EDIT_OUTPUTDIR), tmpOutputDir); // wsprintf(OutputDir,FolderName); } #else // SIMPLE_FOLDER OPENFILENAME file; memset(&file, 0, sizeof(file)); file.lStructSize = sizeof(file); file.hwndOwner = parentWnd; file.Flags = OFN_FILEMUSTEXIST | OFN_NODEREFERENCELINKS | OFN_ENABLEHOOK | OFN_EXPLORER ; // file.lpstrFile = GetDllLocation(); // file.lpstrFile = GetOutputDirectory(); file.lpstrInitialDir = GetOutputDirectory(); file.lpstrFilter = "A Directory\0.*\0"; // file.nFilterIndex = 1; file.nMaxFile = MAX_PATH; // file.lpfnHook = DLLFindCallback; // use to validate the DLL chosen // file.Flags = OFN_ENABLESIZING | OFN_NOREADONLYRETURN | OFN_HIDEREADONLY; file.Flags = OFN_NOREADONLYRETURN | OFN_HIDEREADONLY | OFN_EXPLORER; TCHAR output[250]; ::LoadString(AOut::GetInstance(),IDS_STRING_DIR_SELECT,output,250); file.lpstrTitle = output; GetSaveFileName(&file); #endif // SIMPLE_FOLDER } break; */ case IDC_CHECK_ENC_ABR: EnableAbrOptions(parentWnd, ::IsDlgButtonChecked( parentWnd, IDC_CHECK_ENC_ABR) == BST_CHECKED); break; /* case IDC_RADIO_BITRATE_CBR: AEncodeProperties::DisplayVbrOptions(parentWnd, AEncodeProperties::BR_CBR); break; case IDC_RADIO_BITRATE_VBR: AEncodeProperties::DisplayVbrOptions(parentWnd, AEncodeProperties::BR_VBR); break; case IDC_RADIO_BITRATE_ABR: AEncodeProperties::DisplayVbrOptions(parentWnd, AEncodeProperties::BR_ABR); break; case IDC_CHECK_RESAMPLE: { bool tmp_bResampleUsed = (::IsDlgButtonChecked( parentWnd, IDC_CHECK_RESAMPLE) == BST_CHECKED); if (tmp_bResampleUsed) { ::EnableWindow(::GetDlgItem(parentWnd,IDC_COMBO_SAMPLEFREQ), TRUE); } else { ::EnableWindow(::GetDlgItem(parentWnd,IDC_COMBO_SAMPLEFREQ), FALSE); } } break; */ /* case IDC_COMBO_SETTINGS: // if (CBN_SELCHANGE == GET_WM_COMMAND_CMD(wParam, lParam)) if (CBN_SELENDOK == GET_WM_COMMAND_CMD(wParam, lParam)) { char string[MAX_PATH]; int nIdx = SendMessage(HWND(lParam), CB_GETCURSEL, NULL, NULL); SendMessage(HWND(lParam), CB_GETLBTEXT , nIdx, (LPARAM) string); // get the info corresponding to the new selected item SelectSavedParams(string); UpdateDlgFromValue(parentWnd); } break; */ /* case IDC_BUTTON_CONFIG_SAVE: { // save the data in the current config char string[MAX_PATH]; ::GetWindowText(::GetDlgItem( parentWnd, IDC_COMBO_SETTINGS), string, MAX_PATH); UpdateValueFromDlg(parentWnd); SaveValuesToStringKey(string); SelectSavedParams(string); UpdateConfigs(parentWnd); UpdateDlgFromValue(parentWnd); } break; case IDC_BUTTON_CONFIG_RENAME: { char string[MAX_PATH]; ::GetWindowText(::GetDlgItem( parentWnd, IDC_COMBO_SETTINGS), string, MAX_PATH); if (RenameCurrentTo(string)) { // Update the names displayed UpdateConfigs(parentWnd); } } break; case IDC_BUTTON_CONFIG_DELETE: { char string[MAX_PATH]; ::GetWindowText(::GetDlgItem( parentWnd, IDC_COMBO_SETTINGS), string, MAX_PATH); if (DeleteConfig(string)) { // Update the names displayed UpdateConfigs(parentWnd); UpdateDlgFromValue(parentWnd); } } break; */ } return FALSE; } bool AEncodeProperties::RenameCurrentTo(const std::string & new_config_name) { bool bResult = false; // display all the names of the saved configs // get the values from the saved file if possible if (my_stored_data.LoadFile(my_store_location)) { TiXmlNode* node; node = my_stored_data.FirstChild("lame_acm"); TiXmlElement* CurrentNode = node->FirstChildElement("encodings"); if (CurrentNode->Attribute("default") != NULL) { std::string CurrentConfigName = *CurrentNode->Attribute("default"); // no rename possible for Current if (CurrentConfigName == "") { bResult = true; } else if (CurrentConfigName != "Current") { // find the config that correspond to CurrentConfig TiXmlElement* iterateElmt = CurrentNode->FirstChildElement("config"); // int Idx = 0; while (iterateElmt != NULL) { const std::string * tmpname = iterateElmt->Attribute("name"); /** \todo support language names */ if (tmpname != NULL) { if (tmpname->compare(CurrentConfigName) == 0) { iterateElmt->SetAttribute("name",new_config_name); bResult = true; break; } } // Idx++; iterateElmt = iterateElmt->NextSiblingElement("config"); } } if (bResult) { CurrentNode->SetAttribute("default",new_config_name); my_stored_data.SaveFile(my_store_location); } } } return bResult; } bool AEncodeProperties::DeleteConfig(const std::string & config_name) { bool bResult = false; if (config_name != "Current") { // display all the names of the saved configs // get the values from the saved file if possible if (my_stored_data.LoadFile(my_store_location)) { TiXmlNode* node; node = my_stored_data.FirstChild("lame_acm"); TiXmlElement* CurrentNode = node->FirstChildElement("encodings"); TiXmlElement* iterateElmt = CurrentNode->FirstChildElement("config"); // int Idx = 0; while (iterateElmt != NULL) { const std::string * tmpname = iterateElmt->Attribute("name"); /** \todo support language names */ if (tmpname != NULL) { if (tmpname->compare(config_name) == 0) { CurrentNode->RemoveChild(iterateElmt); bResult = true; break; } } // Idx++; iterateElmt = iterateElmt->NextSiblingElement("config"); } } if (bResult) { my_stored_data.SaveFile(my_store_location); // select a new default config : "Current" SelectSavedParams("Current"); } } return bResult; } void AEncodeProperties::UpdateConfigs(const HWND HwndDlg) { // Add User configs // SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_SETTINGS), CB_RESETCONTENT , NULL, NULL); // display all the names of the saved configs // get the values from the saved file if possible if (my_stored_data.LoadFile(my_store_location)) { TiXmlNode* node; node = my_stored_data.FirstChild("lame_acm"); TiXmlElement* CurrentNode = node->FirstChildElement("encodings"); std::string CurrentConfig = ""; if (CurrentNode->Attribute("default") != NULL) { CurrentConfig = *CurrentNode->Attribute("default"); } TiXmlElement* iterateElmt; my_debug.OutPut("are we here ?"); // find the config that correspond to CurrentConfig iterateElmt = CurrentNode->FirstChildElement("config"); int Idx = 0; while (iterateElmt != NULL) { const std::string * tmpname = iterateElmt->Attribute("name"); /** \todo support language names */ if (tmpname != NULL) { // SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_SETTINGS), CB_ADDSTRING, NULL, (LPARAM) tmpname->c_str()); if (tmpname->compare(CurrentConfig) == 0) { // SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_SETTINGS), CB_SETCURSEL, Idx, NULL); SelectSavedParams(*tmpname); UpdateDlgFromValue(HwndDlg); } } my_debug.OutPut("Idx = %d",Idx); Idx++; // only Current config supported now // iterateElmt = iterateElmt->NextSiblingElement("config"); iterateElmt = NULL; my_debug.OutPut("iterateElmt = 0x%08X",iterateElmt); } } } /* void AEncodeProperties::UpdateAbrSteps(unsigned int min, unsigned int max, unsigned int step) const { } */ void AEncodeProperties::UpdateDlgFromSlides(HWND hwndDlg) const { UINT value_min, value_max, value_step, value; char tmp[4]; value_min = SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_MIN), TBM_GETPOS, NULL, NULL); value_max = SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_MAX), TBM_GETPOS, NULL, NULL); if (value_min>value_max) { SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_MIN), TBM_SETPOS, TRUE, value_max); UpdateDlgFromSlides(hwndDlg); return; } if (value_max=value_min;i-=value_step) { SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_SAMPLE), TBM_SETTIC, 0, i); } SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_SAMPLE), TBM_SETLINESIZE, 0, value_step); SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_SAMPLE), TBM_SETPAGESIZE, 0, value_step); value = SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_SAMPLE), TBM_GETPOS, NULL, NULL); wsprintf(tmp,"%3d",value); ::SetWindowText(GetDlgItem( hwndDlg, IDC_STATIC_AVERAGE_SAMPLE_VALUE), tmp); } void AEncodeProperties::EnableAbrOptions(HWND hDialog, bool enable) { ::EnableWindow(::GetDlgItem( hDialog, IDC_SLIDER_AVERAGE_MIN), enable); ::EnableWindow(::GetDlgItem( hDialog, IDC_SLIDER_AVERAGE_MAX), enable); ::EnableWindow(::GetDlgItem( hDialog, IDC_SLIDER_AVERAGE_STEP), enable); ::EnableWindow(::GetDlgItem( hDialog, IDC_SLIDER_AVERAGE_SAMPLE), enable); ::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_AVERAGE_MIN), enable); ::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_AVERAGE_MAX), enable); ::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_AVERAGE_STEP), enable); ::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_AVERAGE_SAMPLE), enable); ::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_AVERAGE_MIN_VALUE), enable); ::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_AVERAGE_MAX_VALUE), enable); ::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_AVERAGE_STEP_VALUE), enable); ::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_AVERAGE_SAMPLE_VALUE), enable); } lame-svn-r6525-trunk-lame/ACM/AEncodeProperties.h0000644000175000017500000003245607454045067021031 0ustar fabianfabian/** * * Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows * * Copyright (c) 2002 Steve Lhomme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*! \author Steve Lhomme \version \$Id$ */ #if !defined(_AENCODEPROPERTIES_H__INCLUDED_) #define _AENCODEPROPERTIES_H__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include #include #include "ADbg/ADbg.h" //#include "BladeMP3EncDLL.h" #include "tinyxml/tinyxml.h" //#include "AParameters/AParameters.h" typedef const struct { UINT id; const char *tip; } ToolTipItem; /** \class AEncodeProperties \brief the AEncodeProperties class is responsible for handling all the encoding properties */ class AEncodeProperties { public: /** \brief default constructor \param the windows module with which you can retrieve many informations */ AEncodeProperties(HMODULE hModule); /** \brief default destructor */ virtual ~AEncodeProperties() {} /** \enum BRMode \brief A bitrate mode (CBR, VBR, ABR) */ enum BRMode { BR_CBR, BR_VBR, BR_ABR }; /** \brief Handle all the commands that occur in the Config dialog box */ bool HandleDialogCommand(const HWND parentWnd, const WPARAM wParam, const LPARAM lParam); /** \brief check wether 2 instances are equal, ie have the same encoding parameters */ bool operator != (const AEncodeProperties & the_instance) const; /** \brief Check wether the Encode process should use the Copyright bit */ inline const bool GetCopyrightMode() const { return bCopyright; } /** \brief Check wether the Encode process should use the CRC bit */ inline const bool GetCRCMode() const { return bCRC; } /** \brief Check wether the Encode process should use the Original bit */ inline const bool GetOriginalMode() const { return bOriginal; } /** \brief Check wether the Encode process should use the Private bit */ inline const bool GetPrivateMode() const { return bPrivate; } /** \brief Check wether the Encode process should use the Smart Bitrate output */ inline const bool GetSmartOutputMode() const { return bSmartOutput; } /** \brief Check wether the Encode process should allow Average Bitrate output */ inline const bool GetAbrOutputMode() const { return bAbrOutput; } /** \brief Check wether the Encode process shouldn't use the Bit Reservoir */ inline const bool GetNoBiResMode() const { return bNoBitRes; } /** \brief Check wether the Encode process should force the channel mode (stereo or mono resampling) */ inline const bool GetForceChannelMode() const { return bForceChannel; } /** \brief Check wether the Encode process should use the VBR mode */ inline const BRMode GetVBRUseMode() const { return mBRmode; } /** \brief Check wether the Encode process should use the Xing frame in the VBR mode \note the Xing frame is a silent frame at the beginning that contain VBR statistics about the file. */ inline const bool GetXingFrameMode() const { return bXingFrame; } /** \brief Check wether the Encode process should resample before encoding */ inline const bool GetResampleMode() const { return bResample; } /** \brief Set wether the Encode process should use the Copyright bit */ inline void SetCopyrightMode(const bool bMode) { bCopyright = bMode; } /** \brief Set wether the Encode process should use the CRC bit */ inline void SetCRCMode(const bool bMode) { bCRC = bMode; } /** \brief Set wether the Encode process should use the Original bit */ inline void SetOriginalMode(const bool bMode) { bOriginal = bMode; } /** \brief Set wether the Encode process should use the Private bit */ inline void SetPrivateMode(const bool bMode) { bPrivate = bMode; } /** \brief Set wether the Encode process should use the Smart Bitrate output */ inline void SetSmartOutputMode(const bool bMode) { bSmartOutput = bMode; } /** \brief Set wether the Encode process should use the Average Bitrate output */ inline void SetAbrOutputMode(const bool bMode) { bAbrOutput = bMode; } /** \brief Set wether the Encode process shouldn't use the Bit Reservoir */ inline void SetNoBiResMode(const bool bMode) { bNoBitRes = bMode; } /** \brief Set wether the Encode process should force the channel mode (stereo or mono resampling) */ inline void SetForceChannelMode(const bool bMode) { bForceChannel = bMode; } /** \brief Set wether the Encode process should use the VBR mode */ inline void SetVBRUseMode(const BRMode mode) { mBRmode = mode; } /** \brief Set wether the Encode process should use the Xing frame in the VBR mode \note the Xing frame is a silent frame at the beginning that contain VBR statistics about the file. */ inline void SetXingFrameMode(const bool bMode) { bXingFrame = bMode; } /** \brief CBR : Get the bitrate to use / VBR : Get the minimum bitrate value */ const unsigned int GetBitrateValue() const; /** \brief Get the current (VBR:min) bitrate for the specified MPEG version \param bitrate the data that will be filled with the bitrate \param MPEG_Version The MPEG version (MPEG1 or MPEG2) \return 0 if the bitrate is not found, 1 if the bitrate is found */ const int GetBitrateValue(DWORD & bitrate, const DWORD MPEG_Version) const; /** \brief Get the current (VBR:min) bitrate for MPEG I \param bitrate the data that will be filled with the bitrate \return 0 if the bitrate is not found, 1 if the bitrate is found */ const int GetBitrateValueMPEG1(DWORD & bitrate) const; /** \brief Get the current (VBR:min) bitrate for MPEG II \param bitrate the data that will be filled with the bitrate \return 0 if the bitrate is not found, 1 if the bitrate is found */ const int GetBitrateValueMPEG2(DWORD & bitrate) const; /** \brief Get the current (VBR:min) bitrate in the form of a string \param string the string that will be filled \param string_size the size of the string \return -1 if the bitrate is not found, and the number of char copied otherwise */ inline const int GetBitrateString(char * string, int string_size) const {return GetBitrateString(string,string_size,nMinBitrateIndex); } /** \brief Get the (VBR:min) bitrate corresponding to the specified index in the form of a string \param string the string that will be filled \param string_size the size of the string \param a_bitrateID the index in the Bitrate table \return -1 if the bitrate is not found, and the number of char copied otherwise */ const int GetBitrateString(char * string, int string_size, int a_bitrateID) const; /** \brief Get the number of possible bitrates */ inline const int GetBitrateLentgh() const { return sizeof(the_Bitrates) / sizeof(unsigned int); } /** \brief Get the number of possible sampling frequencies */ inline const unsigned int GetResampleFreq() const { return the_SamplingFreqs[nSamplingFreqIndex]; } /** \brief Get the max compression ratio allowed (1:15 default) */ inline double GetSmartRatio() const { return SmartRatioMax;} /** \brief Get the min ABR bitrate possible */ inline unsigned int GetAbrBitrateMin() const { return AverageBitrate_Min;} /** \brief Get the max ABR bitrate possible */ inline unsigned int GetAbrBitrateMax() const { return AverageBitrate_Max;} /** \brief Get the step between ABR bitrates */ inline unsigned int GetAbrBitrateStep() const { return AverageBitrate_Step;} /** \brief Get the VBR attributes for a specified MPEG version \param MaxBitrate receive the maximum bitrate possible in the VBR mode \param Quality receive the quality value (0 to 9 see Lame doc for more info) \param VBRHeader receive the value that indicates wether the VBR/Xing header should be filled \param MPEG_Version The MPEG version (MPEG1 or MPEG2) \return the VBR mode (Old, New, ABR, MTRH, Default or None) */ // VBRMETHOD GetVBRValue(DWORD & MaxBitrate, int & Quality, DWORD & AbrBitrate, BOOL & VBRHeader, const DWORD MPEG_Version) const; /** \brief Get the Lame DLL Location */ // const char * GetDllLocation() const { return DllLocation.c_str(); } /** \brief Set the Lame DLL Location */ // void SetDllLocation( const char * the_string ) { DllLocation = the_string; } /** \brief Get the output directory for encoding */ // const char * GetOutputDirectory() const { return OutputDir.c_str(); } /** \brief Set the output directory for encoding */ // void SetOutputDirectory( const char * the_string ) { OutputDir = the_string; } /** \brief Get the current channel mode to use */ const unsigned int GetChannelModeValue() const; /** \brief Get the current channel mode in the form of a string */ inline const char * GetChannelModeString() const {return GetChannelModeString(nChannelIndex); } /** \brief Get the channel mode in the form of a string for the specified Channel mode index \param a_channelID the Channel mode index (see GetChannelLentgh()) */ const char * GetChannelModeString(const int a_channelID) const; /** \brief Get the number of possible channel mode */ inline const int GetChannelLentgh() const { return 3; } /** \brief Get the current preset to use, see lame documentation/code for more info on the possible presets */ // const LAME_QUALTIY_PRESET GetPresetModeValue() const; /** \brief Get the preset in the form of a string for the specified Channel mode index \param a_presetID the preset index (see GetPresetLentgh()) */ const char * GetPresetModeString(const int a_presetID) const; /** \brief Get the number of possible presets */ // inline const int GetPresetLentgh() const { return sizeof(the_Presets) / sizeof(LAME_QUALTIY_PRESET); } /** \brief Start the user configuration process (called by AOut::config()) */ bool Config(const HINSTANCE hInstance, const HWND HwndParent); /** \brief Init the config dialog box with the right texts and choices */ bool InitConfigDlg(HWND hDialog); /** \brief Update the instance parameters from the config dialog box */ bool UpdateValueFromDlg(HWND hDialog); /** \brief Update the config dialog box from the instance parameters */ bool UpdateDlgFromValue(HWND hDialog); /** \brief Update the config dialog box with the BitRate mode */ static void DisplayVbrOptions(const HWND hDialog, const BRMode the_mode); /** \brief Handle the saving of parameters when something has changed in the config dialog box */ void SaveParams(const HWND hDialog); /** \brief Save the current parameters (current config in use) */ void ParamsSave(void); /** \brief Load the parameters (current config in use) */ void ParamsRestore(void); /** \brief Select the specified config name as the new default one */ void SelectSavedParams(const std::string config_name); /** \brief Save the current parameters to the specified config name */ void SaveValuesToStringKey(const std::string & config_name); /** \brief Rename the current config name to something else */ bool RenameCurrentTo(const std::string & new_config_name); /** \brief Delete the config name from the saved configs */ bool DeleteConfig(const std::string & config_name); ADbg my_debug; /** \brief Update the slides value (on scroll) */ void UpdateDlgFromSlides(HWND parent_window) const; static ToolTipItem Tooltips[13]; private: bool bCopyright; bool bCRC; bool bOriginal; bool bPrivate; bool bNoBitRes; BRMode mBRmode; bool bXingFrame; bool bForceChannel; bool bResample; bool bSmartOutput; bool bAbrOutput; int VbrQuality; unsigned int AverageBitrate_Min; unsigned int AverageBitrate_Max; unsigned int AverageBitrate_Step; double SmartRatioMax; static const unsigned int the_ChannelModes[3]; int nChannelIndex; static const unsigned int the_Bitrates[18]; static const unsigned int the_MPEG1_Bitrates[14]; static const unsigned int the_MPEG2_Bitrates[14]; int nMinBitrateIndex; // CBR and VBR int nMaxBitrateIndex; // only used in VBR mode static const unsigned int the_SamplingFreqs[9]; int nSamplingFreqIndex; // static const LAME_QUALTIY_PRESET the_Presets[17]; int nPresetIndex; // char DllLocation[512]; // std::string DllLocation; // char OutputDir[MAX_PATH]; // std::string OutputDir; // AParameters my_base_parameters; TiXmlDocument my_stored_data; std::string my_store_location; std::string my_current_config; // HINSTANCE hDllInstance; void SaveValuesToElement(TiXmlElement * the_element) const; inline void SetAttributeBool(TiXmlElement * the_elt,const std::string & the_string, const bool the_value) const; void UpdateConfigs(const HWND HwndDlg); void EnableAbrOptions(HWND hDialog, bool enable); HMODULE my_hModule; /** \brief \param config_name \param parentNode */ void GetValuesFromKey(const std::string & config_name, const TiXmlNode & parentNode); }; #endif // !defined(_AENCODEPROPERTIES_H__INCLUDED_) lame-svn-r6525-trunk-lame/ACM/acm.rc0000644000175000017500000001567113717230716016367 0ustar fabianfabian//Microsoft Developer Studio generated resource script. // #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #include "afxres.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // Französisch (Frankreich) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) #ifdef _WIN32 LANGUAGE LANG_FRENCH, SUBLANG_FRENCH #pragma code_page(1252) #endif //_WIN32 #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // TEXTINCLUDE // 1 TEXTINCLUDE DISCARDABLE BEGIN "resource.h\0" END 2 TEXTINCLUDE DISCARDABLE BEGIN "#include ""afxres.h""\r\n" "\0" END 3 TEXTINCLUDE DISCARDABLE BEGIN "\r\n" "\0" END #endif // APSTUDIO_INVOKED #ifndef _MAC ///////////////////////////////////////////////////////////////////////////// // // Version // VS_VERSION_INFO VERSIONINFO FILEVERSION 0,9,1,0 PRODUCTVERSION 0,9,1,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x4L FILETYPE 0x3L FILESUBTYPE 0x8L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" BEGIN VALUE "Comments", "This is an ACM driver for Win32 using Lame to encode\0" VALUE "CompanyName", "https://lame.sourceforge.io/\0" VALUE "FileDescription", "Lame MP3 codec engine\0" VALUE "FileVersion", "0.9.2\0" VALUE "InternalName", "lameACM\0" VALUE "LegalCopyright", "Copyright © 2002 Steve Lhomme, Copyright © 2002-2007 The LAME Project\0" VALUE "LegalTrademarks", "LGPL (see gnu.org)\0" VALUE "OriginalFilename", "lameACM.acm\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "Lame MP3 codec\0" VALUE "ProductVersion", "0.9.2\0" VALUE "SpecialBuild", "\0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 END END #endif // !_MAC ///////////////////////////////////////////////////////////////////////////// // // Icon // // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. IDI_ICON ICON DISCARDABLE "lame.ico" ///////////////////////////////////////////////////////////////////////////// // // Dialog // IDD_CONFIG DIALOGEX 0, 0, 231, 204 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Lame MP3 codec : About" FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN DEFPUSHBUTTON "OK",IDOK,65,183,50,14 PUSHBUTTON "Cancel",IDCANCEL,125,183,50,14 GROUPBOX "Encoding",IDC_STATIC,7,7,142,166 GROUPBOX "Decoding",IDC_STATIC_DECODING,154,7,70,113,WS_DISABLED GROUPBOX "Bits",IDC_STATIC,16,121,124,42 CONTROL "Copyright",IDC_CHECK_COPYRIGHT,"Button",BS_AUTOCHECKBOX | BS_FLAT | WS_GROUP | WS_TABSTOP,23,132,45,10 CONTROL "Checksum",IDC_CHECK_CHECKSUM,"Button",BS_AUTOCHECKBOX | BS_FLAT | WS_GROUP | WS_TABSTOP,84,132,49,10 CONTROL "Original",IDC_CHECK_ORIGINAL,"Button",BS_AUTOCHECKBOX | BS_FLAT | WS_GROUP | WS_TABSTOP,23,148,39,10 CONTROL "Private",IDC_CHECK_PRIVATE,"Button",BS_AUTOCHECKBOX | BS_FLAT | WS_GROUP | WS_TABSTOP,84,148,38,10 COMBOBOX IDC_COMBO_ENC_STEREO,70,21,60,53,CBS_DROPDOWNLIST | WS_VSCROLL | WS_GROUP | WS_TABSTOP LTEXT "Stereo mode",IDC_STATIC,23,24,41,8 CONTROL "Smart Encode",IDC_CHECK_ENC_SMART,"Button", BS_AUTOCHECKBOX | BS_FLAT | WS_GROUP | WS_TABSTOP,49,39, 61,10 ICON IDI_ICON,IDC_STATIC_ENC_ICON,179,129,20,20 CTEXT "v0.0.0 - 0.00",IDC_STATIC_CONFIG_VERSION,168,155,43,17 CONTROL "Average BitRate",IDC_CHECK_ENC_ABR,"Button", BS_AUTOCHECKBOX | BS_FLAT | WS_GROUP | WS_TABSTOP,49,53, 68,10 LTEXT "Min",IDC_STATIC_AVERAGE_MIN,19,67,12,8 LTEXT "Max",IDC_STATIC_AVERAGE_MAX,17,79,14,8 LTEXT "Step",IDC_STATIC_AVERAGE_STEP,15,91,16,8 LTEXT "test",IDC_STATIC_AVERAGE_SAMPLE,19,105,12,8 CONTROL "Slider2",IDC_SLIDER_AVERAGE_MIN,"msctls_trackbar32", TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | WS_GROUP | WS_TABSTOP,33,67,92,11 CONTROL "Slider3",IDC_SLIDER_AVERAGE_MAX,"msctls_trackbar32", TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | WS_GROUP | WS_TABSTOP,33,79,92,11 CONTROL "Slider1",IDC_SLIDER_AVERAGE_STEP,"msctls_trackbar32", TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | WS_GROUP | WS_TABSTOP,33,91,92,11 CONTROL "Slider4",IDC_SLIDER_AVERAGE_SAMPLE,"msctls_trackbar32", WS_TABSTOP,33,104,92,12 CTEXT "000",IDC_STATIC_AVERAGE_SAMPLE_VALUE,125,105,15,9,0, WS_EX_STATICEDGE CTEXT "000",IDC_STATIC_AVERAGE_STEP_VALUE,125,92,15,9,0, WS_EX_STATICEDGE CTEXT "000",IDC_STATIC_AVERAGE_MAX_VALUE,125,80,15,9,0, WS_EX_STATICEDGE CTEXT "000",IDC_STATIC_AVERAGE_MIN_VALUE,125,67,15,9,0, WS_EX_STATICEDGE END IDD_ABOUT DIALOG DISCARDABLE 0, 0, 187, 77 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Lame MP3 codec : About" FONT 8, "MS Sans Serif" BEGIN DEFPUSHBUTTON "OK",IDOK,130,56,50,14 LTEXT "Steve Lhomme + LAME developers",IDC_STATIC,7,33,112,8 LTEXT "LGPL license",IDC_STATIC,7,20,43,8 ICON IDI_ICON,IDC_STATIC,145,16,20,20 LTEXT "Static",IDC_STATIC_ABOUT_TITLE,7,7,173,8 LTEXT "https://lame.sourceforge.io/",IDC_STATIC_ABOUT_URL,7,47,80,8 LTEXT "icon : Lucas Granito",IDC_STATIC,7,61,64,8 END ///////////////////////////////////////////////////////////////////////////// // // DESIGNINFO // #ifdef APSTUDIO_INVOKED GUIDELINES DESIGNINFO DISCARDABLE BEGIN IDD_CONFIG, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 224 TOPMARGIN, 7 BOTTOMMARGIN, 197 END IDD_ABOUT, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 180 TOPMARGIN, 7 BOTTOMMARGIN, 70 END END #endif // APSTUDIO_INVOKED #endif // Französisch (Frankreich) resources ///////////////////////////////////////////////////////////////////////////// #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. // ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED lame-svn-r6525-trunk-lame/ACM/DecodeStream.h0000644000175000017500000000425410544042236017775 0ustar fabianfabian/** * * Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows * * Copyright (c) 2002 Steve Lhomme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*! \author Steve Lhomme \version \$Id$ */ #if !defined(_DECODESTREAM_H__INCLUDED_) #define _DECODESTREAM_H__INCLUDED_ #if _MSC_VER >= 1000 #pragma once #endif // _MSC_VER >= 1000 #include #include #include #include "ADbg/ADbg.h" struct lame_global_flags; class DecodeStream { public: DecodeStream( ); virtual ~DecodeStream( ); static DecodeStream * Create(); static const bool Erase(const DecodeStream * a_ACMStream); bool init(const int nSamplesPerSec, const int nChannels, const int nAvgBytesPerSec, const int nSourceBitrate); bool open(); bool close(LPBYTE pOutputBuffer, DWORD *pOutputSize); DWORD GetOutputSizeForInput(const DWORD the_SrcLength) const; bool ConvertBuffer(LPACMDRVSTREAMHEADER a_StreamHeader); static unsigned int GetOutputSampleRate(int samples_per_sec, int bitrate, int channels); protected: lame_global_flags * gfp; ADbg * my_debug; int my_SamplesPerSec; int my_Channels; int my_AvgBytesPerSec; DWORD my_SamplesPerBlock; int my_SourceBitrate; MPSTR my_DecodeData; unsigned int m_WorkingBufferUseSize; char m_WorkingBuffer[2304*2]; // should be at least twice my_SamplesPerBlock inline int GetBytesPerBlock(DWORD bytes_per_sec, DWORD samples_per_sec, int BlockAlign) const; }; #endif // !defined(_DECODESTREAM_H__INCLUDED_) lame-svn-r6525-trunk-lame/ACM/main.cpp0000644000175000017500000001115110544042236016707 0ustar fabianfabian/** * * Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows * * Copyright (c) 2002 Steve Lhomme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*! \author Steve Lhomme \version \$Id$ */ #if !defined(STRICT) #define STRICT #endif // STRICT #include /// The ACM is considered as a driver and run in Kernel-Mode /// So the new/delete operators have to be overriden in order to use memory /// readable out of the calling process void * operator new( unsigned int cb ) { return LocalAlloc(LPTR, cb); // VirtualAlloc } void operator delete(void *block) { LocalFree(block); } extern "C" { void *acm_Calloc( size_t num, size_t size ) { return LocalAlloc(LPTR, num * size); // VirtualAlloc } void *acm_Malloc( size_t size ) { return LocalAlloc(LPTR, size); // VirtualAlloc } void acm_Free( void * mem) { LocalFree(mem); } }; ////// End of memory instrumentation #include #include #include #include #include "AEncodeProperties.h" #include "ACM.h" #include "resource.h" #include "adebug.h" ADbg * debug = NULL; LONG WINAPI DriverProc(DWORD dwDriverId, HDRVR hdrvr, UINT msg, LONG lParam1, LONG lParam2) { switch (msg) { case DRV_OPEN: // acmDriverOpen { if (debug == NULL) { debug = new ADbg(DEBUG_LEVEL_CREATION); debug->setPrefix("LAMEdrv"); } if (debug != NULL) { // Sent when the driver is opened. if (lParam2 != NULL) debug->OutPut(DEBUG_LEVEL_MSG, "DRV_OPEN (ID 0x%08X), pDesc = 0x%08X",dwDriverId,lParam2); else debug->OutPut(DEBUG_LEVEL_MSG, "DRV_OPEN (ID 0x%08X), pDesc = NULL",dwDriverId); } if (lParam2 != NULL) { LPACMDRVOPENDESC pDesc = (LPACMDRVOPENDESC)lParam2; if (pDesc->fccType != ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC) { if (debug != NULL) { debug->OutPut(DEBUG_LEVEL_FUNC_CODE, "wrong pDesc->fccType (0x%08X)",pDesc->fccType); } return NULL; } } else { if (debug != NULL) { debug->OutPut(DEBUG_LEVEL_FUNC_CODE, "pDesc == NULL"); } } ACM * ThisACM = new ACM(GetDriverModuleHandle(hdrvr)); if (debug != NULL) { debug->OutPut(DEBUG_LEVEL_FUNC_CODE, "OPENED instance 0x%08X",ThisACM); } return (LONG)ThisACM;// returns 0L to fail // value subsequently used // for dwDriverId. } break; case DRV_CLOSE: // acmDriverClose { if (debug != NULL) { // Sent when the driver is closed. Drivers are // unloaded when the open count reaches zero. debug->OutPut(DEBUG_LEVEL_MSG, "DRV_CLOSE"); } ACM * ThisACM = (ACM *)dwDriverId; delete ThisACM; if (debug != NULL) { debug->OutPut(DEBUG_LEVEL_FUNC_CODE, "CLOSED instance 0x%08X",ThisACM); delete debug; debug = NULL; } return 1L; // returns 0L to fail } break; case DRV_LOAD: { // nothing to do if (debug != NULL) { // debug->OutPut(DEBUG_LEVEL_MSG, "DRV_LOAD, version %s %s %s", ACM_VERSION, __DATE__, __TIME__); debug->OutPut(DEBUG_LEVEL_MSG, "DRV_LOAD, %s %s", __DATE__, __TIME__); } return 1L; } break; case DRV_ENABLE: { // nothing to do if (debug != NULL) { debug->OutPut(DEBUG_LEVEL_MSG, "DRV_ENABLE"); } return 1L; } break; case DRV_DISABLE: { // nothing to do if (debug != NULL) { debug->OutPut(DEBUG_LEVEL_MSG, "DRV_DISABLE"); } return 1L; } break; case DRV_FREE: { if (debug != NULL) { debug->OutPut(DEBUG_LEVEL_MSG, "DRV_FREE"); } return 1L; } break; default: { ACM * ThisACM = (ACM *)dwDriverId; if (ThisACM != NULL) return ThisACM->DriverProcedure(hdrvr, msg, lParam1, lParam2); else { if (debug != NULL) { debug->OutPut(DEBUG_LEVEL_MSG, "Driver not opened, unknown message (0x%08X), lParam1 = 0x%08X, lParam2 = 0x%08X", msg, lParam1, lParam2); } return DefDriverProc (dwDriverId, hdrvr, msg, lParam1, lParam2); } } break; } } lame-svn-r6525-trunk-lame/ACM/ADbg/0000755000175000017500000000000015140361504016054 5ustar fabianfabianlame-svn-r6525-trunk-lame/ACM/ADbg/ADbg.h0000644000175000017500000000662207424315050017031 0ustar fabianfabian/************************************************************************ Project : C++ debugging class File version : 0.4 BSD License post 1999 : Copyright (c) 2001, Steve Lhomme All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ************************************************************************/ #if !defined(_DBG_H__INCLUDED_) #define _DBG_H__INCLUDED_ #include static const int MAX_PREFIX_LENGTH = 128; #if !defined(NDEBUG) // define the working debugging class class ADbg { public: ADbg(int level = 0); virtual ~ADbg(); /// \todo make an inline function to test the level first and the process int OutPut(int level, const char * format,...) const; int OutPut(const char * format,...) const; inline int setLevel(const int level) { return my_level = level; } inline bool setIncludeTime(const bool included = true) { return my_time_included = included; } bool setDebugFile(const char * NewFilename); bool unsetDebugFile(); inline bool setUseFile(const bool usefile = true) { return my_use_file = usefile; } inline const char * setPrefix(const char * string) { return strncpy(prefix, string, MAX_PREFIX_LENGTH); } private: int my_level; bool my_time_included; bool my_use_file; bool my_debug_output; int _OutPut(const char * format,va_list params) const; char prefix[MAX_PREFIX_LENGTH]; HANDLE hFile; }; #else // !defined(NDEBUG) // define a class that does nothing (no output) class ADbg { public: ADbg(int level = 0){} virtual ~ADbg() {} inline int OutPut(int level, const char * format,...) const { return 0; } inline int OutPut(const char * format,...) const { return 0; } inline int setLevel(const int level) { return level; } inline bool setIncludeTime(const bool included = true) { return true; } inline bool setDebugFile(const char * NewFilename) { return true; } inline bool unsetDebugFile() { return true; } inline bool setUseFile(const bool usefile = true) { return true; } inline const char * setPrefix(const char * string) { return string; } }; #endif // !defined(NDEBUG) #endif // !defined(_DBG_H__INCLUDED_) lame-svn-r6525-trunk-lame/ACM/ADbg/ADbg.cpp0000644000175000017500000001056307424315050017363 0ustar fabianfabian/************************************************************************ Project : C++ debugging class File version : 0.4 BSD License post 1999 : Copyright (c) 2001, Steve Lhomme All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ************************************************************************/ #include #include #include #include "ADbg.h" #if !defined(NDEBUG) ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// ADbg::ADbg(int level) :my_level(level) ,my_time_included(false) ,my_use_file(false) ,my_debug_output(true) ,hFile(NULL) { prefix[0] = '\0'; OutPut(-1,"ADbg Creation at debug level = %d (0x%08X)",my_level,this); } ADbg::~ADbg() { unsetDebugFile(); OutPut(-1,"ADbg Deletion (0x%08X)",this); } inline int ADbg::_OutPut(const char * format,va_list params) const { int result; char tst[1000]; char myformat[256]; if (my_time_included) { SYSTEMTIME time; GetSystemTime(&time); if (prefix[0] == '\0') wsprintf(myformat,"%04d/%02d/%02d %02d:%02d:%02d.%03d UTC : %s\r\n", time.wYear, time.wMonth, time.wDay, time.wHour, time.wMinute, time.wSecond, time.wMilliseconds, format); else wsprintf(myformat,"%04d/%02d/%02d %02d:%02d:%02d.%03d UTC : %s - %s\r\n", time.wYear, time.wMonth, time.wDay, time.wHour, time.wMinute, time.wSecond, time.wMilliseconds, prefix, format); } else { if (prefix[0] == '\0') wsprintf( myformat, "%s\r\n", format); else wsprintf( myformat, "%s - %s\r\n", prefix, format); } result = vsprintf(tst,myformat,params); if (my_debug_output) OutputDebugString(tst); if (my_use_file && (hFile != NULL)) { SetFilePointer( hFile, 0, 0, FILE_END ); DWORD written; WriteFile( hFile, tst, lstrlen(tst), &written, NULL ); } return result; } int ADbg::OutPut(int forLevel, const char * format,...) const { int result=0; if (forLevel >= my_level) { va_list tstlist; int result; va_start(tstlist, format); result = _OutPut(format,tstlist); } return result; } int ADbg::OutPut(const char * format,...) const { va_list tstlist; va_start(tstlist, format); return _OutPut(format,tstlist); } bool ADbg::setDebugFile(const char * NewFilename) { bool result; result = unsetDebugFile(); if (result) { result = false; hFile = CreateFile(NewFilename, GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ); if (hFile != INVALID_HANDLE_VALUE) { SetFilePointer( hFile, 0, 0, FILE_END ); result = true; OutPut(-1,"Debug file Opening succeeded"); } else OutPut(-1,"Debug file %s Opening failed",NewFilename); } return result; } bool ADbg::unsetDebugFile() { bool result = (hFile == NULL); if (hFile != NULL) { result = (CloseHandle(hFile) != 0); if (result) { OutPut(-1,"Debug file Closing succeeded"); hFile = NULL; } } return result; } #endif // !defined(NDEBUG) lame-svn-r6525-trunk-lame/ACM/ADbg/Makefile.am0000644000175000017500000000012711105565230020107 0ustar fabianfabian## $Id$ include $(top_srcdir)/Makefile.am.global EXTRA_DIST = \ ADbg.cpp \ ADbg.h lame-svn-r6525-trunk-lame/ACM/ADbg/Makefile.in0000644000175000017500000003205414527137541020137 0ustar fabianfabian# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # global section for every Makefile.am VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = ACM/ADbg ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in \ $(top_srcdir)/Makefile.am.global DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFIG_DEFS = @CONFIG_DEFS@ CONFIG_MATH_LIB = @CONFIG_MATH_LIB@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPUCCODE = @CPUCCODE@ CPUTYPE = @CPUTYPE@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILECMD = @FILECMD@ FRONTEND_CFLAGS = @FRONTEND_CFLAGS@ FRONTEND_LDADD = @FRONTEND_LDADD@ FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_CONFIG = @GTK_CONFIG@ GTK_LIBS = @GTK_LIBS@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDADD = @LDADD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBMP3LAME_LDADD = @LIBMP3LAME_LDADD@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@ LIB_MINOR_VERSION = @LIB_MINOR_VERSION@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEDEP = @MAKEDEP@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NASM = @NASM@ NASM_FORMAT = @NASM_FORMAT@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RM_F = @RM_F@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SNDFILE_CFLAGS = @SNDFILE_CFLAGS@ SNDFILE_LIBS = @SNDFILE_LIBS@ STRIP = @STRIP@ VERSION = @VERSION@ WITH_FRONTEND = @WITH_FRONTEND@ WITH_MP3RTP = @WITH_MP3RTP@ WITH_MP3X = @WITH_MP3X@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ mpg123_CFLAGS = @mpg123_CFLAGS@ mpg123_LIBS = @mpg123_LIBS@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.15 foreign EXTRA_DIST = \ ADbg.cpp \ ADbg.h all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.global $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ACM/ADbg/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign ACM/ADbg/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_srcdir)/Makefile.am.global $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags-am uninstall uninstall-am .PRECIOUS: Makefile # end global section # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: lame-svn-r6525-trunk-lame/ACM/tinyxml/0000755000175000017500000000000015140361506016765 5ustar fabianfabianlame-svn-r6525-trunk-lame/ACM/tinyxml/tinyxml.h0000644000175000017500000006307207453556352020667 0ustar fabianfabian/* Copyright (c) 2000 Lee Thomason (www.grinninglizard.com) This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef TINYXML_INCLUDED #define TINYXML_INCLUDED #pragma warning( disable : 4530 ) #pragma warning( disable : 4786 ) #include #include #include class TiXmlDocument; class TiXmlElement; class TiXmlComment; class TiXmlUnknown; class TiXmlAttribute; class TiXmlText; class TiXmlDeclaration; // Help out windows: #if defined( _DEBUG ) && !defined( DEBUG ) #define DEBUG #endif #if defined( DEBUG ) && defined( _MSC_VER ) #include #define TIXML_LOG OutputDebugString #else #define TIXML_LOG printf #endif /** TiXmlBase is a base class for every class in TinyXml. It does little except to establish that TinyXml classes can be printed and provide some utility functions. In XML, the document and elements can contain other elements and other types of nodes. @verbatim A Document can contain: Element (container or leaf) Comment (leaf) Unknown (leaf) Declaration( leaf ) An Element can contain: Element (container or leaf) Text (leaf) Attributes (not on tree) Comment (leaf) Unknown (leaf) A Decleration contains: Attributes (not on tree) @endverbatim */ class TiXmlBase { friend class TiXmlNode; friend class TiXmlElement; friend class TiXmlDocument; public: TiXmlBase() {} virtual ~TiXmlBase() {} /** All TinyXml classes can print themselves to a filestream. This is a formatted print, and will insert tabs and newlines. (For an unformatted stream, use the << operator.) */ virtual void Print( FILE* cfile, int depth ) const = 0; // [internal] Underlying implementation of the operator << virtual void StreamOut ( std::ostream* out ) const = 0; /** The world does not agree on whether white space should be kept or not. In order to make everyone happy, these global, static functions are provided to set whether or not TinyXml will condense all white space into a single space or not. The default is to condense. Note changing these values is not thread safe. */ static void SetCondenseWhiteSpace( bool condense ) { condenseWhiteSpace = condense; } /// Return the current white space setting. static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; } protected: static const char* SkipWhiteSpace( const char* ); static bool StreamWhiteSpace( std::istream* in, std::string* tag ); static bool IsWhiteSpace( int c ) { return ( isspace( c ) || c == '\n' || c == '\r' ); } /* Read to the specified character. Returns true if the character found and no error. */ static bool StreamTo( std::istream* in, int character, std::string* tag ); /* Reads an XML name into the string provided. Returns a pointer just past the last character of the name, or 0 if the function has an error. */ static const char* ReadName( const char*, std::string* name ); /* Reads text. Returns a pointer past the given end tag. Wickedly complex options, but it keeps the (sensitive) code in one place. */ static const char* ReadText( const char* in, // where to start std::string* text, // the string read bool ignoreWhiteSpace, // whether to keep the white space const char* endTag, // what ends this text bool ignoreCase ); // whether to ignore case in the end tag virtual const char* Parse( const char* p ) = 0; // If an entity has been found, transform it into a character. static const char* GetEntity( const char* in, char* value ); // Get a character, while interpreting entities. inline static const char* GetChar( const char* p, char* value ) { assert( p ); if ( *p == '&' ) { return GetEntity( p, value ); } else { *value = *p; return p+1; } } // Puts a string to a stream, expanding entities as it goes. // Note this should not contian the '<', '>', etc, or they will be transformed into entities! static void PutString( const std::string& str, std::ostream* stream ); // Return true if the next characters in the stream are any of the endTag sequences. bool static StringEqual( const char* p, const char* endTag, bool ignoreCase ); enum { TIXML_NO_ERROR = 0, TIXML_ERROR, TIXML_ERROR_OPENING_FILE, TIXML_ERROR_OUT_OF_MEMORY, TIXML_ERROR_PARSING_ELEMENT, TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, TIXML_ERROR_READING_ELEMENT_VALUE, TIXML_ERROR_READING_ATTRIBUTES, TIXML_ERROR_PARSING_EMPTY, TIXML_ERROR_READING_END_TAG, TIXML_ERROR_PARSING_UNKNOWN, TIXML_ERROR_PARSING_COMMENT, TIXML_ERROR_PARSING_DECLARATION, TIXML_ERROR_DOCUMENT_EMPTY, TIXML_ERROR_STRING_COUNT }; static const char* errorString[ TIXML_ERROR_STRING_COUNT ]; private: struct Entity { const char* str; unsigned int strLength; int chr; }; enum { NUM_ENTITY = 5, MAX_ENTITY_LENGTH = 6 }; static Entity entity[ NUM_ENTITY ]; static bool condenseWhiteSpace; }; /** The parent class for everything in the Document Object Model. (Except for attributes, which are contained in elements.) Nodes have siblings, a parent, and children. A node can be in a document, or stand on its own. The type of a TiXmlNode can be queried, and it can be cast to its more defined type. */ class TiXmlNode : public TiXmlBase { public: /** An output stream operator, for every class. Note that this outputs without any newlines or formatting, as opposed to Print(), which includes tabs and new lines. The operator<< and operator>> are not completely symmetric. Writing a node to a stream is very well defined. You'll get a nice stream of output, without any extra whitespace or newlines. But reading is not as well defined. (As it always is.) If you create a TiXmlElement (for example) and read that from an input stream, the text needs to define an element or junk will result. This is true of all input streams, but it's worth keeping in mind. A TiXmlDocument will read nodes until it reads a root element. */ friend std::ostream& operator<< ( std::ostream& out, const TiXmlNode& base ) { base.StreamOut( &out ); return out; } /** An input stream operator, for every class. Tolerant of newlines and formatting, but doesn't expect them. */ friend std::istream& operator>> ( std::istream& in, TiXmlNode& base ) { std::string tag; tag.reserve( 8 * 1000 ); base.StreamIn( &in, &tag ); base.Parse( tag.c_str() ); return in; } /** The types of XML nodes supported by TinyXml. (All the unsupported types are picked up by UNKNOWN.) */ enum NodeType { DOCUMENT, ELEMENT, COMMENT, UNKNOWN, TEXT, DECLARATION, TYPECOUNT }; virtual ~TiXmlNode(); /** The meaning of 'value' changes for the specific type of TiXmlNode. @verbatim Document: filename of the xml file Element: name of the element Comment: the comment text Unknown: the tag contents Text: the text string @endverbatim The subclasses will wrap this function. */ const std::string& Value() const { return value; } /** Changes the value of the node. Defined as: @verbatim Document: filename of the xml file Element: name of the element Comment: the comment text Unknown: the tag contents Text: the text string @endverbatim */ void SetValue( const std::string& _value ) { value = _value; } /// Delete all the children of this node. Does not affect 'this'. void Clear(); /// One step up the DOM. TiXmlNode* Parent() const { return parent; } TiXmlNode* FirstChild() const { return firstChild; } ///< The first child of this node. Will be null if there are no children. TiXmlNode* FirstChild( const std::string& value ) const; ///< The first child of this node with the matching 'value'. Will be null if none found. TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children. TiXmlNode* LastChild( const std::string& value ) const; /// The last child of this node matching 'value'. Will be null if there are no children. /** An alternate way to walk the children of a node. One way to iterate over nodes is: @verbatim for( child = parent->FirstChild(); child; child = child->NextSibling() ) @endverbatim IterateChildren does the same thing with the syntax: @verbatim child = 0; while( child = parent->IterateChildren( child ) ) @endverbatim IterateChildren takes the previous child as input and finds the next one. If the previous child is null, it returns the first. IterateChildren will return null when done. */ TiXmlNode* IterateChildren( TiXmlNode* previous ) const; /// This flavor of IterateChildren searches for children with a particular 'value' TiXmlNode* IterateChildren( const std::string& value, TiXmlNode* previous ) const; /** Add a new node related to this. Adds a child past the LastChild. Returns a pointer to the new object or NULL if an error occured. */ TiXmlNode* InsertEndChild( const TiXmlNode& addThis ); /** Add a new node related to this. Adds a child before the specified child. Returns a pointer to the new object or NULL if an error occured. */ TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ); /** Add a new node related to this. Adds a child after the specified child. Returns a pointer to the new object or NULL if an error occured. */ TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ); /** Replace a child of this node. Returns a pointer to the new object or NULL if an error occured. */ TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ); /// Delete a child of this node. bool RemoveChild( TiXmlNode* removeThis ); /// Navigate to a sibling node. TiXmlNode* PreviousSibling() const { return prev; } /// Navigate to a sibling node. TiXmlNode* PreviousSibling( const std::string& ) const; /// Navigate to a sibling node. TiXmlNode* NextSibling() const { return next; } /// Navigate to a sibling node with the given 'value'. TiXmlNode* NextSibling( const std::string& ) const; /** Convenience function to get through elements. Calls NextSibling and ToElement. Will skip all non-Element nodes. Returns 0 if there is not another element. */ TiXmlElement* NextSiblingElement() const; /** Convenience function to get through elements. Calls NextSibling and ToElement. Will skip all non-Element nodes. Returns 0 if there is not another element. */ TiXmlElement* NextSiblingElement( const std::string& ) const; /// Convenience function to get through elements. TiXmlElement* FirstChildElement() const; /// Convenience function to get through elements. TiXmlElement* FirstChildElement( const std::string& value ) const; /// Query the type (as an enumerated value, above) of this node. virtual int Type() const { return type; } /** Return a pointer to the Document this node lives in. Returns null if not in a document. */ TiXmlDocument* GetDocument() const; /// Returns true if this node has no children. bool NoChildren() const { return !firstChild; } TiXmlDocument* ToDocument() const { return ( this && type == DOCUMENT ) ? (TiXmlDocument*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type. TiXmlElement* ToElement() const { return ( this && type == ELEMENT ) ? (TiXmlElement*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type. TiXmlComment* ToComment() const { return ( this && type == COMMENT ) ? (TiXmlComment*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type. TiXmlUnknown* ToUnknown() const { return ( this && type == UNKNOWN ) ? (TiXmlUnknown*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type. TiXmlText* ToText() const { return ( this && type == TEXT ) ? (TiXmlText*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type. TiXmlDeclaration* ToDeclaration() const { return ( this && type == DECLARATION ) ? (TiXmlDeclaration*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type. virtual TiXmlNode* Clone() const = 0; // The real work of the input operator. virtual void StreamIn( std::istream* in, std::string* tag ) = 0; protected: TiXmlNode( NodeType type ); // The node is passed in by ownership. This object will delete it. TiXmlNode* LinkEndChild( TiXmlNode* addThis ); // Figure out what is at *p, and parse it. Returns null if it is not an xml node. TiXmlNode* Identify( const char* start ); void CopyToClone( TiXmlNode* target ) const { target->value = value; } TiXmlNode* parent; NodeType type; TiXmlNode* firstChild; TiXmlNode* lastChild; std::string value; TiXmlNode* prev; TiXmlNode* next; }; /** An attribute is a name-value pair. Elements have an arbitrary number of attributes, each with a unique name. @note The attributes are not TiXmlNodes, since they are not part of the tinyXML document object model. There are other suggested ways to look at this problem. @note Attributes have a parent */ class TiXmlAttribute : public TiXmlBase { friend class TiXmlAttributeSet; public: /// Construct an empty attribute. TiXmlAttribute() : prev( 0 ), next( 0 ) {} /// Construct an attribute with a name and value. TiXmlAttribute( const std::string& _name, const std::string& _value ) : name( _name ), value( _value ), prev( 0 ), next( 0 ) {} const std::string& Name() const { return name; } ///< Return the name of this attribute. const std::string& Value() const { return value; } ///< Return the value of this attribute. const int IntValue() const; ///< Return the value of this attribute, converted to an integer. const double DoubleValue() const; ///< Return the value of this attribute, converted to a double. void SetName( const std::string& _name ) { name = _name; } ///< Set the name of this attribute. void SetValue( const std::string& _value ) { value = _value; } ///< Set the value. void SetIntValue( int value ); ///< Set the value from an integer. void SetDoubleValue( double value ); ///< Set the value from a double. /// Get the next sibling attribute in the DOM. Returns null at end. TiXmlAttribute* Next() const; /// Get the previous sibling attribute in the DOM. Returns null at beginning. TiXmlAttribute* Previous() const; bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; } bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; } bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; } /* [internal use] Attribtue parsing starts: first letter of the name returns: the next char after the value end quote */ virtual const char* Parse( const char* p ); // [internal use] virtual void Print( FILE* cfile, int depth ) const; // [internal use] virtual void StreamOut( std::ostream* out ) const; // [internal use] // Set the document pointer so the attribute can report errors. void SetDocument( TiXmlDocument* doc ) { document = doc; } private: TiXmlDocument* document; // A pointer back to a document, for error reporting. std::string name; std::string value; TiXmlAttribute* prev; TiXmlAttribute* next; }; /* A class used to manage a group of attributes. It is only used internally, both by the ELEMENT and the DECLARATION. The set can be changed transparent to the Element and Declaration classes that use it, but NOT transparent to the Attribute which has to implement a next() and previous() method. Which makes it a bit problematic and prevents the use of STL. This version is implemented with circular lists because: - I like circular lists - it demonstrates some independence from the (typical) doubly linked list. */ class TiXmlAttributeSet { public: TiXmlAttributeSet(); ~TiXmlAttributeSet(); void Add( TiXmlAttribute* attribute ); void Remove( TiXmlAttribute* attribute ); TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } TiXmlAttribute* Find( const std::string& name ) const; private: TiXmlAttribute sentinel; }; /** The element is a container class. It has a value, the element name, and can contain other elements, text, comments, and unknowns. Elements also contain an arbitrary number of attributes. */ class TiXmlElement : public TiXmlNode { public: /// Construct an element. TiXmlElement( const std::string& value ); virtual ~TiXmlElement(); /** Given an attribute name, attribute returns the value for the attribute of that name, or null if none exists. */ const std::string* Attribute( const std::string& name ) const; /** Given an attribute name, attribute returns the value for the attribute of that name, or null if none exists. */ const std::string* Attribute( const std::string& name, int* i ) const; /** Sets an attribute of name to a given value. The attribute will be created if it does not exist, or changed if it does. */ void SetAttribute( const std::string& name, const std::string& value ); /** Sets an attribute of name to a given value. The attribute will be created if it does not exist, or changed if it does. */ void SetAttribute( const std::string& name, int value ); /** Deletes an attribute with the given name. */ void RemoveAttribute( const std::string& name ); TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); } ///< Access the first attribute in this element. TiXmlAttribute* LastAttribute() const { return attributeSet.Last(); } ///< Access the last attribute in this element. // [internal use] Creates a new Element and returs it. virtual TiXmlNode* Clone() const; // [internal use] virtual void Print( FILE* cfile, int depth ) const; // [internal use] virtual void StreamOut ( std::ostream* out ) const; // [internal use] virtual void StreamIn( std::istream* in, std::string* tag ); protected: /* [internal use] Attribtue parsing starts: next char past '<' returns: next char past '>' */ virtual const char* Parse( const char* p ); /* [internal use] Reads the "value" of the element -- another element, or text. This should terminate with the current end tag. */ const char* ReadValue( const char* in ); bool ReadValue( std::istream* in ); private: TiXmlAttributeSet attributeSet; }; /** An XML comment. */ class TiXmlComment : public TiXmlNode { public: /// Constructs an empty comment. TiXmlComment() : TiXmlNode( TiXmlNode::COMMENT ) {} virtual ~TiXmlComment() {} // [internal use] Creates a new Element and returs it. virtual TiXmlNode* Clone() const; // [internal use] virtual void Print( FILE* cfile, int depth ) const; // [internal use] virtual void StreamOut ( std::ostream* out ) const; // [internal use] virtual void StreamIn( std::istream* in, std::string* tag ); protected: /* [internal use] Attribtue parsing starts: at the ! of the !-- returns: next char past '>' */ virtual const char* Parse( const char* p ); }; /** XML text. Contained in an element. */ class TiXmlText : public TiXmlNode { public: TiXmlText( const std::string& initValue ) : TiXmlNode( TiXmlNode::TEXT ) { SetValue( initValue ); } virtual ~TiXmlText() {} // [internal use] Creates a new Element and returns it. virtual TiXmlNode* Clone() const; // [internal use] virtual void Print( FILE* cfile, int depth ) const; // [internal use] virtual void StreamOut ( std::ostream* out ) const; // [internal use] bool Blank() const; // returns true if all white space and new lines /* [internal use] Attribtue parsing starts: First char of the text returns: next char past '>' */ virtual const char* Parse( const char* p ); // [internal use] virtual void StreamIn( std::istream* in, std::string* tag ); }; /** In correct XML the declaration is the first entry in the file. @verbatim @endverbatim TinyXml will happily read or write files without a declaration, however. There are 3 possible attributes to the declaration: version, encoding, and standalone. Note: In this version of the code, the attributes are handled as special cases, not generic attributes, simply because there can only be at most 3 and they are always the same. */ class TiXmlDeclaration : public TiXmlNode { public: /// Construct an empty declaration. TiXmlDeclaration() : TiXmlNode( TiXmlNode::DECLARATION ) {} /// Construct. TiXmlDeclaration( const std::string& version, const std::string& encoding, const std::string& standalone ); virtual ~TiXmlDeclaration() {} /// Version. Will return empty if none was found. const std::string& Version() const { return version; } /// Encoding. Will return empty if none was found. const std::string& Encoding() const { return encoding; } /// Is this a standalone document? const std::string& Standalone() const { return standalone; } // [internal use] Creates a new Element and returs it. virtual TiXmlNode* Clone() const; // [internal use] virtual void Print( FILE* cfile, int depth ) const; // [internal use] virtual void StreamOut ( std::ostream* out ) const; // [internal use] virtual void StreamIn( std::istream* in, std::string* tag ); protected: // [internal use] // Attribtue parsing starts: next char past '<' // returns: next char past '>' virtual const char* Parse( const char* p ); private: std::string version; std::string encoding; std::string standalone; }; /** Any tag that tinyXml doesn't recognize is save as an unknown. It is a tag of text, but should not be modified. It will be written back to the XML, unchanged, when the file is saved. */ class TiXmlUnknown : public TiXmlNode { public: TiXmlUnknown() : TiXmlNode( TiXmlNode::UNKNOWN ) {} virtual ~TiXmlUnknown() {} // [internal use] virtual TiXmlNode* Clone() const; // [internal use] virtual void Print( FILE* cfile, int depth ) const; // [internal use] virtual void StreamOut ( std::ostream* out ) const; // [internal use] virtual void StreamIn( std::istream* in, std::string* tag ); protected: /* [internal use] Attribute parsing starts: First char of the text returns: next char past '>' */ virtual const char* Parse( const char* p ); }; /** Always the top level node. A document binds together all the XML pieces. It can be saved, loaded, and printed to the screen. The 'value' of a document node is the xml file name. */ class TiXmlDocument : public TiXmlNode { public: /// Create an empty document, that has no name. TiXmlDocument(); /// Create a document with a name. The name of the document is also the filename of the xml. TiXmlDocument( const std::string& documentName ); virtual ~TiXmlDocument() {} /** Load a file using the current document value. Returns true if successful. Will delete any existing document data before loading. */ bool LoadFile(); /// Save a file using the current document value. Returns true if successful. bool SaveFile() const; /// Load a file using the given filename. Returns true if successful. bool LoadFile( const std::string& filename ); /// Save a file using the given filename. Returns true if successful. bool SaveFile( const std::string& filename ) const; /// Parse the given null terminated block of xml data. virtual const char* Parse( const char* p ); /** Get the root element -- the only top level element -- of the document. In well formed XML, there should only be one. TinyXml is tolerant of multiple elements at the document level. */ TiXmlElement* RootElement() const { return FirstChildElement(); } /// If, during parsing, a error occurs, Error will be set to true. bool Error() const { return error; } /// Contains a textual (english) description of the error if one occurs. const std::string& ErrorDesc() const { return errorDesc; } /** Generally, you probably want the error string ( ErrorDesc() ). But if you prefer the ErrorId, this function will fetch it. */ const int ErrorId() const { return errorId; } /// If you have handled the error, it can be reset with this call. void ClearError() { error = false; errorId = 0; errorDesc = ""; } /** Dump the document to standard out. */ void Print() const { Print( stdout, 0 ); } // [internal use] virtual void Print( FILE* cfile, int depth = 0 ) const; // [internal use] virtual void StreamOut ( std::ostream* out ) const; // [internal use] virtual TiXmlNode* Clone() const; // [internal use] void SetError( int err ) { assert( err > 0 && err < TIXML_ERROR_STRING_COUNT ); error = true; errorId = err; errorDesc = errorString[ errorId ]; } // [internal use] virtual void StreamIn( std::istream* in, std::string* tag ); protected: private: bool error; int errorId; std::string errorDesc; }; #endif lame-svn-r6525-trunk-lame/ACM/tinyxml/makedistwin.bat0000755000175000017500000000051307433512236022002 0ustar fabianfabiandel .\tinyxml_win\*.* del .\docs\*.* doxygen dox mkdir tinyxml_win copy readme.txt tinyxml_win copy changes.txt tinyxml_win copy *.cpp tinyxml_win copy *.h tinyxml_win copy *.dsp tinyxml_win copy test0.xml tinyxml_win copy test1.xml tinyxml_win copy test2.xml tinyxml_win mkdir .\tinyxml_win\docs copy docs .\tinyxml_win\docs lame-svn-r6525-trunk-lame/ACM/tinyxml/changes.txt0000644000175000017500000000643007433512236021145 0ustar fabianfabianChanges in version 1.0.1: - Fixed comment tags which were outputing as ' include. Thanks to Steve Lhomme for that. Changes in version 2.0.0 - Made the ToXXX() casts safe if 'this' is null. When "LoadFile" is called with a filename, the value will correctly get set. Thanks to Brian Yoder. - Fixed bug where isalpha() and isalnum() would get called with a negative value for high ascii numbers. Thanks to Alesky Aksenov. - Fixed some errors codes that were not getting set. - Made methods "const" that were not. - Added a switch to enable or disable the ignoring of white space. ( TiXmlDocument::SetIgnoreWhiteSpace() ) - Greater standardization and code re-use in the parser. - Added a stream out operator. - Added a stream in operator. - Entity support. TODO CDATA. Support for "generic entity" #xxx thing. lame-svn-r6525-trunk-lame/ACM/tinyxml/xmltest.cpp0000644000175000017500000002307707453556352021217 0ustar fabianfabian#include "tinyxml.h" #include #include #include using namespace std; int gPass = 0; int gFail = 0; // Utility functions: template< class T > bool XmlTest( const char* testString, T expected, T found, bool noEcho = false ) { if ( expected == found ) cout << "[pass]"; else cout << "[fail]"; if ( noEcho ) cout << " " << testString; else cout << " " << testString << " [" << expected << "][" << found << "]"; cout << "\n"; bool pass = ( expected == found ); if ( pass ) ++gPass; else ++gFail; return pass; } // // This file demonstrates some basic functionality of TinyXml. // Note that the example is very contrived. It presumes you know // what is in the XML file. But it does test the basic operations, // and show how to add and remove nodes. // int main() { // // We start with the 'demoStart' todo list. Process it. And // should hopefully end up with the todo list as illustrated. // const char* demoStart = "\n" "" "\n" "\n" " Go to the Toy store!" " Do bills " " Look for Evil Dinosaurs! " ""; /* What the todo list should look like after processing. In stream (no formatting) representation. */ const char* demoEnd = "" "" "" "" "Go to the" "Toy store!" "" "" "Talk to:" "" "" "" "" "" "" "Do bills" "" ""; // The example parses from the character string (above): { // Write to a file and read it back, to check file I/O. TiXmlDocument doc( "demotest.xml" ); doc.Parse( demoStart ); if ( doc.Error() ) { printf( "Error in %s: %s\n", doc.Value().c_str(), doc.ErrorDesc().c_str() ); exit( 1 ); } doc.SaveFile(); } TiXmlDocument doc( "demotest.xml" ); bool loadOkay = doc.LoadFile(); if ( !loadOkay ) { printf( "Could not load test file 'demotest.xml'. Error='%s'. Exiting.\n", doc.ErrorDesc().c_str() ); exit( 1 ); } printf( "** Demo doc read from disk: ** \n\n" ); doc.Print( stdout ); TiXmlNode* node = 0; TiXmlElement* todoElement = 0; TiXmlElement* itemElement = 0; // -------------------------------------------------------- // An example of changing existing attributes, and removing // an element from the document. // -------------------------------------------------------- // Get the "ToDo" element. // It is a child of the document, and can be selected by name. node = doc.FirstChild( "ToDo" ); assert( node ); todoElement = node->ToElement(); assert( todoElement ); // Going to the toy store is now our second priority... // So set the "priority" attribute of the first item in the list. node = todoElement->FirstChildElement(); // This skips the "PDA" comment. assert( node ); itemElement = node->ToElement(); assert( itemElement ); itemElement->SetAttribute( "priority", 2 ); // Change the distance to "doing bills" from // "none" to "here". It's the next sibling element. itemElement = itemElement->NextSiblingElement(); assert( itemElement ); itemElement->SetAttribute( "distance", "here" ); // Remove the "Look for Evil Dinosours!" item. // It is 1 more sibling away. We ask the parent to remove // a particular child. itemElement = itemElement->NextSiblingElement(); todoElement->RemoveChild( itemElement ); itemElement = 0; // -------------------------------------------------------- // What follows is an example of created elements and text // nodes and adding them to the document. // -------------------------------------------------------- // Add some meetings. TiXmlElement item( "Item" ); item.SetAttribute( "priority", "1" ); item.SetAttribute( "distance", "far" ); TiXmlText text( "Talk to:" ); TiXmlElement meeting1( "Meeting" ); meeting1.SetAttribute( "where", "School" ); TiXmlElement meeting2( "Meeting" ); meeting2.SetAttribute( "where", "Lunch" ); TiXmlElement attendee1( "Attendee" ); attendee1.SetAttribute( "name", "Marple" ); attendee1.SetAttribute( "position", "teacher" ); TiXmlElement attendee2( "Attendee" ); attendee2.SetAttribute( "name", "Vo‚" ); attendee2.SetAttribute( "position", "counselor" ); // Assemble the nodes we've created: meeting1.InsertEndChild( attendee1 ); meeting1.InsertEndChild( attendee2 ); item.InsertEndChild( text ); item.InsertEndChild( meeting1 ); item.InsertEndChild( meeting2 ); // And add the node to the existing list after the first child. node = todoElement->FirstChild( "Item" ); assert( node ); itemElement = node->ToElement(); assert( itemElement ); todoElement->InsertAfterChild( itemElement, item ); printf( "\n** Demo doc processed: ** \n\n" ); doc.Print( stdout ); printf( "** Demo doc processed to stream: ** \n\n" ); cout << doc << endl << endl; // -------------------------------------------------------- // Different tests...do we have what we expect? // -------------------------------------------------------- int count = 0; TiXmlElement* element; ////////////////////////////////////////////////////// cout << "** Basic structure. **\n"; ostringstream outputStream( ostringstream::out ); outputStream << doc; XmlTest( "Output stream correct.", string( demoEnd ), outputStream.str(), true ); node = doc.RootElement(); XmlTest( "Root element exists.", true, ( node != 0 && node->ToElement() ) ); XmlTest( "Root element value is 'ToDo'.", string( "ToDo" ), node->Value() ); node = node->FirstChild(); XmlTest( "First child exists & is a comment.", true, ( node != 0 && node->ToComment() ) ); node = node->NextSibling(); XmlTest( "Sibling element exists & is an element.", true, ( node != 0 && node->ToElement() ) ); XmlTest( "Value is 'Item'.", string( "Item" ), node->Value() ); node = node->FirstChild(); XmlTest( "First child exists.", true, ( node != 0 && node->ToText() ) ); XmlTest( "Value is 'Go to the'.", string( "Go to the" ), node->Value() ); ////////////////////////////////////////////////////// cout << "\n** Iterators. **" << "\n"; // Walk all the top level nodes of the document. count = 0; for( node = doc.FirstChild(); node; node = node->NextSibling() ) { count++; } XmlTest( "Top level nodes, using First / Next.", 3, count ); count = 0; for( node = doc.LastChild(); node; node = node->PreviousSibling() ) { count++; } XmlTest( "Top level nodes, using Last / Previous.", 3, count ); // Walk all the top level nodes of the document, // using a different sytax. count = 0; for( node = doc.IterateChildren( 0 ); node; node = doc.IterateChildren( node ) ) { count++; } XmlTest( "Top level nodes, using IterateChildren.", 3, count ); // Walk all the elements in a node. count = 0; for( element = todoElement->FirstChildElement(); element; element = element->NextSiblingElement() ) { count++; } XmlTest( "Children of the 'ToDo' element, using First / Next.", 3, count ); // Walk all the elements in a node by value. count = 0; for( node = todoElement->FirstChild( "Item" ); node; node = node->NextSibling( "Item" ) ) { count++; } XmlTest( "'Item' children of the 'ToDo' element, using First/Next.", 3, count ); count = 0; for( node = todoElement->LastChild( "Item" ); node; node = node->PreviousSibling( "Item" ) ) { count++; } XmlTest( "'Item' children of the 'ToDo' element, using Last/Previous.", 3, count ); ////////////////////////////////////////////////////// cout << "\n** Parsing. **\n"; istringstream parse0( "" ); TiXmlElement element0( "default" ); parse0 >> element0; XmlTest( "Element parsed, value is 'Element0'.", string( "Element0" ), element0.Value() ); XmlTest( "Reads attribute 'attribute0=\"foo0\"'.", string( "foo0" ), *( element0.Attribute( "attribute0" ) ) ); XmlTest( "Reads incorrectly formatted 'attribute1=noquotes'.", string( "noquotes" ), *( element0.Attribute( "attribute1" ) ) ); XmlTest( "Read attribute with entity value '>'.", string( ">" ), *( element0.Attribute( "attribute2" ) ) ); ////////////////////////////////////////////////////// cout << "\n** Streaming. **\n"; // Round trip check: stream in, then stream back out to verify. The stream // out has already been checked, above. We use the output istringstream inputStringStream( outputStream.str() ); TiXmlDocument document0; inputStringStream >> document0; ostringstream outputStream0( ostringstream::out ); outputStream0 << document0; XmlTest( "Stream round trip correct.", string( demoEnd ), outputStream0.str(), true ); ////////////////////////////////////////////////////// cout << "\n** Parsing, no Condense Whitespace **\n"; TiXmlBase::SetCondenseWhiteSpace( false ); istringstream parse1( "This is \ntext" ); TiXmlElement text1( "text" ); parse1 >> text1; XmlTest( "Condense white space OFF.", string( "This is \ntext" ), text1.FirstChild()->Value(), true ); cout << endl << "Pass " << gPass << ", Fail " << gFail << endl; return 0; } lame-svn-r6525-trunk-lame/ACM/tinyxml/Makefile.am0000644000175000017500000000036011105565230021015 0ustar fabianfabian## $Id$ include $(top_srcdir)/Makefile.am.global EXTRA_DIST = \ Makefile.tinyxml \ changes.txt \ dox \ makedistlinux \ makedistwin.bat \ readme.txt \ tinyxml.cpp \ tinyxml.h \ tinyxmlerror.cpp \ tinyxmlparser.cpp \ xmltest.cpp lame-svn-r6525-trunk-lame/ACM/tinyxml/Makefile.tinyxml0000644000175000017500000001175707433512236022147 0ustar fabianfabian#**************************************************************************** # # Makefil for TinyXml test. # Lee Thomason # www.grinninglizard.com # # This is a GNU make (gmake) makefile #**************************************************************************** # DEBUG can be set to YES to include debugging info, or NO otherwise DEBUG := YES # PROFILE can be set to YES to include profiling info, or NO otherwise PROFILE := NO #**************************************************************************** CC := gcc CXX := g++ LD := g++ AR := ar rc RANLIB := ranlib DEBUG_CFLAGS := -Wall -Wno-unknown-pragmas -Wno-format -g -DDEBUG RELEASE_CFLAGS := -Wall -Wno-unknown-pragmas -Wno-format -O2 LIBS := DEBUG_CXXFLAGS := ${DEBUG_CFLAGS} RELEASE_CXXFLAGS := ${RELEASE_CFLAGS} DEBUG_LDFLAGS := -g RELEASE_LDFLAGS := ifeq (YES, ${DEBUG}) CFLAGS := ${DEBUG_CFLAGS} CXXFLAGS := ${DEBUG_CXXFLAGS} LDFLAGS := ${DEBUG_LDFLAGS} else CFLAGS := ${RELEASE_CFLAGS} CXXFLAGS := ${RELEASE_CXXFLAGS} LDFLAGS := ${RELEASE_LDFLAGS} endif ifeq (YES, ${PROFILE}) CFLAGS := ${CFLAGS} -pg CXXFLAGS := ${CXXFLAGS} -pg LDFLAGS := ${LDFLAGS} -pg endif #**************************************************************************** # Preprocessor directives #**************************************************************************** ifeq (YES, ${PROFILE}) DEFS := else DEFS := endif #**************************************************************************** # Include paths #**************************************************************************** #INCS := -I/usr/include/g++-2 -I/usr/local/include INCS := #**************************************************************************** # Makefile code common to all platforms #**************************************************************************** CFLAGS := ${CFLAGS} ${DEFS} CXXFLAGS := ${CXXFLAGS} ${DEFS} #**************************************************************************** # Targets of the build #**************************************************************************** OUTPUT := xmltest all: ${OUTPUT} #**************************************************************************** # Source files #**************************************************************************** SRCS := tinyxml.cpp tinyxmlparser.cpp xmltest.cpp tinyxmlerror.cpp # Add on the sources for libraries SRCS := ${SRCS} OBJS := $(addsuffix .o,$(basename ${SRCS})) #**************************************************************************** # Output #**************************************************************************** ${OUTPUT}: ${OBJS} ${LD} -o $@ ${LDFLAGS} ${OBJS} ${LIBS} ${EXTRA_LIBS} #**************************************************************************** # common rules #**************************************************************************** # Rules for compiling source files to object files %.o : %.cpp ${CXX} -c ${CXXFLAGS} ${INCS} $< -o $@ %.o : %.c ${CC} -c ${CFLAGS} ${INCS} $< -o $@ clean: -rm -f core ${OBJS} ${OUTPUT} depend: makedepend ${INCS} ${SRCS} # DO NOT DELETE tinyxml.o: tinyxml.h /usr/include/stdio.h /usr/include/features.h tinyxml.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h tinyxml.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h tinyxml.o: /usr/include/bits/sched.h /usr/include/libio.h tinyxml.o: /usr/include/_G_config.h /usr/include/wchar.h tinyxml.o: /usr/include/bits/wchar.h /usr/include/gconv.h tinyxml.o: /usr/include/bits/stdio_lim.h /usr/include/assert.h tinyxmlparser.o: tinyxml.h /usr/include/stdio.h /usr/include/features.h tinyxmlparser.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h tinyxmlparser.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h tinyxmlparser.o: /usr/include/bits/sched.h /usr/include/libio.h tinyxmlparser.o: /usr/include/_G_config.h /usr/include/wchar.h tinyxmlparser.o: /usr/include/bits/wchar.h /usr/include/gconv.h tinyxmlparser.o: /usr/include/bits/stdio_lim.h /usr/include/assert.h tinyxmlparser.o: /usr/include/ctype.h /usr/include/endian.h tinyxmlparser.o: /usr/include/bits/endian.h xmltest.o: tinyxml.h /usr/include/stdio.h /usr/include/features.h xmltest.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h xmltest.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h xmltest.o: /usr/include/bits/sched.h /usr/include/libio.h xmltest.o: /usr/include/_G_config.h /usr/include/wchar.h xmltest.o: /usr/include/bits/wchar.h /usr/include/gconv.h xmltest.o: /usr/include/bits/stdio_lim.h /usr/include/assert.h tinyxmlerror.o: tinyxml.h /usr/include/stdio.h /usr/include/features.h tinyxmlerror.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h tinyxmlerror.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h tinyxmlerror.o: /usr/include/bits/sched.h /usr/include/libio.h tinyxmlerror.o: /usr/include/_G_config.h /usr/include/wchar.h tinyxmlerror.o: /usr/include/bits/wchar.h /usr/include/gconv.h tinyxmlerror.o: /usr/include/bits/stdio_lim.h /usr/include/assert.h lame-svn-r6525-trunk-lame/ACM/tinyxml/tinyxmlparser.cpp0000644000175000017500000004241713261530755022430 0ustar fabianfabian/* Copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com) This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "tinyxml.h" #include #include using namespace std; //#define DEBUG_PARSER TiXmlBase::Entity TiXmlBase::entity[ NUM_ENTITY ] = { { "&", 5, '&' }, { "<", 4, '<' }, { ">", 4, '>' }, { """, 6, '\"' }, { "'", 6, '\'' } }; const char* TiXmlBase::SkipWhiteSpace( const char* p ) { if ( !p || !*p ) { return 0; } while ( p && *p ) { if ( isspace( *p ) || *p == '\n' || *p =='\r' ) // Still using old rules for white space. ++p; else break; } return p; } /*static*/ bool TiXmlBase::StreamWhiteSpace( std::istream* in, std::string* tag ) { for( ;; ) { if ( !in->good() ) return false; int c = in->peek(); if ( !IsWhiteSpace( c ) ) return true; *tag += in->get(); } } /*static*/ bool TiXmlBase::StreamTo( std::istream* in, int character, std::string* tag ) { while ( in->good() ) { int c = in->peek(); if ( c == character ) return true; in->get(); *tag += c; } return false; } const char* TiXmlBase::ReadName( const char* p, string* name ) { *name = ""; assert( p ); // Names start with letters or underscores. // After that, they can be letters, underscores, numbers, // hyphens, or colons. (Colons are valid ony for namespaces, // but tinyxml can't tell namespaces from names.) if ( p && *p && ( isalpha( (unsigned char) *p ) || *p == '_' ) ) { while( p && *p && ( isalnum( (unsigned char ) *p ) || *p == '_' || *p == '-' || *p == ':' ) ) { (*name) += *p; ++p; } return p; } return 0; } const char* TiXmlBase::GetEntity( const char* p, char* value ) { // Presume an entity, and pull it out. string ent; int i; // Ignore the &#x entities. if ( strncmp( "&#x", p, 3 ) == 0 ) { *value = *p; return p+1; } // Now try to match it. for( i=0; iappend( &c, 1 ); } } else { bool whitespace = false; // Remove leading white space: p = SkipWhiteSpace( p ); while ( p && *p && !StringEqual( p, endTag, caseInsensitive ) ) { if ( *p == '\r' || *p == '\n' ) { whitespace = true; ++p; } else if ( isspace( *p ) ) { whitespace = true; ++p; } else { // If we've found whitespace, add it before the // new character. Any whitespace just becomes a space. if ( whitespace ) { text->append( " ", 1 ); whitespace = false; } char c; p = GetChar( p, &c ); text->append( &c, 1 ); } } } return p + strlen( endTag ); } void TiXmlDocument::StreamIn( std::istream* in, std::string* tag ) { // The basic issue with a document is that we don't know what we're // streaming. Read something presumed to be a tag (and hope), then // identify it, and call the appropriate stream method on the tag. // // This "pre-streaming" will never read the closing ">" so the // sub-tag can orient itself. if ( !StreamTo( in, '<', tag ) ) { SetError( TIXML_ERROR_PARSING_EMPTY ); return; } while ( in->good() ) { int tagIndex = tag->length(); while ( in->good() && in->peek() != '>' ) { int c = in->get(); (*tag) += (char) c; } if ( in->good() ) { // We now have something we presume to be a node of // some sort. Identify it, and call the node to // continue streaming. TiXmlNode* node = Identify( tag->c_str() + tagIndex ); if ( node ) { node->StreamIn( in, tag ); bool isElement = node->ToElement() != 0; delete node; node = 0; // If this is the root element, we're done. Parsing will be // done by the >> operator. if ( isElement ) { return; } } else { SetError( TIXML_ERROR ); return; } } } // We should have returned sooner. SetError( TIXML_ERROR ); } const char* TiXmlDocument::Parse( const char* p ) { // Parse away, at the document level. Since a document // contains nothing but other tags, most of what happens // here is skipping white space. // // In this variant (as opposed to stream and Parse) we // read everything we can. if ( !p || !*p || !( p = SkipWhiteSpace( p ) ) ) { SetError( TIXML_ERROR_DOCUMENT_EMPTY ); return false; } while ( p && *p ) { TiXmlNode* node = Identify( p ); if ( node ) { p = node->Parse( p ); LinkEndChild( node ); } else { break; } p = SkipWhiteSpace( p ); } // All is well. return p; } TiXmlNode* TiXmlNode::Identify( const char* p ) { TiXmlNode* returnNode = 0; p = SkipWhiteSpace( p ); if( !p || !*p || *p != '<' ) { return 0; } TiXmlDocument* doc = GetDocument(); p = SkipWhiteSpace( p ); if ( !p || !*p ) { return 0; } // What is this thing? // - Elements start with a letter or underscore, but xml is reserved. // - Comments: "; if ( !StringEqual( p, startTag, false ) ) { document->SetError( TIXML_ERROR_PARSING_COMMENT ); return 0; } p += strlen( startTag ); p = ReadText( p, &value, false, endTag, false ); return p; } const char* TiXmlAttribute::Parse( const char* p ) { p = SkipWhiteSpace( p ); if ( !p || !*p ) return 0; // Read the name, the '=' and the value. p = ReadName( p, &name ); if ( !p || !*p ) { if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES ); return 0; } p = SkipWhiteSpace( p ); if ( !p || !*p || *p != '=' ) { if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES ); return 0; } ++p; // skip '=' p = SkipWhiteSpace( p ); if ( !p || !*p ) { if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES ); return 0; } const char* end; if ( *p == '\'' ) { ++p; end = "\'"; p = ReadText( p, &value, false, end, false ); } else if ( *p == '"' ) { ++p; end = "\""; p = ReadText( p, &value, false, end, false ); } else { // All attribute values should be in single or double quotes. // But this is such a common error that the parser will try // its best, even without them. value = ""; while ( p && *p // existence && !isspace( *p ) && *p != '\n' && *p != '\r' // whitespace && *p != '/' && *p != '>' ) // tag end { value += *p; ++p; } } return p; } void TiXmlText::StreamIn( std::istream* in, std::string* tag ) { while ( in->good() ) { int c = in->peek(); if ( c == '<' ) return; (*tag) += c; in->get(); } } const char* TiXmlText::Parse( const char* p ) { value = ""; //TiXmlDocument* doc = GetDocument(); bool ignoreWhite = true; // if ( doc && !doc->IgnoreWhiteSpace() ) ignoreWhite = false; const char* end = "<"; p = ReadText( p, &value, ignoreWhite, end, false ); if ( p ) return p-1; // don't truncate the '<' return 0; } void TiXmlDeclaration::StreamIn( std::istream* in, std::string* tag ) { while ( in->good() ) { int c = in->get(); (*tag) += c; if ( c == '>' ) { // All is well. return; } } } const char* TiXmlDeclaration::Parse( const char* p ) { p = SkipWhiteSpace( p ); // Find the beginning, find the end, and look for // the stuff in-between. TiXmlDocument* document = GetDocument(); if ( !p || !*p || !StringEqual( p, "SetError( TIXML_ERROR_PARSING_DECLARATION ); return 0; } p += 5; // const char* start = p+5; // const char* end = strstr( start, "?>" ); version = ""; encoding = ""; standalone = ""; while ( p && *p ) { if ( *p == '>' ) { ++p; return p; } p = SkipWhiteSpace( p ); if ( StringEqual( p, "version", true ) ) { // p += 7; TiXmlAttribute attrib; p = attrib.Parse( p ); version = attrib.Value(); } else if ( StringEqual( p, "encoding", true ) ) { // p += 8; TiXmlAttribute attrib; p = attrib.Parse( p ); encoding = attrib.Value(); } else if ( StringEqual( p, "standalone", true ) ) { // p += 10; TiXmlAttribute attrib; p = attrib.Parse( p ); standalone = attrib.Value(); } else { // Read over whatever it is. while( p && *p && *p != '>' && !isspace( *p ) ) ++p; } } return 0; } bool TiXmlText::Blank() const { for ( unsigned i=0; i