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
This commit is contained in:
@@ -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
|
||||
|
32
src/ls.c
32
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);
|
||||
|
2
src/ls.h
2
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);
|
||||
|
@@ -176,6 +176,9 @@ int playerPlay(FILE * fp, char * utf8file) {
|
||||
#endif
|
||||
#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);
|
||||
|
10
src/song.c
10
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);
|
||||
|
19
src/tag.c
19
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;
|
||||
|
Reference in New Issue
Block a user