summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Ottela <mottela@src.gnome.org>2009-01-08 14:43:46 +0000
committerMikael Ottela <mottela@src.gnome.org>2009-01-08 14:43:46 +0000
commit22c5e94d0997729b2d3a36e71474bf2d632a2950 (patch)
treec0a6fdfb3266aecea95b766489a50702ac73dce8
parentd4f5d848cbaf7fe5c84c3b661d5b0f19db691b1c (diff)
downloadtracker-22c5e94d0997729b2d3a36e71474bf2d632a2950.tar.gz
Added initial unit tests for mp3 extraction
svn path=/trunk/; revision=2773
-rw-r--r--ChangeLog18
-rw-r--r--configure.ac1
-rw-r--r--src/tracker-extract/tracker-extract-mp3.c51
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/tracker-extract/Makefile.am29
-rwxr-xr-xtests/tracker-extract/data/mp3/create_mp3_testdata74
-rw-r--r--tests/tracker-extract/data/mp3/header_bitrate_mpeg1_1.data1
-rw-r--r--tests/tracker-extract/data/mp3/header_bitrate_mpeg1_10.data1
-rw-r--r--tests/tracker-extract/data/mp3/header_bitrate_mpeg1_11.data1
-rw-r--r--tests/tracker-extract/data/mp3/header_bitrate_mpeg1_12.data1
-rw-r--r--tests/tracker-extract/data/mp3/header_bitrate_mpeg1_13.data1
-rw-r--r--tests/tracker-extract/data/mp3/header_bitrate_mpeg1_14.data1
-rw-r--r--tests/tracker-extract/data/mp3/header_bitrate_mpeg1_2.data1
-rw-r--r--tests/tracker-extract/data/mp3/header_bitrate_mpeg1_3.data1
-rw-r--r--tests/tracker-extract/data/mp3/header_bitrate_mpeg1_4.data1
-rw-r--r--tests/tracker-extract/data/mp3/header_bitrate_mpeg1_5.data1
-rw-r--r--tests/tracker-extract/data/mp3/header_bitrate_mpeg1_6.data1
-rw-r--r--tests/tracker-extract/data/mp3/header_bitrate_mpeg1_7.data1
-rw-r--r--tests/tracker-extract/data/mp3/header_bitrate_mpeg1_8.data1
-rw-r--r--tests/tracker-extract/data/mp3/header_bitrate_mpeg1_9.data1
-rw-r--r--tests/tracker-extract/data/mp3/header_sampling_mpeg1_1.data1
-rw-r--r--tests/tracker-extract/data/mp3/header_sampling_mpeg1_2.data1
-rw-r--r--tests/tracker-extract/data/mp3/header_sampling_mpeg1_3.data1
-rw-r--r--tests/tracker-extract/data/mp3/header_sampling_mpeg25_1.data1
-rw-r--r--tests/tracker-extract/data/mp3/header_sampling_mpeg25_2.data1
-rw-r--r--tests/tracker-extract/data/mp3/header_sampling_mpeg25_3.data1
-rw-r--r--tests/tracker-extract/data/mp3/header_sampling_mpeg2_1.data1
-rw-r--r--tests/tracker-extract/data/mp3/header_sampling_mpeg2_2.data1
-rw-r--r--tests/tracker-extract/data/mp3/header_sampling_mpeg2_3.data1
-rw-r--r--tests/tracker-extract/data/mp3/id3v1_basic_1.data7
-rw-r--r--tests/tracker-extract/data/mp3/id3v1_basic_2.data7
-rw-r--r--tests/tracker-extract/data/mp3/id3v1_basic_3.data7
-rw-r--r--tests/tracker-extract/data/mp3/id3v23_basic_1.data7
-rw-r--r--tests/tracker-extract/data/mp3/id3v23_basic_2.data7
-rw-r--r--tests/tracker-extract/data/mp3/id3v23_basic_3.data7
-rw-r--r--tests/tracker-extract/data/mp3/id3v23_comm_1.data7
-rw-r--r--tests/tracker-extract/data/mp3/id3v23_comm_2.data7
-rw-r--r--tests/tracker-extract/data/mp3/id3v23_comm_3.data7
-rw-r--r--tests/tracker-extract/data/mp3/id3v23_trck_1.data7
-rw-r--r--tests/tracker-extract/tracker-extract-mp3-test.c396
40 files changed, 656 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 1a8ff15af..bd2991424 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2009-01-08 Mikael Ottela <mikael.ottela@ixonos.com>
+
+ * configure.ac
+ * tests/Makefile.am
+ * tests/tracker-extract
+ * tests/tracker-extract/Makefile.am
+ * tests/tracker-extract/tracker-extract-mp3-test.c: Added some
+ initial unit tests for mp3 extraction.
+
+ * tests/tracker-extract/data
+ * tests/tracker-extract/data/mp3
+ * tests/tracker-extract/data/mp3/*.data
+ * tests/tracker-extract/data/mp3/create_mp3_testdata: Test data
+ for the mp3 extraction unit tests and a script for creating the files.
+
+ * src/tracker-extract/tracker-extract-mp3.c: Added some missing
+ pieces of track number and release data extraction.
+
2009-01-08 Carlos Garnacho <carlos@imendio.com>
* src/tracker-indexer/tracker-module-file.[ch]: Add get_flags()
diff --git a/configure.ac b/configure.ac
index 917853863..4dcfdfa7a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1209,6 +1209,7 @@ AC_CONFIG_FILES([
tests/trackerd/Makefile
tests/trackerd/xesam/Makefile
tests/tracker-indexer/Makefile
+ tests/tracker-extract/Makefile
utils/Makefile
utils/qdbm/Makefile
utils/tracker-fts/Makefile
diff --git a/src/tracker-extract/tracker-extract-mp3.c b/src/tracker-extract/tracker-extract-mp3.c
index efa27c9f1..e54e1c7fb 100644
--- a/src/tracker-extract/tracker-extract-mp3.c
+++ b/src/tracker-extract/tracker-extract-mp3.c
@@ -64,6 +64,7 @@ typedef struct {
gchar *album;
gchar *year;
gchar *comment;
+ gchar *trackno;
gchar *genre;
} id3tag;
@@ -287,6 +288,7 @@ get_id3 (const gchar *data,
id3tag *id3)
{
const gchar *pos;
+ gchar buf[5];
if (size < 128) {
return FALSE;
@@ -322,10 +324,23 @@ get_id3 (const gchar *data,
NULL, NULL, NULL);
pos += 4;
- id3->comment = g_convert (pos, 30,
- "UTF-8",
- "ISO-8859-1",
- NULL, NULL, NULL);
+
+ if (pos[28] != (guint)0) {
+ id3->comment = g_convert (pos, 30,
+ "UTF-8",
+ "ISO-8859-1",
+ NULL, NULL, NULL);
+
+ id3->trackno = NULL;
+ } else {
+ id3->comment = g_convert (pos, 28,
+ "UTF-8",
+ "ISO-8859-1",
+ NULL, NULL, NULL);
+ snprintf (buf, 5, "%d", pos[29]);
+ id3->trackno = strdup(buf);
+ }
+
pos += 30;
id3->genre = (char *) "";
@@ -567,6 +582,8 @@ get_id3v24_tags (const gchar *data,
{"TIT2", "Audio:Title"},
{"TIT3", "Audio:Comment"},
{"WCOP", "File:License"},
+ {"TDRL", "Audio:ReleaseDate"},
+ {"TRCK", "Audio:TrackNo"},
{NULL, 0},
};
@@ -691,6 +708,14 @@ get_id3v24_tags (const gchar *data,
csize--;
if (word != NULL && strlen (word) > 0) {
+
+ if (strcmp (tmap[i].text, "TRCK") == 0) {
+ gchar **parts;
+ parts = g_strsplit (word, "/", 2);
+ g_free (word);
+ word = g_strdup (parts[0]);
+ g_strfreev (parts);
+ }
g_hash_table_insert (metadata,
g_strdup (tmap[i].type),
@@ -828,6 +853,8 @@ get_id3v23_tags (const gchar *data,
{"TLAN", "File:Language"},
{"TIT2", "Audio:Title"},
{"WCOP", "File:License"},
+ {"TYER", "Audio:ReleaseDate"},
+ {"TRCK", "Audio:TrackNo"},
{NULL, 0},
};
@@ -952,12 +979,13 @@ get_id3v23_tags (const gchar *data,
csize--;
if (word != NULL && strlen(word) > 0) {
- if (strcmp (tmap[i].text, "COMM") == 0) {
- gchar *s;
- s = g_strdup (word + strlen (word) + 1);
+ if (strcmp (tmap[i].text, "TRCK") == 0) {
+ gchar **parts;
+ parts = g_strsplit (word, "/", 2);
g_free (word);
- word = s;
+ word = g_strdup (parts[0]);
+ g_strfreev (parts);
}
g_hash_table_insert (metadata,
@@ -1233,6 +1261,7 @@ extract_mp3 (const gchar *filename,
info.year = NULL;
info.comment = NULL;
info.genre = NULL;
+ info.trackno = NULL;
filedata.audio_offset = 0;
filedata.albumartdata = NULL;
@@ -1308,6 +1337,12 @@ extract_mp3 (const gchar *filename,
tracker_escape_metadata (info.comment));
}
+ if (info.trackno && strlen (info.trackno) > 0) {
+ g_hash_table_insert (metadata,
+ g_strdup ("Audio:TrackNo"),
+ tracker_escape_metadata (info.trackno));
+ }
+
free (info.title);
free (info.year);
free (info.album);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4d7ebea7b..fd96c2cd2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -6,3 +6,5 @@ SUBDIRS = common \
trackerd \
scripts \
tracker-indexer
+
+# tracker-extract
diff --git a/tests/tracker-extract/Makefile.am b/tests/tracker-extract/Makefile.am
new file mode 100644
index 000000000..0d229a57c
--- /dev/null
+++ b/tests/tracker-extract/Makefile.am
@@ -0,0 +1,29 @@
+include $(top_srcdir)/Makefile.decl
+
+noinst_PROGRAMS = $(TEST_PROGS)
+
+TEST_PROGS += \
+ test-tracker-extract-mp3
+
+INCLUDES = \
+ -DG_LOG_DOMAIN=\"Tracker\" \
+ -DTEST_DATA_DIR=\""$(top_builddir)/tests/tracker-extract/data"\"\
+ -DTRACKER_COMPILATION \
+ -I$(top_srcdir)/src \
+ -I$(top_srcdir)/tests/common \
+ $(DBUS_CFLAGS) \
+ $(GMODULE_CFLAGS) \
+ $(GTHREAD_CFLAGS) \
+ $(PANGO_CFLAGS) \
+ $(GLIB2_CFLAGS)
+
+test_tracker_extract_mp3_SOURCES = \
+ tracker-extract-mp3-test.c
+
+
+test_tracker_extract_mp3_LDADD = \
+ $(top_builddir)/src/tracker-extract/libextract-mp3.la \
+ $(top_builddir)/src/libtracker-common/libtracker-common.la \
+ $(GMODULE_LIBS) \
+ $(GTHREAD_LIBS) \
+ $(GLIB2_LIBS)
diff --git a/tests/tracker-extract/data/mp3/create_mp3_testdata b/tests/tracker-extract/data/mp3/create_mp3_testdata
new file mode 100755
index 000000000..3256e403b
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/create_mp3_testdata
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+# *** Basic id3v1 tags (ver 1 layer 3) ***
+
+echo Basic id3v1 tags 1| text2wave - | lame --resample 48 - "id3v1_basic_1.mp3"
+id3v2 --id3v1-only -t "The title" -a "The Artist" -A "The album name" -y 1969 -c "This is a basic comment" -T 5 -g 5 "id3v1_basic_1.mp3"
+echo Basic id3v1 tags 2| text2wave - | lame --resample 48 - "id3v1_basic_2.mp3"
+id3v2 --id3v1-only -t "Title" -a "Artist" -A "Album" -y 1999 -c "Comment" -T 6 -g 6 "id3v1_basic_2.mp3"
+echo Basic id3v1 tags 3| text2wave - | lame --resample 48 - "id3v1_basic_3.mp3"
+id3v2 --id3v1-only -t "nimi" -a "artisti" -A "levy" -y 2029 -c "jotain kommenttia" -T 7 -g 7 "id3v1_basic_3.mp3"
+
+# *** id3v1 specific tags ***
+
+
+
+# *** Basic id3v23 tags (ver 1 layer 3) ***
+
+echo Basic id3v23 tags 1| text2wave - | lame --resample 48 - "id3v23_basic_1.mp3"
+id3v2 --id3v2-only -t "The titlev23" -a "The artistv23" -A "The album namev23" -y 1969 -c "This is a basic commentv23" -T 8 -g 8 "id3v23_basic_1.mp3"
+echo Basic id3v23 tags 2| text2wave - | lame --resample 48 - "id3v23_basic_2.mp3"
+id3v2 --id3v2-only -t "Titlev23" -a "Artistv23" -A "Albumv23" -y 1999 -c "Commentv23" -T 9 -g 9 "id3v23_basic_2.mp3"
+echo Basic id3v23 tags 3| text2wave - | lame --resample 48 - "id3v23_basic_3.mp3"
+id3v2 --id3v2-only -t "nimiv23" -a "artistiv23" -A "levyv23" -y 2029 -c "jotain kommenttiav23" -T 10 -g 10 "id3v23_basic_3.mp3"
+
+# *** id3v23 specific tags ***
+
+#TRCK
+echo Basic id3v23 tags 1| text2wave - | lame --resample 48 - "id3v23_trck_1.mp3"
+id3v2 --id3v2-only -t "The titlev23" -a "The artistv23" -A "The album namev23" -y 1969 -c "This is a basic commentv23" -T 88/95 -g 8 "id3v23_trck_1.mp3"
+
+#COMM
+echo Basic id3v23 tags 1| text2wave - | lame --resample 48 - "id3v23_comm_1.mp3"
+id3v2 --id3v2-only -t "The titlev23" -a "The artistv23" -A "The album namev23" -y 1969 -c "" -T 8 -g 8 "id3v23_comm_1.mp3"
+
+echo Basic id3v23 tags 1| text2wave - | lame --resample 48 - "id3v23_comm_2.mp3"
+id3v2 --id3v2-only -t "The titlev23" -a "The artistv23" -A "The album namev23" -y 1969 -c " " -T 8 -g 8 "id3v23_comm_2.mp3"
+
+echo Basic id3v23 tags 1| text2wave - | lame --resample 48 - "id3v23_comm_3.mp3"
+id3v2 --id3v2-only -t "The titlev23" -a "The artistv23" -A "The album namev23" -y 1969 -c "c" -T 8 -g 8 "id3v23_comm_3.mp3"
+
+# *** Basic header/calculated tags ***
+
+#Sampling rate
+echo Header sampling 32 | text2wave - | lame --resample 32 - "header_sampling_mpeg1_1.mp3"
+echo Header sampling 48 | text2wave - | lame --resample 48 - "header_sampling_mpeg1_2.mp3"
+echo Header sampling 44.1| text2wave - | lame --resample 44.1 - "header_sampling_mpeg1_3.mp3"
+
+echo Header sampling 16 | text2wave - | lame --resample 16 - "header_sampling_mpeg2_1.mp3"
+echo Header sampling 24 | text2wave - | lame --resample 24 - "header_sampling_mpeg2_2.mp3"
+echo Header sampling 22.05| text2wave - | lame --resample 22.05 - "header_sampling_mpeg2_3.mp3"
+
+echo Header sampling 8 | text2wave - | lame --resample 8 - "header_sampling_mpeg25_1.mp3"
+echo Header sampling 12 | text2wave - | lame --resample 12 - "header_sampling_mpeg25_2.mp3"
+echo Header sampling 11.025| text2wave - | lame --resample 11.025 - "header_sampling_mpeg25_3.mp3"
+
+#Bitrate
+echo Header bitrate 32 | text2wave - | lame --resample 32 --cbr -b 32 - "header_bitrate_mpeg1_1.mp3"
+echo Header bitrate 40 | text2wave - | lame --resample 32 --cbr -b 40 - "header_bitrate_mpeg1_2.mp3"
+echo Header bitrate 48 | text2wave - | lame --resample 32 --cbr -b 48 - "header_bitrate_mpeg1_3.mp3"
+echo Header bitrate 56 | text2wave - | lame --resample 32 --cbr -b 56 - "header_bitrate_mpeg1_4.mp3"
+echo Header bitrate 64 | text2wave - | lame --resample 32 --cbr -b 64 - "header_bitrate_mpeg1_5.mp3"
+echo Header bitrate 80 | text2wave - | lame --resample 32 --cbr -b 80 - "header_bitrate_mpeg1_6.mp3"
+echo Header bitrate 96 | text2wave - | lame --resample 32 --cbr -b 96 - "header_bitrate_mpeg1_7.mp3"
+echo Header bitrate 112| text2wave - | lame --resample 32 --cbr -b 112 - "header_bitrate_mpeg1_8.mp3"
+echo Header bitrate 128| text2wave - | lame --resample 32 --cbr -b 128 - "header_bitrate_mpeg1_9.mp3"
+echo Header bitrate 160| text2wave - | lame --resample 32 --cbr -b 160 - "header_bitrate_mpeg1_10.mp3"
+echo Header bitrate 192| text2wave - | lame --resample 32 --cbr -b 192 - "header_bitrate_mpeg1_11.mp3"
+echo Header bitrate 224| text2wave - | lame --resample 32 --cbr -b 224 - "header_bitrate_mpeg1_12.mp3"
+echo Header bitrate 256| text2wave - | lame --resample 32 --cbr -b 256 - "header_bitrate_mpeg1_13.mp3"
+echo Header bitrate 320| text2wave - | lame --resample 32 --cbr -b 320 - "header_bitrate_mpeg1_14.mp3"
+
+
+
+
diff --git a/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_1.data b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_1.data
new file mode 100644
index 000000000..de331018b
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_1.data
@@ -0,0 +1 @@
+Audio:Bitrate = "32"
diff --git a/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_10.data b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_10.data
new file mode 100644
index 000000000..b76c034b5
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_10.data
@@ -0,0 +1 @@
+Audio:Bitrate = "160"
diff --git a/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_11.data b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_11.data
new file mode 100644
index 000000000..d31281bd5
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_11.data
@@ -0,0 +1 @@
+Audio:Bitrate = "192"
diff --git a/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_12.data b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_12.data
new file mode 100644
index 000000000..5b246992c
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_12.data
@@ -0,0 +1 @@
+Audio:Bitrate = "224"
diff --git a/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_13.data b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_13.data
new file mode 100644
index 000000000..b3d8b9c43
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_13.data
@@ -0,0 +1 @@
+Audio:Bitrate = "256"
diff --git a/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_14.data b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_14.data
new file mode 100644
index 000000000..e0e33ef6a
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_14.data
@@ -0,0 +1 @@
+Audio:Bitrate = "320"
diff --git a/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_2.data b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_2.data
new file mode 100644
index 000000000..64b9ffef4
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_2.data
@@ -0,0 +1 @@
+Audio:Bitrate = "40"
diff --git a/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_3.data b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_3.data
new file mode 100644
index 000000000..b4600aaf0
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_3.data
@@ -0,0 +1 @@
+Audio:Bitrate = "48"
diff --git a/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_4.data b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_4.data
new file mode 100644
index 000000000..f1a552423
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_4.data
@@ -0,0 +1 @@
+Audio:Bitrate = "56"
diff --git a/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_5.data b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_5.data
new file mode 100644
index 000000000..364c5da14
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_5.data
@@ -0,0 +1 @@
+Audio:Bitrate = "64"
diff --git a/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_6.data b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_6.data
new file mode 100644
index 000000000..6fd8aebea
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_6.data
@@ -0,0 +1 @@
+Audio:Bitrate = "80"
diff --git a/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_7.data b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_7.data
new file mode 100644
index 000000000..626e27b65
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_7.data
@@ -0,0 +1 @@
+Audio:Bitrate = "96"
diff --git a/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_8.data b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_8.data
new file mode 100644
index 000000000..eae518d46
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_8.data
@@ -0,0 +1 @@
+Audio:Bitrate = "112"
diff --git a/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_9.data b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_9.data
new file mode 100644
index 000000000..16925b5ae
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/header_bitrate_mpeg1_9.data
@@ -0,0 +1 @@
+Audio:Bitrate = "128"
diff --git a/tests/tracker-extract/data/mp3/header_sampling_mpeg1_1.data b/tests/tracker-extract/data/mp3/header_sampling_mpeg1_1.data
new file mode 100644
index 000000000..3156e4987
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/header_sampling_mpeg1_1.data
@@ -0,0 +1 @@
+Audio:Samplerate = "32000"
diff --git a/tests/tracker-extract/data/mp3/header_sampling_mpeg1_2.data b/tests/tracker-extract/data/mp3/header_sampling_mpeg1_2.data
new file mode 100644
index 000000000..9393f5dc9
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/header_sampling_mpeg1_2.data
@@ -0,0 +1 @@
+Audio:Samplerate = "48000"
diff --git a/tests/tracker-extract/data/mp3/header_sampling_mpeg1_3.data b/tests/tracker-extract/data/mp3/header_sampling_mpeg1_3.data
new file mode 100644
index 000000000..b739bceba
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/header_sampling_mpeg1_3.data
@@ -0,0 +1 @@
+Audio:Samplerate = "44100"
diff --git a/tests/tracker-extract/data/mp3/header_sampling_mpeg25_1.data b/tests/tracker-extract/data/mp3/header_sampling_mpeg25_1.data
new file mode 100644
index 000000000..bbd0758db
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/header_sampling_mpeg25_1.data
@@ -0,0 +1 @@
+Audio:Samplerate = "8000"
diff --git a/tests/tracker-extract/data/mp3/header_sampling_mpeg25_2.data b/tests/tracker-extract/data/mp3/header_sampling_mpeg25_2.data
new file mode 100644
index 000000000..49a1feee7
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/header_sampling_mpeg25_2.data
@@ -0,0 +1 @@
+Audio:Samplerate = "12000"
diff --git a/tests/tracker-extract/data/mp3/header_sampling_mpeg25_3.data b/tests/tracker-extract/data/mp3/header_sampling_mpeg25_3.data
new file mode 100644
index 000000000..78a47aa7a
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/header_sampling_mpeg25_3.data
@@ -0,0 +1 @@
+Audio:Samplerate = "11025"
diff --git a/tests/tracker-extract/data/mp3/header_sampling_mpeg2_1.data b/tests/tracker-extract/data/mp3/header_sampling_mpeg2_1.data
new file mode 100644
index 000000000..15c4966ec
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/header_sampling_mpeg2_1.data
@@ -0,0 +1 @@
+Audio:Samplerate = "16000"
diff --git a/tests/tracker-extract/data/mp3/header_sampling_mpeg2_2.data b/tests/tracker-extract/data/mp3/header_sampling_mpeg2_2.data
new file mode 100644
index 000000000..db1cb9a17
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/header_sampling_mpeg2_2.data
@@ -0,0 +1 @@
+Audio:Samplerate = "24000"
diff --git a/tests/tracker-extract/data/mp3/header_sampling_mpeg2_3.data b/tests/tracker-extract/data/mp3/header_sampling_mpeg2_3.data
new file mode 100644
index 000000000..cedc85514
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/header_sampling_mpeg2_3.data
@@ -0,0 +1 @@
+Audio:Samplerate = "22050"
diff --git a/tests/tracker-extract/data/mp3/id3v1_basic_1.data b/tests/tracker-extract/data/mp3/id3v1_basic_1.data
new file mode 100644
index 000000000..fb860142d
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/id3v1_basic_1.data
@@ -0,0 +1,7 @@
+Audio:Title = "The title"
+Audio:Artist = "The artist"
+Audio:Album = "The album name"
+Audio:Comment = "This is a basic comment"
+Audio:Genre = "Funk"
+Audio:ReleaseDate = "1969"
+Audio:TrackNo = "5"
diff --git a/tests/tracker-extract/data/mp3/id3v1_basic_2.data b/tests/tracker-extract/data/mp3/id3v1_basic_2.data
new file mode 100644
index 000000000..9baa7f7f1
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/id3v1_basic_2.data
@@ -0,0 +1,7 @@
+Audio:Title = "Title"
+Audio:Artist = "Artist"
+Audio:Album = "Album"
+Audio:Comment = "Comment"
+Audio:Genre = "Grunge"
+Audio:ReleaseDate = "1999"
+Audio:TrackNo = "6"
diff --git a/tests/tracker-extract/data/mp3/id3v1_basic_3.data b/tests/tracker-extract/data/mp3/id3v1_basic_3.data
new file mode 100644
index 000000000..c02915f91
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/id3v1_basic_3.data
@@ -0,0 +1,7 @@
+Audio:Title = "nimi"
+Audio:Artist = "artisti"
+Audio:Album = "levy"
+Audio:Comment = "jotain kommenttia"
+Audio:Genre = "Hip-Hop"
+Audio:ReleaseDate = "2029"
+Audio:TrackNo = "7"
diff --git a/tests/tracker-extract/data/mp3/id3v23_basic_1.data b/tests/tracker-extract/data/mp3/id3v23_basic_1.data
new file mode 100644
index 000000000..1b54d88ae
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/id3v23_basic_1.data
@@ -0,0 +1,7 @@
+Audio:Title = "The titlev23"
+Audio:Artist = "The artistv23"
+Audio:Album = "The album namev23"
+Audio:Comment = "This is a basic commentv23"
+Audio:Genre = "(8)"
+Audio:ReleaseDate = "1969"
+Audio:TrackNo = "5"
diff --git a/tests/tracker-extract/data/mp3/id3v23_basic_2.data b/tests/tracker-extract/data/mp3/id3v23_basic_2.data
new file mode 100644
index 000000000..0375611e5
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/id3v23_basic_2.data
@@ -0,0 +1,7 @@
+Audio:Title = "Titlev23"
+Audio:Artist = "Artistv23"
+Audio:Album = "Albumv23"
+Audio:Comment = "Commentv23"
+Audio:Genre = "(9)"
+Audio:ReleaseDate = "1999"
+Audio:TrackNo = "6"
diff --git a/tests/tracker-extract/data/mp3/id3v23_basic_3.data b/tests/tracker-extract/data/mp3/id3v23_basic_3.data
new file mode 100644
index 000000000..db2406ce0
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/id3v23_basic_3.data
@@ -0,0 +1,7 @@
+Audio:Title = "nimiv23"
+Audio:Artist = "artistiv23"
+Audio:Album = "levyv23"
+Audio:Comment = "jotain kommenttiav23"
+Audio:Genre = "(10)"
+Audio:ReleaseDate = "2029"
+Audio:TrackNo = "10"
diff --git a/tests/tracker-extract/data/mp3/id3v23_comm_1.data b/tests/tracker-extract/data/mp3/id3v23_comm_1.data
new file mode 100644
index 000000000..9d8758fb3
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/id3v23_comm_1.data
@@ -0,0 +1,7 @@
+Audio:Title = "The titlev23"
+Audio:Artist = "The artistv23"
+Audio:Album = "The album namev23"
+Audio:Comment = ""
+Audio:Genre = "(8)"
+Audio:ReleaseDate = "1969"
+Audio:TrackNo = "8"
diff --git a/tests/tracker-extract/data/mp3/id3v23_comm_2.data b/tests/tracker-extract/data/mp3/id3v23_comm_2.data
new file mode 100644
index 000000000..a7859fce9
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/id3v23_comm_2.data
@@ -0,0 +1,7 @@
+Audio:Title = "The titlev23"
+Audio:Artist = "The artistv23"
+Audio:Album = "The album namev23"
+Audio:Comment = " "
+Audio:Genre = "(8)"
+Audio:ReleaseDate = "1969"
+Audio:TrackNo = "8"
diff --git a/tests/tracker-extract/data/mp3/id3v23_comm_3.data b/tests/tracker-extract/data/mp3/id3v23_comm_3.data
new file mode 100644
index 000000000..1864ccb33
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/id3v23_comm_3.data
@@ -0,0 +1,7 @@
+Audio:Title = "The titlev23"
+Audio:Artist = "The artistv23"
+Audio:Album = "The album namev23"
+Audio:Comment = "c"
+Audio:Genre = "(8)"
+Audio:ReleaseDate = "1969"
+Audio:TrackNo = "8"
diff --git a/tests/tracker-extract/data/mp3/id3v23_trck_1.data b/tests/tracker-extract/data/mp3/id3v23_trck_1.data
new file mode 100644
index 000000000..b79f3a1b4
--- /dev/null
+++ b/tests/tracker-extract/data/mp3/id3v23_trck_1.data
@@ -0,0 +1,7 @@
+Audio:Title = "The titlev23"
+Audio:Artist = "The artistv23"
+Audio:Album = "The album namev23"
+Audio:Comment = "This is a basic commentv23"
+Audio:Genre = "(8)"
+Audio:ReleaseDate = "1969"
+Audio:TrackNo = "88"
diff --git a/tests/tracker-extract/tracker-extract-mp3-test.c b/tests/tracker-extract/tracker-extract-mp3-test.c
new file mode 100644
index 000000000..a871949dc
--- /dev/null
+++ b/tests/tracker-extract/tracker-extract-mp3-test.c
@@ -0,0 +1,396 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2008, Nokia (urho.konttori@nokia.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <string.h>
+#include <fcntl.h>
+#include <glib.h>
+
+#include <tracker-extract/tracker-extract.h>
+
+typedef struct
+{
+ gchar *filename;
+ gchar *testdata;
+} ExtractData;
+
+static GHashTable *
+parse_testdata_file (const gchar *filename)
+{
+ GHashTable *testdata;
+ GScanner *scanner;
+ GTokenType ttype;
+ GScannerConfig config = {
+ " \t\r\n", /* characters to skip */
+ G_CSET_a_2_z "_" G_CSET_A_2_Z, /* identifier start */
+ G_CSET_a_2_z "_.:" G_CSET_A_2_Z G_CSET_DIGITS,/* identifier cont. */
+ "#\n", /* single line comment */
+ TRUE, /* case_sensitive */
+ TRUE, /* skip multi-line comments */
+ TRUE, /* skip single line comments */
+ FALSE, /* scan multi-line comments */
+ TRUE, /* scan identifiers */
+ TRUE, /* scan 1-char identifiers */
+ FALSE, /* scan NULL identifiers */
+ FALSE, /* scan symbols */
+ FALSE, /* scan binary */
+ FALSE, /* scan octal */
+ TRUE, /* scan float */
+ TRUE, /* scan hex */
+ FALSE, /* scan hex dollar */
+ TRUE, /* scan single quote strings */
+ TRUE, /* scan double quite strings */
+ TRUE, /* numbers to int */
+ FALSE, /* int to float */
+ TRUE, /* identifier to string */
+ TRUE, /* char to token */
+ FALSE, /* symbol to token */
+ FALSE, /* scope 0 fallback */
+ FALSE /* store int64 */
+ };
+
+ int fd;
+
+ testdata = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ g_free,
+ g_free);
+
+ fd = open (filename, O_RDONLY);
+
+ g_assert (fd >= 0);
+
+ scanner = g_scanner_new (&config);
+ g_scanner_input_file (scanner, fd);
+ scanner->input_name = filename;
+
+ for (ttype = g_scanner_get_next_token(scanner);
+ ttype != G_TOKEN_EOF;
+ ttype = g_scanner_get_next_token (scanner)) {
+ if (ttype = G_TOKEN_IDENTIFIER) {
+ gchar key[256];
+ strcpy (key, scanner->value.v_identifier);
+
+ ttype = g_scanner_get_next_token(scanner);
+ g_assert (ttype == G_TOKEN_EQUAL_SIGN);
+
+ ttype = g_scanner_get_next_token(scanner);
+
+ switch (ttype) {
+ case G_TOKEN_STRING:
+
+ g_hash_table_insert (testdata,
+ g_strdup(key),
+ g_strdup(scanner->value.v_string));
+ break;
+
+ default:
+ g_assert_not_reached();
+
+ }
+
+ }
+ }
+ g_scanner_destroy (scanner);
+ close (fd);
+
+ return testdata;
+}
+
+static void
+dump_metadataitem (gpointer key,
+ gpointer value,
+ gpointer user_data)
+{
+ gchar *value_utf8;
+
+ g_assert (key != NULL);
+ g_assert (value != NULL);
+
+ value_utf8 = g_locale_to_utf8 (value, -1, NULL, NULL, NULL);
+
+ if (value_utf8) {
+ value_utf8 = g_strstrip (value_utf8);
+ g_print ("%s=%s;\n", (gchar*) key, value_utf8);
+ g_free (value_utf8);
+ }
+}
+
+static void
+dump_metadata (GHashTable *metadata)
+{
+ g_assert (metadata != NULL);
+ g_hash_table_foreach (metadata, dump_metadataitem, NULL);
+}
+
+static void
+check_metadata (GHashTable *metadata, gchar *key, gchar *value)
+{
+ gchar *cvalue;
+ g_assert (metadata != NULL);
+ g_assert (key != NULL);
+ g_assert (value != NULL);
+
+ cvalue = g_hash_table_lookup (metadata, key);
+ g_assert (cvalue != NULL);
+ g_assert_cmpstr (cvalue, ==, value);
+}
+
+static TrackerExtractorData *
+search_mime_extractor (const gchar *mime)
+{
+ TrackerExtractorData *data;
+
+ data = tracker_get_extractor_data();
+
+ while (data->mime) {
+
+ if (strcmp(data->mime,mime) == 0) {
+ return data;
+ }
+ data++;
+ }
+
+ return NULL;
+}
+
+static void
+extract_file (const gchar *file, const gchar *testdatafile)
+{
+ GHashTable *metadata;
+ GHashTable *testdata;
+
+ gchar *filename;
+ gchar *testdata_filename;
+
+ TrackerExtractorData *data;
+
+ GHashTableIter iter;
+ gpointer key, value;
+
+ filename = g_strconcat (TEST_DATA_DIR, file, NULL);
+ testdata_filename = g_strconcat (TEST_DATA_DIR, testdatafile, NULL);
+
+ metadata = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ g_free,
+ g_free);
+
+ data = search_mime_extractor ("audio/mpeg");
+ g_assert (data != NULL);
+ (*data->extractor) (filename, metadata);
+
+ testdata = parse_testdata_file (testdata_filename);
+
+ g_hash_table_iter_init (&iter, testdata);
+ while (g_hash_table_iter_next (&iter, &key, &value)) {
+ check_metadata (metadata, (gchar *)key, (gchar *)value);
+ }
+
+ g_hash_table_destroy (metadata);
+ g_hash_table_destroy (testdata);
+}
+
+static void
+test_extract_mp3_check_extractor_data (void)
+{
+ TrackerExtractorData *data;
+ guint extractors = 0;
+
+ data = tracker_get_extractor_data();
+
+ while (data->mime) {
+
+ if (data->extractor == NULL) {
+ g_error ("Extractor for mime '%s' declared NULL", data->mime);
+ }
+
+ extractors++;
+ data++;
+ }
+
+ g_assert (extractors > 1);
+}
+
+static void
+test_extract_mp3_extract_file (gconstpointer user_data)
+{
+ const ExtractData *data = user_data;
+ extract_file (data->filename, data->testdata);
+}
+
+int
+main (int argc, char **argv) {
+
+ gint result;
+ ExtractData data;
+
+ g_type_init ();
+ g_thread_init (NULL);
+ g_test_init (&argc, &argv, NULL);
+
+ g_test_message ("Testing basic extractor functionality");
+ g_test_add_func ("/tracker-extract/tracker-extract-mp3/check-extractor-data", test_extract_mp3_check_extractor_data);
+
+ g_test_message ("Testing basic id3v1 metadata tags");
+
+ data.filename = "/mp3/id3v1_basic_1.mp3";
+ data.testdata = "/mp3/id3v1_basic_1.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/id3v1/1", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/id3v1_basic_2.mp3";
+ data.testdata = "/mp3/id3v1_basic_2.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/id3v1/2", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/id3v1_basic_3.mp3";
+ data.testdata = "/mp3/id3v1_basic_3.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/id3v1/3", &data, test_extract_mp3_extract_file);
+
+ g_test_message ("Testing basic id3v23 metadata tags");
+
+ data.filename = "/mp3/id3v23_basic_1.mp3";
+ data.testdata = "/mp3/id3v23_basic_1.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/id3v23/1", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/id3v23_basic_2.mp3";
+ data.testdata = "/mp3/id3v23_basic_2.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/id3v23/2", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/id3v23_basic_3.mp3";
+ data.testdata = "/mp3/id3v23_basic_3.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/id3v23/3", &data, test_extract_mp3_extract_file);
+
+ g_test_message ("Testing specific id3v23 tags");
+
+ data.filename = "/mp3/id3v23_trck_1.mp3";
+ data.testdata = "/mp3/id3v23_trck_1.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/id3v23/trck-1", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/id3v23_comm_1.mp3";
+ data.testdata = "/mp3/id3v23_comm_1.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/id3v23/comm-1", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/id3v23_comm_2.mp3";
+ data.testdata = "/mp3/id3v23_comm_2.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/id3v23/comm-2", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/id3v23_comm_3.mp3";
+ data.testdata = "/mp3/id3v23_comm_3.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/id3v23/comm-3", &data, test_extract_mp3_extract_file);
+
+ g_test_message ("Testing header/calculated metadata");
+
+ data.filename = "/mp3/header_bitrate_mpeg1_1.mp3";
+ data.testdata = "/mp3/header_bitrate_mpeg1_1.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/header/bitrate-mpeg1-1", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/header_bitrate_mpeg1_2.mp3";
+ data.testdata = "/mp3/header_bitrate_mpeg1_2.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/header/bitrate-mpeg1-2", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/header_bitrate_mpeg1_3.mp3";
+ data.testdata = "/mp3/header_bitrate_mpeg1_3.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/header/bitrate-mpeg1-3", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/header_bitrate_mpeg1_4.mp3";
+ data.testdata = "/mp3/header_bitrate_mpeg1_4.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/header/bitrate-mpeg1-4", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/header_bitrate_mpeg1_5.mp3";
+ data.testdata = "/mp3/header_bitrate_mpeg1_5.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/header/bitrate-mpeg1-5", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/header_bitrate_mpeg1_6.mp3";
+ data.testdata = "/mp3/header_bitrate_mpeg1_6.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/header/bitrate-mpeg1-6", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/header_bitrate_mpeg1_7.mp3";
+ data.testdata = "/mp3/header_bitrate_mpeg1_7.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/header/bitrate-mpeg1-7", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/header_bitrate_mpeg1_8.mp3";
+ data.testdata = "/mp3/header_bitrate_mpeg1_8.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/header/bitrate-mpeg1-8", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/header_bitrate_mpeg1_9.mp3";
+ data.testdata = "/mp3/header_bitrate_mpeg1_9.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/header/bitrate-mpeg1-9", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/header_bitrate_mpeg1_10.mp3";
+ data.testdata = "/mp3/header_bitrate_mpeg1_10.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/header/bitrate-mpeg1-10", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/header_bitrate_mpeg1_11.mp3";
+ data.testdata = "/mp3/header_bitrate_mpeg1_11.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/header/bitrate-mpeg1-11", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/header_bitrate_mpeg1_12.mp3";
+ data.testdata = "/mp3/header_bitrate_mpeg1_12.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/header/bitrate-mpeg1-12", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/header_bitrate_mpeg1_13.mp3";
+ data.testdata = "/mp3/header_bitrate_mpeg1_13.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/header/bitrate-mpeg1-13", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/header_bitrate_mpeg1_14.mp3";
+ data.testdata = "/mp3/header_bitrate_mpeg1_14.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/header/bitrate-mpeg1-14", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/header_sampling_mpeg1_1.mp3";
+ data.testdata = "/mp3/header_sampling_mpeg1_1.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/header/sampling-mpeg1-1", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/header_sampling_mpeg1_2.mp3";
+ data.testdata = "/mp3/header_sampling_mpeg1_2.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/header/sampling-mpeg1-2", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/header_sampling_mpeg1_3.mp3";
+ data.testdata = "/mp3/header_sampling_mpeg1_3.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/header/sampling-mpeg1-3", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/header_sampling_mpeg2_1.mp3";
+ data.testdata = "/mp3/header_sampling_mpeg2_1.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/header/sampling-mpeg2-1", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/header_sampling_mpeg2_2.mp3";
+ data.testdata = "/mp3/header_sampling_mpeg2_2.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/header/sampling-mpeg2-2", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/header_sampling_mpeg2_3.mp3";
+ data.testdata = "/mp3/header_sampling_mpeg2_3.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/header/sampling-mpeg2-3", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/header_sampling_mpeg25_1.mp3";
+ data.testdata = "/mp3/header_sampling_mpeg25_1.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/header/sampling-mpeg25-1", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/header_sampling_mpeg25_2.mp3";
+ data.testdata = "/mp3/header_sampling_mpeg25_2.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/header/sampling-mpeg25-2", &data, test_extract_mp3_extract_file);
+
+ data.filename = "/mp3/header_sampling_mpeg25_3.mp3";
+ data.testdata = "/mp3/header_sampling_mpeg25_3.data";
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/header/sampling-mpeg25-3", &data, test_extract_mp3_extract_file);
+
+ g_test_message ("Testing metadata ordering (priorities of sources)");
+
+ result = g_test_run ();
+
+ return result;
+}