diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-03-17 03:10:17 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-03-17 03:10:17 +0000 |
commit | f114fbd437dc4f767d85b9f429adf3a3eb9b943f (patch) | |
tree | c6a4a83596498787c7457998ad4d22d93cad1796 | |
parent | 0f11ce855e1cd4949d2c5db9c3f616b7be201b11 (diff) | |
download | mpd-f114fbd437dc4f767d85b9f429adf3a3eb9b943f.tar.gz mpd-f114fbd437dc4f767d85b9f429adf3a3eb9b943f.tar.xz mpd-f114fbd437dc4f767d85b9f429adf3a3eb9b943f.zip |
fix a few snafoo's in configure.ac
Add initial stuff for AAC support, now we just need to write the decoder
git-svn-id: https://svn.musicpd.org/mpd/trunk@264 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | configure.ac | 55 | ||||
-rw-r--r-- | src/decode.h | 1 | ||||
-rw-r--r-- | src/ls.c | 32 | ||||
-rw-r--r-- | src/ls.h | 2 | ||||
-rw-r--r-- | src/player.c | 3 | ||||
-rw-r--r-- | src/song.c | 10 | ||||
-rw-r--r-- | src/tag.c | 19 | ||||
-rw-r--r-- | src/tag.h | 4 |
8 files changed, 121 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac index 7030dfc6c..b59770648 100644 --- a/configure.ac +++ b/configure.ac @@ -28,6 +28,7 @@ AC_ARG_ENABLE(ipv6,[ --disable-ipv6 disable IPv6 support],,enable_ipv6=yes) AC_ARG_ENABLE(ogg,[ --disable-ogg disable ogg support],,enable_ogg=yes) AC_ARG_ENABLE(flac,[ --disable-flac disable flac support],,enable_flac=yes) AC_ARG_ENABLE(mp3,[ --disable-mp3 disable mp3 support],,enable_mp3=yes) +AC_ARG_ENABLE(aac,[ --disable-aac disable AAC support],,enable_aac=yes) AC_ARG_ENABLE(audiofile,[ --disable-audiofile disable audiofile support, disables wave support],,enable_audiofile=yes) AC_ARG_ENABLE(mpd_mad,[ --enable-mpd-mad use mpd libmad],use_mpd_mad=yes,) AC_ARG_ENABLE(id3,[ --disable-id3 disable id3 support],,enable_id3=yes) @@ -41,6 +42,10 @@ AC_ARG_WITH(mad,[ --with-mad=PFX Prefix where libmad is installed (optional)] AC_ARG_WITH(mad-libraries,[ --with-mad-libraries=DIR Directory where libmad library is installed (optional)], mad_libraries="$withval", mad_libraries="") AC_ARG_WITH(mad-includes,[ --with-mad-includes=DIR Directory where mad header files are installed (optional)], mad_includes="$withval", mad_includes="") +AC_ARG_WITH(faad,[ --with-faad=PFX Prefix where faad lib is installed (optional)], faad_prefix="$withval", faad_prefix="") +AC_ARG_WITH(faad-libraries,[ --with-faad-libraries=DIR Directory where faad library is installed (optional)], faad_libraries="$withval", faad_libraries="") +AC_ARG_WITH(faad-includes,[ --with-faad-includes=DIR Directory where faad header files are installed (optional)], faad_includes="$withval", faad_includes="") + AC_C_BIGENDIAN AC_CHECK_SIZEOF(short) @@ -120,20 +125,23 @@ if test x$enable_id3 = xyes; then if test "x$id3tag_includes" != "x" ; then ID3TAG_CFLAGS="-I$id3tag_includes" elif test "x$id3tag_prefix" != "x" ; then - ID3TAG_CFLAGS="-I$id3tag_prefix/lib" + ID3TAG_CFLAGS="-I$id3tag_prefix/include" elif test "x$prefix" != "xNONE"; then - ID3TAG_CFLAGS="-I$libdir" + ID3TAG_CFLAGS="-I$includedir" fi ID3TAG_CFLAGS="$ID3TAG_CFLAGS" oldcflags=$CFLAGS - CFLAGS="$CFLAGS $ID3TAG_CFLAGS $ID3TAG_LIBS" + oldlibs=$LIBS + CFLAGS="$CFLAGS $MPD_CFLAGS $ID3TAG_CFLAGS" + LIBS="$LIBS $MPD_LIBS $ID3TAG_LIBS" AC_CHECK_LIB(id3tag,id3_file_open,[ID3_LIB="$ID3TAG_LIBS"; MPD_CFLAGS="$MPD_CFLAGS $ID3TAG_CFLAGS"; use_libid3tag=yes], [use_libid3tag=no;use_mpd_id3tag=yes]) CFLAGS=$oldcflags + LIBS=$oldlibs fi if test x$use_mpd_id3tag = xyes; then MPD_CFLAGS="$MPD_CFLAGS -DUSE_MPD_ID3TAG" @@ -163,14 +171,20 @@ if test x$enable_mp3 = xyes; then if test "x$mad_includes" != "x" ; then MAD_CFLAGS="-I$mad_includes" elif test "x$mad_prefix" != "x" ; then - MAD_CFLAGS="-I$mad_prefix/lib" + MAD_CFLAGS="-I$mad_prefix/include" elif test "x$prefix" != "xNONE"; then - MAD_CFLAGS="-I$libdir" + MAD_CFLAGS="-I$includedir" fi + oldcflags=$CFLAGS + oldlibs=$LIBS + CFLAGS="$CFLAGS $MPD_CFLAGS $MAD_CFLAGS" + LIBS="$LIBS $MPD_LIBS $MAD_LIBS" AC_CHECK_LIB(mad,mad_stream_init,[MAD_LIB="$MAD_LIBS"; MPD_CFLAGS="$MPD_CFLAGS $MAD_CFLAGS";use_libmad=yes], [use_libmad=no;use_mpd_mad=yes]) + CFLAGS=$oldcflags + LIBS=$oldlibs fi if test x$use_mpd_mad = xyes; then MPD_CFLAGS="$MPD_CFLAGS -DUSE_MPD_MAD" @@ -181,6 +195,37 @@ if test x$enable_mp3 = xyes; then MPD_CFLAGS="$MPD_CFLAGS -DHAVE_MAD" fi +if test x$enable_aac = xyes; then + if test "x$faad_libraries" != "x" ; then + FAAD_LIBS="-L$faad_libraries" + elif test "x$faad_prefix" != "x" ; then + FAAD_LIBS="-L$faad_prefix/lib" + elif test "x$prefix" != "xNONE"; then + FAAD_LIBS="-L$libdir" + fi + + FAAD_LIBS="$FAAD_LIBS -lfaad" + + if test "x$faad_includes" != "x" ; then + FAAD_CFLAGS="-I$faad_includes" + elif test "x$faad_prefix" != "x" ; then + FAAD_CFLAGS="-I$faad_prefix/include" + elif test "x$prefix" != "xNONE"; then + FAAD_CFLAGS="-I$includedir" + fi + + oldcflags=$CFLAGS + oldlibs=$LIBS + CFLAGS="$CFLAGS $MPD_CFLAGS $FAAD_CFLAGS" + LIBS="$LIBS $MPD_LIBS $FAAD_LIBS" + AC_CHECK_HEADER(faad.h,,enable_aac=no) + if test x$enable_aac = xyes; then + AC_CHECK_LIB(faad, faacDecDecode,[MPD_LIBS="$MPD_LIBS $FAAD_LIBS";MPD_CFLAGS="$MPD_CFLAGS $FAAD_CFLAGS -DHAVE_FAAD"],enable_aac=no) + fi + CFLAGS=$oldcflags + LIBS=$oldlibs +fi + if test x$enable_ogg = xyes; then XIPH_PATH_OGG(MPD_LIBS="$MPD_LIBS $OGG_LIBS" MPD_CFLAGS="$MPD_CFLAGS $OGG_CFLAGS",enable_ogg=no) fi diff --git a/src/decode.h b/src/decode.h index a73fe21a2..6dd25fdb8 100644 --- a/src/decode.h +++ b/src/decode.h @@ -26,6 +26,7 @@ #define DECODE_TYPE_OGG 1 #define DECODE_TYPE_FLAC 2 #define DECODE_TYPE_AUDIOFILE 3 +#define DECODE_TYPE_AAC 4 #define DECODE_STATE_STOP 0 #define DECODE_STATE_DECODE 1 @@ -125,6 +125,9 @@ int isMusic(char * utf8file, time_t * mtime) { #ifdef HAVE_AUDIOFILE if((ret = isWave(utf8file,mtime))) return ret; #endif +#ifdef HAVE_FAAD + if((ret = isAac(utf8file,mtime))) return ret; +#endif return ret; } @@ -246,6 +249,35 @@ int isOgg(char * utf8file, time_t * mtime) { return 0; } +int isAac(char * utf8file, time_t * mtime) { + struct stat st; + char * file = utf8ToFsCharset(utf8file); + char * actualFile = file; + + if(actualFile[0]!='/') actualFile = rmp2amp(file); + + if(stat(actualFile,&st)==0) { + if(S_ISREG(st.st_mode)) { + char * dup; + char * cLast; + char * cNext; + int ret = 0; + dup = strdup(file); + cNext = cLast = strtok(dup,"."); + while((cNext = strtok(NULL,"."))) cLast = cNext; + if(cLast && 0==strcasecmp(cLast,"aac")) { + if(mtime) *mtime = st.st_mtime; + ret = 1; + } + free(dup); + return ret; + } + else return 0; + } + + return 0; +} + int isMp3(char * utf8file, time_t * mtime) { struct stat st; char * file = utf8ToFsCharset(utf8file); @@ -26,6 +26,8 @@ int lsPlaylists(FILE * fp, char * utf8path); int isMp3(char * utf8file, time_t * mtime); +int isAac(char * utf8file, time_t * mtime); + int isOgg(char * utf8file, time_t * mtime); int isFlac(char * utf8file, time_t * mtime); diff --git a/src/player.c b/src/player.c index 5932a40cb..54fda2a6e 100644 --- a/src/player.c +++ b/src/player.c @@ -177,6 +177,9 @@ int playerPlay(FILE * fp, char * utf8file) { #ifdef HAVE_AUDIOFILE else if(isWave(utf8file,NULL)) pc->decodeType = DECODE_TYPE_AUDIOFILE; #endif +#ifdef HAVE_FAAD + else if(isAac(utf8file,NULL)) pc->decodeType = DECODE_TYPE_AAC; +#endif else { strncpy(pc->erroredFile,pc->file,MAXPATHLEN); pc->error = PLAYER_ERROR_UNKTYPE; diff --git a/src/song.c b/src/song.c index 42754c12d..4a0cfd4bb 100644 --- a/src/song.c +++ b/src/song.c @@ -78,6 +78,11 @@ Song * newSong(char * utf8file) { song->tag = audiofileTagDup(utf8file); } #endif +#ifdef HAVE_FAAD + else if(isAac(utf8file,&(song->mtime))) { + song->tag = aacTagDup(utf8file); + } +#endif if(!song->tag || song->tag->time<0) { freeSong(song); @@ -240,6 +245,11 @@ int updateSongInfo(Song * song) { song->tag = audiofileTagDup(utf8file); } #endif +#ifdef HAVE_FAAD + else if(isAac(utf8file,&(song->mtime))) { + song->tag = aacTagDup(utf8file); + } +#endif if(!song->tag || song->tag->time<0) return -1; else addSongToTables(song); @@ -167,6 +167,25 @@ MpdTag * mp3TagDup(char * utf8file) { } #endif +#ifdef HAVE_FAAD +MpdTag * aacTagDup(char * utf8file) { + MpdTag * ret = NULL; + int time; + + ret = id3Dup(utf8file); + +#warning getAacTotalTime needs implementing + //time = getAacTotalTime(rmp2amp(utf8ToFsCharset(utf8file))); + + if(time>=0) { + if(!ret) ret = newMpdTag(); + ret->time = time; + } + + return ret; +} +#endif + #ifdef HAVE_OGG MpdTag * oggTagDup(char * utf8file) { MpdTag * ret = NULL; @@ -37,6 +37,10 @@ void freeMpdTag(MpdTag * tag); MpdTag * mp3TagDup(char * utf8file); #endif +#ifdef HAVE_FAAD +MpdTag * aacTagDup(char * utf8file); +#endif + #ifdef HAVE_OGG MpdTag * oggTagDup(char * utf8file); #endif |