Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4391014a
authored
Oct 17, 2016
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Split genres into separate util class
parent
110c8f6f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
41 deletions
library/src/main/java/com/google/android/exoplayer2/extractor/mp4/AtomParsers.java
library/src/main/java/com/google/android/exoplayer2/metadata/id3/Id3Decoder.java
library/src/main/java/com/google/android/exoplayer2/metadata/id3/Id3Util.java
library/src/main/java/com/google/android/exoplayer2/extractor/mp4/AtomParsers.java
View file @
4391014a
...
...
@@ -27,7 +27,7 @@ import com.google.android.exoplayer2.metadata.Metadata;
import
com.google.android.exoplayer2.metadata.id3.BinaryFrame
;
import
com.google.android.exoplayer2.metadata.id3.CommentFrame
;
import
com.google.android.exoplayer2.metadata.id3.Id3Frame
;
import
com.google.android.exoplayer2.metadata.id3.Id3
Decoder
;
import
com.google.android.exoplayer2.metadata.id3.Id3
Util
;
import
com.google.android.exoplayer2.metadata.id3.TextInformationFrame
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.CodecSpecificDataUtil
;
...
...
@@ -36,7 +36,6 @@ import com.google.android.exoplayer2.util.ParsableByteArray;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.video.AvcConfig
;
import
com.google.android.exoplayer2.video.HevcConfig
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
...
...
@@ -666,7 +665,7 @@ import java.util.List;
byte
[]
bytes
=
(
byte
[])
value
;
if
(
bytes
.
length
==
2
)
{
int
code
=
(
bytes
[
0
]
<<
8
)
+
(
bytes
[
1
]
&
0xFF
);
String
s
=
Id3
Decoder
.
decodeGenre
(
code
);
String
s
=
Id3
Util
.
decodeGenre
(
code
);
if
(
s
!=
null
)
{
Id3Frame
frame
=
new
TextInformationFrame
(
attributeName
,
s
);
builder
.
add
(
frame
);
...
...
library/src/main/java/com/google/android/exoplayer2/metadata/id3/Id3Decoder.java
View file @
4391014a
...
...
@@ -428,10 +428,6 @@ public final class Id3Decoder implements MetadataDecoder {
?
1
:
2
;
}
public
static
String
decodeGenre
(
int
code
)
{
return
(
0
<
code
&&
code
<=
standardGenres
.
length
)
?
standardGenres
[
code
-
1
]
:
null
;
}
private
static
final
class
Id3Header
{
private
final
int
majorVersion
;
...
...
@@ -446,38 +442,4 @@ public final class Id3Decoder implements MetadataDecoder {
}
private
static
final
String
[]
standardGenres
=
new
String
[]
{
// These are the official ID3v1 genres.
"Blues"
,
"Classic Rock"
,
"Country"
,
"Dance"
,
"Disco"
,
"Funk"
,
"Grunge"
,
"Hip-Hop"
,
"Jazz"
,
"Metal"
,
"New Age"
,
"Oldies"
,
"Other"
,
"Pop"
,
"R&B"
,
"Rap"
,
"Reggae"
,
"Rock"
,
"Techno"
,
"Industrial"
,
"Alternative"
,
"Ska"
,
"Death Metal"
,
"Pranks"
,
"Soundtrack"
,
"Euro-Techno"
,
"Ambient"
,
"Trip-Hop"
,
"Vocal"
,
"Jazz+Funk"
,
"Fusion"
,
"Trance"
,
"Classical"
,
"Instrumental"
,
"Acid"
,
"House"
,
"Game"
,
"Sound Clip"
,
"Gospel"
,
"Noise"
,
"AlternRock"
,
"Bass"
,
"Soul"
,
"Punk"
,
"Space"
,
"Meditative"
,
"Instrumental Pop"
,
"Instrumental Rock"
,
"Ethnic"
,
"Gothic"
,
"Darkwave"
,
"Techno-Industrial"
,
"Electronic"
,
"Pop-Folk"
,
"Eurodance"
,
"Dream"
,
"Southern Rock"
,
"Comedy"
,
"Cult"
,
"Gangsta"
,
"Top 40"
,
"Christian Rap"
,
"Pop/Funk"
,
"Jungle"
,
"Native American"
,
"Cabaret"
,
"New Wave"
,
"Psychadelic"
,
"Rave"
,
"Showtunes"
,
"Trailer"
,
"Lo-Fi"
,
"Tribal"
,
"Acid Punk"
,
"Acid Jazz"
,
"Polka"
,
"Retro"
,
"Musical"
,
"Rock & Roll"
,
"Hard Rock"
,
// These were made up by the authors of Winamp but backported into the ID3 spec.
"Folk"
,
"Folk-Rock"
,
"National Folk"
,
"Swing"
,
"Fast Fusion"
,
"Bebob"
,
"Latin"
,
"Revival"
,
"Celtic"
,
"Bluegrass"
,
"Avantgarde"
,
"Gothic Rock"
,
"Progressive Rock"
,
"Psychedelic Rock"
,
"Symphonic Rock"
,
"Slow Rock"
,
"Big Band"
,
"Chorus"
,
"Easy Listening"
,
"Acoustic"
,
"Humour"
,
"Speech"
,
"Chanson"
,
"Opera"
,
"Chamber Music"
,
"Sonata"
,
"Symphony"
,
"Booty Bass"
,
"Primus"
,
"Porn Groove"
,
"Satire"
,
"Slow Jam"
,
"Club"
,
"Tango"
,
"Samba"
,
"Folklore"
,
"Ballad"
,
"Power Ballad"
,
"Rhythmic Soul"
,
"Freestyle"
,
"Duet"
,
"Punk Rock"
,
"Drum Solo"
,
"A capella"
,
"Euro-House"
,
"Dance Hall"
,
// These were also invented by the Winamp folks but ignored by the ID3 authors.
"Goa"
,
"Drum & Bass"
,
"Club-House"
,
"Hardcore"
,
"Terror"
,
"Indie"
,
"BritPop"
,
"Negerpunk"
,
"Polsk Punk"
,
"Beat"
,
"Christian Gangsta Rap"
,
"Heavy Metal"
,
"Black Metal"
,
"Crossover"
,
"Contemporary Christian"
,
"Christian Rock"
,
"Merengue"
,
"Salsa"
,
"Thrash Metal"
,
"Anime"
,
"Jpop"
,
"Synthpop"
};
}
library/src/main/java/com/google/android/exoplayer2/metadata/id3/Id3Util.java
0 → 100644
View file @
4391014a
/*
* Copyright (C) 2016 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
.
metadata
.
id3
;
/**
* ID3 utility methods.
*/
public
class
Id3Util
{
private
static
final
String
[]
STANDARD_GENRES
=
new
String
[]
{
// These are the official ID3v1 genres.
"Blues"
,
"Classic Rock"
,
"Country"
,
"Dance"
,
"Disco"
,
"Funk"
,
"Grunge"
,
"Hip-Hop"
,
"Jazz"
,
"Metal"
,
"New Age"
,
"Oldies"
,
"Other"
,
"Pop"
,
"R&B"
,
"Rap"
,
"Reggae"
,
"Rock"
,
"Techno"
,
"Industrial"
,
"Alternative"
,
"Ska"
,
"Death Metal"
,
"Pranks"
,
"Soundtrack"
,
"Euro-Techno"
,
"Ambient"
,
"Trip-Hop"
,
"Vocal"
,
"Jazz+Funk"
,
"Fusion"
,
"Trance"
,
"Classical"
,
"Instrumental"
,
"Acid"
,
"House"
,
"Game"
,
"Sound Clip"
,
"Gospel"
,
"Noise"
,
"AlternRock"
,
"Bass"
,
"Soul"
,
"Punk"
,
"Space"
,
"Meditative"
,
"Instrumental Pop"
,
"Instrumental Rock"
,
"Ethnic"
,
"Gothic"
,
"Darkwave"
,
"Techno-Industrial"
,
"Electronic"
,
"Pop-Folk"
,
"Eurodance"
,
"Dream"
,
"Southern Rock"
,
"Comedy"
,
"Cult"
,
"Gangsta"
,
"Top 40"
,
"Christian Rap"
,
"Pop/Funk"
,
"Jungle"
,
"Native American"
,
"Cabaret"
,
"New Wave"
,
"Psychadelic"
,
"Rave"
,
"Showtunes"
,
"Trailer"
,
"Lo-Fi"
,
"Tribal"
,
"Acid Punk"
,
"Acid Jazz"
,
"Polka"
,
"Retro"
,
"Musical"
,
"Rock & Roll"
,
"Hard Rock"
,
// These were made up by the authors of Winamp but backported into the ID3 spec.
"Folk"
,
"Folk-Rock"
,
"National Folk"
,
"Swing"
,
"Fast Fusion"
,
"Bebob"
,
"Latin"
,
"Revival"
,
"Celtic"
,
"Bluegrass"
,
"Avantgarde"
,
"Gothic Rock"
,
"Progressive Rock"
,
"Psychedelic Rock"
,
"Symphonic Rock"
,
"Slow Rock"
,
"Big Band"
,
"Chorus"
,
"Easy Listening"
,
"Acoustic"
,
"Humour"
,
"Speech"
,
"Chanson"
,
"Opera"
,
"Chamber Music"
,
"Sonata"
,
"Symphony"
,
"Booty Bass"
,
"Primus"
,
"Porn Groove"
,
"Satire"
,
"Slow Jam"
,
"Club"
,
"Tango"
,
"Samba"
,
"Folklore"
,
"Ballad"
,
"Power Ballad"
,
"Rhythmic Soul"
,
"Freestyle"
,
"Duet"
,
"Punk Rock"
,
"Drum Solo"
,
"A capella"
,
"Euro-House"
,
"Dance Hall"
,
// These were also invented by the Winamp folks but ignored by the ID3 authors.
"Goa"
,
"Drum & Bass"
,
"Club-House"
,
"Hardcore"
,
"Terror"
,
"Indie"
,
"BritPop"
,
"Negerpunk"
,
"Polsk Punk"
,
"Beat"
,
"Christian Gangsta Rap"
,
"Heavy Metal"
,
"Black Metal"
,
"Crossover"
,
"Contemporary Christian"
,
"Christian Rock"
,
"Merengue"
,
"Salsa"
,
"Thrash Metal"
,
"Anime"
,
"Jpop"
,
"Synthpop"
};
private
Id3Util
()
{}
public
static
String
decodeGenre
(
int
code
)
{
return
(
0
<
code
&&
code
<=
STANDARD_GENRES
.
length
)
?
STANDARD_GENRES
[
code
-
1
]
:
null
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment