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 Change-Id: Iba1152013b7577168af71f947d7249560419fa05
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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...
|
||||
};
|
||||
|
||||
|
||||
@@ -73,6 +73,7 @@ enum {
|
||||
kKeyDiscNumber = 'dnum', // cstring
|
||||
kKeyDate = 'date', // cstring
|
||||
kKeyWriter = 'writ', // cstring
|
||||
kKeyCompilation = 'cpil', // cstring
|
||||
kKeyTimeScale = 'tmsl', // int32_t
|
||||
|
||||
// video profile and level
|
||||
|
||||
@@ -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...
|
||||
}
|
||||
|
||||
@@ -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]);
|
||||
|
||||
|
||||
@@ -1176,6 +1176,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) {
|
||||
|
||||
@@ -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 },
|
||||
|
||||
@@ -155,6 +155,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]);
|
||||
|
||||
|
||||
@@ -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]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user