Add ID3 genres added in Wimamp 5.6 (2010).

All these genres are currently causing a warning and are not added to the Metadata.Entry.

PiperOrigin-RevId: 290594810
This commit is contained in:
tonihei 2020-01-20 12:15:27 +00:00 committed by Oliver Woodman
parent 7aefaa7d68
commit c79cb1bfe0
3 changed files with 87 additions and 4 deletions

View File

@ -50,6 +50,9 @@
This issue caused FLAC streams with other bit depths to sound like white noise
on earlier releases, but only when embedded in a non-FLAC container such as
Matroska or MP4.
* Select multiple metadata tracks if multiple metadata renderers are available
([#6676](https://github.com/google/ExoPlayer/issues/6676)).
* Add support for ID3 genres added in Wimamp 5.6 (2010).
### 2.11.1 (2019-12-20) ###

View File

@ -16,6 +16,7 @@
package com.google.android.exoplayer2.extractor.mp4;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.extractor.GaplessInfoHolder;
@ -74,7 +75,8 @@ import java.nio.ByteBuffer;
private static final int PICTURE_TYPE_FRONT_COVER = 3;
// Standard genres.
private static final String[] STANDARD_GENRES =
@VisibleForTesting
/* package */ static final String[] STANDARD_GENRES =
new String[] {
// These are the official ID3v1 genres.
"Blues",
@ -157,7 +159,7 @@ import java.nio.ByteBuffer;
"Musical",
"Rock & Roll",
"Hard Rock",
// These were made up by the authors of Winamp and later added to the ID3 spec.
// Genres made up by the authors of Winamp (v1.91) and later added to the ID3 spec.
"Folk",
"Folk-Rock",
"National Folk",
@ -204,7 +206,7 @@ import java.nio.ByteBuffer;
"A capella",
"Euro-House",
"Dance Hall",
// These were made up by the authors of Winamp but have not been added to the ID3 spec.
// Genres made up by the authors of Winamp (v1.91) but have not been added to the ID3 spec.
"Goa",
"Drum & Bass",
"Club-House",
@ -226,7 +228,52 @@ import java.nio.ByteBuffer;
"Thrash Metal",
"Anime",
"Jpop",
"Synthpop"
"Synthpop",
// Genres made up by the authors of Winamp (v5.6) but have not been added to the ID3 spec.
"Abstract",
"Art Rock",
"Baroque",
"Bhangra",
"Big beat",
"Breakbeat",
"Chillout",
"Downtempo",
"Dub",
"EBM",
"Eclectic",
"Electro",
"Electroclash",
"Emo",
"Experimental",
"Garage",
"Global",
"IDM",
"Illbient",
"Industro-Goth",
"Jam Band",
"Krautrock",
"Leftfield",
"Lounge",
"Math Rock",
"New Romantic",
"Nu-Breakz",
"Post-Punk",
"Post-Rock",
"Psytrance",
"Shoegaze",
"Space Rock",
"Trop Rock",
"World Music",
"Neoclassical",
"Audiobook",
"Audio theatre",
"Neue Deutsche Welle",
"Podcast",
"Indie-Rock",
"G-Funk",
"Dubstep",
"Garage Rock",
"Psybient"
};
private static final String LANGUAGE_UNDEFINED = "und";

View File

@ -0,0 +1,33 @@
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.exoplayer2.extractor.mp4;
import static com.google.common.truth.Truth.assertThat;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
/** Test for {@link MetadataUtil}. */
@RunWith(AndroidJUnit4.class)
public final class MetadataUtilTest {
@Test
public void standardGenre_length_matchesNumberOfId3Genres() {
// Sanity check that we haven't forgotten a genre in the list.
assertThat(MetadataUtil.STANDARD_GENRES).hasLength(192);
}
}