Commit 244c202c by andrewlewis Committed by Oliver Woodman

Fix hidden API warnings from Metalava

PiperOrigin-RevId: 255442455
parent 2a765f6b
......@@ -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> {
......
......@@ -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);
......
......@@ -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;
......
......@@ -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 DvbSubtitle decode(byte[] data, int length, boolean reset) {
protected Subtitle decode(byte[] data, int length, boolean reset) {
if (reset) {
parser.reset();
}
......
......@@ -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 SsaSubtitle 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();
......
......@@ -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 SubripSubtitle 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);
......
......@@ -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 TtmlSubtitle decode(byte[] bytes, int length, boolean reset)
protected Subtitle decode(byte[] bytes, int length, boolean reset)
throws SubtitleDecoderException {
try {
XmlPullParser xmlParser = xmlParserFactory.newPullParser();
......
......@@ -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 Mp4WebvttSubtitle 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.
......
......@@ -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 WebvttSubtitle 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.
......
......@@ -380,13 +380,13 @@ public final class SimpleCache implements Cache {
}
@Override
public synchronized SimpleCacheSpan startReadWrite(String key, long position)
public synchronized CacheSpan startReadWrite(String key, long position)
throws InterruptedException, CacheException {
Assertions.checkState(!released);
checkInitialization();
while (true) {
SimpleCacheSpan 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 SimpleCacheSpan startReadWriteNonBlocking(String key, long position)
public synchronized CacheSpan startReadWriteNonBlocking(String key, long position)
throws CacheException {
Assertions.checkState(!released);
checkInitialization();
......
......@@ -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);
SsaSubtitle 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);
SsaSubtitle 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);
SsaSubtitle 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);
SsaSubtitle 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);
SsaSubtitle 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(SsaSubtitle 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(SsaSubtitle 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(SsaSubtitle 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.");
......
......@@ -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);
SubripSubtitle 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);
SubripSubtitle 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);
SubripSubtitle 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);
SubripSubtitle 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);
SubripSubtitle 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);
SubripSubtitle 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);
SubripSubtitle 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);
SubripSubtitle 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);
SubripSubtitle 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);
SubripSubtitle 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(SubripSubtitle 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(SubripSubtitle 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(SubripSubtitle 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(
SubripSubtitle subtitle,
Subtitle subtitle,
int eventIndex,
@Cue.AnchorType int lineAnchor,
@Cue.AnchorType int positionAnchor) {
......
......@@ -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);
}
}
......@@ -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) {
......
......@@ -363,7 +363,7 @@ public final class CacheDataSourceTest {
.appendReadData(1);
// Lock the content on the cache.
SimpleCacheSpan cacheSpan = cache.startReadWriteNonBlocking(defaultCacheKey, 0);
CacheSpan cacheSpan = cache.startReadWriteNonBlocking(defaultCacheKey, 0);
assertThat(cacheSpan).isNotNull();
assertThat(cacheSpan.isHoleSpan()).isTrue();
......
......@@ -164,7 +164,7 @@ public class SimpleCacheTest {
.isEqualTo(150);
// Removing the last span shouldn't cause the length be change next time cache loaded
SimpleCacheSpan lastSpan = simpleCache2.startReadWrite(KEY_1, 145);
CacheSpan lastSpan = simpleCache2.startReadWrite(KEY_1, 145);
simpleCache2.removeSpan(lastSpan);
simpleCache2.release();
simpleCache2 = getSimpleCache();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment