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
244c202c
authored
Jun 27, 2019
by
andrewlewis
Committed by
Oliver Woodman
Jul 02, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix hidden API warnings from Metalava
PiperOrigin-RevId: 255442455
parent
2a765f6b
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
50 additions
and
44 deletions
library/core/src/main/java/com/google/android/exoplayer2/drm/DefaultDrmSession.java
library/core/src/main/java/com/google/android/exoplayer2/extractor/ts/H262Reader.java
library/core/src/main/java/com/google/android/exoplayer2/extractor/ts/SeiReader.java
library/core/src/main/java/com/google/android/exoplayer2/text/dvb/DvbDecoder.java
library/core/src/main/java/com/google/android/exoplayer2/text/ssa/SsaDecoder.java
library/core/src/main/java/com/google/android/exoplayer2/text/subrip/SubripDecoder.java
library/core/src/main/java/com/google/android/exoplayer2/text/ttml/TtmlDecoder.java
library/core/src/main/java/com/google/android/exoplayer2/text/webvtt/Mp4WebvttDecoder.java
library/core/src/main/java/com/google/android/exoplayer2/text/webvtt/WebvttDecoder.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/SimpleCache.java
library/core/src/test/java/com/google/android/exoplayer2/text/ssa/SsaDecoderTest.java
library/core/src/test/java/com/google/android/exoplayer2/text/subrip/SubripDecoderTest.java
library/core/src/test/java/com/google/android/exoplayer2/text/ttml/TtmlDecoderTest.java
library/core/src/test/java/com/google/android/exoplayer2/text/webvtt/WebvttDecoderTest.java
library/core/src/test/java/com/google/android/exoplayer2/upstream/cache/CacheDataSourceTest.java
library/core/src/test/java/com/google/android/exoplayer2/upstream/cache/SimpleCacheTest.java
library/core/src/main/java/com/google/android/exoplayer2/drm/DefaultDrmSession.java
View file @
244c202c
...
...
@@ -45,7 +45,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
/** A {@link DrmSession} that supports playbacks using {@link ExoMediaDrm}. */
@TargetApi
(
18
)
/* package */
class
DefaultDrmSession
<
T
extends
ExoMediaCrypto
>
implements
DrmSession
<
T
>
{
public
class
DefaultDrmSession
<
T
extends
ExoMediaCrypto
>
implements
DrmSession
<
T
>
{
/** Manages provisioning requests. */
public
interface
ProvisioningManager
<
T
extends
ExoMediaCrypto
>
{
...
...
library/core/src/main/java/com/google/android/exoplayer2/extractor/ts/H262Reader.java
View file @
244c202c
...
...
@@ -72,7 +72,7 @@ public final class H262Reader implements ElementaryStreamReader {
this
(
null
);
}
public
H262Reader
(
UserDataReader
userDataReader
)
{
/* package */
H262Reader
(
UserDataReader
userDataReader
)
{
this
.
userDataReader
=
userDataReader
;
prefixFlags
=
new
boolean
[
4
];
csdBuffer
=
new
CsdBuffer
(
128
);
...
...
library/core/src/main/java/com/google/android/exoplayer2/extractor/ts/SeiReader.java
View file @
244c202c
...
...
@@ -26,10 +26,8 @@ import com.google.android.exoplayer2.util.MimeTypes;
import
com.google.android.exoplayer2.util.ParsableByteArray
;
import
java.util.List
;
/**
* Consumes SEI buffers, outputting contained CEA-608 messages to a {@link TrackOutput}.
*/
/* package */
final
class
SeiReader
{
/** Consumes SEI buffers, outputting contained CEA-608 messages to a {@link TrackOutput}. */
public
final
class
SeiReader
{
private
final
List
<
Format
>
closedCaptionFormats
;
private
final
TrackOutput
[]
outputs
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/text/dvb/DvbDecoder.java
View file @
244c202c
...
...
@@ -16,6 +16,7 @@
package
com
.
google
.
android
.
exoplayer2
.
text
.
dvb
;
import
com.google.android.exoplayer2.text.SimpleSubtitleDecoder
;
import
com.google.android.exoplayer2.text.Subtitle
;
import
com.google.android.exoplayer2.util.ParsableByteArray
;
import
java.util.List
;
...
...
@@ -38,7 +39,7 @@ public final class DvbDecoder extends SimpleSubtitleDecoder {
}
@Override
protected
Dvb
Subtitle
decode
(
byte
[]
data
,
int
length
,
boolean
reset
)
{
protected
Subtitle
decode
(
byte
[]
data
,
int
length
,
boolean
reset
)
{
if
(
reset
)
{
parser
.
reset
();
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/text/ssa/SsaDecoder.java
View file @
244c202c
...
...
@@ -19,6 +19,7 @@ import android.text.TextUtils;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.text.Cue
;
import
com.google.android.exoplayer2.text.SimpleSubtitleDecoder
;
import
com.google.android.exoplayer2.text.Subtitle
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.Log
;
import
com.google.android.exoplayer2.util.LongArray
;
...
...
@@ -72,7 +73,7 @@ public final class SsaDecoder extends SimpleSubtitleDecoder {
}
@Override
protected
S
saS
ubtitle
decode
(
byte
[]
bytes
,
int
length
,
boolean
reset
)
{
protected
Subtitle
decode
(
byte
[]
bytes
,
int
length
,
boolean
reset
)
{
ArrayList
<
Cue
>
cues
=
new
ArrayList
<>();
LongArray
cueTimesUs
=
new
LongArray
();
...
...
library/core/src/main/java/com/google/android/exoplayer2/text/subrip/SubripDecoder.java
View file @
244c202c
...
...
@@ -21,6 +21,7 @@ import android.text.Spanned;
import
android.text.TextUtils
;
import
com.google.android.exoplayer2.text.Cue
;
import
com.google.android.exoplayer2.text.SimpleSubtitleDecoder
;
import
com.google.android.exoplayer2.text.Subtitle
;
import
com.google.android.exoplayer2.util.Log
;
import
com.google.android.exoplayer2.util.LongArray
;
import
com.google.android.exoplayer2.util.ParsableByteArray
;
...
...
@@ -34,9 +35,9 @@ import java.util.regex.Pattern;
public
final
class
SubripDecoder
extends
SimpleSubtitleDecoder
{
// Fractional positions for use when alignment tags are present.
/* package */
static
final
float
START_FRACTION
=
0.08f
;
/* package */
static
final
float
END_FRACTION
=
1
-
START_FRACTION
;
/* package */
static
final
float
MID_FRACTION
=
0.5f
;
private
static
final
float
START_FRACTION
=
0.08f
;
private
static
final
float
END_FRACTION
=
1
-
START_FRACTION
;
private
static
final
float
MID_FRACTION
=
0.5f
;
private
static
final
String
TAG
=
"SubripDecoder"
;
...
...
@@ -68,7 +69,7 @@ public final class SubripDecoder extends SimpleSubtitleDecoder {
}
@Override
protected
Sub
ripSub
title
decode
(
byte
[]
bytes
,
int
length
,
boolean
reset
)
{
protected
Subtitle
decode
(
byte
[]
bytes
,
int
length
,
boolean
reset
)
{
ArrayList
<
Cue
>
cues
=
new
ArrayList
<>();
LongArray
cueTimesUs
=
new
LongArray
();
ParsableByteArray
subripData
=
new
ParsableByteArray
(
bytes
,
length
);
...
...
library/core/src/main/java/com/google/android/exoplayer2/text/ttml/TtmlDecoder.java
View file @
244c202c
...
...
@@ -19,6 +19,7 @@ import android.text.Layout;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.text.Cue
;
import
com.google.android.exoplayer2.text.SimpleSubtitleDecoder
;
import
com.google.android.exoplayer2.text.Subtitle
;
import
com.google.android.exoplayer2.text.SubtitleDecoderException
;
import
com.google.android.exoplayer2.util.ColorParser
;
import
com.google.android.exoplayer2.util.Log
;
...
...
@@ -102,7 +103,7 @@ public final class TtmlDecoder extends SimpleSubtitleDecoder {
}
@Override
protected
Ttml
Subtitle
decode
(
byte
[]
bytes
,
int
length
,
boolean
reset
)
protected
Subtitle
decode
(
byte
[]
bytes
,
int
length
,
boolean
reset
)
throws
SubtitleDecoderException
{
try
{
XmlPullParser
xmlParser
=
xmlParserFactory
.
newPullParser
();
...
...
library/core/src/main/java/com/google/android/exoplayer2/text/webvtt/Mp4WebvttDecoder.java
View file @
244c202c
...
...
@@ -17,6 +17,7 @@ package com.google.android.exoplayer2.text.webvtt;
import
com.google.android.exoplayer2.text.Cue
;
import
com.google.android.exoplayer2.text.SimpleSubtitleDecoder
;
import
com.google.android.exoplayer2.text.Subtitle
;
import
com.google.android.exoplayer2.text.SubtitleDecoderException
;
import
com.google.android.exoplayer2.util.ParsableByteArray
;
import
com.google.android.exoplayer2.util.Util
;
...
...
@@ -49,7 +50,7 @@ public final class Mp4WebvttDecoder extends SimpleSubtitleDecoder {
}
@Override
protected
Mp4Webvtt
Subtitle
decode
(
byte
[]
bytes
,
int
length
,
boolean
reset
)
protected
Subtitle
decode
(
byte
[]
bytes
,
int
length
,
boolean
reset
)
throws
SubtitleDecoderException
{
// Webvtt in Mp4 samples have boxes inside of them, so we have to do a traditional box parsing:
// first 4 bytes size and then 4 bytes type.
...
...
library/core/src/main/java/com/google/android/exoplayer2/text/webvtt/WebvttDecoder.java
View file @
244c202c
...
...
@@ -18,6 +18,7 @@ package com.google.android.exoplayer2.text.webvtt;
import
android.text.TextUtils
;
import
com.google.android.exoplayer2.ParserException
;
import
com.google.android.exoplayer2.text.SimpleSubtitleDecoder
;
import
com.google.android.exoplayer2.text.Subtitle
;
import
com.google.android.exoplayer2.text.SubtitleDecoderException
;
import
com.google.android.exoplayer2.util.ParsableByteArray
;
import
java.util.ArrayList
;
...
...
@@ -55,7 +56,7 @@ public final class WebvttDecoder extends SimpleSubtitleDecoder {
}
@Override
protected
Webvtt
Subtitle
decode
(
byte
[]
bytes
,
int
length
,
boolean
reset
)
protected
Subtitle
decode
(
byte
[]
bytes
,
int
length
,
boolean
reset
)
throws
SubtitleDecoderException
{
parsableWebvttData
.
reset
(
bytes
,
length
);
// Initialization for consistent starting state.
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/SimpleCache.java
View file @
244c202c
...
...
@@ -380,13 +380,13 @@ public final class SimpleCache implements Cache {
}
@Override
public
synchronized
Simple
CacheSpan
startReadWrite
(
String
key
,
long
position
)
public
synchronized
CacheSpan
startReadWrite
(
String
key
,
long
position
)
throws
InterruptedException
,
CacheException
{
Assertions
.
checkState
(!
released
);
checkInitialization
();
while
(
true
)
{
Simple
CacheSpan
span
=
startReadWriteNonBlocking
(
key
,
position
);
CacheSpan
span
=
startReadWriteNonBlocking
(
key
,
position
);
if
(
span
!=
null
)
{
return
span
;
}
else
{
...
...
@@ -402,7 +402,7 @@ public final class SimpleCache implements Cache {
@Override
@Nullable
public
synchronized
Simple
CacheSpan
startReadWriteNonBlocking
(
String
key
,
long
position
)
public
synchronized
CacheSpan
startReadWriteNonBlocking
(
String
key
,
long
position
)
throws
CacheException
{
Assertions
.
checkState
(!
released
);
checkInitialization
();
...
...
library/core/src/test/java/com/google/android/exoplayer2/text/ssa/SsaDecoderTest.java
View file @
244c202c
...
...
@@ -20,6 +20,7 @@ import static com.google.common.truth.Truth.assertThat;
import
androidx.test.core.app.ApplicationProvider
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
com.google.android.exoplayer2.testutil.TestUtil
;
import
com.google.android.exoplayer2.text.Subtitle
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
org.junit.Test
;
...
...
@@ -41,7 +42,7 @@ public final class SsaDecoderTest {
public
void
testDecodeEmpty
()
throws
IOException
{
SsaDecoder
decoder
=
new
SsaDecoder
();
byte
[]
bytes
=
TestUtil
.
getByteArray
(
ApplicationProvider
.
getApplicationContext
(),
EMPTY
);
S
saS
ubtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
Subtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
assertThat
(
subtitle
.
getEventTimeCount
()).
isEqualTo
(
0
);
assertThat
(
subtitle
.
getCues
(
0
).
isEmpty
()).
isTrue
();
...
...
@@ -51,7 +52,7 @@ public final class SsaDecoderTest {
public
void
testDecodeTypical
()
throws
IOException
{
SsaDecoder
decoder
=
new
SsaDecoder
();
byte
[]
bytes
=
TestUtil
.
getByteArray
(
ApplicationProvider
.
getApplicationContext
(),
TYPICAL
);
S
saS
ubtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
Subtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
assertThat
(
subtitle
.
getEventTimeCount
()).
isEqualTo
(
6
);
assertTypicalCue1
(
subtitle
,
0
);
...
...
@@ -71,7 +72,7 @@ public final class SsaDecoderTest {
SsaDecoder
decoder
=
new
SsaDecoder
(
initializationData
);
byte
[]
bytes
=
TestUtil
.
getByteArray
(
ApplicationProvider
.
getApplicationContext
(),
TYPICAL_DIALOGUE_ONLY
);
S
saS
ubtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
Subtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
assertThat
(
subtitle
.
getEventTimeCount
()).
isEqualTo
(
6
);
assertTypicalCue1
(
subtitle
,
0
);
...
...
@@ -85,7 +86,7 @@ public final class SsaDecoderTest {
SsaDecoder
decoder
=
new
SsaDecoder
();
byte
[]
bytes
=
TestUtil
.
getByteArray
(
ApplicationProvider
.
getApplicationContext
(),
INVALID_TIMECODES
);
S
saS
ubtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
Subtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
assertThat
(
subtitle
.
getEventTimeCount
()).
isEqualTo
(
2
);
assertTypicalCue3
(
subtitle
,
0
);
...
...
@@ -96,7 +97,7 @@ public final class SsaDecoderTest {
SsaDecoder
decoder
=
new
SsaDecoder
();
byte
[]
bytes
=
TestUtil
.
getByteArray
(
ApplicationProvider
.
getApplicationContext
(),
NO_END_TIMECODES
);
S
saS
ubtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
Subtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
assertThat
(
subtitle
.
getEventTimeCount
()).
isEqualTo
(
3
);
...
...
@@ -113,21 +114,21 @@ public final class SsaDecoderTest {
.
isEqualTo
(
"This is the third subtitle, with a comma."
);
}
private
static
void
assertTypicalCue1
(
S
saS
ubtitle
subtitle
,
int
eventIndex
)
{
private
static
void
assertTypicalCue1
(
Subtitle
subtitle
,
int
eventIndex
)
{
assertThat
(
subtitle
.
getEventTime
(
eventIndex
)).
isEqualTo
(
0
);
assertThat
(
subtitle
.
getCues
(
subtitle
.
getEventTime
(
eventIndex
)).
get
(
0
).
text
.
toString
())
.
isEqualTo
(
"This is the first subtitle."
);
assertThat
(
subtitle
.
getEventTime
(
eventIndex
+
1
)).
isEqualTo
(
1230000
);
}
private
static
void
assertTypicalCue2
(
S
saS
ubtitle
subtitle
,
int
eventIndex
)
{
private
static
void
assertTypicalCue2
(
Subtitle
subtitle
,
int
eventIndex
)
{
assertThat
(
subtitle
.
getEventTime
(
eventIndex
)).
isEqualTo
(
2340000
);
assertThat
(
subtitle
.
getCues
(
subtitle
.
getEventTime
(
eventIndex
)).
get
(
0
).
text
.
toString
())
.
isEqualTo
(
"This is the second subtitle \nwith a newline \nand another."
);
assertThat
(
subtitle
.
getEventTime
(
eventIndex
+
1
)).
isEqualTo
(
3450000
);
}
private
static
void
assertTypicalCue3
(
S
saS
ubtitle
subtitle
,
int
eventIndex
)
{
private
static
void
assertTypicalCue3
(
Subtitle
subtitle
,
int
eventIndex
)
{
assertThat
(
subtitle
.
getEventTime
(
eventIndex
)).
isEqualTo
(
4560000
);
assertThat
(
subtitle
.
getCues
(
subtitle
.
getEventTime
(
eventIndex
)).
get
(
0
).
text
.
toString
())
.
isEqualTo
(
"This is the third subtitle, with a comma."
);
...
...
library/core/src/test/java/com/google/android/exoplayer2/text/subrip/SubripDecoderTest.java
View file @
244c202c
...
...
@@ -21,6 +21,7 @@ import androidx.test.core.app.ApplicationProvider;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
com.google.android.exoplayer2.testutil.TestUtil
;
import
com.google.android.exoplayer2.text.Cue
;
import
com.google.android.exoplayer2.text.Subtitle
;
import
java.io.IOException
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
...
...
@@ -44,7 +45,7 @@ public final class SubripDecoderTest {
public
void
testDecodeEmpty
()
throws
IOException
{
SubripDecoder
decoder
=
new
SubripDecoder
();
byte
[]
bytes
=
TestUtil
.
getByteArray
(
ApplicationProvider
.
getApplicationContext
(),
EMPTY_FILE
);
Sub
ripSub
title
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
Subtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
assertThat
(
subtitle
.
getEventTimeCount
()).
isEqualTo
(
0
);
assertThat
(
subtitle
.
getCues
(
0
).
isEmpty
()).
isTrue
();
...
...
@@ -54,7 +55,7 @@ public final class SubripDecoderTest {
public
void
testDecodeTypical
()
throws
IOException
{
SubripDecoder
decoder
=
new
SubripDecoder
();
byte
[]
bytes
=
TestUtil
.
getByteArray
(
ApplicationProvider
.
getApplicationContext
(),
TYPICAL_FILE
);
Sub
ripSub
title
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
Subtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
assertThat
(
subtitle
.
getEventTimeCount
()).
isEqualTo
(
6
);
assertTypicalCue1
(
subtitle
,
0
);
...
...
@@ -68,7 +69,7 @@ public final class SubripDecoderTest {
byte
[]
bytes
=
TestUtil
.
getByteArray
(
ApplicationProvider
.
getApplicationContext
(),
TYPICAL_WITH_BYTE_ORDER_MARK
);
Sub
ripSub
title
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
Subtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
assertThat
(
subtitle
.
getEventTimeCount
()).
isEqualTo
(
6
);
assertTypicalCue1
(
subtitle
,
0
);
...
...
@@ -82,7 +83,7 @@ public final class SubripDecoderTest {
byte
[]
bytes
=
TestUtil
.
getByteArray
(
ApplicationProvider
.
getApplicationContext
(),
TYPICAL_EXTRA_BLANK_LINE
);
Sub
ripSub
title
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
Subtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
assertThat
(
subtitle
.
getEventTimeCount
()).
isEqualTo
(
6
);
assertTypicalCue1
(
subtitle
,
0
);
...
...
@@ -97,7 +98,7 @@ public final class SubripDecoderTest {
byte
[]
bytes
=
TestUtil
.
getByteArray
(
ApplicationProvider
.
getApplicationContext
(),
TYPICAL_MISSING_TIMECODE
);
Sub
ripSub
title
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
Subtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
assertThat
(
subtitle
.
getEventTimeCount
()).
isEqualTo
(
4
);
assertTypicalCue1
(
subtitle
,
0
);
...
...
@@ -111,7 +112,7 @@ public final class SubripDecoderTest {
byte
[]
bytes
=
TestUtil
.
getByteArray
(
ApplicationProvider
.
getApplicationContext
(),
TYPICAL_MISSING_SEQUENCE
);
Sub
ripSub
title
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
Subtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
assertThat
(
subtitle
.
getEventTimeCount
()).
isEqualTo
(
4
);
assertTypicalCue1
(
subtitle
,
0
);
...
...
@@ -125,7 +126,7 @@ public final class SubripDecoderTest {
byte
[]
bytes
=
TestUtil
.
getByteArray
(
ApplicationProvider
.
getApplicationContext
(),
TYPICAL_NEGATIVE_TIMESTAMPS
);
Sub
ripSub
title
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
Subtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
assertThat
(
subtitle
.
getEventTimeCount
()).
isEqualTo
(
2
);
assertTypicalCue3
(
subtitle
,
0
);
...
...
@@ -137,7 +138,7 @@ public final class SubripDecoderTest {
SubripDecoder
decoder
=
new
SubripDecoder
();
byte
[]
bytes
=
TestUtil
.
getByteArray
(
ApplicationProvider
.
getApplicationContext
(),
TYPICAL_UNEXPECTED_END
);
Sub
ripSub
title
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
Subtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
assertThat
(
subtitle
.
getEventTimeCount
()).
isEqualTo
(
4
);
assertTypicalCue1
(
subtitle
,
0
);
...
...
@@ -149,7 +150,7 @@ public final class SubripDecoderTest {
SubripDecoder
decoder
=
new
SubripDecoder
();
byte
[]
bytes
=
TestUtil
.
getByteArray
(
ApplicationProvider
.
getApplicationContext
(),
NO_END_TIMECODES_FILE
);
Sub
ripSub
title
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
Subtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
assertThat
(
subtitle
.
getEventTimeCount
()).
isEqualTo
(
3
);
...
...
@@ -171,7 +172,7 @@ public final class SubripDecoderTest {
SubripDecoder
decoder
=
new
SubripDecoder
();
byte
[]
bytes
=
TestUtil
.
getByteArray
(
ApplicationProvider
.
getApplicationContext
(),
TYPICAL_WITH_TAGS
);
Sub
ripSub
title
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
Subtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
assertTypicalCue1
(
subtitle
,
0
);
assertTypicalCue2
(
subtitle
,
2
);
...
...
@@ -194,21 +195,21 @@ public final class SubripDecoderTest {
assertAlignmentCue
(
subtitle
,
26
,
Cue
.
ANCHOR_TYPE_START
,
Cue
.
ANCHOR_TYPE_END
);
// {/an9}
}
private
static
void
assertTypicalCue1
(
Sub
ripSub
title
subtitle
,
int
eventIndex
)
{
private
static
void
assertTypicalCue1
(
Subtitle
subtitle
,
int
eventIndex
)
{
assertThat
(
subtitle
.
getEventTime
(
eventIndex
)).
isEqualTo
(
0
);
assertThat
(
subtitle
.
getCues
(
subtitle
.
getEventTime
(
eventIndex
)).
get
(
0
).
text
.
toString
())
.
isEqualTo
(
"This is the first subtitle."
);
assertThat
(
subtitle
.
getEventTime
(
eventIndex
+
1
)).
isEqualTo
(
1234000
);
}
private
static
void
assertTypicalCue2
(
Sub
ripSub
title
subtitle
,
int
eventIndex
)
{
private
static
void
assertTypicalCue2
(
Subtitle
subtitle
,
int
eventIndex
)
{
assertThat
(
subtitle
.
getEventTime
(
eventIndex
)).
isEqualTo
(
2345000
);
assertThat
(
subtitle
.
getCues
(
subtitle
.
getEventTime
(
eventIndex
)).
get
(
0
).
text
.
toString
())
.
isEqualTo
(
"This is the second subtitle.\nSecond subtitle with second line."
);
assertThat
(
subtitle
.
getEventTime
(
eventIndex
+
1
)).
isEqualTo
(
3456000
);
}
private
static
void
assertTypicalCue3
(
Sub
ripSub
title
subtitle
,
int
eventIndex
)
{
private
static
void
assertTypicalCue3
(
Subtitle
subtitle
,
int
eventIndex
)
{
assertThat
(
subtitle
.
getEventTime
(
eventIndex
)).
isEqualTo
(
4567000
);
assertThat
(
subtitle
.
getCues
(
subtitle
.
getEventTime
(
eventIndex
)).
get
(
0
).
text
.
toString
())
.
isEqualTo
(
"This is the third subtitle."
);
...
...
@@ -216,7 +217,7 @@ public final class SubripDecoderTest {
}
private
static
void
assertAlignmentCue
(
Sub
ripSub
title
subtitle
,
Subtitle
subtitle
,
int
eventIndex
,
@Cue
.
AnchorType
int
lineAnchor
,
@Cue
.
AnchorType
int
positionAnchor
)
{
...
...
library/core/src/test/java/com/google/android/exoplayer2/text/ttml/TtmlDecoderTest.java
View file @
244c202c
...
...
@@ -701,6 +701,6 @@ public final class TtmlDecoderTest {
private
TtmlSubtitle
getSubtitle
(
String
file
)
throws
IOException
,
SubtitleDecoderException
{
TtmlDecoder
ttmlDecoder
=
new
TtmlDecoder
();
byte
[]
bytes
=
TestUtil
.
getByteArray
(
ApplicationProvider
.
getApplicationContext
(),
file
);
return
ttmlDecoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
return
(
TtmlSubtitle
)
ttmlDecoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
}
}
library/core/src/test/java/com/google/android/exoplayer2/text/webvtt/WebvttDecoderTest.java
View file @
244c202c
...
...
@@ -395,7 +395,7 @@ public class WebvttDecoderTest {
throws
IOException
,
SubtitleDecoderException
{
WebvttDecoder
decoder
=
new
WebvttDecoder
();
byte
[]
bytes
=
TestUtil
.
getByteArray
(
ApplicationProvider
.
getApplicationContext
(),
asset
);
return
decoder
.
decode
(
bytes
,
bytes
.
length
,
/* reset= */
false
);
return
(
WebvttSubtitle
)
decoder
.
decode
(
bytes
,
bytes
.
length
,
/* reset= */
false
);
}
private
Spanned
getUniqueSpanTextAt
(
WebvttSubtitle
sub
,
long
timeUs
)
{
...
...
library/core/src/test/java/com/google/android/exoplayer2/upstream/cache/CacheDataSourceTest.java
View file @
244c202c
...
...
@@ -363,7 +363,7 @@ public final class CacheDataSourceTest {
.
appendReadData
(
1
);
// Lock the content on the cache.
Simple
CacheSpan
cacheSpan
=
cache
.
startReadWriteNonBlocking
(
defaultCacheKey
,
0
);
CacheSpan
cacheSpan
=
cache
.
startReadWriteNonBlocking
(
defaultCacheKey
,
0
);
assertThat
(
cacheSpan
).
isNotNull
();
assertThat
(
cacheSpan
.
isHoleSpan
()).
isTrue
();
...
...
library/core/src/test/java/com/google/android/exoplayer2/upstream/cache/SimpleCacheTest.java
View file @
244c202c
...
...
@@ -164,7 +164,7 @@ public class SimpleCacheTest {
.
isEqualTo
(
150
);
// Removing the last span shouldn't cause the length be change next time cache loaded
Simple
CacheSpan
lastSpan
=
simpleCache2
.
startReadWrite
(
KEY_1
,
145
);
CacheSpan
lastSpan
=
simpleCache2
.
startReadWrite
(
KEY_1
,
145
);
simpleCache2
.
removeSpan
(
lastSpan
);
simpleCache2
.
release
();
simpleCache2
=
getSimpleCache
();
...
...
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