am ba77a3f9: Add support for the "compilation" tag in mp3, mp4 and ogg, and also add support for two common ways of specifying album artist in ogg files. b/3311831

* commit 'ba77a3f9cb1d68b2ed4813aaae856444578e3a75':
  Add support for the "compilation" tag in mp3, mp4 and ogg, and also add support for two common ways of specifying album artist in ogg files. b/3311831
This commit is contained in:
Marco Nelissen
2011-01-06 20:29:11 -08:00
committed by Android Git Automerger
9 changed files with 27 additions and 0 deletions

View File

@@ -899,6 +899,13 @@ public final class MediaStore {
*/
public static final String ALBUM_ARTIST = "album_artist";
/**
* Whether the song is part of a compilation
* <P>Type: TEXT</P>
* @hide
*/
public static final String COMPILATION = "compilation";
/**
* A non human readable key calculated from the ARTIST, used for
* searching, sorting and grouping

View File

@@ -56,6 +56,7 @@ enum {
METADATA_KEY_MIMETYPE = 22,
METADATA_KEY_DISC_NUMBER = 23,
METADATA_KEY_ALBUMARTIST = 24,
METADATA_KEY_COMPILATION = 25,
// Add more here...
};

View File

@@ -75,6 +75,7 @@ enum {
kKeyDiscNumber = 'dnum', // cstring
kKeyDate = 'date', // cstring
kKeyWriter = 'writ', // cstring
kKeyCompilation = 'cpil', // cstring
kKeyTimeScale = 'tmsl', // int32_t
// video profile and level

View File

@@ -258,5 +258,6 @@ public class MediaMetadataRetriever
public static final int METADATA_KEY_MIMETYPE = 22;
public static final int METADATA_KEY_DISCNUMBER = 23;
public static final int METADATA_KEY_ALBUMARTIST = 24;
public static final int METADATA_KEY_COMPILATION = 25;
// Add more here...
}

View File

@@ -743,6 +743,7 @@ sp<MetaData> MP3Extractor::getMetaData() {
{ kKeyAuthor, "TXT", "TEXT" },
{ kKeyCDTrackNumber, "TRK", "TRCK" },
{ kKeyDiscNumber, "TPA", "TPOS" },
{ kKeyCompilation, "TCP", "TCMP" },
};
static const size_t kNumMapEntries = sizeof(kMap) / sizeof(kMap[0]);

View File

@@ -1379,6 +1379,17 @@ status_t MPEG4Extractor::parseMetaData(off_t offset, size_t size) {
metadataKey = kKeyGenre;
break;
}
case FOURCC('c', 'p', 'i', 'l'):
{
if (size == 9 && flags == 21) {
char tmp[16];
sprintf(tmp, "%d",
(int)buffer[size - 1]);
mFileMetaData->setCString(kKeyCompilation, tmp);
}
break;
}
case FOURCC('t', 'r', 'k', 'n'):
{
if (size == 16 && flags == 0) {

View File

@@ -660,6 +660,9 @@ void MyVorbisExtractor::parseFileMetaData() {
} kMap[] = {
{ "TITLE", kKeyTitle },
{ "ARTIST", kKeyArtist },
{ "ALBUMARTIST", kKeyAlbumArtist },
{ "ALBUM ARTIST", kKeyAlbumArtist },
{ "COMPILATION", kKeyCompilation },
{ "ALBUM", kKeyAlbum },
{ "COMPOSER", kKeyComposer },
{ "GENRE", kKeyGenre },

View File

@@ -156,6 +156,7 @@ status_t StagefrightMediaScanner::processFile(
{ "year", METADATA_KEY_YEAR },
{ "duration", METADATA_KEY_DURATION },
{ "writer", METADATA_KEY_WRITER },
{ "compilation", METADATA_KEY_COMPILATION },
};
static const size_t kNumEntries = sizeof(kKeyMap) / sizeof(kKeyMap[0]);

View File

@@ -355,6 +355,7 @@ void StagefrightMetadataRetriever::parseMetaData() {
{ kKeyTitle, METADATA_KEY_TITLE },
{ kKeyYear, METADATA_KEY_YEAR },
{ kKeyWriter, METADATA_KEY_WRITER },
{ kKeyCompilation, METADATA_KEY_COMPILATION },
};
static const size_t kNumMapEntries = sizeof(kMap) / sizeof(kMap[0]);