From 133453cc112df7e7d5ce35f3dde5178303154da5 Mon Sep 17 00:00:00 2001 From: kramm Date: Wed, 4 Feb 2004 07:48:40 +0000 Subject: [PATCH] * renamed USE_FREETYPE to HAVE_FREETYPE mp3 support can now be disabled --- avi2swf/avi2swf.cc | 6 ++++++ config.h.in | 9 ++++++--- configure.in | 44 ++++++++++++------------------------------ lib/modules/swfsound.c | 50 +++++++++++++++++++++++++++++++++++++++--------- lib/rfxswf.c | 5 ++++- lib/rfxswf.h | 9 +++------ 6 files changed, 72 insertions(+), 51 deletions(-) diff --git a/avi2swf/avi2swf.cc b/avi2swf/avi2swf.cc index 8905a32..d0fd823 100644 --- a/avi2swf/avi2swf.cc +++ b/avi2swf/avi2swf.cc @@ -404,6 +404,12 @@ int videoreader_avifile_open(videoreader_t* v, char* filename) printf("Couldn't open video stream\n"); i->do_audio = 0; } +#ifdef NO_MP3 + if(i->do_audio) { + printf(stderr, "MP3 support has been disabled at compile time, not converting soundtrack"); + i->do_audio = 0; + } +#endif if(!i->do_video && !i->do_audio) { printf("File has neither audio nor video streams.(?)\n"); diff --git a/config.h.in b/config.h.in index 595eaf3..7ae0eea 100644 --- a/config.h.in +++ b/config.h.in @@ -112,11 +112,14 @@ /* use gzip/uncompress */ #undef USE_GZIP -/* use libfreetype */ +/* let ttf2pt1 use libfreetype */ #undef USE_FREETYPE -/* use internal l.a.m.e. mp3 library */ -#undef USE_MP3 +/* have/use freetype library */ +#undef HAVE_FREETYPE + +/* have/use internal l.a.m.e. mp3 library */ +#undef HAVE_LAME /* system() can handle command substitution */ #undef SYSTEM_BACKTICKS diff --git a/configure.in b/configure.in index 2377fe5..20dd0aa 100644 --- a/configure.in +++ b/configure.in @@ -7,11 +7,11 @@ AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging], DEBUG=true) AC_ARG_ENABLE(optimizations, [ --enable-optimizations turn on compiler optimizations (recommended for avi2swf)], OPTIMIZE=true) -AC_ARG_ENABLE(mp3, -[ --disable-mp3 don't compile any mp3 code in], NO_MP3=true) +AC_ARG_ENABLE(lame, +[ --disable-lame don't compile any L.A.M.E. mp3 encoding code in], DISABLE_LAME=true) PACKAGE=swftools -VERSION=2004-02-01-1614 +VERSION=0.5.0_pre1 @@ -76,7 +76,6 @@ fi AC_PROG_LN_S AC_PROG_LIBTOOL AC_CHECK_PROGS(UNCOMPRESS, gzip uncompress compress, ) - AC_CHECK_PROGS(FREETYPE_CONFIG, freetype-config, ) # TODO: use this dnl Checks for system services AC_EXEEXT @@ -127,9 +126,8 @@ dnl Checks for libraries. DISABLEPDF2SWF=true; MISSINGLIBS="${MISSINGLIBS} t1lib" ) - AC_CHECK_LIB(freetype, FT_Init_FreeType, - USE_FREETYPE=true, - ) + +RFX_CHECK_FREETYPE RFX_CHECK_BYTEORDER AC_SUBST(WORDS_BIGENDIAN) @@ -159,9 +157,6 @@ if test "x${ac_cv_header_zlib_h}" != "xyes"; then ZLIBMISSING=true; fi -if test "x$USE_FREETYPE" != "x"; then - AC_DEFINE_UNQUOTED(USE_FREETYPE, "$USE_FREETYPE") -fi AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") AC_DEFINE_UNQUOTED(VERSION, "$VERSION") AC_SUBST(PACKAGE) @@ -196,29 +191,14 @@ if test "x${AVIFILE}" != "xtrue"; then avi2swf= fi -if test "x${NO_MP3}" == "x"; then - AC_DEFINE_UNQUOTED(USE_MP3, 1) +if test "x${DISABLE_LAME}" == "xtrue"; then + echo "*" disabling lame support... + lame_objects= +else + AC_DEFINE_UNQUOTED(HAVE_LAME, 1) + lame_objects='$(lame_objects_2)' fi - -if test "x${USE_FREETYPE}" == "xtrue"; then - if test "x{$FREETYPE_CONFIG}" != "x"; then - ftinclude=`freetype-config --cflags` - ftlibs=`freetype-config --libs` - CXXFLAGS="$CXXFLAGS $ftinclude" - CFLAGS="$CFLAGS $ftinclude" - LIBS="$LIBS $ftlibs" - else if test -d /usr/include/freetype2; then - CXXFLAGS="$CXXFLAGS -I/usr/include/freetype2" - CFLAGS="$CFLAGS -I/usr/include/freetype2" - LIBS="$LIBS -lfreetype" - else if test -d /usr/local/include/freetype2; then - CXXFLAGS="$CXXFLAGS -I/usr/local/include/freetype2" - CFLAGS="$CFLAGS -I/usr/local/include/freetype2" - LIBS="$LIBS -L /usr/local/lib -lfreetype" - fi - fi - fi -fi +AC_SUBST(lame_objects) if test "x${UNCOMPRESS}" = "xgzip"; then AC_DEFINE_UNQUOTED(USE_GZIP, 1) diff --git a/lib/modules/swfsound.c b/lib/modules/swfsound.c index 7032b02..a7ca0e1 100644 --- a/lib/modules/swfsound.c +++ b/lib/modules/swfsound.c @@ -21,12 +21,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef RFXSWF_DISABLESOUND +#ifndef NO_MP3 #include "../rfxswf.h" #ifdef BLADEENC -fjokjklj +#define HAVE_SOUND + CodecInitOut * init = 0; void swf_SetSoundStreamHead(TAG*tag, U16 avgnumsamples) { @@ -76,17 +77,18 @@ void swf_SetSoundStreamBlock(TAG*tag, S16*samples, int numsamples, char first) } #endif +/* TODO: find a better way to set these from the outside */ -#ifdef LAME - -#include "../lame/lame.h" - -/* TODO: find a way to set these from the outside */ int swf_mp3_in_samplerate = 44100; int swf_mp3_out_samplerate = 11025; int swf_mp3_channels = 1; int swf_mp3_bitrate = 32; +#ifdef HAVE_LAME +#define HAVE_SOUND + +#include "../lame/lame.h" + static lame_global_flags*lame_flags; static void initlame() @@ -237,6 +239,37 @@ void swf_SetSoundDefine(TAG*tag, S16*samples, int num) free(buf); } +#endif + +#endif + +#ifndef HAVE_SOUND + +// supply stubs + +void swf_SetSoundStreamHead(TAG*tag, int avgnumsamples) +{ + fprintf(stderr, "Error: no sound support compiled in.\n");exit(1); +} +void swf_SetSoundStreamBlock(TAG*tag, S16*samples, int seek, char first) +{ + fprintf(stderr, "Error: no sound support compiled in.\n");exit(1); +} +void swf_SetSoundStreamEnd(TAG*tag) +{ + fprintf(stderr, "Error: no sound support compiled in.\n");exit(1); +} +void swf_SetSoundDefineRaw(TAG*tag, S16*samples, int num, int samplerate) +{ + fprintf(stderr, "Error: no sound support compiled in.\n");exit(1); +} +void swf_SetSoundDefine(TAG*tag, S16*samples, int num) +{ + fprintf(stderr, "Error: no sound support compiled in.\n");exit(1); +} + +#endif + #define SOUNDINFO_STOP 32 #define SOUNDINFO_NOMULTIPLE 16 #define SOUNDINFO_HASENVELOPE 8 @@ -244,6 +277,7 @@ void swf_SetSoundDefine(TAG*tag, S16*samples, int num) #define SOUNDINFO_HASOUTPOINT 2 #define SOUNDINFO_HASINPOINT 1 + void swf_SetSoundInfo(TAG*tag, SOUNDINFO*info) { U8 flags = (info->stop?SOUNDINFO_STOP:0) @@ -270,6 +304,4 @@ void swf_SetSoundInfo(TAG*tag, SOUNDINFO*info) } } -#endif -#endif // RFXSWF_DISABLESOUND diff --git a/lib/rfxswf.c b/lib/rfxswf.c index 3e8f0a8..944418d 100644 --- a/lib/rfxswf.c +++ b/lib/rfxswf.c @@ -35,8 +35,11 @@ #include #endif // HAVE_ZLIB -#define LAME +#ifndef RFXSWF_DISABLESOUND +#ifdef HAVE_LAME #include "lame/lame.h" +#endif +#endif #include "./bitio.h" #include "./MD5.h" diff --git a/lib/rfxswf.h b/lib/rfxswf.h index 2e12d12..07b9ea0 100644 --- a/lib/rfxswf.h +++ b/lib/rfxswf.h @@ -39,6 +39,9 @@ extern "C" { #include "./drawer.h" #define DEBUG_RFXSWF +#ifdef RFXSWF_DISABLESOUND +#define NO_MP3 +#endif #ifndef TRUE #define TRUE (1) @@ -702,18 +705,12 @@ int swf_SetLosslessBits(TAG * t,U16 width,U16 height,void * bitmap,U8 bitmap_fla int swf_SetLosslessBitsIndexed(TAG * t,U16 width,U16 height,U8 * bitmap,RGBA * palette,U16 ncolors); int swf_SetLosslessBitsGrayscale(TAG * t,U16 width,U16 height,U8 * bitmap); -#ifndef RFXSWF_DISABLESOUND - // swfsound.c void swf_SetSoundStreamHead(TAG*tag, int avgnumsamples); void swf_SetSoundStreamBlock(TAG*tag, S16*samples, int seek, char first); /* expects 2304 samples */ - void swf_SetSoundDefine(TAG*tag, S16*samples, int num); - void swf_SetSoundInfo(TAG*tag, SOUNDINFO*info); -#endif // RFXSWF_DISABLESOUND - // swftools.c U8 swf_isDefiningTag(TAG * t); -- 1.7.10.4