aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-03-17 03:10:17 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-03-17 03:10:17 +0000
commitf114fbd437dc4f767d85b9f429adf3a3eb9b943f (patch)
treec6a4a83596498787c7457998ad4d22d93cad1796 /src
parent0f11ce855e1cd4949d2c5db9c3f616b7be201b11 (diff)
downloadmpd-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--src/decode.h1
-rw-r--r--src/ls.c32
-rw-r--r--src/ls.h2
-rw-r--r--src/player.c3
-rw-r--r--src/song.c10
-rw-r--r--src/tag.c19
-rw-r--r--src/tag.h4
7 files changed, 71 insertions, 0 deletions
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
diff --git a/src/ls.c b/src/ls.c
index 56930e75c..c98b0b65d 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -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);
diff --git a/src/ls.h b/src/ls.h
index 6884549de..708f81618 100644
--- a/src/ls.h
+++ b/src/ls.h
@@ -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);
diff --git a/src/tag.c b/src/tag.c
index f7bd5d39d..d599b44c4 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -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;
diff --git a/src/tag.h b/src/tag.h
index 0f176449f..763f1fcb6 100644
--- a/src/tag.h
+++ b/src/tag.h
@@ -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