summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-08-19 19:51:51 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-08-19 19:51:51 +0200
commitd9047cae233291b7c6d467a45623fe7731097e64 (patch)
treef2d44038a6875c80675507ef8ba91d91ce00ef1c
parentf88cabeea2032eca6951559fe70a942bf56ff3f9 (diff)
eliminated mp4v2 dependency
fixed mp4 tag reader using mp4ff
-rw-r--r--configure.ac5
-rw-r--r--plugins/aac/Makefile.am13
-rw-r--r--plugins/aac/aac.c39
-rw-r--r--plugins/aac/mp4ff/mp4ff.h1
-rw-r--r--plugins/aac/mp4ff/mp4ffint.h2
-rw-r--r--plugins/aac/mp4ff/mp4meta.c2
6 files changed, 54 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index e6d97f50..4b95c54b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -366,9 +366,8 @@ fi
if test "x$enable_aac" != "xno" ; then
AC_CHECK_LIB([faad], [main], [HAVE_FAAD=1])
- AC_CHECK_LIB([mp4v2], [main], [HAVE_MP4V2=1])
- if test ${HAVE_FAAD} && test ${HAVE_MP4V2} ; then
- FAAD2_LIBS="-lfaad -lmp4v2"
+ if test ${HAVE_FAAD} ; then
+ FAAD2_LIBS="-lfaad"
AC_SUBST(FAAD2_LIBS)
HAVE_AAC=yes
fi
diff --git a/plugins/aac/Makefile.am b/plugins/aac/Makefile.am
index 6d2d1bca..afef6c55 100644
--- a/plugins/aac/Makefile.am
+++ b/plugins/aac/Makefile.am
@@ -1,11 +1,20 @@
if HAVE_AAC
aacdir = $(libdir)/$(PACKAGE)
pkglib_LTLIBRARIES = aac.la
-aac_la_SOURCES = aac.c aac_parser.c aac_parser.h
+aac_la_SOURCES = aac.c aac_parser.c aac_parser.h\
+mp4ff/mp4atom.c\
+mp4ff/mp4ff.c\
+mp4ff/mp4meta.c\
+mp4ff/mp4sample.c\
+mp4ff/mp4tagupdate.c\
+mp4ff/mp4util.c\
+mp4ff/mp4ff.h\
+mp4ff/mp4ffint.h\
+mp4ff/mp4ff_int_types.h
aac_la_LDFLAGS = -module
aac_la_LIBADD = $(LDADD) $(FAAD2_LIBS)
-AM_CFLAGS = $(CFLAGS) -std=c99
+AM_CFLAGS = $(CFLAGS) -std=c99 -DUSE_MP4FF -DUSE_TAGGING
endif
diff --git a/plugins/aac/aac.c b/plugins/aac/aac.c
index cb975f40..89934f0e 100644
--- a/plugins/aac/aac.c
+++ b/plugins/aac/aac.c
@@ -30,6 +30,7 @@
#ifdef USE_MP4FF
#include "mp4ff/mp4ff.h"
#else
+#warning linking mp4v2 to faad2 is illegal
#include <mp4v2/mp4v2.h>
#endif
@@ -853,6 +854,34 @@ aac_seek (DB_fileinfo_t *_info, float t) {
return aac_seek_sample (_info, t * _info->samplerate);
}
+#ifdef USE_MP4FF
+static const char *metainfo[] = {
+ "artist", "artist",
+ "title", "title",
+ "album", "album",
+ "track", "track",
+ "date", "year",
+ "genre", "genre",
+ "comment", "comment",
+ "performer", "performer",
+ "albumartist", "band",
+ "writer", "composer",
+ "vendor", "vendor",
+ "disc", "disc",
+ "compilation", "compilation",
+ "totaldiscs", "numdiscs",
+ "copyright", "copyright",
+ "totaltracks", "numtracks",
+ "tool", "tool",
+ NULL
+};
+
+
+/* find a metadata item by name */
+/* returns 0 if item found, 1 if no such item */
+extern int32_t mp4ff_meta_find_by_name(const mp4ff_t *f, const char *item, char **value);
+#endif
+
static DB_playItem_t *
aac_insert (DB_playItem_t *after, const char *fname) {
trace ("adding %s\n", fname);
@@ -921,7 +950,15 @@ aac_insert (DB_playItem_t *after, const char *fname) {
// read tags
if (mp4) {
-#ifndef USE_MP4FF
+#ifdef USE_MP4FF
+ char *s;
+ for (int i = 0; metainfo[i]; i += 2) {
+ if (mp4ff_meta_find_by_name(mp4, metainfo[i], &s)) {
+ deadbeef->pl_add_meta (it, metainfo[i+1], s);
+ free (s);
+ }
+ }
+#else
const MP4Tags *tags = MP4TagsAlloc ();
MP4TagsFetch (tags, mp4);
diff --git a/plugins/aac/mp4ff/mp4ff.h b/plugins/aac/mp4ff/mp4ff.h
index 17b7fe76..f8828f4f 100644
--- a/plugins/aac/mp4ff/mp4ff.h
+++ b/plugins/aac/mp4ff/mp4ff.h
@@ -95,6 +95,7 @@ uint32_t mp4ff_get_audio_type(const mp4ff_t * f,const int32_t track);
int mp4ff_meta_get_num_items(const mp4ff_t *f);
int mp4ff_meta_get_by_index(const mp4ff_t *f, unsigned int index,
char **item, char **value);
+int mp4ff_meta_find_by_name(const mp4ff_t *f, const char *item, char **value);
int mp4ff_meta_get_title(const mp4ff_t *f, char **value);
int mp4ff_meta_get_artist(const mp4ff_t *f, char **value);
int mp4ff_meta_get_writer(const mp4ff_t *f, char **value);
diff --git a/plugins/aac/mp4ff/mp4ffint.h b/plugins/aac/mp4ff/mp4ffint.h
index c92b5886..f4673b03 100644
--- a/plugins/aac/mp4ff/mp4ffint.h
+++ b/plugins/aac/mp4ff/mp4ffint.h
@@ -289,7 +289,7 @@ static int32_t mp4ff_tag_add_field(mp4ff_metadata_t *tags, const char *item, con
static int32_t mp4ff_tag_set_field(mp4ff_metadata_t *tags, const char *item, const char *value);
static int32_t mp4ff_set_metadata_name(mp4ff_t *f, const uint8_t atom_type, char **name);
static int32_t mp4ff_parse_tag(mp4ff_t *f, const uint8_t parent_atom_type, const int32_t size);
-static int32_t mp4ff_meta_find_by_name(const mp4ff_t *f, const char *item, char **value);
+int32_t mp4ff_meta_find_by_name(const mp4ff_t *f, const char *item, char **value);
int32_t mp4ff_parse_metadata(mp4ff_t *f, const int32_t size);
int32_t mp4ff_tag_delete(mp4ff_metadata_t *tags);
int32_t mp4ff_meta_get_num_items(const mp4ff_t *f);
diff --git a/plugins/aac/mp4ff/mp4meta.c b/plugins/aac/mp4ff/mp4meta.c
index 7cd2e727..a0c1b7e3 100644
--- a/plugins/aac/mp4ff/mp4meta.c
+++ b/plugins/aac/mp4ff/mp4meta.c
@@ -344,7 +344,7 @@ int32_t mp4ff_parse_metadata(mp4ff_t *f, const int32_t size)
/* find a metadata item by name */
/* returns 0 if item found, 1 if no such item */
-static int32_t mp4ff_meta_find_by_name(const mp4ff_t *f, const char *item, char **value)
+int32_t mp4ff_meta_find_by_name(const mp4ff_t *f, const char *item, char **value)
{
uint32_t i;