From 33220920709682955aab7b0da11fb65c7f0a206f Mon Sep 17 00:00:00 2001 From: ibaker Date: Tue, 23 Apr 2024 13:26:15 -0700 Subject: [PATCH] Fix MP4 ID3 sort tag mapping The ID3 tags are documented here: https://wiki.hydrogenaud.io/index.php?title=Foobar2000:ID3_Tag_Mapping The MP4 fourcc types are documented here: https://mutagen.readthedocs.io/en/latest/api/mp4.html#mutagen.mp4.MP4Tags From the field definitions at the top of this file: * `TYPE_SORT_ALBUM = 0x736f616c = 'soal'` * `TYPE_SORT_ARTIST = 0x736f6172 = 'soar'` * `TYPE_SORT_ALBUM_ARTIST = 0x736f6161 = 'soaa'` Issue: androidx/media#1302 #minor-release PiperOrigin-RevId: 627486902 --- RELEASENOTES.md | 4 ++++ .../java/androidx/media3/extractor/mp4/MetadataUtil.java | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 38bcc31826..149da72d7f 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -21,6 +21,10 @@ * Video: * Text: * Metadata: + * Fix mapping of MP4 to ID3 sort tags. Previously the 'album sort' + (`soal`), 'artist sort' (`soar`) and 'album artist sort' (`soaa`) MP4 + tags were wrongly mapped to the `TSO2`, `TSOA` and `TSOP` ID3 tags + ([#1302](https://github.com/androidx/media/issues/1302)). * Image: * DRM: * Allow setting a `LoadErrorHandlingPolicy` on diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/MetadataUtil.java b/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/MetadataUtil.java index 01e570fa7b..6ec81e6840 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/MetadataUtil.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/MetadataUtil.java @@ -387,11 +387,11 @@ import com.google.common.collect.ImmutableList; } else if (type == TYPE_SORT_TRACK_NAME) { return parseTextAttribute(type, "TSOT", ilst); } else if (type == TYPE_SORT_ALBUM) { - return parseTextAttribute(type, "TSO2", ilst); - } else if (type == TYPE_SORT_ARTIST) { return parseTextAttribute(type, "TSOA", ilst); - } else if (type == TYPE_SORT_ALBUM_ARTIST) { + } else if (type == TYPE_SORT_ARTIST) { return parseTextAttribute(type, "TSOP", ilst); + } else if (type == TYPE_SORT_ALBUM_ARTIST) { + return parseTextAttribute(type, "TSO2", ilst); } else if (type == TYPE_SORT_COMPOSER) { return parseTextAttribute(type, "TSOC", ilst); } else if (type == TYPE_RATING) {