Commit 4c1a294b by bachinger

Format Java source files

PiperOrigin-RevId: 372127633
parent 39ac09e7
Showing with 895 additions and 1126 deletions
......@@ -201,8 +201,10 @@ public class MainActivity extends AppCompatActivity
@Override
@NonNull
public QueueItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
TextView v = (TextView) LayoutInflater.from(parent.getContext())
.inflate(android.R.layout.simple_list_item_1, parent, false);
TextView v =
(TextView)
LayoutInflater.from(parent.getContext())
.inflate(android.R.layout.simple_list_item_1, parent, false);
return new QueueItemViewHolder(v);
}
......@@ -223,7 +225,6 @@ public class MainActivity extends AppCompatActivity
public int getItemCount() {
return playerManager.getMediaQueueSize();
}
}
private class RecyclerViewCallback extends ItemTouchHelper.SimpleCallback {
......
......@@ -24,9 +24,7 @@ import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Timeline;
import java.util.Arrays;
/**
* A {@link Timeline} for Cast media queues.
*/
/** A {@link Timeline} for Cast media queues. */
/* package */ final class CastTimeline extends Timeline {
/** Holds {@link Timeline} related data for a Cast media item. */
......@@ -190,5 +188,4 @@ import java.util.Arrays;
result = 31 * result + Arrays.hashCode(isLive);
return result;
}
}
......@@ -22,9 +22,7 @@ import com.google.android.gms.cast.CastStatusCodes;
import com.google.android.gms.cast.MediaInfo;
import com.google.android.gms.cast.MediaTrack;
/**
* Utility methods for ExoPlayer/Cast integration.
*/
/** Utility methods for ExoPlayer/Cast integration. */
/* package */ final class CastUtils {
/** The duration returned by {@link MediaInfo#getStreamDuration()} for live streams. */
......@@ -103,8 +101,8 @@ import com.google.android.gms.cast.MediaTrack;
}
/**
* Creates a {@link Format} instance containing all information contained in the given
* {@link MediaTrack} object.
* Creates a {@link Format} instance containing all information contained in the given {@link
* MediaTrack} object.
*
* @param mediaTrack The {@link MediaTrack}.
* @return The equivalent {@link Format}.
......@@ -118,5 +116,4 @@ import com.google.android.gms.cast.MediaTrack;
}
private CastUtils() {}
}
......@@ -46,5 +46,4 @@ public final class DefaultCastOptionsProvider implements OptionsProvider {
public List<SessionProvider> getAdditionalSessionProviders(Context context) {
return Collections.emptyList();
}
}
......@@ -22,9 +22,7 @@ import java.nio.ByteBuffer;
import org.chromium.net.UploadDataProvider;
import org.chromium.net.UploadDataSink;
/**
* A {@link UploadDataProvider} implementation that provides data from a {@code byte[]}.
*/
/** A {@link UploadDataProvider} implementation that provides data from a {@code byte[]}. */
/* package */ final class ByteArrayUploadDataProvider extends UploadDataProvider {
private final byte[] data;
......@@ -53,5 +51,4 @@ import org.chromium.net.UploadDataSink;
position = 0;
uploadDataSink.onRewindSucceeded();
}
}
......@@ -265,9 +265,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
}
}
/**
* Thrown when an error is encountered when trying to open a {@link CronetDataSource}.
*/
/** Thrown when an error is encountered when trying to open a {@link CronetDataSource}. */
public static final class OpenException extends HttpDataSourceException {
/**
......@@ -985,13 +983,14 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
private static int getStatus(UrlRequest request) throws InterruptedException {
final ConditionVariable conditionVariable = new ConditionVariable();
final int[] statusHolder = new int[1];
request.getStatus(new UrlRequest.StatusListener() {
@Override
public void onStatus(int status) {
statusHolder[0] = status;
conditionVariable.open();
}
});
request.getStatus(
new UrlRequest.StatusListener() {
@Override
public void onStatus(int status) {
statusHolder[0] = status;
conditionVariable.open();
}
});
conditionVariable.block();
return statusHolder[0];
}
......
......@@ -27,15 +27,11 @@ import org.chromium.net.CronetEngine;
@Deprecated
public final class CronetDataSourceFactory extends BaseFactory {
/**
* The default connection timeout, in milliseconds.
*/
/** The default connection timeout, in milliseconds. */
public static final int DEFAULT_CONNECT_TIMEOUT_MILLIS =
CronetDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS;
/**
* The default read timeout, in milliseconds.
*/
/** The default read timeout, in milliseconds. */
public static final int DEFAULT_READ_TIMEOUT_MILLIS =
CronetDataSource.DEFAULT_READ_TIMEOUT_MILLIS;
......@@ -338,8 +334,8 @@ public final class CronetDataSourceFactory extends BaseFactory {
}
@Override
protected HttpDataSource createDataSourceInternal(HttpDataSource.RequestProperties
defaultRequestProperties) {
protected HttpDataSource createDataSourceInternal(
HttpDataSource.RequestProperties defaultRequestProperties) {
@Nullable CronetEngine cronetEngine = cronetEngineWrapper.getCronetEngine();
if (cronetEngine == null) {
return fallbackFactory.createDataSource();
......@@ -357,5 +353,4 @@ public final class CronetDataSourceFactory extends BaseFactory {
}
return dataSource;
}
}
......@@ -49,25 +49,15 @@ public final class CronetEngineWrapper {
@Retention(RetentionPolicy.SOURCE)
@IntDef({SOURCE_NATIVE, SOURCE_GMS, SOURCE_UNKNOWN, SOURCE_USER_PROVIDED, SOURCE_UNAVAILABLE})
public @interface CronetEngineSource {}
/**
* Natively bundled Cronet implementation.
*/
/** Natively bundled Cronet implementation. */
public static final int SOURCE_NATIVE = 0;
/**
* Cronet implementation from GMSCore.
*/
/** Cronet implementation from GMSCore. */
public static final int SOURCE_GMS = 1;
/**
* Other (unknown) Cronet implementation.
*/
/** Other (unknown) Cronet implementation. */
public static final int SOURCE_UNKNOWN = 2;
/**
* User-provided Cronet engine.
*/
/** User-provided Cronet engine. */
public static final int SOURCE_USER_PROVIDED = 3;
/**
* No Cronet implementation available. Fallback Http provider is used if possible.
*/
/** No Cronet implementation available. Fallback Http provider is used if possible. */
public static final int SOURCE_UNAVAILABLE = 4;
/**
......@@ -124,11 +114,15 @@ public final class CronetEngineWrapper {
}
Log.d(TAG, "CronetEngine built using " + providerName);
} catch (SecurityException e) {
Log.w(TAG, "Failed to build CronetEngine. Please check if current process has "
+ "android.permission.ACCESS_NETWORK_STATE.");
Log.w(
TAG,
"Failed to build CronetEngine. Please check if current process has "
+ "android.permission.ACCESS_NETWORK_STATE.");
} catch (UnsatisfiedLinkError e) {
Log.w(TAG, "Failed to link Cronet binaries. Please check if native Cronet binaries are "
+ "bundled into your app.");
Log.w(
TAG,
"Failed to link Cronet binaries. Please check if native Cronet binaries are "
+ "bundled into your app.");
}
}
if (cronetEngine == null) {
......@@ -215,8 +209,7 @@ public final class CronetEngineWrapper {
}
/**
* Convert Cronet provider name into a sortable preference value.
* Smaller values are preferred.
* Convert Cronet provider name into a sortable preference value. Smaller values are preferred.
*/
private int evaluateCronetProviderType(String providerName) {
if (isNativeProvider(providerName)) {
......@@ -229,9 +222,7 @@ public final class CronetEngineWrapper {
return -1;
}
/**
* Compares version strings of format "12.123.35.23".
*/
/** Compares version strings of format "12.123.35.23". */
private static int compareVersionStrings(String versionLeft, String versionRight) {
if (versionLeft == null || versionRight == null) {
return 0;
......@@ -253,5 +244,4 @@ public final class CronetEngineWrapper {
return 0;
}
}
}
......@@ -79,10 +79,7 @@ public final class FfmpegAudioRenderer extends DecoderAudioRenderer<FfmpegAudioD
@Nullable Handler eventHandler,
@Nullable AudioRendererEventListener eventListener,
AudioSink audioSink) {
super(
eventHandler,
eventListener,
audioSink);
super(eventHandler, eventListener, audioSink);
}
@Override
......
......@@ -50,9 +50,7 @@ public final class FfmpegLibrary {
LOADER.setLibraries(libraries);
}
/**
* Returns whether the underlying library is available, loading it if necessary.
*/
/** Returns whether the underlying library is available, loading it if necessary. */
public static boolean isAvailable() {
return LOADER.isAvailable();
}
......
......@@ -28,9 +28,7 @@ import com.google.android.exoplayer2.util.Util;
import java.io.IOException;
import java.nio.ByteBuffer;
/**
* JNI wrapper for the libflac Flac decoder.
*/
/** JNI wrapper for the libflac Flac decoder. */
/* package */ final class FlacDecoderJni {
/** Exception to be thrown if {@link #decodeSample(ByteBuffer)} fails to decode a frame. */
......@@ -196,9 +194,7 @@ import java.nio.ByteBuffer;
}
}
/**
* Returns the position of the next data to be decoded, or -1 in case of error.
*/
/** Returns the position of the next data to be decoded, or -1 in case of error. */
public long getDecodePosition() {
return flacGetDecodePosition(nativeDecoderContext);
}
......@@ -303,5 +299,4 @@ import java.nio.ByteBuffer;
private native void flacReset(long context, long newPosition);
private native void flacRelease(long context);
}
......@@ -40,11 +40,8 @@ public final class FlacLibrary {
LOADER.setLibraries(libraries);
}
/**
* Returns whether the underlying library is available, loading it if necessary.
*/
/** Returns whether the underlying library is available, loading it if necessary. */
public static boolean isAvailable() {
return LOADER.isAvailable();
}
}
......@@ -67,10 +67,7 @@ public final class LibflacAudioRenderer extends DecoderAudioRenderer<FlacDecoder
@Nullable Handler eventHandler,
@Nullable AudioRendererEventListener eventListener,
AudioSink audioSink) {
super(
eventHandler,
eventListener,
audioSink);
super(eventHandler, eventListener, audioSink);
}
@Override
......
......@@ -233,9 +233,7 @@ public final class ImaPlaybackTest {
@Override
protected MediaSource buildSource(
HostActivity host,
DrmSessionManager drmSessionManager,
FrameLayout overlayFrameLayout) {
HostActivity host, DrmSessionManager drmSessionManager, FrameLayout overlayFrameLayout) {
Context context = host.getApplicationContext();
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(context);
MediaSource contentMediaSource =
......
......@@ -77,12 +77,12 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
/**
* Sets the {@link ControlDispatcher}.
*
* @param controlDispatcher The {@link ControlDispatcher}, or null to use
* {@link DefaultControlDispatcher}.
* @param controlDispatcher The {@link ControlDispatcher}, or null to use {@link
* DefaultControlDispatcher}.
*/
public void setControlDispatcher(@Nullable ControlDispatcher controlDispatcher) {
this.controlDispatcher = controlDispatcher == null ? new DefaultControlDispatcher()
: controlDispatcher;
this.controlDispatcher =
controlDispatcher == null ? new DefaultControlDispatcher() : controlDispatcher;
}
/**
......@@ -132,7 +132,8 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
@Override
public boolean isPlaying() {
int playbackState = player.getPlaybackState();
return playbackState != Player.STATE_IDLE && playbackState != Player.STATE_ENDED
return playbackState != Player.STATE_IDLE
&& playbackState != Player.STATE_ENDED
&& player.getPlayWhenReady();
}
......@@ -259,8 +260,11 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
Pair<Integer, String> errorMessage = errorMessageProvider.getErrorMessage(exception);
callback.onError(LeanbackPlayerAdapter.this, errorMessage.first, errorMessage.second);
} else {
callback.onError(LeanbackPlayerAdapter.this, exception.type, context.getString(
R.string.lb_media_player_error, exception.type, exception.rendererIndex));
callback.onError(
LeanbackPlayerAdapter.this,
exception.type,
context.getString(
R.string.lb_media_player_error, exception.type, exception.rendererIndex));
}
}
......@@ -298,7 +302,5 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
public void onRenderedFirstFrame() {
// Do nothing.
}
}
}
......@@ -168,10 +168,7 @@ public class SessionPlayerConnectorTest {
SimpleExoPlayer simpleExoPlayer = null;
SessionPlayerConnector playerConnector = null;
try {
simpleExoPlayer =
new SimpleExoPlayer.Builder(context)
.setLooper(Looper.myLooper())
.build();
simpleExoPlayer = new SimpleExoPlayer.Builder(context).setLooper(Looper.myLooper()).build();
playerConnector =
new SessionPlayerConnector(simpleExoPlayer, new DefaultMediaItemConverter());
playerConnector.setControlDispatcher(controlDispatcher);
......
......@@ -89,7 +89,6 @@ import com.google.android.exoplayer2.audio.AudioAttributes;
}
}
private Utils() {
// Prevent instantiation.
}
......
......@@ -33,8 +33,7 @@ public final class RepeatModeActionProvider implements MediaSessionConnector.Cus
private static final String ACTION_REPEAT_MODE = "ACTION_EXO_REPEAT_MODE";
@RepeatModeUtil.RepeatToggleModes
private final int repeatToggleModes;
@RepeatModeUtil.RepeatToggleModes private final int repeatToggleModes;
private final CharSequence repeatAllDescription;
private final CharSequence repeatOneDescription;
private final CharSequence repeatOffDescription;
......@@ -93,9 +92,9 @@ public final class RepeatModeActionProvider implements MediaSessionConnector.Cus
iconResourceId = R.drawable.exo_media_action_repeat_off;
break;
}
PlaybackStateCompat.CustomAction.Builder repeatBuilder = new PlaybackStateCompat.CustomAction
.Builder(ACTION_REPEAT_MODE, actionLabel, iconResourceId);
PlaybackStateCompat.CustomAction.Builder repeatBuilder =
new PlaybackStateCompat.CustomAction.Builder(
ACTION_REPEAT_MODE, actionLabel, iconResourceId);
return repeatBuilder.build();
}
}
......@@ -57,8 +57,8 @@ public final class TimelineQueueEditor
/**
* Adapter to get {@link MediaDescriptionCompat} of items in the queue and to notify the
* application about changes in the queue to sync the data structure backing the
* {@link MediaSessionConnector}.
* application about changes in the queue to sync the data structure backing the {@link
* MediaSessionConnector}.
*/
public interface QueueDataAdapter {
/**
......@@ -83,9 +83,7 @@ public final class TimelineQueueEditor
void move(int from, int to);
}
/**
* Used to evaluate whether two {@link MediaDescriptionCompat} are considered equal.
*/
/** Used to evaluate whether two {@link MediaDescriptionCompat} are considered equal. */
interface MediaDescriptionEqualityChecker {
/**
* Returns {@code true} whether the descriptions are considered equal.
......
......@@ -51,8 +51,8 @@ public abstract class TimelineQueueNavigator implements MediaSessionConnector.Qu
/**
* Creates an instance for a given {@link MediaSessionCompat}.
* <p>
* Equivalent to {@code TimelineQueueNavigator(mediaSession, DEFAULT_MAX_QUEUE_SIZE)}.
*
* <p>Equivalent to {@code TimelineQueueNavigator(mediaSession, DEFAULT_MAX_QUEUE_SIZE)}.
*
* @param mediaSession The {@link MediaSessionCompat}.
*/
......@@ -62,10 +62,10 @@ public abstract class TimelineQueueNavigator implements MediaSessionConnector.Qu
/**
* Creates an instance for a given {@link MediaSessionCompat} and maximum queue size.
* <p>
* If the number of windows in the {@link Player}'s {@link Timeline} exceeds {@code maxQueueSize},
* the media session queue will correspond to {@code maxQueueSize} windows centered on the one
* currently being played.
*
* <p>If the number of windows in the {@link Player}'s {@link Timeline} exceeds {@code
* maxQueueSize}, the media session queue will correspond to {@code maxQueueSize} windows centered
* on the one currently being played.
*
* @param mediaSession The {@link MediaSessionCompat}.
* @param maxQueueSize The maximum queue size.
......
......@@ -463,11 +463,11 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource {
}
/**
* Reads up to {@code length} bytes of data and stores them into {@code buffer}, starting at
* index {@code offset}.
* <p>
* This method blocks until at least one byte of data can be read, the end of the opened range is
* detected, or an exception is thrown.
* Reads up to {@code length} bytes of data and stores them into {@code buffer}, starting at index
* {@code offset}.
*
* <p>This method blocks until at least one byte of data can be read, the end of the opened range
* is detected, or an exception is thrown.
*
* @param buffer The buffer into which the read data should be stored.
* @param offset The start offset into {@code buffer} at which data should be written.
......@@ -498,9 +498,7 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource {
return read;
}
/**
* Closes the current connection quietly, if there is one.
*/
/** Closes the current connection quietly, if there is one. */
private void closeConnectionQuietly() {
if (response != null) {
Assertions.checkNotNull(response.body()).close();
......@@ -508,5 +506,4 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource {
}
responseByteStream = null;
}
}
......@@ -104,11 +104,7 @@ public final class OkHttpDataSourceFactory extends BaseFactory {
protected OkHttpDataSource createDataSourceInternal(
HttpDataSource.RequestProperties defaultRequestProperties) {
OkHttpDataSource dataSource =
new OkHttpDataSource(
callFactory,
userAgent,
cacheControl,
defaultRequestProperties);
new OkHttpDataSource(callFactory, userAgent, cacheControl, defaultRequestProperties);
if (listener != null) {
dataSource.addTransferListener(listener);
}
......
......@@ -121,7 +121,5 @@ public class OpusPlaybackTest {
Looper.myLooper().quit();
}
}
}
}
......@@ -27,5 +27,4 @@ public final class OpusDecoderException extends DecoderException {
/* package */ OpusDecoderException(String message, Throwable cause) {
super(message, cause);
}
}
......@@ -48,9 +48,7 @@ public final class OpusLibrary {
OpusLibrary.exoMediaCryptoType = exoMediaCryptoType;
}
/**
* Returns whether the underlying library is available, loading it if necessary.
*/
/** Returns whether the underlying library is available, loading it if necessary. */
public static boolean isAvailable() {
return LOADER.isAvailable();
}
......@@ -71,5 +69,6 @@ public final class OpusLibrary {
}
public static native String opusGetVersion();
public static native boolean opusIsSecureDecodeSupported();
}
......@@ -80,5 +80,4 @@ public final class RtmpDataSource extends BaseDataSource {
public Uri getUri() {
return uri;
}
}
......@@ -42,5 +42,4 @@ public final class RtmpDataSourceFactory implements DataSource.Factory {
}
return dataSource;
}
}
......@@ -145,8 +145,8 @@ public final class VpxDecoder
if (result != NO_ERROR) {
if (result == DRM_ERROR) {
String message = "Drm error: " + vpxGetErrorMessage(vpxDecContext);
DecryptionException cause = new DecryptionException(
vpxGetErrorCode(vpxDecContext), message);
DecryptionException cause =
new DecryptionException(vpxGetErrorCode(vpxDecContext), message);
return new VpxDecoderException(message, cause);
} else {
return new VpxDecoderException("Decode error: " + vpxGetErrorMessage(vpxDecContext));
......@@ -209,6 +209,7 @@ public final class VpxDecoder
boolean disableLoopFilter, boolean enableRowMultiThreadMode, int threads);
private native long vpxClose(long context);
private native long vpxDecode(long context, ByteBuffer encoded, int length);
private native long vpxSecureDecode(
......@@ -239,6 +240,6 @@ public final class VpxDecoder
private native int vpxReleaseFrame(long context, VideoDecoderOutputBuffer outputBuffer);
private native int vpxGetErrorCode(long context);
private native String vpxGetErrorMessage(long context);
private native String vpxGetErrorMessage(long context);
}
......@@ -48,9 +48,7 @@ public final class VpxLibrary {
VpxLibrary.exoMediaCryptoType = exoMediaCryptoType;
}
/**
* Returns whether the underlying library is available, loading it if necessary.
*/
/** Returns whether the underlying library is available, loading it if necessary. */
public static boolean isAvailable() {
return LOADER.isAvailable();
}
......@@ -70,13 +68,10 @@ public final class VpxLibrary {
return isAvailable() ? vpxGetBuildConfig() : null;
}
/**
* Returns true if the underlying libvpx library supports high bit depth.
*/
/** Returns true if the underlying libvpx library supports high bit depth. */
public static boolean isHighBitDepthSupported() {
String config = getBuildConfig();
int indexHbd = config != null
? config.indexOf("--enable-vp9-highbitdepth") : -1;
int indexHbd = config != null ? config.indexOf("--enable-vp9-highbitdepth") : -1;
return indexHbd >= 0;
}
......@@ -90,7 +85,8 @@ public final class VpxLibrary {
}
private static native String vpxGetVersion();
private static native String vpxGetBuildConfig();
public static native boolean vpxIsSecureDecodeSupported();
public static native boolean vpxIsSecureDecodeSupported();
}
......@@ -59,8 +59,8 @@ public final class ExoPlaybackException extends Exception implements Bundleable
public static final int TYPE_RENDERER = 1;
/**
* The error was an unexpected {@link RuntimeException}.
* <p>
* Call {@link #getUnexpectedException()} to retrieve the underlying cause.
*
* <p>Call {@link #getUnexpectedException()} to retrieve the underlying cause.
*/
public static final int TYPE_UNEXPECTED = 2;
/**
......
......@@ -21,9 +21,7 @@ import java.util.HashSet;
/** Information about the ExoPlayer library. */
public final class ExoPlayerLibraryInfo {
/**
* A tag to use when logging library information.
*/
/** A tag to use when logging library information. */
public static final String TAG = "ExoPlayer";
/** The version of the library expressed as a string, for example "1.2.3". */
......@@ -73,9 +71,7 @@ public final class ExoPlayerLibraryInfo {
private ExoPlayerLibraryInfo() {} // Prevents instantiation.
/**
* Returns a string consisting of registered module names separated by ", ".
*/
/** Returns a string consisting of registered module names separated by ", ". */
public static synchronized String registeredModules() {
return registeredModulesString;
}
......@@ -90,5 +86,4 @@ public final class ExoPlayerLibraryInfo {
registeredModulesString = registeredModulesString + ", " + name;
}
}
}
......@@ -681,8 +681,8 @@ public final class Format implements Parcelable {
*/
public final int maxInputSize;
/**
* Initialization data that must be provided to the decoder. Will not be null, but may be empty
* if initialization data is not required.
* Initialization data that must be provided to the decoder. Will not be null, but may be empty if
* initialization data is not required.
*/
public final List<byte[]> initializationData;
/** DRM initialization data if the stream is protected, or null otherwise. */
......@@ -697,17 +697,11 @@ public final class Format implements Parcelable {
// Video specific.
/**
* The width of the video in pixels, or {@link #NO_VALUE} if unknown or not applicable.
*/
/** The width of the video in pixels, or {@link #NO_VALUE} if unknown or not applicable. */
public final int width;
/**
* The height of the video in pixels, or {@link #NO_VALUE} if unknown or not applicable.
*/
/** The height of the video in pixels, or {@link #NO_VALUE} if unknown or not applicable. */
public final int height;
/**
* The frame rate in frames per second, or {@link #NO_VALUE} if unknown or not applicable.
*/
/** The frame rate in frames per second, or {@link #NO_VALUE} if unknown or not applicable. */
public final float frameRate;
/**
* The clockwise rotation that should be applied to the video for it to be rendered in the correct
......@@ -729,13 +723,9 @@ public final class Format implements Parcelable {
// Audio specific.
/**
* The number of audio channels, or {@link #NO_VALUE} if unknown or not applicable.
*/
/** The number of audio channels, or {@link #NO_VALUE} if unknown or not applicable. */
public final int channelCount;
/**
* The audio sampling rate in Hz, or {@link #NO_VALUE} if unknown or not applicable.
*/
/** The audio sampling rate in Hz, or {@link #NO_VALUE} if unknown or not applicable. */
public final int sampleRate;
/** The {@link C.PcmEncoding} for PCM audio. Set to {@link #NO_VALUE} for other media types. */
@C.PcmEncoding public final int pcmEncoding;
......@@ -1549,17 +1539,17 @@ public final class Format implements Parcelable {
dest.writeInt(accessibilityChannel);
}
public static final Creator<Format> CREATOR = new Creator<Format>() {
public static final Creator<Format> CREATOR =
new Creator<Format>() {
@Override
public Format createFromParcel(Parcel in) {
return new Format(in);
}
@Override
public Format[] newArray(int size) {
return new Format[size];
}
@Override
public Format createFromParcel(Parcel in) {
return new Format(in);
}
};
@Override
public Format[] newArray(int size) {
return new Format[size];
}
};
}
......@@ -21,17 +21,11 @@ package com.google.android.exoplayer2;
*/
public final class IllegalSeekPositionException extends IllegalStateException {
/**
* The {@link Timeline} in which the seek was attempted.
*/
/** The {@link Timeline} in which the seek was attempted. */
public final Timeline timeline;
/**
* The index of the window being seeked to.
*/
/** The index of the window being seeked to. */
public final int windowIndex;
/**
* The seek position in the specified window.
*/
/** The seek position in the specified window. */
public final long positionMs;
/**
......@@ -44,5 +38,4 @@ public final class IllegalSeekPositionException extends IllegalStateException {
this.windowIndex = windowIndex;
this.positionMs = positionMs;
}
}
......@@ -559,9 +559,7 @@ public final class MediaItem implements Bundleable {
return this;
}
/**
* Returns a new {@link MediaItem} instance with the current builder values.
*/
/** Returns a new {@link MediaItem} instance with the current builder values. */
public MediaItem build() {
checkState(drmLicenseUri == null || drmUuid != null);
@Nullable PlaybackProperties playbackProperties = null;
......
......@@ -24,16 +24,12 @@ public class ParserException extends IOException {
super();
}
/**
* @param message The detail message for the exception.
*/
/** @param message The detail message for the exception. */
public ParserException(String message) {
super(message);
}
/**
* @param cause The cause for the exception.
*/
/** @param cause The cause for the exception. */
public ParserException(Throwable cause) {
super(cause);
}
......@@ -45,5 +41,4 @@ public class ParserException extends IOException {
public ParserException(String message, Throwable cause) {
super(message, cause);
}
}
......@@ -229,9 +229,7 @@ public abstract class Timeline implements Bundleable {
*/
public long defaultPositionUs;
/**
* The duration of this window in microseconds, or {@link C#TIME_UNSET} if unknown.
*/
/** The duration of this window in microseconds, or {@link C#TIME_UNSET} if unknown. */
public long durationUs;
/** The index of the first period that belongs to this window. */
......@@ -312,16 +310,12 @@ public abstract class Timeline implements Bundleable {
return defaultPositionUs;
}
/**
* Returns the duration of the window in milliseconds, or {@link C#TIME_UNSET} if unknown.
*/
/** Returns the duration of the window in milliseconds, or {@link C#TIME_UNSET} if unknown. */
public long getDurationMs() {
return C.usToMs(durationUs);
}
/**
* Returns the duration of this window in microseconds, or {@link C#TIME_UNSET} if unknown.
*/
/** Returns the duration of this window in microseconds, or {@link C#TIME_UNSET} if unknown. */
public long getDurationUs() {
return durationUs;
}
......@@ -572,14 +566,10 @@ public abstract class Timeline implements Bundleable {
*/
@Nullable public Object uid;
/**
* The index of the window to which this period belongs.
*/
/** The index of the window to which this period belongs. */
public int windowIndex;
/**
* The duration of this period in microseconds, or {@link C#TIME_UNSET} if unknown.
*/
/** The duration of this period in microseconds, or {@link C#TIME_UNSET} if unknown. */
public long durationUs;
/**
......@@ -660,16 +650,12 @@ public abstract class Timeline implements Bundleable {
return this;
}
/**
* Returns the duration of the period in milliseconds, or {@link C#TIME_UNSET} if unknown.
*/
/** Returns the duration of the period in milliseconds, or {@link C#TIME_UNSET} if unknown. */
public long getDurationMs() {
return C.usToMs(durationUs);
}
/**
* Returns the duration of this period in microseconds, or {@link C#TIME_UNSET} if unknown.
*/
/** Returns the duration of this period in microseconds, or {@link C#TIME_UNSET} if unknown. */
public long getDurationUs() {
return durationUs;
}
......@@ -777,8 +763,8 @@ public abstract class Timeline implements Bundleable {
}
/**
* Returns the number of ads in the ad group at index {@code adGroupIndex}, or
* {@link C#LENGTH_UNSET} if not yet known.
* Returns the number of ads in the ad group at index {@code adGroupIndex}, or {@link
* C#LENGTH_UNSET} if not yet known.
*
* @param adGroupIndex The ad group index.
* @return The number of ads in the ad group, or {@link C#LENGTH_UNSET} if not yet known.
......@@ -788,8 +774,8 @@ public abstract class Timeline implements Bundleable {
}
/**
* Returns the duration of the ad at index {@code adIndexInAdGroup} in the ad group at
* {@code adGroupIndex}, in microseconds, or {@link C#TIME_UNSET} if not yet known.
* Returns the duration of the ad at index {@code adIndexInAdGroup} in the ad group at {@code
* adGroupIndex}, in microseconds, or {@link C#TIME_UNSET} if not yet known.
*
* @param adGroupIndex The ad group index.
* @param adIndexInAdGroup The ad index in the ad group.
......@@ -949,16 +935,12 @@ public abstract class Timeline implements Bundleable {
}
};
/**
* Returns whether the timeline is empty.
*/
/** Returns whether the timeline is empty. */
public final boolean isEmpty() {
return getWindowCount() == 0;
}
/**
* Returns the number of windows in the timeline.
*/
/** Returns the number of windows in the timeline. */
public abstract int getWindowCount();
/**
......@@ -974,13 +956,15 @@ public abstract class Timeline implements Bundleable {
int windowIndex, @Player.RepeatMode int repeatMode, boolean shuffleModeEnabled) {
switch (repeatMode) {
case Player.REPEAT_MODE_OFF:
return windowIndex == getLastWindowIndex(shuffleModeEnabled) ? C.INDEX_UNSET
return windowIndex == getLastWindowIndex(shuffleModeEnabled)
? C.INDEX_UNSET
: windowIndex + 1;
case Player.REPEAT_MODE_ONE:
return windowIndex;
case Player.REPEAT_MODE_ALL:
return windowIndex == getLastWindowIndex(shuffleModeEnabled)
? getFirstWindowIndex(shuffleModeEnabled) : windowIndex + 1;
? getFirstWindowIndex(shuffleModeEnabled)
: windowIndex + 1;
default:
throw new IllegalStateException();
}
......@@ -999,13 +983,15 @@ public abstract class Timeline implements Bundleable {
int windowIndex, @Player.RepeatMode int repeatMode, boolean shuffleModeEnabled) {
switch (repeatMode) {
case Player.REPEAT_MODE_OFF:
return windowIndex == getFirstWindowIndex(shuffleModeEnabled) ? C.INDEX_UNSET
return windowIndex == getFirstWindowIndex(shuffleModeEnabled)
? C.INDEX_UNSET
: windowIndex - 1;
case Player.REPEAT_MODE_ONE:
return windowIndex;
case Player.REPEAT_MODE_ALL:
return windowIndex == getFirstWindowIndex(shuffleModeEnabled)
? getLastWindowIndex(shuffleModeEnabled) : windowIndex - 1;
? getLastWindowIndex(shuffleModeEnabled)
: windowIndex - 1;
default:
throw new IllegalStateException();
}
......@@ -1064,9 +1050,7 @@ public abstract class Timeline implements Bundleable {
public abstract Window getWindow(
int windowIndex, Window window, long defaultPositionProjectionUs);
/**
* Returns the number of periods in the timeline.
*/
/** Returns the number of periods in the timeline. */
public abstract int getPeriodCount();
/**
......
......@@ -66,21 +66,13 @@ public final class Ac3Util {
* #STREAM_TYPE_UNDEFINED} otherwise.
*/
public final @StreamType int streamType;
/**
* The audio sampling rate in Hz.
*/
/** The audio sampling rate in Hz. */
public final int sampleRate;
/**
* The number of audio channels
*/
/** The number of audio channels */
public final int channelCount;
/**
* The size of the frame.
*/
/** The size of the frame. */
public final int frameSize;
/**
* Number of audio samples in the frame.
*/
/** Number of audio samples in the frame. */
public final int sampleCount;
private SyncFrameInfo(
......@@ -97,7 +89,6 @@ public final class Ac3Util {
this.frameSize = frameSize;
this.sampleCount = sampleCount;
}
}
/** Maximum rate for an AC-3 audio stream, in bytes per second. */
......@@ -118,27 +109,17 @@ public final class Ac3Util {
*/
public static final int TRUEHD_SYNCFRAME_PREFIX_LENGTH = 10;
/**
* The number of new samples per (E-)AC-3 audio block.
*/
/** The number of new samples per (E-)AC-3 audio block. */
private static final int AUDIO_SAMPLES_PER_AUDIO_BLOCK = 256;
/** Each syncframe has 6 blocks that provide 256 new audio samples. See subsection 4.1. */
private static final int AC3_SYNCFRAME_AUDIO_SAMPLE_COUNT = 6 * AUDIO_SAMPLES_PER_AUDIO_BLOCK;
/**
* Number of audio blocks per E-AC-3 syncframe, indexed by numblkscod.
*/
/** Number of audio blocks per E-AC-3 syncframe, indexed by numblkscod. */
private static final int[] BLOCKS_PER_SYNCFRAME_BY_NUMBLKSCOD = new int[] {1, 2, 3, 6};
/**
* Sample rates, indexed by fscod.
*/
/** Sample rates, indexed by fscod. */
private static final int[] SAMPLE_RATE_BY_FSCOD = new int[] {48000, 44100, 32000};
/**
* Sample rates, indexed by fscod2 (E-AC-3).
*/
/** Sample rates, indexed by fscod2 (E-AC-3). */
private static final int[] SAMPLE_RATE_BY_FSCOD2 = new int[] {24000, 22050, 16000};
/**
* Channel counts, indexed by acmod.
*/
/** Channel counts, indexed by acmod. */
private static final int[] CHANNEL_COUNT_BY_ACMOD = new int[] {2, 1, 2, 3, 3, 4, 4, 5};
/** Nominal bitrates in kbps, indexed by frmsizecod / 2. (See table 4.13.) */
private static final int[] BITRATE_BY_HALF_FRMSIZECOD =
......@@ -316,7 +297,7 @@ public final class Ac3Util {
}
if (streamType == SyncFrameInfo.STREAM_TYPE_TYPE0) {
if (data.readBit()) { // pgmscle
data.skipBits(6); //pgmscl
data.skipBits(6); // pgmscl
}
if (acmod == 0 && data.readBit()) { // pgmscl2e
data.skipBits(6); // pgmscl2
......@@ -562,7 +543,9 @@ public final class Ac3Util {
private static int getAc3SyncframeSize(int fscod, int frmsizecod) {
int halfFrmsizecod = frmsizecod / 2;
if (fscod < 0 || fscod >= SAMPLE_RATE_BY_FSCOD.length || frmsizecod < 0
if (fscod < 0
|| fscod >= SAMPLE_RATE_BY_FSCOD.length
|| frmsizecod < 0
|| halfFrmsizecod >= SYNCFRAME_SIZE_WORDS_BY_HALF_FRMSIZECOD_44_1.length) {
// Invalid values provided.
return C.LENGTH_UNSET;
......@@ -580,5 +563,4 @@ public final class Ac3Util {
}
private Ac3Util() {}
}
......@@ -41,9 +41,7 @@ public final class AudioAttributes implements Bundleable {
public static final AudioAttributes DEFAULT = new Builder().build();
/**
* Builder for {@link AudioAttributes}.
*/
/** Builder for {@link AudioAttributes}. */
public static final class Builder {
private @C.AudioContentType int contentType;
......@@ -64,25 +62,19 @@ public final class AudioAttributes implements Bundleable {
allowedCapturePolicy = C.ALLOW_CAPTURE_BY_ALL;
}
/**
* @see android.media.AudioAttributes.Builder#setContentType(int)
*/
/** @see android.media.AudioAttributes.Builder#setContentType(int) */
public Builder setContentType(@C.AudioContentType int contentType) {
this.contentType = contentType;
return this;
}
/**
* @see android.media.AudioAttributes.Builder#setFlags(int)
*/
/** @see android.media.AudioAttributes.Builder#setFlags(int) */
public Builder setFlags(@C.AudioFlags int flags) {
this.flags = flags;
return this;
}
/**
* @see android.media.AudioAttributes.Builder#setUsage(int)
*/
/** @see android.media.AudioAttributes.Builder#setUsage(int) */
public Builder setUsage(@C.AudioUsage int usage) {
this.usage = usage;
return this;
......@@ -98,7 +90,6 @@ public final class AudioAttributes implements Bundleable {
public AudioAttributes build() {
return new AudioAttributes(contentType, flags, usage, allowedCapturePolicy);
}
}
public final @C.AudioContentType int contentType;
......
......@@ -44,24 +44,22 @@ public final class DtsUtil {
private static final byte FIRST_BYTE_LE = (byte) (SYNC_VALUE_LE >>> 24);
private static final byte FIRST_BYTE_14B_LE = (byte) (SYNC_VALUE_14B_LE >>> 24);
/**
* Maps AMODE to the number of channels. See ETSI TS 102 114 table 5.4.
*/
private static final int[] CHANNELS_BY_AMODE = new int[] {1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 6,
7, 8, 8};
/**
* Maps SFREQ to the sampling frequency in Hz. See ETSI TS 102 144 table 5.5.
*/
private static final int[] SAMPLE_RATE_BY_SFREQ = new int[] {-1, 8000, 16000, 32000, -1, -1,
11025, 22050, 44100, -1, -1, 12000, 24000, 48000, -1, -1};
/**
* Maps RATE to 2 * bitrate in kbit/s. See ETSI TS 102 144 table 5.7.
*/
private static final int[] TWICE_BITRATE_KBPS_BY_RATE = new int[] {64, 112, 128, 192, 224, 256,
384, 448, 512, 640, 768, 896, 1024, 1152, 1280, 1536, 1920, 2048, 2304, 2560, 2688, 2816,
2823, 2944, 3072, 3840, 4096, 6144, 7680};
/** Maps AMODE to the number of channels. See ETSI TS 102 114 table 5.4. */
private static final int[] CHANNELS_BY_AMODE =
new int[] {1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 6, 7, 8, 8};
/** Maps SFREQ to the sampling frequency in Hz. See ETSI TS 102 144 table 5.5. */
private static final int[] SAMPLE_RATE_BY_SFREQ =
new int[] {
-1, 8000, 16000, 32000, -1, -1, 11025, 22050, 44100, -1, -1, 12000, 24000, 48000, -1, -1
};
/** Maps RATE to 2 * bitrate in kbit/s. See ETSI TS 102 144 table 5.7. */
private static final int[] TWICE_BITRATE_KBPS_BY_RATE =
new int[] {
64, 112, 128, 192, 224, 256, 384, 448, 512, 640, 768, 896, 1024, 1152, 1280, 1536, 1920,
2048, 2304, 2560, 2688, 2816, 2823, 2944, 3072, 3840, 4096, 6144, 7680
};
/**
* Returns whether a given integer matches a DTS sync word. Synchronization and storage modes are
......@@ -99,8 +97,10 @@ public final class DtsUtil {
int sfreq = frameBits.readBits(4);
int sampleRate = SAMPLE_RATE_BY_SFREQ[sfreq];
int rate = frameBits.readBits(5);
int bitrate = rate >= TWICE_BITRATE_KBPS_BY_RATE.length ? Format.NO_VALUE
: TWICE_BITRATE_KBPS_BY_RATE[rate] * 1000 / 2;
int bitrate =
rate >= TWICE_BITRATE_KBPS_BY_RATE.length
? Format.NO_VALUE
: TWICE_BITRATE_KBPS_BY_RATE[rate] * 1000 / 2;
frameBits.skipBits(10); // MIX, DYNF, TIMEF, AUXF, HDCD, EXT_AUDIO_ID, EXT_AUDIO, ASPF
channelCount += frameBits.readBits(2) > 0 ? 1 : 0; // LFF
return new Format.Builder()
......@@ -230,5 +230,4 @@ public final class DtsUtil {
}
private DtsUtil() {}
}
......@@ -20,33 +20,24 @@ import com.google.android.exoplayer2.C;
/** Base class for buffers with flags. */
public abstract class Buffer {
@C.BufferFlags
private int flags;
@C.BufferFlags private int flags;
/**
* Clears the buffer.
*/
/** Clears the buffer. */
public void clear() {
flags = 0;
}
/**
* Returns whether the {@link C#BUFFER_FLAG_DECODE_ONLY} flag is set.
*/
/** Returns whether the {@link C#BUFFER_FLAG_DECODE_ONLY} flag is set. */
public final boolean isDecodeOnly() {
return getFlag(C.BUFFER_FLAG_DECODE_ONLY);
}
/**
* Returns whether the {@link C#BUFFER_FLAG_END_OF_STREAM} flag is set.
*/
/** Returns whether the {@link C#BUFFER_FLAG_END_OF_STREAM} flag is set. */
public final boolean isEndOfStream() {
return getFlag(C.BUFFER_FLAG_END_OF_STREAM);
}
/**
* Returns whether the {@link C#BUFFER_FLAG_KEY_FRAME} flag is set.
*/
/** Returns whether the {@link C#BUFFER_FLAG_KEY_FRAME} flag is set. */
public final boolean isKeyFrame() {
return getFlag(C.BUFFER_FLAG_KEY_FRAME);
}
......@@ -69,8 +60,8 @@ public abstract class Buffer {
/**
* Adds the {@code flag} to this buffer's flags.
*
* @param flag The flag to add to this buffer's flags, which should be one of the
* {@code C.BUFFER_FLAG_*} constants.
* @param flag The flag to add to this buffer's flags, which should be one of the {@code
* C.BUFFER_FLAG_*} constants.
*/
public final void addFlag(@C.BufferFlags int flag) {
flags |= flag;
......@@ -94,5 +85,4 @@ public abstract class Buffer {
protected final boolean getFlag(@C.BufferFlags int flag) {
return (flags & flag) == flag;
}
}
......@@ -63,13 +63,9 @@ public final class CryptoInfo {
* @see android.media.MediaCodec.CryptoInfo#numSubSamples
*/
public int numSubSamples;
/**
* @see android.media.MediaCodec.CryptoInfo.Pattern
*/
/** @see android.media.MediaCodec.CryptoInfo.Pattern */
public int encryptedBlocks;
/**
* @see android.media.MediaCodec.CryptoInfo.Pattern
*/
/** @see android.media.MediaCodec.CryptoInfo.Pattern */
public int clearBlocks;
private final android.media.MediaCodec.CryptoInfo frameworkCryptoInfo;
......@@ -80,11 +76,16 @@ public final class CryptoInfo {
patternHolder = Util.SDK_INT >= 24 ? new PatternHolderV24(frameworkCryptoInfo) : null;
}
/**
* @see android.media.MediaCodec.CryptoInfo#set(int, int[], int[], byte[], byte[], int)
*/
public void set(int numSubSamples, int[] numBytesOfClearData, int[] numBytesOfEncryptedData,
byte[] key, byte[] iv, @C.CryptoMode int mode, int encryptedBlocks, int clearBlocks) {
/** @see android.media.MediaCodec.CryptoInfo#set(int, int[], int[], byte[], byte[], int) */
public void set(
int numSubSamples,
int[] numBytesOfClearData,
int[] numBytesOfEncryptedData,
byte[] key,
byte[] iv,
@C.CryptoMode int mode,
int encryptedBlocks,
int clearBlocks) {
this.numSubSamples = numSubSamples;
this.numBytesOfClearData = numBytesOfClearData;
this.numBytesOfEncryptedData = numBytesOfEncryptedData;
......@@ -157,7 +158,5 @@ public final class CryptoInfo {
pattern.set(encryptedBlocks, clearBlocks);
frameworkCryptoInfo.setPattern(pattern);
}
}
}
......@@ -66,22 +66,14 @@ public class DecoderInputBuffer extends Buffer {
BUFFER_REPLACEMENT_MODE_DIRECT
})
public @interface BufferReplacementMode {}
/**
* Disallows buffer replacement.
*/
/** Disallows buffer replacement. */
public static final int BUFFER_REPLACEMENT_MODE_DISABLED = 0;
/**
* Allows buffer replacement using {@link ByteBuffer#allocate(int)}.
*/
/** Allows buffer replacement using {@link ByteBuffer#allocate(int)}. */
public static final int BUFFER_REPLACEMENT_MODE_NORMAL = 1;
/**
* Allows buffer replacement using {@link ByteBuffer#allocateDirect(int)}.
*/
/** Allows buffer replacement using {@link ByteBuffer#allocateDirect(int)}. */
public static final int BUFFER_REPLACEMENT_MODE_DIRECT = 2;
/**
* {@link CryptoInfo} for encrypted data.
*/
/** {@link CryptoInfo} for encrypted data. */
public final CryptoInfo cryptoInfo;
/** The buffer's data, or {@code null} if no data has been set. */
......@@ -95,9 +87,7 @@ public class DecoderInputBuffer extends Buffer {
*/
public boolean waitingForKeys;
/**
* The time at which the sample should be presented.
*/
/** The time at which the sample should be presented. */
public long timeUs;
/**
......@@ -194,9 +184,7 @@ public class DecoderInputBuffer extends Buffer {
data = newData;
}
/**
* Returns whether the {@link C#BUFFER_FLAG_ENCRYPTED} flag is set.
*/
/** Returns whether the {@link C#BUFFER_FLAG_ENCRYPTED} flag is set. */
public final boolean isEncrypted() {
return getFlag(C.BUFFER_FLAG_ENCRYPTED);
}
......
......@@ -87,14 +87,10 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
/** The protection scheme type, or null if not applicable or unknown. */
@Nullable public final String schemeType;
/**
* Number of {@link SchemeData}s.
*/
/** Number of {@link SchemeData}s. */
public final int schemeDataCount;
/**
* @param schemeDatas Scheme initialization data for possibly multiple DRM schemes.
*/
/** @param schemeDatas Scheme initialization data for possibly multiple DRM schemes. */
public DrmInitData(List<SchemeData> schemeDatas) {
this(null, false, schemeDatas.toArray(new SchemeData[0]));
}
......@@ -107,9 +103,7 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
this(schemeType, false, schemeDatas.toArray(new SchemeData[0]));
}
/**
* @param schemeDatas Scheme initialization data for possibly multiple DRM schemes.
*/
/** @param schemeDatas Scheme initialization data for possibly multiple DRM schemes. */
public DrmInitData(SchemeData... schemeDatas) {
this(null, schemeDatas);
}
......@@ -122,8 +116,8 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
this(schemeType, true, schemeDatas);
}
private DrmInitData(@Nullable String schemeType, boolean cloneSchemeDatas,
SchemeData... schemeDatas) {
private DrmInitData(
@Nullable String schemeType, boolean cloneSchemeDatas, SchemeData... schemeDatas) {
this.schemeType = schemeType;
if (cloneSchemeDatas) {
schemeDatas = schemeDatas.clone();
......@@ -208,7 +202,8 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
@Override
public int compare(SchemeData first, SchemeData second) {
return C.UUID_NIL.equals(first.uuid) ? (C.UUID_NIL.equals(second.uuid) ? 0 : 1)
return C.UUID_NIL.equals(first.uuid)
? (C.UUID_NIL.equals(second.uuid) ? 0 : 1)
: first.uuid.compareTo(second.uuid);
}
......@@ -228,17 +223,16 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
public static final Parcelable.Creator<DrmInitData> CREATOR =
new Parcelable.Creator<DrmInitData>() {
@Override
public DrmInitData createFromParcel(Parcel in) {
return new DrmInitData(in);
}
@Override
public DrmInitData[] newArray(int size) {
return new DrmInitData[size];
}
@Override
public DrmInitData createFromParcel(Parcel in) {
return new DrmInitData(in);
}
};
@Override
public DrmInitData[] newArray(int size) {
return new DrmInitData[size];
}
};
// Internal methods.
......@@ -252,9 +246,7 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
return false;
}
/**
* Scheme initialization data.
*/
/** Scheme initialization data. */
public static final class SchemeData implements Parcelable {
// Lazily initialized hashcode.
......@@ -324,9 +316,7 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
return hasData() && !other.hasData() && matches(other.uuid);
}
/**
* Returns whether {@link #data} is non-null.
*/
/** Returns whether {@link #data} is non-null. */
public boolean hasData() {
return data != null;
}
......@@ -387,18 +377,15 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
public static final Parcelable.Creator<SchemeData> CREATOR =
new Parcelable.Creator<SchemeData>() {
@Override
public SchemeData createFromParcel(Parcel in) {
return new SchemeData(in);
}
@Override
public SchemeData[] newArray(int size) {
return new SchemeData[size];
}
};
@Override
public SchemeData createFromParcel(Parcel in) {
return new SchemeData(in);
}
@Override
public SchemeData[] newArray(int size) {
return new SchemeData[size];
}
};
}
}
......@@ -62,16 +62,12 @@ public final class Metadata implements Parcelable {
private final Entry[] entries;
/**
* @param entries The metadata entries.
*/
/** @param entries The metadata entries. */
public Metadata(Entry... entries) {
this.entries = entries;
}
/**
* @param entries The metadata entries.
*/
/** @param entries The metadata entries. */
public Metadata(List<? extends Entry> entries) {
this.entries = entries.toArray(new Entry[0]);
}
......@@ -83,9 +79,7 @@ public final class Metadata implements Parcelable {
}
}
/**
* Returns the number of metadata entries.
*/
/** Returns the number of metadata entries. */
public int length() {
return entries.length;
}
......
......@@ -22,13 +22,12 @@ import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
public final class MetadataInputBuffer extends DecoderInputBuffer {
/**
* An offset that must be added to the metadata's timestamps after it's been decoded, or
* {@link Format#OFFSET_SAMPLE_RELATIVE} if {@link #timeUs} should be added.
* An offset that must be added to the metadata's timestamps after it's been decoded, or {@link
* Format#OFFSET_SAMPLE_RELATIVE} if {@link #timeUs} should be added.
*/
public long subsampleOffsetUs;
public MetadataInputBuffer() {
super(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_NORMAL);
}
}
......@@ -57,24 +57,16 @@ public final class EventMessage implements Metadata.Entry {
/** The message scheme. */
public final String schemeIdUri;
/**
* The value for the event.
*/
/** The value for the event. */
public final String value;
/**
* The duration of the event in milliseconds.
*/
/** The duration of the event in milliseconds. */
public final long durationMs;
/**
* The instance identifier.
*/
/** The instance identifier. */
public final long id;
/**
* The body of the message.
*/
/** The body of the message. */
public final byte[] messageData;
// Lazily initialized hashcode.
......@@ -185,16 +177,14 @@ public final class EventMessage implements Metadata.Entry {
public static final Parcelable.Creator<EventMessage> CREATOR =
new Parcelable.Creator<EventMessage>() {
@Override
public EventMessage createFromParcel(Parcel in) {
return new EventMessage(in);
}
@Override
public EventMessage[] newArray(int size) {
return new EventMessage[size];
}
};
@Override
public EventMessage createFromParcel(Parcel in) {
return new EventMessage(in);
}
@Override
public EventMessage[] newArray(int size) {
return new EventMessage[size];
}
};
}
......@@ -69,5 +69,4 @@ public final class EventMessageEncoder {
outputStream.writeByte((int) (value >>> 8) & 0xFF);
outputStream.writeByte((int) value & 0xFF);
}
}
......@@ -59,7 +59,8 @@ public final class ApicFrame extends Id3Frame {
return false;
}
ApicFrame other = (ApicFrame) obj;
return pictureType == other.pictureType && Util.areEqual(mimeType, other.mimeType)
return pictureType == other.pictureType
&& Util.areEqual(mimeType, other.mimeType)
&& Util.areEqual(description, other.description)
&& Arrays.equals(pictureData, other.pictureData);
}
......@@ -89,18 +90,17 @@ public final class ApicFrame extends Id3Frame {
dest.writeByteArray(pictureData);
}
public static final Parcelable.Creator<ApicFrame> CREATOR = new Parcelable.Creator<ApicFrame>() {
public static final Parcelable.Creator<ApicFrame> CREATOR =
new Parcelable.Creator<ApicFrame>() {
@Override
public ApicFrame createFromParcel(Parcel in) {
return new ApicFrame(in);
}
@Override
public ApicFrame[] newArray(int size) {
return new ApicFrame[size];
}
};
@Override
public ApicFrame createFromParcel(Parcel in) {
return new ApicFrame(in);
}
@Override
public ApicFrame[] newArray(int size) {
return new ApicFrame[size];
}
};
}
......@@ -75,7 +75,5 @@ public final class BinaryFrame extends Id3Frame {
public BinaryFrame[] newArray(int size) {
return new BinaryFrame[size];
}
};
}
......@@ -31,18 +31,20 @@ public final class ChapterFrame extends Id3Frame {
public final String chapterId;
public final int startTimeMs;
public final int endTimeMs;
/**
* The byte offset of the start of the chapter, or {@link C#POSITION_UNSET} if not set.
*/
/** The byte offset of the start of the chapter, or {@link C#POSITION_UNSET} if not set. */
public final long startOffset;
/**
* The byte offset of the end of the chapter, or {@link C#POSITION_UNSET} if not set.
*/
/** The byte offset of the end of the chapter, or {@link C#POSITION_UNSET} if not set. */
public final long endOffset;
private final Id3Frame[] subFrames;
public ChapterFrame(String chapterId, int startTimeMs, int endTimeMs, long startOffset,
long endOffset, Id3Frame[] subFrames) {
public ChapterFrame(
String chapterId,
int startTimeMs,
int endTimeMs,
long startOffset,
long endOffset,
Id3Frame[] subFrames) {
super(ID);
this.chapterId = chapterId;
this.startTimeMs = startTimeMs;
......@@ -66,16 +68,12 @@ public final class ChapterFrame extends Id3Frame {
}
}
/**
* Returns the number of sub-frames.
*/
/** Returns the number of sub-frames. */
public int getSubFrameCount() {
return subFrames.length;
}
/**
* Returns the sub-frame at {@code index}.
*/
/** Returns the sub-frame at {@code index}. */
public Id3Frame getSubFrame(int index) {
return subFrames[index];
}
......@@ -126,18 +124,17 @@ public final class ChapterFrame extends Id3Frame {
return 0;
}
public static final Creator<ChapterFrame> CREATOR = new Creator<ChapterFrame>() {
@Override
public ChapterFrame createFromParcel(Parcel in) {
return new ChapterFrame(in);
}
@Override
public ChapterFrame[] newArray(int size) {
return new ChapterFrame[size];
}
public static final Creator<ChapterFrame> CREATOR =
new Creator<ChapterFrame>() {
};
@Override
public ChapterFrame createFromParcel(Parcel in) {
return new ChapterFrame(in);
}
@Override
public ChapterFrame[] newArray(int size) {
return new ChapterFrame[size];
}
};
}
......@@ -33,7 +33,11 @@ public final class ChapterTocFrame extends Id3Frame {
public final String[] children;
private final Id3Frame[] subFrames;
public ChapterTocFrame(String elementId, boolean isRoot, boolean isOrdered, String[] children,
public ChapterTocFrame(
String elementId,
boolean isRoot,
boolean isOrdered,
String[] children,
Id3Frame[] subFrames) {
super(ID);
this.elementId = elementId;
......@@ -56,16 +60,12 @@ public final class ChapterTocFrame extends Id3Frame {
}
}
/**
* Returns the number of sub-frames.
*/
/** Returns the number of sub-frames. */
public int getSubFrameCount() {
return subFrames.length;
}
/**
* Returns the sub-frame at {@code index}.
*/
/** Returns the sub-frame at {@code index}. */
public Id3Frame getSubFrame(int index) {
return subFrames[index];
}
......@@ -107,18 +107,17 @@ public final class ChapterTocFrame extends Id3Frame {
}
}
public static final Creator<ChapterTocFrame> CREATOR = new Creator<ChapterTocFrame>() {
public static final Creator<ChapterTocFrame> CREATOR =
new Creator<ChapterTocFrame>() {
@Override
public ChapterTocFrame createFromParcel(Parcel in) {
return new ChapterTocFrame(in);
}
@Override
public ChapterTocFrame[] newArray(int size) {
return new ChapterTocFrame[size];
}
};
@Override
public ChapterTocFrame createFromParcel(Parcel in) {
return new ChapterTocFrame(in);
}
@Override
public ChapterTocFrame[] newArray(int size) {
return new ChapterTocFrame[size];
}
};
}
......@@ -54,7 +54,8 @@ public final class CommentFrame extends Id3Frame {
return false;
}
CommentFrame other = (CommentFrame) obj;
return Util.areEqual(description, other.description) && Util.areEqual(language, other.language)
return Util.areEqual(description, other.description)
&& Util.areEqual(language, other.language)
&& Util.areEqual(text, other.text);
}
......@@ -93,7 +94,5 @@ public final class CommentFrame extends Id3Frame {
public CommentFrame[] newArray(int size) {
return new CommentFrame[size];
}
};
}
......@@ -58,8 +58,10 @@ public final class GeobFrame extends Id3Frame {
return false;
}
GeobFrame other = (GeobFrame) obj;
return Util.areEqual(mimeType, other.mimeType) && Util.areEqual(filename, other.filename)
&& Util.areEqual(description, other.description) && Arrays.equals(data, other.data);
return Util.areEqual(mimeType, other.mimeType)
&& Util.areEqual(filename, other.filename)
&& Util.areEqual(description, other.description)
&& Arrays.equals(data, other.data);
}
@Override
......@@ -93,18 +95,17 @@ public final class GeobFrame extends Id3Frame {
dest.writeByteArray(data);
}
public static final Parcelable.Creator<GeobFrame> CREATOR = new Parcelable.Creator<GeobFrame>() {
public static final Parcelable.Creator<GeobFrame> CREATOR =
new Parcelable.Creator<GeobFrame>() {
@Override
public GeobFrame createFromParcel(Parcel in) {
return new GeobFrame(in);
}
@Override
public GeobFrame[] newArray(int size) {
return new GeobFrame[size];
}
};
@Override
public GeobFrame createFromParcel(Parcel in) {
return new GeobFrame(in);
}
@Override
public GeobFrame[] newArray(int size) {
return new GeobFrame[size];
}
};
}
......@@ -20,9 +20,7 @@ import com.google.android.exoplayer2.metadata.Metadata;
/** Base class for ID3 frames. */
public abstract class Id3Frame implements Metadata.Entry {
/**
* The frame ID.
*/
/** The frame ID. */
public final String id;
public Id3Frame(String id) {
......@@ -38,5 +36,4 @@ public abstract class Id3Frame implements Metadata.Entry {
public int describeContents() {
return 0;
}
}
......@@ -75,18 +75,17 @@ public final class PrivFrame extends Id3Frame {
dest.writeByteArray(privateData);
}
public static final Parcelable.Creator<PrivFrame> CREATOR = new Parcelable.Creator<PrivFrame>() {
@Override
public PrivFrame createFromParcel(Parcel in) {
return new PrivFrame(in);
}
@Override
public PrivFrame[] newArray(int size) {
return new PrivFrame[size];
}
};
public static final Parcelable.Creator<PrivFrame> CREATOR =
new Parcelable.Creator<PrivFrame>() {
@Override
public PrivFrame createFromParcel(Parcel in) {
return new PrivFrame(in);
}
@Override
public PrivFrame[] newArray(int size) {
return new PrivFrame[size];
}
};
}
......@@ -49,7 +49,8 @@ public final class UrlLinkFrame extends Id3Frame {
return false;
}
UrlLinkFrame other = (UrlLinkFrame) obj;
return id.equals(other.id) && Util.areEqual(description, other.description)
return id.equals(other.id)
&& Util.areEqual(description, other.description)
&& Util.areEqual(url, other.url);
}
......@@ -88,7 +89,5 @@ public final class UrlLinkFrame extends Id3Frame {
public UrlLinkFrame[] newArray(int size) {
return new UrlLinkFrame[size];
}
};
}
......@@ -37,9 +37,7 @@ public final class TrackGroup implements Parcelable {
// Lazily initialized hashcode.
private int hashCode;
/**
* @param formats The track formats. At least one {@link Format} must be provided.
*/
/** @param formats The track formats. At least one {@link Format} must be provided. */
public TrackGroup(Format... formats) {
Assertions.checkState(formats.length > 0);
this.formats = formats;
......
......@@ -58,9 +58,7 @@ public final class Cue {
*/
public static final int ANCHOR_TYPE_START = 0;
/**
* Anchors the middle of the cue box.
*/
/** Anchors the middle of the cue box. */
public static final int ANCHOR_TYPE_MIDDLE = 1;
/**
......@@ -78,14 +76,10 @@ public final class Cue {
@IntDef({TYPE_UNSET, LINE_TYPE_FRACTION, LINE_TYPE_NUMBER})
public @interface LineType {}
/**
* Value for {@link #lineType} when {@link #line} is a fractional position.
*/
/** Value for {@link #lineType} when {@link #line} is a fractional position. */
public static final int LINE_TYPE_FRACTION = 0;
/**
* Value for {@link #lineType} when {@link #line} is a line number.
*/
/** Value for {@link #lineType} when {@link #line} is a line number. */
public static final int LINE_TYPE_NUMBER = 1;
/**
......@@ -247,14 +241,10 @@ public final class Cue {
*/
public final float bitmapHeight;
/**
* Specifies whether or not the {@link #windowColor} property is set.
*/
/** Specifies whether or not the {@link #windowColor} property is set. */
public final boolean windowColorSet;
/**
* The fill color of the window.
*/
/** The fill color of the window. */
public final int windowColor;
/**
......
......@@ -26,14 +26,10 @@ import java.util.Map;
/** Reads data from URI-identified resources. */
public interface DataSource extends DataReader {
/**
* A factory for {@link DataSource} instances.
*/
/** A factory for {@link DataSource} instances. */
interface Factory {
/**
* Creates a {@link DataSource} instance.
*/
/** Creates a {@link DataSource} instance. */
DataSource createDataSource();
}
......@@ -83,7 +79,8 @@ public interface DataSource extends DataReader {
*
* @return The {@link Uri} from which data is being read, or null if the source is not open.
*/
@Nullable Uri getUri();
@Nullable
Uri getUri();
/**
* When the source is open, returns the response headers associated with the last {@link #open}
......
......@@ -360,9 +360,7 @@ public final class DataSpec {
/** The position of the data when read from {@link #uri}. */
public final long position;
/**
* The length of the data, or {@link C#LENGTH_UNSET}.
*/
/** The length of the data, or {@link C#LENGTH_UNSET}. */
public final long length;
/**
......
......@@ -194,9 +194,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
/** The default connection timeout, in milliseconds. */
public static final int DEFAULT_CONNECT_TIMEOUT_MILLIS = 8 * 1000;
/**
* The default read timeout, in milliseconds.
*/
/** The default read timeout, in milliseconds. */
public static final int DEFAULT_READ_TIMEOUT_MILLIS = 8 * 1000;
private static final String TAG = "DefaultHttpDataSource";
......@@ -325,9 +323,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
requestProperties.clear();
}
/**
* Opens the source to read the specified data.
*/
/** Opens the source to read the specified data. */
@Override
public long open(DataSpec dataSpec) throws HttpDataSourceException {
this.dataSpec = dataSpec;
......@@ -411,8 +407,8 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
HttpUtil.getContentLength(
connection.getHeaderField(HttpHeaders.CONTENT_LENGTH),
connection.getHeaderField(HttpHeaders.CONTENT_RANGE));
bytesToRead = contentLength != C.LENGTH_UNSET ? (contentLength - bytesToSkip)
: C.LENGTH_UNSET;
bytesToRead =
contentLength != C.LENGTH_UNSET ? (contentLength - bytesToSkip) : C.LENGTH_UNSET;
}
} else {
// Gzip is enabled. If the server opts to use gzip then the content length in the response
......@@ -481,9 +477,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
}
}
/**
* Establishes a connection, following redirects to do so where permitted.
*/
/** Establishes a connection, following redirects to do so where permitted. */
private HttpURLConnection makeConnection(DataSpec dataSpec) throws IOException {
URL url = new URL(dataSpec.uri.toString());
@HttpMethod int httpMethod = dataSpec.httpMethod;
......@@ -675,11 +669,11 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
}
/**
* Reads up to {@code length} bytes of data and stores them into {@code buffer}, starting at
* index {@code offset}.
* <p>
* This method blocks until at least one byte of data can be read, the end of the opened range is
* detected, or an exception is thrown.
* Reads up to {@code length} bytes of data and stores them into {@code buffer}, starting at index
* {@code offset}.
*
* <p>This method blocks until at least one byte of data can be read, the end of the opened range
* is detected, or an exception is thrown.
*
* @param buffer The buffer into which the read data should be stored.
* @param offset The start offset into {@code buffer} at which data should be written.
......@@ -756,9 +750,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
}
}
/**
* Closes the current connection quietly, if there is one.
*/
/** Closes the current connection quietly, if there is one. */
private void closeConnectionQuietly() {
if (connection != null) {
try {
......
......@@ -33,9 +33,7 @@ import java.util.Map;
/** An HTTP {@link DataSource}. */
public interface HttpDataSource extends DataSource {
/**
* A factory for {@link HttpDataSource} instances.
*/
/** A factory for {@link HttpDataSource} instances. */
interface Factory extends DataSource.Factory {
@Override
......@@ -61,9 +59,9 @@ public interface HttpDataSource extends DataSource {
}
/**
* Stores HTTP request properties (aka HTTP headers) and provides methods to modify the headers
* in a thread safe way to avoid the potential of creating snapshots of an inconsistent or
* unintended state.
* Stores HTTP request properties (aka HTTP headers) and provides methods to modify the headers in
* a thread safe way to avoid the potential of creating snapshots of an inconsistent or unintended
* state.
*/
final class RequestProperties {
......@@ -119,9 +117,7 @@ public interface HttpDataSource extends DataSource {
requestProperties.remove(name);
}
/**
* Clears all request properties.
*/
/** Clears all request properties. */
public synchronized void clear() {
requestPropertiesSnapshot = null;
requestProperties.clear();
......@@ -191,9 +187,7 @@ public interface HttpDataSource extends DataSource {
&& !contentType.contains("xml");
};
/**
* Thrown when an error is encountered when trying to read from a {@link HttpDataSource}.
*/
/** Thrown when an error is encountered when trying to read from a {@link HttpDataSource}. */
class HttpDataSourceException extends IOException {
@Documented
......@@ -207,9 +201,7 @@ public interface HttpDataSource extends DataSource {
@Type public final int type;
/**
* The {@link DataSpec} associated with the current connection.
*/
/** The {@link DataSpec} associated with the current connection. */
public final DataSpec dataSpec;
public HttpDataSourceException(DataSpec dataSpec, @Type int type) {
......@@ -230,8 +222,8 @@ public interface HttpDataSource extends DataSource {
this.type = type;
}
public HttpDataSourceException(String message, IOException cause, DataSpec dataSpec,
@Type int type) {
public HttpDataSourceException(
String message, IOException cause, DataSpec dataSpec, @Type int type) {
super(message, cause);
this.dataSpec = dataSpec;
this.type = type;
......@@ -256,9 +248,7 @@ public interface HttpDataSource extends DataSource {
}
}
/**
* Thrown when the content type is invalid.
*/
/** Thrown when the content type is invalid. */
final class InvalidContentTypeException extends HttpDataSourceException {
public final String contentType;
......@@ -274,17 +264,13 @@ public interface HttpDataSource extends DataSource {
*/
final class InvalidResponseCodeException extends HttpDataSourceException {
/**
* The response code that was outside of the 2xx range.
*/
/** The response code that was outside of the 2xx range. */
public final int responseCode;
/** The http status message. */
@Nullable public final String responseMessage;
/**
* An unmodifiable map of the response header fields and values.
*/
/** An unmodifiable map of the response header fields and values. */
public final Map<String, List<String>> headerFields;
/** The response body. */
......@@ -333,7 +319,6 @@ public interface HttpDataSource extends DataSource {
this.headerFields = headerFields;
this.responseBody = responseBody;
}
}
/**
......@@ -373,9 +358,7 @@ public interface HttpDataSource extends DataSource {
*/
void clearRequestProperty(String name);
/**
* Clears all request headers that were set by {@link #setRequestProperty(String, String)}.
*/
/** Clears all request headers that were set by {@link #setRequestProperty(String, String)}. */
void clearAllRequestProperties();
/**
......
......@@ -224,5 +224,4 @@ public final class Assertions {
throw new IllegalStateException("Not in applications main thread");
}
}
}
......@@ -25,9 +25,7 @@ import androidx.annotation.Nullable;
*/
public interface Clock {
/**
* Default {@link Clock} to use for all non-test cases.
*/
/** Default {@link Clock} to use for all non-test cases. */
Clock DEFAULT = new SystemClock();
/**
......
......@@ -88,11 +88,7 @@ public final class ListenerSet<T> {
* during one {@link Looper} message queue iteration were handled by the listeners.
*/
public ListenerSet(Looper looper, Clock clock, IterationFinishedEvent<T> iterationFinishedEvent) {
this(
/* listeners= */ new CopyOnWriteArraySet<>(),
looper,
clock,
iterationFinishedEvent);
this(/* listeners= */ new CopyOnWriteArraySet<>(), looper, clock, iterationFinishedEvent);
}
private ListenerSet(
......
......@@ -29,9 +29,7 @@ public final class LongArray {
this(DEFAULT_INITIAL_CAPACITY);
}
/**
* @param initialCapacity The initial capacity of the array.
*/
/** @param initialCapacity The initial capacity of the array. */
public LongArray(int initialCapacity) {
values = new long[initialCapacity];
}
......@@ -63,9 +61,7 @@ public final class LongArray {
return values[index];
}
/**
* Returns the current size of the array.
*/
/** Returns the current size of the array. */
public int size() {
return size;
}
......@@ -78,5 +74,4 @@ public final class LongArray {
public long[] toArray() {
return Arrays.copyOf(values, size);
}
}
......@@ -24,9 +24,7 @@ public final class NalUnitUtil {
private static final String TAG = "NalUnitUtil";
/**
* Holds data parsed from a sequence parameter set NAL unit.
*/
/** Holds data parsed from a sequence parameter set NAL unit. */
public static final class SpsData {
public final int profileIdc;
......@@ -71,25 +69,23 @@ public final class NalUnitUtil {
this.picOrderCntLsbLength = picOrderCntLsbLength;
this.deltaPicOrderAlwaysZeroFlag = deltaPicOrderAlwaysZeroFlag;
}
}
/**
* Holds data parsed from a picture parameter set NAL unit.
*/
/** Holds data parsed from a picture parameter set NAL unit. */
public static final class PpsData {
public final int picParameterSetId;
public final int seqParameterSetId;
public final boolean bottomFieldPicOrderInFramePresentFlag;
public PpsData(int picParameterSetId, int seqParameterSetId,
public PpsData(
int picParameterSetId,
int seqParameterSetId,
boolean bottomFieldPicOrderInFramePresentFlag) {
this.picParameterSetId = picParameterSetId;
this.seqParameterSetId = seqParameterSetId;
this.bottomFieldPicOrderInFramePresentFlag = bottomFieldPicOrderInFramePresentFlag;
}
}
/** Four initial bytes that must prefix NAL units for decoding. */
......@@ -98,25 +94,26 @@ public final class NalUnitUtil {
/** Value for aspect_ratio_idc indicating an extended aspect ratio, in H.264 and H.265 SPSs. */
public static final int EXTENDED_SAR = 0xFF;
/** Aspect ratios indexed by aspect_ratio_idc, in H.264 and H.265 SPSs. */
public static final float[] ASPECT_RATIO_IDC_VALUES = new float[] {
1f /* Unspecified. Assume square */,
1f,
12f / 11f,
10f / 11f,
16f / 11f,
40f / 33f,
24f / 11f,
20f / 11f,
32f / 11f,
80f / 33f,
18f / 11f,
15f / 11f,
64f / 33f,
160f / 99f,
4f / 3f,
3f / 2f,
2f
};
public static final float[] ASPECT_RATIO_IDC_VALUES =
new float[] {
1f /* Unspecified. Assume square */,
1f,
12f / 11f,
10f / 11f,
16f / 11f,
40f / 33f,
24f / 11f,
20f / 11f,
32f / 11f,
80f / 33f,
18f / 11f,
15f / 11f,
64f / 33f,
160f / 99f,
4f / 3f,
3f / 2f,
2f
};
private static final int H264_NAL_UNIT_TYPE_SEI = 6; // Supplemental enhancement information
private static final int H264_NAL_UNIT_TYPE_SPS = 7; // Sequence parameter set
......@@ -131,10 +128,10 @@ public final class NalUnitUtil {
private static int[] scratchEscapePositions = new int[10];
/**
* Unescapes {@code data} up to the specified limit, replacing occurrences of [0, 0, 3] with
* [0, 0]. The unescaped data is returned in-place, with the return value indicating its length.
* <p>
* Executions of this method are mutually exclusive, so it should not be called with very large
* Unescapes {@code data} up to the specified limit, replacing occurrences of [0, 0, 3] with [0,
* 0]. The unescaped data is returned in-place, with the return value indicating its length.
*
* <p>Executions of this method are mutually exclusive, so it should not be called with very large
* buffers.
*
* @param data The data to unescape.
......@@ -150,8 +147,8 @@ public final class NalUnitUtil {
if (position < limit) {
if (scratchEscapePositions.length <= scratchEscapeCount) {
// Grow scratchEscapePositions to hold a larger number of positions.
scratchEscapePositions = Arrays.copyOf(scratchEscapePositions,
scratchEscapePositions.length * 2);
scratchEscapePositions =
Arrays.copyOf(scratchEscapePositions, scratchEscapePositions.length * 2);
}
scratchEscapePositions[scratchEscapeCount++] = position;
position += 3;
......@@ -180,9 +177,9 @@ public final class NalUnitUtil {
/**
* Discards data from the buffer up to the first SPS, where {@code data.position()} is interpreted
* as the length of the buffer.
* <p>
* When the method returns, {@code data.position()} will contain the new length of the buffer. If
* the buffer is not empty it is guaranteed to start with an SPS.
*
* <p>When the method returns, {@code data.position()} will contain the new length of the buffer.
* If the buffer is not empty it is guaranteed to start with an SPS.
*
* @param data Buffer containing start code delimited NAL units.
*/
......@@ -225,9 +222,9 @@ public final class NalUnitUtil {
*/
public static boolean isNalUnitSei(@Nullable String mimeType, byte nalUnitHeaderFirstByte) {
return (MimeTypes.VIDEO_H264.equals(mimeType)
&& (nalUnitHeaderFirstByte & 0x1F) == H264_NAL_UNIT_TYPE_SEI)
&& (nalUnitHeaderFirstByte & 0x1F) == H264_NAL_UNIT_TYPE_SEI)
|| (MimeTypes.VIDEO_H265.equals(mimeType)
&& ((nalUnitHeaderFirstByte & 0x7E) >> 1) == H265_NAL_UNIT_TYPE_PREFIX_SEI);
&& ((nalUnitHeaderFirstByte & 0x7E) >> 1) == H265_NAL_UNIT_TYPE_PREFIX_SEI);
}
/**
......@@ -273,9 +270,16 @@ public final class NalUnitUtil {
int chromaFormatIdc = 1; // Default is 4:2:0
boolean separateColorPlaneFlag = false;
if (profileIdc == 100 || profileIdc == 110 || profileIdc == 122 || profileIdc == 244
|| profileIdc == 44 || profileIdc == 83 || profileIdc == 86 || profileIdc == 118
|| profileIdc == 128 || profileIdc == 138) {
if (profileIdc == 100
|| profileIdc == 110
|| profileIdc == 122
|| profileIdc == 244
|| profileIdc == 44
|| profileIdc == 83
|| profileIdc == 86
|| profileIdc == 118
|| profileIdc == 128
|| profileIdc == 138) {
chromaFormatIdc = data.readUnsignedExpGolombCodedInt();
if (chromaFormatIdc == 3) {
separateColorPlaneFlag = data.readBit();
......@@ -403,16 +407,16 @@ public final class NalUnitUtil {
/**
* Finds the first NAL unit in {@code data}.
* <p>
* If {@code prefixFlags} is null then the first three bytes of a NAL unit must be entirely
*
* <p>If {@code prefixFlags} is null then the first three bytes of a NAL unit must be entirely
* contained within the part of the array being searched in order for it to be found.
* <p>
* When {@code prefixFlags} is non-null, this method supports finding NAL units whose first four
* bytes span {@code data} arrays passed to successive calls. To use this feature, pass the same
* {@code prefixFlags} parameter to successive calls. State maintained in this parameter enables
* the detection of such NAL units. Note that when using this feature, the return value may be 3,
* 2 or 1 less than {@code startOffset}, to indicate a NAL unit starting 3, 2 or 1 bytes before
* the first byte in the current array.
*
* <p>When {@code prefixFlags} is non-null, this method supports finding NAL units whose first
* four bytes span {@code data} arrays passed to successive calls. To use this feature, pass the
* same {@code prefixFlags} parameter to successive calls. State maintained in this parameter
* enables the detection of such NAL units. Note that when using this feature, the return value
* may be 3, 2 or 1 less than {@code startOffset}, to indicate a NAL unit starting 3, 2 or 1 bytes
* before the first byte in the current array.
*
* @param data The data to search.
* @param startOffset The offset (inclusive) in the data to start the search.
......@@ -422,8 +426,8 @@ public final class NalUnitUtil {
* must be at least 3 elements long.
* @return The offset of the NAL unit, or {@code endOffset} if a NAL unit was not found.
*/
public static int findNalUnit(byte[] data, int startOffset, int endOffset,
boolean[] prefixFlags) {
public static int findNalUnit(
byte[] data, int startOffset, int endOffset, boolean[] prefixFlags) {
int length = endOffset - startOffset;
Assertions.checkState(length >= 0);
......@@ -515,5 +519,4 @@ public final class NalUnitUtil {
private NalUnitUtil() {
// Prevent instantiation.
}
}
......@@ -89,16 +89,12 @@ public final class ParsableBitArray {
byteLimit = limit;
}
/**
* Returns the number of bits yet to be read.
*/
/** Returns the number of bits yet to be read. */
public int bitsLeft() {
return (byteLimit - byteOffset) * 8 - bitOffset;
}
/**
* Returns the current bit offset.
*/
/** Returns the current bit offset. */
public int getPosition() {
return byteOffset * 8 + bitOffset;
}
......@@ -124,9 +120,7 @@ public final class ParsableBitArray {
assertValidOffset();
}
/**
* Skips a single bit.
*/
/** Skips a single bit. */
public void skipBit() {
if (++bitOffset == 8) {
bitOffset = 0;
......@@ -344,8 +338,7 @@ public final class ParsableBitArray {
private void assertValidOffset() {
// It is fine for position to be at the end of the array, but no further.
Assertions.checkState(byteOffset >= 0
&& (byteOffset < byteLimit || (byteOffset == byteLimit && bitOffset == 0)));
Assertions.checkState(
byteOffset >= 0 && (byteOffset < byteLimit || (byteOffset == byteLimit && bitOffset == 0)));
}
}
......@@ -120,9 +120,7 @@ public final class ParsableByteArray {
return limit - position;
}
/**
* Returns the limit.
*/
/** Returns the limit. */
public int limit() {
return limit;
}
......@@ -137,9 +135,7 @@ public final class ParsableByteArray {
this.limit = limit;
}
/**
* Returns the current offset in the array, in bytes.
*/
/** Returns the current offset in the array, in bytes. */
public int getPosition() {
return position;
}
......@@ -186,8 +182,8 @@ public final class ParsableByteArray {
}
/**
* Reads the next {@code length} bytes into {@code bitArray}, and resets the position of
* {@code bitArray} to zero.
* Reads the next {@code length} bytes into {@code bitArray}, and resets the position of {@code
* bitArray} to zero.
*
* @param bitArray The {@link ParsableBitArray} into which the bytes should be read.
* @param length The number of bytes to write.
......@@ -222,97 +218,70 @@ public final class ParsableByteArray {
position += length;
}
/**
* Peeks at the next byte as an unsigned value.
*/
/** Peeks at the next byte as an unsigned value. */
public int peekUnsignedByte() {
return (data[position] & 0xFF);
}
/**
* Peeks at the next char.
*/
/** Peeks at the next char. */
public char peekChar() {
return (char) ((data[position] & 0xFF) << 8
| (data[position + 1] & 0xFF));
return (char) ((data[position] & 0xFF) << 8 | (data[position + 1] & 0xFF));
}
/**
* Reads the next byte as an unsigned value.
*/
/** Reads the next byte as an unsigned value. */
public int readUnsignedByte() {
return (data[position++] & 0xFF);
}
/**
* Reads the next two bytes as an unsigned value.
*/
/** Reads the next two bytes as an unsigned value. */
public int readUnsignedShort() {
return (data[position++] & 0xFF) << 8
| (data[position++] & 0xFF);
return (data[position++] & 0xFF) << 8 | (data[position++] & 0xFF);
}
/**
* Reads the next two bytes as an unsigned value.
*/
/** Reads the next two bytes as an unsigned value. */
public int readLittleEndianUnsignedShort() {
return (data[position++] & 0xFF) | (data[position++] & 0xFF) << 8;
}
/**
* Reads the next two bytes as a signed value.
*/
/** Reads the next two bytes as a signed value. */
public short readShort() {
return (short) ((data[position++] & 0xFF) << 8
| (data[position++] & 0xFF));
return (short) ((data[position++] & 0xFF) << 8 | (data[position++] & 0xFF));
}
/**
* Reads the next two bytes as a signed value.
*/
/** Reads the next two bytes as a signed value. */
public short readLittleEndianShort() {
return (short) ((data[position++] & 0xFF) | (data[position++] & 0xFF) << 8);
}
/**
* Reads the next three bytes as an unsigned value.
*/
/** Reads the next three bytes as an unsigned value. */
public int readUnsignedInt24() {
return (data[position++] & 0xFF) << 16
| (data[position++] & 0xFF) << 8
| (data[position++] & 0xFF);
}
/**
* Reads the next three bytes as a signed value.
*/
/** Reads the next three bytes as a signed value. */
public int readInt24() {
return ((data[position++] & 0xFF) << 24) >> 8
| (data[position++] & 0xFF) << 8
| (data[position++] & 0xFF);
}
/**
* Reads the next three bytes as a signed value in little endian order.
*/
/** Reads the next three bytes as a signed value in little endian order. */
public int readLittleEndianInt24() {
return (data[position++] & 0xFF)
| (data[position++] & 0xFF) << 8
| (data[position++] & 0xFF) << 16;
}
/**
* Reads the next three bytes as an unsigned value in little endian order.
*/
/** Reads the next three bytes as an unsigned value in little endian order. */
public int readLittleEndianUnsignedInt24() {
return (data[position++] & 0xFF)
| (data[position++] & 0xFF) << 8
| (data[position++] & 0xFF) << 16;
}
/**
* Reads the next four bytes as an unsigned value.
*/
/** Reads the next four bytes as an unsigned value. */
public long readUnsignedInt() {
return (data[position++] & 0xFFL) << 24
| (data[position++] & 0xFFL) << 16
......@@ -320,9 +289,7 @@ public final class ParsableByteArray {
| (data[position++] & 0xFFL);
}
/**
* Reads the next four bytes as an unsigned value in little endian order.
*/
/** Reads the next four bytes as an unsigned value in little endian order. */
public long readLittleEndianUnsignedInt() {
return (data[position++] & 0xFFL)
| (data[position++] & 0xFFL) << 8
......@@ -330,9 +297,7 @@ public final class ParsableByteArray {
| (data[position++] & 0xFFL) << 24;
}
/**
* Reads the next four bytes as a signed value
*/
/** Reads the next four bytes as a signed value */
public int readInt() {
return (data[position++] & 0xFF) << 24
| (data[position++] & 0xFF) << 16
......@@ -340,9 +305,7 @@ public final class ParsableByteArray {
| (data[position++] & 0xFF);
}
/**
* Reads the next four bytes as a signed value in little endian order.
*/
/** Reads the next four bytes as a signed value in little endian order. */
public int readLittleEndianInt() {
return (data[position++] & 0xFF)
| (data[position++] & 0xFF) << 8
......@@ -350,9 +313,7 @@ public final class ParsableByteArray {
| (data[position++] & 0xFF) << 24;
}
/**
* Reads the next eight bytes as a signed value.
*/
/** Reads the next eight bytes as a signed value. */
public long readLong() {
return (data[position++] & 0xFFL) << 56
| (data[position++] & 0xFFL) << 48
......@@ -364,9 +325,7 @@ public final class ParsableByteArray {
| (data[position++] & 0xFFL);
}
/**
* Reads the next eight bytes as a signed value in little endian order.
*/
/** Reads the next eight bytes as a signed value in little endian order. */
public long readLittleEndianLong() {
return (data[position++] & 0xFFL)
| (data[position++] & 0xFFL) << 8
......@@ -378,20 +337,17 @@ public final class ParsableByteArray {
| (data[position++] & 0xFFL) << 56;
}
/**
* Reads the next four bytes, returning the integer portion of the fixed point 16.16 integer.
*/
/** Reads the next four bytes, returning the integer portion of the fixed point 16.16 integer. */
public int readUnsignedFixedPoint1616() {
int result = (data[position++] & 0xFF) << 8
| (data[position++] & 0xFF);
int result = (data[position++] & 0xFF) << 8 | (data[position++] & 0xFF);
position += 2; // Skip the non-integer portion.
return result;
}
/**
* Reads a Synchsafe integer.
* <p>
* Synchsafe integers keep the highest bit of every byte zeroed. A 32 bit synchsafe integer can
*
* <p>Synchsafe integers keep the highest bit of every byte zeroed. A 32 bit synchsafe integer can
* store 28 bits of information.
*
* @return The parsed value.
......@@ -444,16 +400,12 @@ public final class ParsableByteArray {
return result;
}
/**
* Reads the next four bytes as a 32-bit floating point value.
*/
/** Reads the next four bytes as a 32-bit floating point value. */
public float readFloat() {
return Float.intBitsToFloat(readInt());
}
/**
* Reads the next eight bytes as a 64-bit floating point value.
*/
/** Reads the next eight bytes as a 64-bit floating point value. */
public double readDouble() {
return Double.longBitsToDouble(readLong());
}
......@@ -555,8 +507,10 @@ public final class ParsableByteArray {
while (lineLimit < limit && !Util.isLinebreak(data[lineLimit])) {
lineLimit++;
}
if (lineLimit - position >= 3 && data[position] == (byte) 0xEF
&& data[position + 1] == (byte) 0xBB && data[position + 2] == (byte) 0xBF) {
if (lineLimit - position >= 3
&& data[position] == (byte) 0xEF
&& data[position + 1] == (byte) 0xBB
&& data[position + 2] == (byte) 0xBF) {
// There's a UTF-8 byte order mark at the start of the line. Discard it.
position += 3;
}
......@@ -611,5 +565,4 @@ public final class ParsableByteArray {
position += length;
return value;
}
}
......@@ -55,9 +55,7 @@ public final class ParsableNalUnitBitArray {
assertValidOffset();
}
/**
* Skips a single bit.
*/
/** Skips a single bit. */
public void skipBit() {
if (++bitOffset == 8) {
bitOffset = 0;
......@@ -198,14 +196,16 @@ public final class ParsableNalUnitBitArray {
}
private boolean shouldSkipByte(int offset) {
return 2 <= offset && offset < byteLimit && data[offset] == (byte) 0x03
&& data[offset - 2] == (byte) 0x00 && data[offset - 1] == (byte) 0x00;
return 2 <= offset
&& offset < byteLimit
&& data[offset] == (byte) 0x03
&& data[offset - 2] == (byte) 0x00
&& data[offset - 1] == (byte) 0x00;
}
private void assertValidOffset() {
// It is fine for position to be at the end of the array, but no further.
Assertions.checkState(byteOffset >= 0
&& (byteOffset < byteLimit || (byteOffset == byteLimit && bitOffset == 0)));
Assertions.checkState(
byteOffset >= 0 && (byteOffset < byteLimit || (byteOffset == byteLimit && bitOffset == 0)));
}
}
......@@ -35,13 +35,9 @@ public final class RepeatModeUtil {
flag = true,
value = {REPEAT_TOGGLE_MODE_NONE, REPEAT_TOGGLE_MODE_ONE, REPEAT_TOGGLE_MODE_ALL})
public @interface RepeatToggleModes {}
/**
* All repeat mode buttons disabled.
*/
/** All repeat mode buttons disabled. */
public static final int REPEAT_TOGGLE_MODE_NONE = 0;
/**
* "Repeat One" button enabled.
*/
/** "Repeat One" button enabled. */
public static final int REPEAT_TOGGLE_MODE_ONE = 1;
/** "Repeat All" button enabled. */
public static final int REPEAT_TOGGLE_MODE_ALL = 1 << 1; // 2
......@@ -57,8 +53,8 @@ public final class RepeatModeUtil {
* @param enabledModes Bitmask of enabled modes.
* @return The next repeat mode.
*/
public static @Player.RepeatMode int getNextRepeatMode(@Player.RepeatMode int currentMode,
int enabledModes) {
public static @Player.RepeatMode int getNextRepeatMode(
@Player.RepeatMode int currentMode, int enabledModes) {
for (int offset = 1; offset <= 2; offset++) {
@Player.RepeatMode int proposedMode = (currentMode + offset) % 3;
if (isRepeatModeEnabled(proposedMode, enabledModes)) {
......
......@@ -56,5 +56,4 @@ public final class TraceUtil {
private static void endSectionV18() {
android.os.Trace.endSection();
}
}
......@@ -126,23 +126,23 @@ public final class Util {
*/
public static final String MODEL = Build.MODEL;
/**
* A concise description of the device that it can be useful to log for debugging purposes.
*/
public static final String DEVICE_DEBUG_INFO = DEVICE + ", " + MODEL + ", " + MANUFACTURER + ", "
+ SDK_INT;
/** A concise description of the device that it can be useful to log for debugging purposes. */
public static final String DEVICE_DEBUG_INFO =
DEVICE + ", " + MODEL + ", " + MANUFACTURER + ", " + SDK_INT;
/** An empty byte array. */
public static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
private static final String TAG = "Util";
private static final Pattern XS_DATE_TIME_PATTERN = Pattern.compile(
"(\\d\\d\\d\\d)\\-(\\d\\d)\\-(\\d\\d)[Tt]"
+ "(\\d\\d):(\\d\\d):(\\d\\d)([\\.,](\\d+))?"
+ "([Zz]|((\\+|\\-)(\\d?\\d):?(\\d\\d)))?");
private static final Pattern XS_DATE_TIME_PATTERN =
Pattern.compile(
"(\\d\\d\\d\\d)\\-(\\d\\d)\\-(\\d\\d)[Tt]"
+ "(\\d\\d):(\\d\\d):(\\d\\d)([\\.,](\\d+))?"
+ "([Zz]|((\\+|\\-)(\\d?\\d):?(\\d\\d)))?");
private static final Pattern XS_DURATION_PATTERN =
Pattern.compile("^(-)?P(([0-9]*)Y)?(([0-9]*)M)?(([0-9]*)D)?"
+ "(T(([0-9]*)H)?(([0-9]*)M)?(([0-9.]*)S)?)?$");
Pattern.compile(
"^(-)?P(([0-9]*)Y)?(([0-9]*)M)?(([0-9]*)D)?"
+ "(T(([0-9]*)H)?(([0-9]*)M)?(([0-9.]*)S)?)?$");
private static final Pattern ESCAPED_CHARACTER_PATTERN = Pattern.compile("%([A-Fa-f0-9]{2})");
// https://docs.microsoft.com/en-us/azure/media-services/previous/media-services-deliver-content-overview#URLs.
......@@ -930,8 +930,8 @@ public final class Util {
/**
* Returns the index of the largest element in {@code array} that is less than (or optionally
* equal to) a specified {@code value}.
* <p>
* The search is performed using a binary search algorithm, so the array must be sorted. If the
*
* <p>The search is performed using a binary search algorithm, so the array must be sorted. If the
* array contains multiple elements equal to {@code value} and {@code inclusive} is true, the
* index of the first one will be returned.
*
......@@ -945,8 +945,8 @@ public final class Util {
* @return The index of the largest element in {@code array} that is less than (or optionally
* equal to) {@code value}.
*/
public static int binarySearchFloor(long[] array, long value, boolean inclusive,
boolean stayInBounds) {
public static int binarySearchFloor(
long[] array, long value, boolean inclusive, boolean stayInBounds) {
int index = Arrays.binarySearch(array, value);
if (index < 0) {
index = -(index + 2);
......@@ -1226,8 +1226,8 @@ public final class Util {
} else if (matcher.group(9).equalsIgnoreCase("Z")) {
timezoneShift = 0;
} else {
timezoneShift = ((Integer.parseInt(matcher.group(12)) * 60
+ Integer.parseInt(matcher.group(13))));
timezoneShift =
((Integer.parseInt(matcher.group(12)) * 60 + Integer.parseInt(matcher.group(13))));
if ("-".equals(matcher.group(11))) {
timezoneShift *= -1;
}
......@@ -1237,12 +1237,13 @@ public final class Util {
dateTime.clear();
// Note: The month value is 0-based, hence the -1 on group(2)
dateTime.set(Integer.parseInt(matcher.group(1)),
Integer.parseInt(matcher.group(2)) - 1,
Integer.parseInt(matcher.group(3)),
Integer.parseInt(matcher.group(4)),
Integer.parseInt(matcher.group(5)),
Integer.parseInt(matcher.group(6)));
dateTime.set(
Integer.parseInt(matcher.group(1)),
Integer.parseInt(matcher.group(2)) - 1,
Integer.parseInt(matcher.group(3)),
Integer.parseInt(matcher.group(4)),
Integer.parseInt(matcher.group(5)),
Integer.parseInt(matcher.group(6)));
if (!TextUtils.isEmpty(matcher.group(8))) {
final BigDecimal bd = new BigDecimal("0." + matcher.group(8));
// we care only for milliseconds, so movePointRight(3)
......@@ -1259,9 +1260,9 @@ public final class Util {
/**
* Scales a large timestamp.
* <p>
* Logically, scaling consists of a multiplication followed by a division. The actual operations
* performed are designed to minimize the probability of overflow.
*
* <p>Logically, scaling consists of a multiplication followed by a division. The actual
* operations performed are designed to minimize the probability of overflow.
*
* @param timestamp The timestamp to scale.
* @param multiplier The multiplier.
......@@ -1431,8 +1432,10 @@ public final class Util {
byte[] data = new byte[hexString.length() / 2];
for (int i = 0; i < data.length; i++) {
int stringOffset = i * 2;
data[i] = (byte) ((Character.digit(hexString.charAt(stringOffset), 16) << 4)
+ Character.digit(hexString.charAt(stringOffset + 1), 16));
data[i] =
(byte)
((Character.digit(hexString.charAt(stringOffset), 16) << 4)
+ Character.digit(hexString.charAt(stringOffset + 1), 16));
}
return data;
}
......@@ -1486,8 +1489,13 @@ public final class Util {
} catch (NameNotFoundException e) {
versionName = "?";
}
return applicationName + "/" + versionName + " (Linux;Android " + Build.VERSION.RELEASE
+ ") " + ExoPlayerLibraryInfo.VERSION_SLASHY;
return applicationName
+ "/"
+ versionName
+ " (Linux;Android "
+ Build.VERSION.RELEASE
+ ") "
+ ExoPlayerLibraryInfo.VERSION_SLASHY;
}
/** Returns the number of codec strings in {@code codecs} whose type matches {@code trackType}. */
......@@ -1676,9 +1684,7 @@ public final class Util {
}
}
/**
* Returns the {@link C.AudioUsage} corresponding to the specified {@link C.StreamType}.
*/
/** Returns the {@link C.AudioUsage} corresponding to the specified {@link C.StreamType}. */
@C.AudioUsage
public static int getAudioUsageForStreamType(@C.StreamType int streamType) {
switch (streamType) {
......@@ -1700,9 +1706,7 @@ public final class Util {
}
}
/**
* Returns the {@link C.AudioContentType} corresponding to the specified {@link C.StreamType}.
*/
/** Returns the {@link C.AudioContentType} corresponding to the specified {@link C.StreamType}. */
@C.AudioContentType
public static int getAudioContentTypeForStreamType(@C.StreamType int streamType) {
switch (streamType) {
......@@ -1720,9 +1724,7 @@ public final class Util {
}
}
/**
* Returns the {@link C.StreamType} corresponding to the specified {@link C.AudioUsage}.
*/
/** Returns the {@link C.StreamType} corresponding to the specified {@link C.AudioUsage}. */
@C.StreamType
public static int getStreamTypeForAudioUsage(@C.AudioUsage int usage) {
switch (usage) {
......@@ -1932,10 +1934,10 @@ public final class Util {
* Escapes a string so that it's safe for use as a file or directory name on at least FAT32
* filesystems. FAT32 is the most restrictive of all filesystems still commonly used today.
*
* <p>For simplicity, this only handles common characters known to be illegal on FAT32:
* &lt;, &gt;, :, ", /, \, |, ?, and *. % is also escaped since it is used as the escape
* character. Escaping is performed in a consistent way so that no collisions occur and
* {@link #unescapeFileName(String)} can be used to retrieve the original file name.
* <p>For simplicity, this only handles common characters known to be illegal on FAT32: &lt;,
* &gt;, :, ", /, \, |, ?, and *. % is also escaped since it is used as the escape character.
* Escaping is performed in a consistent way so that no collisions occur and {@link
* #unescapeFileName(String)} can be used to retrieve the original file name.
*
* @param fileName File name to be escaped.
* @return An escaped file name which will be safe for use on at least FAT32 filesystems.
......@@ -2034,8 +2036,8 @@ public final class Util {
}
/**
* A hacky method that always throws {@code t} even if {@code t} is a checked exception,
* and is not declared to be thrown.
* A hacky method that always throws {@code t} even if {@code t} is a checked exception, and is
* not declared to be thrown.
*/
public static void sneakyThrow(Throwable t) {
sneakyThrowInternal(t);
......@@ -2082,8 +2084,9 @@ public final class Util {
*/
public static int crc32(byte[] bytes, int start, int end, int initialValue) {
for (int i = start; i < end; i++) {
initialValue = (initialValue << 8)
^ CRC32_BYTES_MSBF[((initialValue >>> 24) ^ (bytes[i] & 0xFF)) & 0xFF];
initialValue =
(initialValue << 8)
^ CRC32_BYTES_MSBF[((initialValue >>> 24) ^ (bytes[i] & 0xFF)) & 0xFF];
}
return initialValue;
}
......
......@@ -66,8 +66,9 @@ public final class AvcConfig {
@Nullable String codecs = null;
if (numSequenceParameterSets > 0) {
byte[] sps = initializationData.get(0);
SpsData spsData = NalUnitUtil.parseSpsNalUnit(initializationData.get(0),
nalUnitLengthFieldLength, sps.length);
SpsData spsData =
NalUnitUtil.parseSpsNalUnit(
initializationData.get(0), nalUnitLengthFieldLength, sps.length);
width = spsData.width;
height = spsData.height;
pixelWidthAspectRatio = spsData.pixelWidthAspectRatio;
......@@ -109,5 +110,4 @@ public final class AvcConfig {
data.skipBytes(length);
return CodecSpecificDataUtil.buildNalUnit(data.getData(), offset, length);
}
}
......@@ -30,15 +30,13 @@ public final class ColorInfo implements Parcelable {
* The color space of the video. Valid values are {@link C#COLOR_SPACE_BT601}, {@link
* C#COLOR_SPACE_BT709}, {@link C#COLOR_SPACE_BT2020} or {@link Format#NO_VALUE} if unknown.
*/
@C.ColorSpace
public final int colorSpace;
@C.ColorSpace public final int colorSpace;
/**
* The color range of the video. Valid values are {@link C#COLOR_RANGE_LIMITED}, {@link
* C#COLOR_RANGE_FULL} or {@link Format#NO_VALUE} if unknown.
*/
@C.ColorRange
public final int colorRange;
@C.ColorRange public final int colorRange;
/**
* The color transfer characteristics of the video. Valid values are {@link C#COLOR_TRANSFER_HLG},
......@@ -99,8 +97,15 @@ public final class ColorInfo implements Parcelable {
@Override
public String toString() {
return "ColorInfo(" + colorSpace + ", " + colorRange + ", " + colorTransfer
+ ", " + (hdrStaticInfo != null) + ")";
return "ColorInfo("
+ colorSpace
+ ", "
+ colorRange
+ ", "
+ colorTransfer
+ ", "
+ (hdrStaticInfo != null)
+ ")";
}
@Override
......
......@@ -64,7 +64,11 @@ public final class HevcConfig {
int numberOfNalUnits = data.readUnsignedShort();
for (int j = 0; j < numberOfNalUnits; j++) {
int nalUnitLength = data.readUnsignedShort();
System.arraycopy(NalUnitUtil.NAL_START_CODE, 0, buffer, bufferPosition,
System.arraycopy(
NalUnitUtil.NAL_START_CODE,
0,
buffer,
bufferPosition,
NalUnitUtil.NAL_START_CODE.length);
bufferPosition += NalUnitUtil.NAL_START_CODE.length;
System.arraycopy(
......@@ -116,5 +120,4 @@ public final class HevcConfig {
this.nalUnitLengthFieldLength = nalUnitLengthFieldLength;
this.codecs = codecs;
}
}
......@@ -50,7 +50,7 @@ public final class EventMessageDecoderTest {
assertThat(eventMessage.value).isEqualTo("123");
assertThat(eventMessage.durationMs).isEqualTo(3000);
assertThat(eventMessage.id).isEqualTo(1000403);
assertThat(eventMessage.messageData).isEqualTo(new byte[]{0, 1, 2, 3, 4});
assertThat(eventMessage.messageData).isEqualTo(new byte[] {0, 1, 2, 3, 4});
}
@Test
......
......@@ -39,5 +39,4 @@ public final class EventMessageTest {
// Assert equals.
assertThat(fromParcelEventMessage).isEqualTo(eventMessage);
}
}
......@@ -28,10 +28,11 @@ public final class ChapterFrameTest {
@Test
public void parcelable() {
Id3Frame[] subFrames = new Id3Frame[] {
new TextInformationFrame("TIT2", null, "title"),
new UrlLinkFrame("WXXX", "description", "url")
};
Id3Frame[] subFrames =
new Id3Frame[] {
new TextInformationFrame("TIT2", null, "title"),
new UrlLinkFrame("WXXX", "description", "url")
};
ChapterFrame chapterFrameToParcel = new ChapterFrame("id", 0, 1, 2, 3, subFrames);
Parcel parcel = Parcel.obtain();
......@@ -43,5 +44,4 @@ public final class ChapterFrameTest {
parcel.recycle();
}
}
......@@ -29,12 +29,13 @@ public final class ChapterTocFrameTest {
@Test
public void parcelable() {
String[] children = new String[] {"child0", "child1"};
Id3Frame[] subFrames = new Id3Frame[] {
new TextInformationFrame("TIT2", null, "title"),
new UrlLinkFrame("WXXX", "description", "url")
};
ChapterTocFrame chapterTocFrameToParcel = new ChapterTocFrame("id", false, true, children,
subFrames);
Id3Frame[] subFrames =
new Id3Frame[] {
new TextInformationFrame("TIT2", null, "title"),
new UrlLinkFrame("WXXX", "description", "url")
};
ChapterTocFrame chapterTocFrameToParcel =
new ChapterTocFrame("id", false, true, children, subFrames);
Parcel parcel = Parcel.obtain();
chapterTocFrameToParcel.writeToParcel(parcel, 0);
......@@ -45,5 +46,4 @@ public final class ChapterTocFrameTest {
parcel.recycle();
}
}
......@@ -38,8 +38,13 @@ public final class Id3DecoderTest {
@Test
public void decodeTxxxFrame() {
byte[] rawId3 = buildSingleFrameTag("TXXX", new byte[] {3, 0, 109, 100, 105, 97, 108, 111, 103,
95, 86, 73, 78, 68, 73, 67, 79, 49, 53, 50, 55, 54, 54, 52, 95, 115, 116, 97, 114, 116, 0});
byte[] rawId3 =
buildSingleFrameTag(
"TXXX",
new byte[] {
3, 0, 109, 100, 105, 97, 108, 111, 103, 95, 86, 73, 78, 68, 73, 67, 79, 49, 53, 50,
55, 54, 54, 52, 95, 115, 116, 97, 114, 116, 0
});
Id3Decoder decoder = new Id3Decoder();
Metadata metadata = decoder.decode(rawId3, rawId3.length);
assertThat(metadata.length()).isEqualTo(1);
......@@ -65,8 +70,9 @@ public final class Id3DecoderTest {
@Test
public void decodeTextInformationFrame() {
byte[] rawId3 = buildSingleFrameTag("TIT2", new byte[] {3, 72, 101, 108, 108, 111, 32, 87, 111,
114, 108, 100, 0});
byte[] rawId3 =
buildSingleFrameTag(
"TIT2", new byte[] {3, 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 0});
Id3Decoder decoder = new Id3Decoder();
Metadata metadata = decoder.decode(rawId3, rawId3.length);
assertThat(metadata.length()).isEqualTo(1);
......@@ -92,9 +98,41 @@ public final class Id3DecoderTest {
@Test
public void decodeWxxxFrame() {
byte[] rawId3 = buildSingleFrameTag("WXXX", new byte[] {ID3_TEXT_ENCODING_UTF_8, 116, 101, 115,
116, 0, 104, 116, 116, 112, 115, 58, 47, 47, 116, 101, 115, 116, 46, 99, 111, 109, 47, 97,
98, 99, 63, 100, 101, 102});
byte[] rawId3 =
buildSingleFrameTag(
"WXXX",
new byte[] {
ID3_TEXT_ENCODING_UTF_8,
116,
101,
115,
116,
0,
104,
116,
116,
112,
115,
58,
47,
47,
116,
101,
115,
116,
46,
99,
111,
109,
47,
97,
98,
99,
63,
100,
101,
102
});
Id3Decoder decoder = new Id3Decoder();
Metadata metadata = decoder.decode(rawId3, rawId3.length);
assertThat(metadata.length()).isEqualTo(1);
......@@ -120,8 +158,13 @@ public final class Id3DecoderTest {
@Test
public void decodeUrlLinkFrame() {
byte[] rawId3 = buildSingleFrameTag("WCOM", new byte[] {104, 116, 116, 112, 115, 58, 47, 47,
116, 101, 115, 116, 46, 99, 111, 109, 47, 97, 98, 99, 63, 100, 101, 102});
byte[] rawId3 =
buildSingleFrameTag(
"WCOM",
new byte[] {
104, 116, 116, 112, 115, 58, 47, 47, 116, 101, 115, 116, 46, 99, 111, 109, 47, 97, 98,
99, 63, 100, 101, 102
});
Id3Decoder decoder = new Id3Decoder();
Metadata metadata = decoder.decode(rawId3, rawId3.length);
assertThat(metadata.length()).isEqualTo(1);
......@@ -148,7 +191,7 @@ public final class Id3DecoderTest {
assertThat(metadata.length()).isEqualTo(1);
PrivFrame privFrame = (PrivFrame) metadata.get(0);
assertThat(privFrame.owner).isEqualTo("test");
assertThat(privFrame.privateData).isEqualTo(new byte[]{1, 2, 3, 4});
assertThat(privFrame.privateData).isEqualTo(new byte[] {1, 2, 3, 4});
// Test empty.
rawId3 = buildSingleFrameTag("PRIV", new byte[0]);
......@@ -161,9 +204,13 @@ public final class Id3DecoderTest {
@Test
public void decodeApicFrame() {
byte[] rawId3 = buildSingleFrameTag("APIC", new byte[] {3, 105, 109, 97, 103, 101, 47, 106, 112,
101, 103, 0, 16, 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 0});
byte[] rawId3 =
buildSingleFrameTag(
"APIC",
new byte[] {
3, 105, 109, 97, 103, 101, 47, 106, 112, 101, 103, 0, 16, 72, 101, 108, 108, 111, 32,
87, 111, 114, 108, 100, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0
});
Id3Decoder decoder = new Id3Decoder();
Metadata metadata = decoder.decode(rawId3, rawId3.length);
assertThat(metadata.length()).isEqualTo(1);
......@@ -172,13 +219,37 @@ public final class Id3DecoderTest {
assertThat(apicFrame.pictureType).isEqualTo(16);
assertThat(apicFrame.description).isEqualTo("Hello World");
assertThat(apicFrame.pictureData).hasLength(10);
assertThat(apicFrame.pictureData).isEqualTo(new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 0});
assertThat(apicFrame.pictureData).isEqualTo(new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 0});
}
@Test
public void decodeCommentFrame() {
byte[] rawId3 = buildSingleFrameTag("COMM", new byte[] {ID3_TEXT_ENCODING_UTF_8, 101, 110, 103,
100, 101, 115, 99, 114, 105, 112, 116, 105, 111, 110, 0, 116, 101, 120, 116, 0});
byte[] rawId3 =
buildSingleFrameTag(
"COMM",
new byte[] {
ID3_TEXT_ENCODING_UTF_8,
101,
110,
103,
100,
101,
115,
99,
114,
105,
112,
116,
105,
111,
110,
0,
116,
101,
120,
116,
0
});
Id3Decoder decoder = new Id3Decoder();
Metadata metadata = decoder.decode(rawId3, rawId3.length);
assertThat(metadata.length()).isEqualTo(1);
......
......@@ -45,5 +45,4 @@ public final class MlltFrameTest {
parcel.recycle();
}
}
......@@ -29,9 +29,10 @@ public final class NalUnitUtilTest {
private static final int TEST_PARTIAL_NAL_POSITION = 4;
private static final int TEST_NAL_POSITION = 10;
private static final byte[] SPS_TEST_DATA = createByteArray(0x00, 0x00, 0x01, 0x67, 0x4D, 0x40,
0x16, 0xEC, 0xA0, 0x50, 0x17, 0xFC, 0xB8, 0x08, 0x80, 0x00, 0x00, 0x03, 0x00, 0x80, 0x00,
0x00, 0x0F, 0x47, 0x8B, 0x16, 0xCB);
private static final byte[] SPS_TEST_DATA =
createByteArray(
0x00, 0x00, 0x01, 0x67, 0x4D, 0x40, 0x16, 0xEC, 0xA0, 0x50, 0x17, 0xFC, 0xB8, 0x08, 0x80,
0x00, 0x00, 0x03, 0x00, 0x80, 0x00, 0x00, 0x0F, 0x47, 0x8B, 0x16, 0xCB);
private static final int SPS_TEST_DATA_OFFSET = 3;
@Test
......@@ -121,8 +122,8 @@ public final class NalUnitUtilTest {
@Test
public void parseSpsNalUnit() {
NalUnitUtil.SpsData data = NalUnitUtil.parseSpsNalUnit(SPS_TEST_DATA, SPS_TEST_DATA_OFFSET,
SPS_TEST_DATA.length);
NalUnitUtil.SpsData data =
NalUnitUtil.parseSpsNalUnit(SPS_TEST_DATA, SPS_TEST_DATA_OFFSET, SPS_TEST_DATA.length);
assertThat(data.width).isEqualTo(640);
assertThat(data.height).isEqualTo(360);
assertThat(data.deltaPicOrderAlwaysZeroFlag).isFalse();
......
......@@ -90,8 +90,11 @@ public final class ContentDataSourceTest {
DataSpec dataSpec = new DataSpec(contentUri, offset, length);
byte[] completeData =
TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), DATA_PATH);
byte[] expectedData = Arrays.copyOfRange(completeData, offset,
length == C.LENGTH_UNSET ? completeData.length : offset + length);
byte[] expectedData =
Arrays.copyOfRange(
completeData,
offset,
length == C.LENGTH_UNSET ? completeData.length : offset + length);
TestUtil.assertDataSourceContent(dataSource, dataSpec, expectedData, !pipeMode);
} finally {
dataSource.close();
......
......@@ -123,5 +123,4 @@ public final class TestContentProvider extends ContentProvider
private static String getFileName(Uri uri) {
return uri.getPath().replaceFirst("/", "");
}
}
......@@ -45,8 +45,8 @@ public abstract class BaseRenderer implements Renderer, RendererCapabilities {
private boolean throwRendererExceptionIsExecuting;
/**
* @param trackType The track type that the renderer handles. One of the {@link C}
* {@code TRACK_TYPE_*} constants.
* @param trackType The track type that the renderer handles. One of the {@link C} {@code
* TRACK_TYPE_*} constants.
*/
public BaseRenderer(int trackType) {
this.trackType = trackType;
......@@ -253,8 +253,8 @@ public abstract class BaseRenderer implements Renderer, RendererCapabilities {
/**
* Called when the renderer is started.
* <p>
* The default implementation is a no-op.
*
* <p>The default implementation is a no-op.
*
* @throws ExoPlaybackException If an error occurs.
*/
......@@ -273,8 +273,8 @@ public abstract class BaseRenderer implements Renderer, RendererCapabilities {
/**
* Called when the renderer is disabled.
* <p>
* The default implementation is a no-op.
*
* <p>The default implementation is a no-op.
*/
protected void onDisabled() {
// Do nothing.
......@@ -325,9 +325,7 @@ public abstract class BaseRenderer implements Renderer, RendererCapabilities {
return Assertions.checkNotNull(configuration);
}
/**
* Returns the index of the renderer within the player.
*/
/** Returns the index of the renderer within the player. */
protected final int getIndex() {
return index;
}
......
......@@ -22,8 +22,8 @@ import com.google.android.exoplayer2.util.MediaClock;
import com.google.android.exoplayer2.util.StandaloneMediaClock;
/**
* Default {@link MediaClock} which uses a renderer media clock and falls back to a
* {@link StandaloneMediaClock} if necessary.
* Default {@link MediaClock} which uses a renderer media clock and falls back to a {@link
* StandaloneMediaClock} if necessary.
*/
/* package */ final class DefaultMediaClock implements MediaClock {
......@@ -60,17 +60,13 @@ import com.google.android.exoplayer2.util.StandaloneMediaClock;
isUsingStandaloneClock = true;
}
/**
* Starts the standalone fallback clock.
*/
/** Starts the standalone fallback clock. */
public void start() {
standaloneClockIsStarted = true;
standaloneClock.start();
}
/**
* Stops the standalone fallback clock.
*/
/** Stops the standalone fallback clock. */
public void stop() {
standaloneClockIsStarted = false;
standaloneClock.stop();
......
......@@ -61,15 +61,13 @@ public class DefaultRenderersFactory implements RenderersFactory {
@Retention(RetentionPolicy.SOURCE)
@IntDef({EXTENSION_RENDERER_MODE_OFF, EXTENSION_RENDERER_MODE_ON, EXTENSION_RENDERER_MODE_PREFER})
public @interface ExtensionRendererMode {}
/**
* Do not allow use of extension renderers.
*/
/** Do not allow use of extension renderers. */
public static final int EXTENSION_RENDERER_MODE_OFF = 0;
/**
* Allow use of extension renderers. Extension renderers are indexed after core renderers of the
* same type. A {@link TrackSelector} that prefers the first suitable renderer will therefore
* prefer to use a core renderer to an extension renderer in the case that both are able to play
* a given track.
* prefer to use a core renderer to an extension renderer in the case that both are able to play a
* given track.
*/
public static final int EXTENSION_RENDERER_MODE_ON = 1;
/**
......@@ -331,10 +329,18 @@ public class DefaultRenderersFactory implements RenderersFactory {
audioRendererEventListener,
renderersList);
}
buildTextRenderers(context, textRendererOutput, eventHandler.getLooper(),
extensionRendererMode, renderersList);
buildMetadataRenderers(context, metadataRendererOutput, eventHandler.getLooper(),
extensionRendererMode, renderersList);
buildTextRenderers(
context,
textRendererOutput,
eventHandler.getLooper(),
extensionRendererMode,
renderersList);
buildMetadataRenderers(
context,
metadataRendererOutput,
eventHandler.getLooper(),
extensionRendererMode,
renderersList);
buildCameraMotionRenderers(context, extensionRendererMode, renderersList);
buildMiscellaneousRenderers(context, eventHandler, extensionRendererMode, renderersList);
return renderersList.toArray(new Renderer[0]);
......@@ -626,8 +632,11 @@ public class DefaultRenderersFactory implements RenderersFactory {
* @param extensionRendererMode The extension renderer mode.
* @param out An array to which the built renderers should be appended.
*/
protected void buildMiscellaneousRenderers(Context context, Handler eventHandler,
@ExtensionRendererMode int extensionRendererMode, ArrayList<Renderer> out) {
protected void buildMiscellaneousRenderers(
Context context,
Handler eventHandler,
@ExtensionRendererMode int extensionRendererMode,
ArrayList<Renderer> out) {
// Do nothing.
}
......
......@@ -122,8 +122,7 @@ public abstract class NoSampleRenderer implements Renderer, RendererCapabilities
}
@Override
public final void maybeThrowStreamError() throws IOException {
}
public final void maybeThrowStreamError() throws IOException {}
@Override
public final void resetPosition(long positionUs) throws ExoPlaybackException {
......@@ -188,8 +187,8 @@ public abstract class NoSampleRenderer implements Renderer, RendererCapabilities
/**
* Called when the renderer is enabled.
* <p>
* The default implementation is a no-op.
*
* <p>The default implementation is a no-op.
*
* @param joining Whether this renderer is being enabled to join an ongoing playback.
* @throws ExoPlaybackException If an error occurs.
......@@ -200,11 +199,11 @@ public abstract class NoSampleRenderer implements Renderer, RendererCapabilities
/**
* Called when the renderer's offset has been changed.
* <p>
* The default implementation is a no-op.
*
* @param offsetUs The offset that should be subtracted from {@code positionUs} in
* {@link #render(long, long)} to get the playback position with respect to the media.
* <p>The default implementation is a no-op.
*
* @param offsetUs The offset that should be subtracted from {@code positionUs} in {@link
* #render(long, long)} to get the playback position with respect to the media.
* @throws ExoPlaybackException If an error occurs.
*/
protected void onRendererOffsetChanged(long offsetUs) throws ExoPlaybackException {
......@@ -212,11 +211,11 @@ public abstract class NoSampleRenderer implements Renderer, RendererCapabilities
}
/**
* Called when the position is reset. This occurs when the renderer is enabled after
* {@link #onRendererOffsetChanged(long)} has been called, and also when a position
* discontinuity is encountered.
* <p>
* The default implementation is a no-op.
* Called when the position is reset. This occurs when the renderer is enabled after {@link
* #onRendererOffsetChanged(long)} has been called, and also when a position discontinuity is
* encountered.
*
* <p>The default implementation is a no-op.
*
* @param positionUs The new playback position in microseconds.
* @param joining Whether this renderer is being enabled to join an ongoing playback.
......@@ -228,8 +227,8 @@ public abstract class NoSampleRenderer implements Renderer, RendererCapabilities
/**
* Called when the renderer is started.
* <p>
* The default implementation is a no-op.
*
* <p>The default implementation is a no-op.
*
* @throws ExoPlaybackException If an error occurs.
*/
......@@ -248,8 +247,8 @@ public abstract class NoSampleRenderer implements Renderer, RendererCapabilities
/**
* Called when the renderer is disabled.
* <p>
* The default implementation is a no-op.
*
* <p>The default implementation is a no-op.
*/
protected void onDisabled() {
// Do nothing.
......@@ -275,11 +274,8 @@ public abstract class NoSampleRenderer implements Renderer, RendererCapabilities
return configuration;
}
/**
* Returns the index of the renderer within the player.
*/
/** Returns the index of the renderer within the player. */
protected final int getIndex() {
return index;
}
}
......@@ -25,9 +25,7 @@ import com.google.android.exoplayer2.trackselection.TrackSelectorResult;
import com.google.common.collect.ImmutableList;
import java.util.List;
/**
* Information about an ongoing playback.
*/
/** Information about an ongoing playback. */
/* package */ final class PlaybackInfo {
/**
......
......@@ -302,9 +302,9 @@ public interface Renderer extends PlayerMessage.Target {
/**
* Starts the renderer, meaning that calls to {@link #render(long, long)} will cause media to be
* rendered.
* <p>
* This method may be called when the renderer is in the following states:
* {@link #STATE_ENABLED}.
*
* <p>This method may be called when the renderer is in the following states: {@link
* #STATE_ENABLED}.
*
* @throws ExoPlaybackException If an error occurs.
*/
......@@ -332,9 +332,9 @@ public interface Renderer extends PlayerMessage.Target {
/**
* Returns whether the renderer has read the current {@link SampleStream} to the end.
* <p>
* This method may be called when the renderer is in the following states:
* {@link #STATE_ENABLED}, {@link #STATE_STARTED}.
*
* <p>This method may be called when the renderer is in the following states: {@link
* #STATE_ENABLED}, {@link #STATE_STARTED}.
*/
boolean hasReadStreamToEnd();
......@@ -351,9 +351,9 @@ public interface Renderer extends PlayerMessage.Target {
/**
* Signals to the renderer that the current {@link SampleStream} will be the final one supplied
* before it is next disabled or reset.
* <p>
* This method may be called when the renderer is in the following states:
* {@link #STATE_ENABLED}, {@link #STATE_STARTED}.
*
* <p>This method may be called when the renderer is in the following states: {@link
* #STATE_ENABLED}, {@link #STATE_STARTED}.
*/
void setCurrentStreamFinal();
......@@ -366,9 +366,9 @@ public interface Renderer extends PlayerMessage.Target {
/**
* Throws an error that's preventing the renderer from reading from its {@link SampleStream}. Does
* nothing if no such error exists.
* <p>
* This method may be called when the renderer is in the following states:
* {@link #STATE_ENABLED}, {@link #STATE_STARTED}.
*
* <p>This method may be called when the renderer is in the following states: {@link
* #STATE_ENABLED}, {@link #STATE_STARTED}.
*
* @throws IOException An error that's preventing the renderer from making progress or buffering
* more data.
......@@ -377,12 +377,12 @@ public interface Renderer extends PlayerMessage.Target {
/**
* Signals to the renderer that a position discontinuity has occurred.
* <p>
* After a position discontinuity, the renderer's {@link SampleStream} is guaranteed to provide
*
* <p>After a position discontinuity, the renderer's {@link SampleStream} is guaranteed to provide
* samples starting from a key frame.
* <p>
* This method may be called when the renderer is in the following states:
* {@link #STATE_ENABLED}, {@link #STATE_STARTED}.
*
* <p>This method may be called when the renderer is in the following states: {@link
* #STATE_ENABLED}, {@link #STATE_STARTED}.
*
* @param positionUs The new playback position in microseconds.
* @throws ExoPlaybackException If an error occurs handling the reset.
......@@ -433,16 +433,16 @@ public interface Renderer extends PlayerMessage.Target {
/**
* Whether the renderer is able to immediately render media from the current position.
* <p>
* If the renderer is in the {@link #STATE_STARTED} state then returning true indicates that the
* renderer has everything that it needs to continue playback. Returning false indicates that
*
* <p>If the renderer is in the {@link #STATE_STARTED} state then returning true indicates that
* the renderer has everything that it needs to continue playback. Returning false indicates that
* the player should pause until the renderer is ready.
* <p>
* If the renderer is in the {@link #STATE_ENABLED} state then returning true indicates that the
* renderer is ready for playback to be started. Returning false indicates that it is not.
* <p>
* This method may be called when the renderer is in the following states:
* {@link #STATE_ENABLED}, {@link #STATE_STARTED}.
*
* <p>If the renderer is in the {@link #STATE_ENABLED} state then returning true indicates that
* the renderer is ready for playback to be started. Returning false indicates that it is not.
*
* <p>This method may be called when the renderer is in the following states: {@link
* #STATE_ENABLED}, {@link #STATE_STARTED}.
*
* @return Whether the renderer is ready to render media.
*/
......@@ -470,9 +470,9 @@ public interface Renderer extends PlayerMessage.Target {
/**
* Disable the renderer, transitioning it to the {@link #STATE_DISABLED} state.
* <p>
* This method may be called when the renderer is in the following states:
* {@link #STATE_ENABLED}.
*
* <p>This method may be called when the renderer is in the following states: {@link
* #STATE_ENABLED}.
*/
void disable();
......
......@@ -61,18 +61,14 @@ public interface RendererCapabilities {
/** A mask to apply to {@link Capabilities} to obtain the {@link AdaptiveSupport} only. */
int ADAPTIVE_SUPPORT_MASK = 0b11000;
/**
* The {@link Renderer} can seamlessly adapt between formats.
*/
/** The {@link Renderer} can seamlessly adapt between formats. */
int ADAPTIVE_SEAMLESS = 0b10000;
/**
* The {@link Renderer} can adapt between formats, but may suffer a brief discontinuity
* (~50-100ms) when adaptation occurs.
*/
int ADAPTIVE_NOT_SEAMLESS = 0b01000;
/**
* The {@link Renderer} does not support adaptation between formats.
*/
/** The {@link Renderer} does not support adaptation between formats. */
int ADAPTIVE_NOT_SUPPORTED = 0b00000;
/**
......@@ -86,13 +82,9 @@ public interface RendererCapabilities {
/** A mask to apply to {@link Capabilities} to obtain the {@link TunnelingSupport} only. */
int TUNNELING_SUPPORT_MASK = 0b100000;
/**
* The {@link Renderer} supports tunneled output.
*/
/** The {@link Renderer} supports tunneled output. */
int TUNNELING_SUPPORTED = 0b100000;
/**
* The {@link Renderer} does not support tunneled output.
*/
/** The {@link Renderer} does not support tunneled output. */
int TUNNELING_NOT_SUPPORTED = 0b000000;
/**
......
......@@ -123,9 +123,7 @@ public final class AudioCapabilities {
return Arrays.binarySearch(supportedEncodings, encoding) >= 0;
}
/**
* Returns the maximum number of channels the device can play at the same time.
*/
/** Returns the maximum number of channels the device can play at the same time. */
public int getMaxChannelCount() {
return maxChannelCount;
}
......@@ -150,8 +148,11 @@ public final class AudioCapabilities {
@Override
public String toString() {
return "AudioCapabilities[maxChannelCount=" + maxChannelCount
+ ", supportedEncodings=" + Arrays.toString(supportedEncodings) + "]";
return "AudioCapabilities[maxChannelCount="
+ maxChannelCount
+ ", supportedEncodings="
+ Arrays.toString(supportedEncodings)
+ "]";
}
private static boolean deviceMaySetExternalSurroundSoundGlobalSetting() {
......
......@@ -34,9 +34,7 @@ import com.google.android.exoplayer2.util.Util;
*/
public final class AudioCapabilitiesReceiver {
/**
* Listener notified when audio capabilities change.
*/
/** Listener notified when audio capabilities change. */
public interface Listener {
/**
......@@ -45,7 +43,6 @@ public final class AudioCapabilitiesReceiver {
* @param audioCapabilities The current audio capabilities for the device.
*/
void onAudioCapabilitiesChanged(AudioCapabilities audioCapabilities);
}
private final Context context;
......@@ -77,8 +74,8 @@ public final class AudioCapabilitiesReceiver {
/**
* Registers the receiver, meaning it will notify the listener when audio capability changes
* occur. The current audio capabilities will be returned. It is important to call
* {@link #unregister} when the receiver is no longer required.
* occur. The current audio capabilities will be returned. It is important to call {@link
* #unregister} when the receiver is no longer required.
*
* @return The current audio capabilities for the device.
*/
......@@ -162,5 +159,4 @@ public final class AudioCapabilitiesReceiver {
onNewAudioCapabilities(AudioCapabilities.getCapabilities(context));
}
}
}
......@@ -76,7 +76,6 @@ public interface AudioProcessor {
public UnhandledAudioFormatException(AudioFormat inputAudioFormat) {
super("Unhandled format: " + inputAudioFormat);
}
}
/** An empty, direct {@link ByteBuffer}. */
......@@ -114,11 +113,11 @@ public interface AudioProcessor {
void queueInput(ByteBuffer buffer);
/**
* Queues an end of stream signal. After this method has been called,
* {@link #queueInput(ByteBuffer)} may not be called until after the next call to
* {@link #flush()}. Calling {@link #getOutput()} will return any remaining output data. Multiple
* calls may be required to read all of the remaining output data. {@link #isEnded()} will return
* {@code true} once all remaining output data has been read.
* Queues an end of stream signal. After this method has been called, {@link
* #queueInput(ByteBuffer)} may not be called until after the next call to {@link #flush()}.
* Calling {@link #getOutput()} will return any remaining output data. Multiple calls may be
* required to read all of the remaining output data. {@link #isEnded()} will return {@code true}
* once all remaining output data has been read.
*/
void queueEndOfStream();
......
......@@ -57,9 +57,7 @@ import java.nio.ByteBuffer;
*/
public interface AudioSink {
/**
* Listener for audio sink events.
*/
/** Listener for audio sink events. */
interface Listener {
/**
......@@ -132,9 +130,7 @@ public interface AudioSink {
default void onAudioSinkError(Exception audioSinkError) {}
}
/**
* Thrown when a failure occurs configuring the sink.
*/
/** Thrown when a failure occurs configuring the sink. */
final class ConfigurationException extends Exception {
/** Input {@link Format} of the sink when the configuration failure occurs. */
......@@ -200,8 +196,8 @@ public interface AudioSink {
/**
* The error value returned from the sink implementation. If the sink writes to a platform
* {@link AudioTrack}, this will be the error value returned from
* {@link AudioTrack#write(byte[], int, int)} or {@link AudioTrack#write(ByteBuffer, int, int)}.
* {@link AudioTrack}, this will be the error value returned from {@link
* AudioTrack#write(byte[], int, int)} or {@link AudioTrack#write(ByteBuffer, int, int)}.
* Otherwise, the meaning of the error code depends on the sink implementation.
*/
public final int errorCode;
......@@ -223,7 +219,6 @@ public interface AudioSink {
this.errorCode = errorCode;
this.format = format;
}
}
/** Thrown when the sink encounters an unexpected timestamp discontinuity. */
......@@ -327,9 +322,7 @@ public interface AudioSink {
void configure(Format inputFormat, int specifiedBufferSize, @Nullable int[] outputChannels)
throws ConfigurationException;
/**
* Starts or resumes consuming audio if initialized.
*/
/** Starts or resumes consuming audio if initialized. */
void play();
/** Signals to the sink that the next buffer may be discontinuous with the previous buffer. */
......@@ -370,9 +363,7 @@ public interface AudioSink {
*/
boolean isEnded();
/**
* Returns whether the sink has data pending that has not been consumed yet.
*/
/** Returns whether the sink has data pending that has not been consumed yet. */
boolean hasPendingData();
/**
......@@ -395,8 +386,8 @@ public interface AudioSink {
/**
* Sets attributes for audio playback. If the attributes have changed and if the sink is not
* configured for use with tunneling, then it is reset and the audio session id is cleared.
* <p>
* If the sink is configured for use with tunneling then the audio attributes are ignored. The
*
* <p>If the sink is configured for use with tunneling then the audio attributes are ignored. The
* sink is not reset and the audio session id is not cleared. The passed attributes will be used
* if the sink is later re-configured into non-tunneled mode.
*
......@@ -432,9 +423,7 @@ public interface AudioSink {
*/
void setVolume(float volume);
/**
* Pauses playback.
*/
/** Pauses playback. */
void pause();
/**
......
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