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
4510210a
authored
Nov 20, 2022
by
Alexander Capehart
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'multi-value-id3v2' into dev-v2
parents
f2a63e9d
d8729e55
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
100 additions
and
42 deletions
extensions/ima/src/main/java/com/google/android/exoplayer2/ext/ima/ImaServerSideAdInsertionMediaSource.java
library/core/src/test/java/com/google/android/exoplayer2/metadata/MetadataRendererTest.java
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp3/Mp3Extractor.java
library/extractor/src/main/java/com/google/android/exoplayer2/metadata/id3/Id3Decoder.java
library/extractor/src/main/java/com/google/android/exoplayer2/metadata/id3/TextInformationFrame.java
library/extractor/src/test/java/com/google/android/exoplayer2/metadata/id3/Id3DecoderTest.java
extensions/ima/src/main/java/com/google/android/exoplayer2/ext/ima/ImaServerSideAdInsertionMediaSource.java
View file @
4510210a
...
@@ -811,7 +811,7 @@ public final class ImaServerSideAdInsertionMediaSource extends CompositeMediaSou
...
@@ -811,7 +811,7 @@ public final class ImaServerSideAdInsertionMediaSource extends CompositeMediaSou
if
(
entry
instanceof
TextInformationFrame
)
{
if
(
entry
instanceof
TextInformationFrame
)
{
TextInformationFrame
textFrame
=
(
TextInformationFrame
)
entry
;
TextInformationFrame
textFrame
=
(
TextInformationFrame
)
entry
;
if
(
"TXXX"
.
equals
(
textFrame
.
id
))
{
if
(
"TXXX"
.
equals
(
textFrame
.
id
))
{
streamPlayer
.
triggerUserTextReceived
(
textFrame
.
value
);
streamPlayer
.
triggerUserTextReceived
(
textFrame
.
value
s
[
0
]
);
}
}
}
else
if
(
entry
instanceof
EventMessage
)
{
}
else
if
(
entry
instanceof
EventMessage
)
{
EventMessage
eventMessage
=
(
EventMessage
)
entry
;
EventMessage
eventMessage
=
(
EventMessage
)
entry
;
...
...
library/core/src/test/java/com/google/android/exoplayer2/metadata/MetadataRendererTest.java
View file @
4510210a
...
@@ -107,7 +107,7 @@ public class MetadataRendererTest {
...
@@ -107,7 +107,7 @@ public class MetadataRendererTest {
assertThat
(
metadata
).
hasSize
(
1
);
assertThat
(
metadata
).
hasSize
(
1
);
assertThat
(
metadata
.
get
(
0
).
length
()).
isEqualTo
(
1
);
assertThat
(
metadata
.
get
(
0
).
length
()).
isEqualTo
(
1
);
TextInformationFrame
expectedId3Frame
=
TextInformationFrame
expectedId3Frame
=
new
TextInformationFrame
(
"TXXX"
,
"Test description"
,
"Test value"
);
new
TextInformationFrame
(
"TXXX"
,
"Test description"
,
new
String
[]
{
"Test value"
}
);
assertThat
(
metadata
.
get
(
0
).
get
(
0
)).
isEqualTo
(
expectedId3Frame
);
assertThat
(
metadata
.
get
(
0
).
get
(
0
)).
isEqualTo
(
expectedId3Frame
);
}
}
...
...
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp3/Mp3Extractor.java
View file @
4510210a
...
@@ -592,7 +592,7 @@ public final class Mp3Extractor implements Extractor {
...
@@ -592,7 +592,7 @@ public final class Mp3Extractor implements Extractor {
Metadata
.
Entry
entry
=
metadata
.
get
(
i
);
Metadata
.
Entry
entry
=
metadata
.
get
(
i
);
if
(
entry
instanceof
TextInformationFrame
if
(
entry
instanceof
TextInformationFrame
&&
((
TextInformationFrame
)
entry
).
id
.
equals
(
"TLEN"
))
{
&&
((
TextInformationFrame
)
entry
).
id
.
equals
(
"TLEN"
))
{
return
Util
.
msToUs
(
Long
.
parseLong
(((
TextInformationFrame
)
entry
).
value
));
return
Util
.
msToUs
(
Long
.
parseLong
(((
TextInformationFrame
)
entry
).
value
s
[
0
]
));
}
}
}
}
}
}
...
...
library/extractor/src/main/java/com/google/android/exoplayer2/metadata/id3/Id3Decoder.java
View file @
4510210a
...
@@ -455,14 +455,29 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
...
@@ -455,14 +455,29 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
byte
[]
data
=
new
byte
[
frameSize
-
1
];
byte
[]
data
=
new
byte
[
frameSize
-
1
];
id3Data
.
readBytes
(
data
,
0
,
frameSize
-
1
);
id3Data
.
readBytes
(
data
,
0
,
frameSize
-
1
);
int
descriptionEndIndex
=
indexOf
Eos
(
data
,
0
,
encoding
);
int
descriptionEndIndex
=
indexOf
Terminator
(
data
,
0
,
encoding
);
String
description
=
new
String
(
data
,
0
,
descriptionEndIndex
,
charset
);
String
description
=
new
String
(
data
,
0
,
descriptionEndIndex
,
charset
);
// In ID3v2.4, text information frames can contain multiple values delimited by a null
// terminator. Thus, we after each "end of stream" marker we actually need to keep looking
// for more data, at least until the index is equal to the data length.
ArrayList
<
String
>
values
=
new
ArrayList
<>();
int
valueStartIndex
=
descriptionEndIndex
+
delimiterLength
(
encoding
);
int
valueStartIndex
=
descriptionEndIndex
+
delimiterLength
(
encoding
);
int
valueEndIndex
=
indexOfEos
(
data
,
valueStartIndex
,
encoding
);
if
(
valueStartIndex
>=
data
.
length
)
{
String
value
=
decodeStringIfValid
(
data
,
valueStartIndex
,
valueEndIndex
,
charset
);
return
new
TextInformationFrame
(
"TXXX"
,
description
,
new
String
[
0
]);
}
int
valueEndIndex
=
indexOfTerminator
(
data
,
valueStartIndex
,
encoding
);
while
(
valueStartIndex
<
valueEndIndex
)
{
String
value
=
decodeStringIfValid
(
data
,
valueStartIndex
,
valueEndIndex
,
charset
);
values
.
add
(
value
);
valueStartIndex
=
valueEndIndex
+
delimiterLength
(
encoding
);
valueEndIndex
=
indexOfTerminator
(
data
,
valueStartIndex
,
encoding
);
}
return
new
TextInformationFrame
(
"TXXX"
,
description
,
value
);
return
new
TextInformationFrame
(
"TXXX"
,
description
,
value
s
.
toArray
(
new
String
[
0
])
);
}
}
@Nullable
@Nullable
...
@@ -479,10 +494,26 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
...
@@ -479,10 +494,26 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
byte
[]
data
=
new
byte
[
frameSize
-
1
];
byte
[]
data
=
new
byte
[
frameSize
-
1
];
id3Data
.
readBytes
(
data
,
0
,
frameSize
-
1
);
id3Data
.
readBytes
(
data
,
0
,
frameSize
-
1
);
int
valueEndIndex
=
indexOfEos
(
data
,
0
,
encoding
);
// In ID3v2.4, text information frames can contain multiple values delimited by a null
String
value
=
new
String
(
data
,
0
,
valueEndIndex
,
charset
);
// terminator. Thus, we after each "end of stream" marker we actually need to keep looking
// for more data, at least until the index is equal to the data length.
ArrayList
<
String
>
values
=
new
ArrayList
<>();
int
valueStartIndex
=
0
;
if
(
valueStartIndex
>=
data
.
length
)
{
return
new
TextInformationFrame
(
id
,
null
,
new
String
[
0
]);
}
int
valueEndIndex
=
indexOfTerminator
(
data
,
valueStartIndex
,
encoding
);
while
(
valueStartIndex
<
valueEndIndex
)
{
String
value
=
decodeStringIfValid
(
data
,
valueStartIndex
,
valueEndIndex
,
charset
);
values
.
add
(
value
);
valueStartIndex
=
valueEndIndex
+
delimiterLength
(
encoding
);
valueEndIndex
=
indexOfTerminator
(
data
,
valueStartIndex
,
encoding
);
}
return
new
TextInformationFrame
(
id
,
null
,
value
);
return
new
TextInformationFrame
(
id
,
null
,
value
s
.
toArray
(
new
String
[
0
])
);
}
}
@Nullable
@Nullable
...
@@ -499,7 +530,7 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
...
@@ -499,7 +530,7 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
byte
[]
data
=
new
byte
[
frameSize
-
1
];
byte
[]
data
=
new
byte
[
frameSize
-
1
];
id3Data
.
readBytes
(
data
,
0
,
frameSize
-
1
);
id3Data
.
readBytes
(
data
,
0
,
frameSize
-
1
);
int
descriptionEndIndex
=
indexOf
Eos
(
data
,
0
,
encoding
);
int
descriptionEndIndex
=
indexOf
Terminator
(
data
,
0
,
encoding
);
String
description
=
new
String
(
data
,
0
,
descriptionEndIndex
,
charset
);
String
description
=
new
String
(
data
,
0
,
descriptionEndIndex
,
charset
);
int
urlStartIndex
=
descriptionEndIndex
+
delimiterLength
(
encoding
);
int
urlStartIndex
=
descriptionEndIndex
+
delimiterLength
(
encoding
);
...
@@ -546,11 +577,11 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
...
@@ -546,11 +577,11 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
String
mimeType
=
new
String
(
data
,
0
,
mimeTypeEndIndex
,
"ISO-8859-1"
);
String
mimeType
=
new
String
(
data
,
0
,
mimeTypeEndIndex
,
"ISO-8859-1"
);
int
filenameStartIndex
=
mimeTypeEndIndex
+
1
;
int
filenameStartIndex
=
mimeTypeEndIndex
+
1
;
int
filenameEndIndex
=
indexOf
Eos
(
data
,
filenameStartIndex
,
encoding
);
int
filenameEndIndex
=
indexOf
Terminator
(
data
,
filenameStartIndex
,
encoding
);
String
filename
=
decodeStringIfValid
(
data
,
filenameStartIndex
,
filenameEndIndex
,
charset
);
String
filename
=
decodeStringIfValid
(
data
,
filenameStartIndex
,
filenameEndIndex
,
charset
);
int
descriptionStartIndex
=
filenameEndIndex
+
delimiterLength
(
encoding
);
int
descriptionStartIndex
=
filenameEndIndex
+
delimiterLength
(
encoding
);
int
descriptionEndIndex
=
indexOf
Eos
(
data
,
descriptionStartIndex
,
encoding
);
int
descriptionEndIndex
=
indexOf
Terminator
(
data
,
descriptionStartIndex
,
encoding
);
String
description
=
String
description
=
decodeStringIfValid
(
data
,
descriptionStartIndex
,
descriptionEndIndex
,
charset
);
decodeStringIfValid
(
data
,
descriptionStartIndex
,
descriptionEndIndex
,
charset
);
...
@@ -588,7 +619,7 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
...
@@ -588,7 +619,7 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
int
pictureType
=
data
[
mimeTypeEndIndex
+
1
]
&
0xFF
;
int
pictureType
=
data
[
mimeTypeEndIndex
+
1
]
&
0xFF
;
int
descriptionStartIndex
=
mimeTypeEndIndex
+
2
;
int
descriptionStartIndex
=
mimeTypeEndIndex
+
2
;
int
descriptionEndIndex
=
indexOf
Eos
(
data
,
descriptionStartIndex
,
encoding
);
int
descriptionEndIndex
=
indexOf
Terminator
(
data
,
descriptionStartIndex
,
encoding
);
String
description
=
String
description
=
new
String
(
new
String
(
data
,
descriptionStartIndex
,
descriptionEndIndex
-
descriptionStartIndex
,
charset
);
data
,
descriptionStartIndex
,
descriptionEndIndex
-
descriptionStartIndex
,
charset
);
...
@@ -617,11 +648,11 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
...
@@ -617,11 +648,11 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
data
=
new
byte
[
frameSize
-
4
];
data
=
new
byte
[
frameSize
-
4
];
id3Data
.
readBytes
(
data
,
0
,
frameSize
-
4
);
id3Data
.
readBytes
(
data
,
0
,
frameSize
-
4
);
int
descriptionEndIndex
=
indexOf
Eos
(
data
,
0
,
encoding
);
int
descriptionEndIndex
=
indexOf
Terminator
(
data
,
0
,
encoding
);
String
description
=
new
String
(
data
,
0
,
descriptionEndIndex
,
charset
);
String
description
=
new
String
(
data
,
0
,
descriptionEndIndex
,
charset
);
int
textStartIndex
=
descriptionEndIndex
+
delimiterLength
(
encoding
);
int
textStartIndex
=
descriptionEndIndex
+
delimiterLength
(
encoding
);
int
textEndIndex
=
indexOf
Eos
(
data
,
textStartIndex
,
encoding
);
int
textEndIndex
=
indexOf
Terminator
(
data
,
textStartIndex
,
encoding
);
String
text
=
decodeStringIfValid
(
data
,
textStartIndex
,
textEndIndex
,
charset
);
String
text
=
decodeStringIfValid
(
data
,
textStartIndex
,
textEndIndex
,
charset
);
return
new
CommentFrame
(
language
,
description
,
text
);
return
new
CommentFrame
(
language
,
description
,
text
);
...
@@ -798,7 +829,7 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
...
@@ -798,7 +829,7 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
:
String
.
format
(
Locale
.
US
,
"%c%c%c%c"
,
frameId0
,
frameId1
,
frameId2
,
frameId3
);
:
String
.
format
(
Locale
.
US
,
"%c%c%c%c"
,
frameId0
,
frameId1
,
frameId2
,
frameId3
);
}
}
private
static
int
indexOf
Eos
(
byte
[]
data
,
int
fromIndex
,
int
encoding
)
{
private
static
int
indexOf
Terminator
(
byte
[]
data
,
int
fromIndex
,
int
encoding
)
{
int
terminationPos
=
indexOfZeroByte
(
data
,
fromIndex
);
int
terminationPos
=
indexOfZeroByte
(
data
,
fromIndex
);
// For single byte encoding charsets, we're done.
// For single byte encoding charsets, we're done.
...
...
library/extractor/src/main/java/com/google/android/exoplayer2/metadata/id3/TextInformationFrame.java
View file @
4510210a
...
@@ -19,52 +19,77 @@ import static com.google.android.exoplayer2.util.Util.castNonNull;
...
@@ -19,52 +19,77 @@ import static com.google.android.exoplayer2.util.Util.castNonNull;
import
android.os.Parcel
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
android.os.Parcelable
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.MediaMetadata
;
import
com.google.android.exoplayer2.MediaMetadata
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.util.Util
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
/** Text information ID3 frame. */
/** Text information ID3 frame. */
public
final
class
TextInformationFrame
extends
Id3Frame
{
public
final
class
TextInformationFrame
extends
Id3Frame
{
private
final
static
String
MULTI_VALUE_DELIMITER
=
", "
;
@Nullable
public
final
String
description
;
@Nullable
public
final
String
description
;
/** @deprecated Use {@code values} instead. */
@Deprecated
public
final
String
value
;
public
final
String
value
;
public
TextInformationFrame
(
String
id
,
@Nullable
String
description
,
String
value
)
{
@NonNull
public
final
String
[]
values
;
public
TextInformationFrame
(
String
id
,
@Nullable
String
description
,
@NonNull
String
[]
values
)
{
super
(
id
);
super
(
id
);
this
.
description
=
description
;
this
.
description
=
description
;
this
.
value
=
value
;
this
.
values
=
values
;
if
(
values
.
length
>
0
)
{
this
.
value
=
values
[
0
];
}
else
{
this
.
value
=
null
;
}
}
/** @deprecated Use {@code TextInformationFrame(String id, String description, String[] values} instead */
@Deprecated
public
TextInformationFrame
(
String
id
,
@Nullable
String
description
,
String
value
)
{
this
(
id
,
description
,
new
String
[]
{
value
}
);
}
}
/* package */
TextInformationFrame
(
Parcel
in
)
{
/* package */
TextInformationFrame
(
Parcel
in
)
{
super
(
castNonNull
(
in
.
readString
()));
super
(
castNonNull
(
in
.
readString
()));
description
=
in
.
readString
();
description
=
in
.
readString
();
value
=
castNonNull
(
in
.
readString
());
values
=
in
.
createStringArray
();
this
.
value
=
values
[
0
];
}
}
@Override
@Override
public
void
populateMediaMetadata
(
MediaMetadata
.
Builder
builder
)
{
public
void
populateMediaMetadata
(
MediaMetadata
.
Builder
builder
)
{
// Depending on the context this frame is in, we either take the first value of a multi-value
// frame because multiple values make no sense, or we join the values together with a comma
// when multiple values do make sense.
switch
(
id
)
{
switch
(
id
)
{
case
"TT2"
:
case
"TT2"
:
case
"TIT2"
:
case
"TIT2"
:
builder
.
setTitle
(
value
);
builder
.
setTitle
(
value
s
[
0
]
);
break
;
break
;
case
"TP1"
:
case
"TP1"
:
case
"TPE1"
:
case
"TPE1"
:
builder
.
setArtist
(
value
);
builder
.
setArtist
(
String
.
join
(
MULTI_VALUE_DELIMITER
,
values
)
);
break
;
break
;
case
"TP2"
:
case
"TP2"
:
case
"TPE2"
:
case
"TPE2"
:
builder
.
setAlbumArtist
(
value
);
builder
.
setAlbumArtist
(
String
.
join
(
MULTI_VALUE_DELIMITER
,
values
)
);
break
;
break
;
case
"TAL"
:
case
"TAL"
:
case
"TALB"
:
case
"TALB"
:
builder
.
setAlbumTitle
(
value
);
builder
.
setAlbumTitle
(
value
s
[
0
]
);
break
;
break
;
case
"TRK"
:
case
"TRK"
:
case
"TRCK"
:
case
"TRCK"
:
String
[]
trackNumbers
=
Util
.
split
(
value
,
"/"
);
String
[]
trackNumbers
=
Util
.
split
(
value
s
[
0
]
,
"/"
);
try
{
try
{
int
trackNumber
=
Integer
.
parseInt
(
trackNumbers
[
0
]);
int
trackNumber
=
Integer
.
parseInt
(
trackNumbers
[
0
]);
@Nullable
@Nullable
...
@@ -78,7 +103,7 @@ public final class TextInformationFrame extends Id3Frame {
...
@@ -78,7 +103,7 @@ public final class TextInformationFrame extends Id3Frame {
case
"TYE"
:
case
"TYE"
:
case
"TYER"
:
case
"TYER"
:
try
{
try
{
builder
.
setRecordingYear
(
Integer
.
parseInt
(
value
));
builder
.
setRecordingYear
(
Integer
.
parseInt
(
value
s
[
0
]
));
}
catch
(
NumberFormatException
e
)
{
}
catch
(
NumberFormatException
e
)
{
// Do nothing, invalid input.
// Do nothing, invalid input.
}
}
...
@@ -86,15 +111,16 @@ public final class TextInformationFrame extends Id3Frame {
...
@@ -86,15 +111,16 @@ public final class TextInformationFrame extends Id3Frame {
case
"TDA"
:
case
"TDA"
:
case
"TDAT"
:
case
"TDAT"
:
try
{
try
{
int
month
=
Integer
.
parseInt
(
value
.
substring
(
2
,
4
));
String
date
=
values
[
0
];
int
day
=
Integer
.
parseInt
(
value
.
substring
(
0
,
2
));
int
month
=
Integer
.
parseInt
(
date
.
substring
(
2
,
4
));
int
day
=
Integer
.
parseInt
(
date
.
substring
(
0
,
2
));
builder
.
setRecordingMonth
(
month
).
setRecordingDay
(
day
);
builder
.
setRecordingMonth
(
month
).
setRecordingDay
(
day
);
}
catch
(
NumberFormatException
|
StringIndexOutOfBoundsException
e
)
{
}
catch
(
NumberFormatException
|
StringIndexOutOfBoundsException
e
)
{
// Do nothing, invalid input.
// Do nothing, invalid input.
}
}
break
;
break
;
case
"TDRC"
:
case
"TDRC"
:
List
<
Integer
>
recordingDate
=
parseId3v2point4TimestampFrameForDate
(
value
);
List
<
Integer
>
recordingDate
=
parseId3v2point4TimestampFrameForDate
(
value
s
[
0
]
);
switch
(
recordingDate
.
size
())
{
switch
(
recordingDate
.
size
())
{
case
3
:
case
3
:
builder
.
setRecordingDay
(
recordingDate
.
get
(
2
));
builder
.
setRecordingDay
(
recordingDate
.
get
(
2
));
...
@@ -112,7 +138,7 @@ public final class TextInformationFrame extends Id3Frame {
...
@@ -112,7 +138,7 @@ public final class TextInformationFrame extends Id3Frame {
}
}
break
;
break
;
case
"TDRL"
:
case
"TDRL"
:
List
<
Integer
>
releaseDate
=
parseId3v2point4TimestampFrameForDate
(
value
);
List
<
Integer
>
releaseDate
=
parseId3v2point4TimestampFrameForDate
(
value
s
[
0
]
);
switch
(
releaseDate
.
size
())
{
switch
(
releaseDate
.
size
())
{
case
3
:
case
3
:
builder
.
setReleaseDay
(
releaseDate
.
get
(
2
));
builder
.
setReleaseDay
(
releaseDate
.
get
(
2
));
...
@@ -131,15 +157,15 @@ public final class TextInformationFrame extends Id3Frame {
...
@@ -131,15 +157,15 @@ public final class TextInformationFrame extends Id3Frame {
break
;
break
;
case
"TCM"
:
case
"TCM"
:
case
"TCOM"
:
case
"TCOM"
:
builder
.
setComposer
(
value
);
builder
.
setComposer
(
String
.
join
(
MULTI_VALUE_DELIMITER
,
values
)
);
break
;
break
;
case
"TP3"
:
case
"TP3"
:
case
"TPE3"
:
case
"TPE3"
:
builder
.
setConductor
(
value
);
builder
.
setConductor
(
String
.
join
(
MULTI_VALUE_DELIMITER
,
values
)
);
break
;
break
;
case
"TXT"
:
case
"TXT"
:
case
"TEXT"
:
case
"TEXT"
:
builder
.
setWriter
(
value
);
builder
.
setWriter
(
String
.
join
(
MULTI_VALUE_DELIMITER
,
values
)
);
break
;
break
;
default
:
default
:
break
;
break
;
...
@@ -157,7 +183,7 @@ public final class TextInformationFrame extends Id3Frame {
...
@@ -157,7 +183,7 @@ public final class TextInformationFrame extends Id3Frame {
TextInformationFrame
other
=
(
TextInformationFrame
)
obj
;
TextInformationFrame
other
=
(
TextInformationFrame
)
obj
;
return
Util
.
areEqual
(
id
,
other
.
id
)
return
Util
.
areEqual
(
id
,
other
.
id
)
&&
Util
.
areEqual
(
description
,
other
.
description
)
&&
Util
.
areEqual
(
description
,
other
.
description
)
&&
Util
.
areEqual
(
value
,
other
.
value
);
&&
Arrays
.
equals
(
values
,
other
.
values
);
}
}
@Override
@Override
...
@@ -165,13 +191,13 @@ public final class TextInformationFrame extends Id3Frame {
...
@@ -165,13 +191,13 @@ public final class TextInformationFrame extends Id3Frame {
int
result
=
17
;
int
result
=
17
;
result
=
31
*
result
+
id
.
hashCode
();
result
=
31
*
result
+
id
.
hashCode
();
result
=
31
*
result
+
(
description
!=
null
?
description
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
description
!=
null
?
description
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
value
!=
null
?
value
.
hashCode
()
:
0
);
result
=
31
*
result
+
Arrays
.
hashCode
(
values
);
return
result
;
return
result
;
}
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
id
+
": description="
+
description
+
": value="
+
value
;
return
id
+
": description="
+
description
+
": value="
+
String
.
join
(
MULTI_VALUE_DELIMITER
,
values
)
;
}
}
// Parcelable implementation.
// Parcelable implementation.
...
@@ -180,7 +206,7 @@ public final class TextInformationFrame extends Id3Frame {
...
@@ -180,7 +206,7 @@ public final class TextInformationFrame extends Id3Frame {
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
dest
.
writeString
(
id
);
dest
.
writeString
(
id
);
dest
.
writeString
(
description
);
dest
.
writeString
(
description
);
dest
.
writeString
(
value
);
dest
.
writeString
Array
(
values
);
}
}
public
static
final
Parcelable
.
Creator
<
TextInformationFrame
>
CREATOR
=
public
static
final
Parcelable
.
Creator
<
TextInformationFrame
>
CREATOR
=
...
...
library/extractor/src/test/java/com/google/android/exoplayer2/metadata/id3/Id3DecoderTest.java
View file @
4510210a
...
@@ -52,7 +52,7 @@ public final class Id3DecoderTest {
...
@@ -52,7 +52,7 @@ public final class Id3DecoderTest {
TextInformationFrame
textInformationFrame
=
(
TextInformationFrame
)
metadata
.
get
(
0
);
TextInformationFrame
textInformationFrame
=
(
TextInformationFrame
)
metadata
.
get
(
0
);
assertThat
(
textInformationFrame
.
id
).
isEqualTo
(
"TXXX"
);
assertThat
(
textInformationFrame
.
id
).
isEqualTo
(
"TXXX"
);
assertThat
(
textInformationFrame
.
description
).
isEmpty
();
assertThat
(
textInformationFrame
.
description
).
isEmpty
();
assertThat
(
textInformationFrame
.
value
).
isEqualTo
(
"mdialog_VINDICO1527664_start"
);
assertThat
(
textInformationFrame
.
value
s
[
0
]
).
isEqualTo
(
"mdialog_VINDICO1527664_start"
);
// Test UTF-16.
// Test UTF-16.
rawId3
=
rawId3
=
...
@@ -67,7 +67,7 @@ public final class Id3DecoderTest {
...
@@ -67,7 +67,7 @@ public final class Id3DecoderTest {
textInformationFrame
=
(
TextInformationFrame
)
metadata
.
get
(
0
);
textInformationFrame
=
(
TextInformationFrame
)
metadata
.
get
(
0
);
assertThat
(
textInformationFrame
.
id
).
isEqualTo
(
"TXXX"
);
assertThat
(
textInformationFrame
.
id
).
isEqualTo
(
"TXXX"
);
assertThat
(
textInformationFrame
.
description
).
isEqualTo
(
"Hello World"
);
assertThat
(
textInformationFrame
.
description
).
isEqualTo
(
"Hello World"
);
assertThat
(
textInformationFrame
.
value
).
isEmpty
();
assertThat
(
textInformationFrame
.
value
s
).
isEmpty
();
// Test empty.
// Test empty.
rawId3
=
buildSingleFrameTag
(
"TXXX"
,
new
byte
[
0
]);
rawId3
=
buildSingleFrameTag
(
"TXXX"
,
new
byte
[
0
]);
...
@@ -81,7 +81,7 @@ public final class Id3DecoderTest {
...
@@ -81,7 +81,7 @@ public final class Id3DecoderTest {
textInformationFrame
=
(
TextInformationFrame
)
metadata
.
get
(
0
);
textInformationFrame
=
(
TextInformationFrame
)
metadata
.
get
(
0
);
assertThat
(
textInformationFrame
.
id
).
isEqualTo
(
"TXXX"
);
assertThat
(
textInformationFrame
.
id
).
isEqualTo
(
"TXXX"
);
assertThat
(
textInformationFrame
.
description
).
isEmpty
();
assertThat
(
textInformationFrame
.
description
).
isEmpty
();
assertThat
(
textInformationFrame
.
value
).
isEmpty
();
assertThat
(
textInformationFrame
.
value
s
).
isEmpty
();
}
}
@Test
@Test
...
@@ -95,7 +95,8 @@ public final class Id3DecoderTest {
...
@@ -95,7 +95,8 @@ public final class Id3DecoderTest {
TextInformationFrame
textInformationFrame
=
(
TextInformationFrame
)
metadata
.
get
(
0
);
TextInformationFrame
textInformationFrame
=
(
TextInformationFrame
)
metadata
.
get
(
0
);
assertThat
(
textInformationFrame
.
id
).
isEqualTo
(
"TIT2"
);
assertThat
(
textInformationFrame
.
id
).
isEqualTo
(
"TIT2"
);
assertThat
(
textInformationFrame
.
description
).
isNull
();
assertThat
(
textInformationFrame
.
description
).
isNull
();
assertThat
(
textInformationFrame
.
value
).
isEqualTo
(
"Hello World"
);
assertThat
(
textInformationFrame
.
values
.
length
).
isEqualTo
(
1
);
assertThat
(
textInformationFrame
.
values
[
0
]).
isEqualTo
(
"Hello World"
);
// Test empty.
// Test empty.
rawId3
=
buildSingleFrameTag
(
"TIT2"
,
new
byte
[
0
]);
rawId3
=
buildSingleFrameTag
(
"TIT2"
,
new
byte
[
0
]);
...
@@ -109,7 +110,7 @@ public final class Id3DecoderTest {
...
@@ -109,7 +110,7 @@ public final class Id3DecoderTest {
textInformationFrame
=
(
TextInformationFrame
)
metadata
.
get
(
0
);
textInformationFrame
=
(
TextInformationFrame
)
metadata
.
get
(
0
);
assertThat
(
textInformationFrame
.
id
).
isEqualTo
(
"TIT2"
);
assertThat
(
textInformationFrame
.
id
).
isEqualTo
(
"TIT2"
);
assertThat
(
textInformationFrame
.
description
).
isNull
();
assertThat
(
textInformationFrame
.
description
).
isNull
();
assertThat
(
textInformationFrame
.
value
).
isEmpty
();
assertThat
(
textInformationFrame
.
value
s
).
isEmpty
();
}
}
@Test
@Test
...
...
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