Format Java source files
PiperOrigin-RevId: 372127633
This commit is contained in:
parent
39ac09e7c6
commit
4c1a294b2e
@ -201,7 +201,9 @@ public class MainActivity extends AppCompatActivity
|
|||||||
@Override
|
@Override
|
||||||
@NonNull
|
@NonNull
|
||||||
public QueueItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
public QueueItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
TextView v = (TextView) LayoutInflater.from(parent.getContext())
|
TextView v =
|
||||||
|
(TextView)
|
||||||
|
LayoutInflater.from(parent.getContext())
|
||||||
.inflate(android.R.layout.simple_list_item_1, parent, false);
|
.inflate(android.R.layout.simple_list_item_1, parent, false);
|
||||||
return new QueueItemViewHolder(v);
|
return new QueueItemViewHolder(v);
|
||||||
}
|
}
|
||||||
@ -223,7 +225,6 @@ public class MainActivity extends AppCompatActivity
|
|||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return playerManager.getMediaQueueSize();
|
return playerManager.getMediaQueueSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class RecyclerViewCallback extends ItemTouchHelper.SimpleCallback {
|
private class RecyclerViewCallback extends ItemTouchHelper.SimpleCallback {
|
||||||
|
@ -24,9 +24,7 @@ import com.google.android.exoplayer2.MediaItem;
|
|||||||
import com.google.android.exoplayer2.Timeline;
|
import com.google.android.exoplayer2.Timeline;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/** A {@link Timeline} for Cast media queues. */
|
||||||
* A {@link Timeline} for Cast media queues.
|
|
||||||
*/
|
|
||||||
/* package */ final class CastTimeline extends Timeline {
|
/* package */ final class CastTimeline extends Timeline {
|
||||||
|
|
||||||
/** Holds {@link Timeline} related data for a Cast media item. */
|
/** Holds {@link Timeline} related data for a Cast media item. */
|
||||||
@ -190,5 +188,4 @@ import java.util.Arrays;
|
|||||||
result = 31 * result + Arrays.hashCode(isLive);
|
result = 31 * result + Arrays.hashCode(isLive);
|
||||||
return result;
|
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.MediaInfo;
|
||||||
import com.google.android.gms.cast.MediaTrack;
|
import com.google.android.gms.cast.MediaTrack;
|
||||||
|
|
||||||
/**
|
/** Utility methods for ExoPlayer/Cast integration. */
|
||||||
* Utility methods for ExoPlayer/Cast integration.
|
|
||||||
*/
|
|
||||||
/* package */ final class CastUtils {
|
/* package */ final class CastUtils {
|
||||||
|
|
||||||
/** The duration returned by {@link MediaInfo#getStreamDuration()} for live streams. */
|
/** 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
|
* Creates a {@link Format} instance containing all information contained in the given {@link
|
||||||
* {@link MediaTrack} object.
|
* MediaTrack} object.
|
||||||
*
|
*
|
||||||
* @param mediaTrack The {@link MediaTrack}.
|
* @param mediaTrack The {@link MediaTrack}.
|
||||||
* @return The equivalent {@link Format}.
|
* @return The equivalent {@link Format}.
|
||||||
@ -118,5 +116,4 @@ import com.google.android.gms.cast.MediaTrack;
|
|||||||
}
|
}
|
||||||
|
|
||||||
private CastUtils() {}
|
private CastUtils() {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -46,5 +46,4 @@ public final class DefaultCastOptionsProvider implements OptionsProvider {
|
|||||||
public List<SessionProvider> getAdditionalSessionProviders(Context context) {
|
public List<SessionProvider> getAdditionalSessionProviders(Context context) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,9 +22,7 @@ import java.nio.ByteBuffer;
|
|||||||
import org.chromium.net.UploadDataProvider;
|
import org.chromium.net.UploadDataProvider;
|
||||||
import org.chromium.net.UploadDataSink;
|
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 {
|
/* package */ final class ByteArrayUploadDataProvider extends UploadDataProvider {
|
||||||
|
|
||||||
private final byte[] data;
|
private final byte[] data;
|
||||||
@ -53,5 +51,4 @@ import org.chromium.net.UploadDataSink;
|
|||||||
position = 0;
|
position = 0;
|
||||||
uploadDataSink.onRewindSucceeded();
|
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 {
|
public static final class OpenException extends HttpDataSourceException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -985,7 +983,8 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
|
|||||||
private static int getStatus(UrlRequest request) throws InterruptedException {
|
private static int getStatus(UrlRequest request) throws InterruptedException {
|
||||||
final ConditionVariable conditionVariable = new ConditionVariable();
|
final ConditionVariable conditionVariable = new ConditionVariable();
|
||||||
final int[] statusHolder = new int[1];
|
final int[] statusHolder = new int[1];
|
||||||
request.getStatus(new UrlRequest.StatusListener() {
|
request.getStatus(
|
||||||
|
new UrlRequest.StatusListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onStatus(int status) {
|
public void onStatus(int status) {
|
||||||
statusHolder[0] = status;
|
statusHolder[0] = status;
|
||||||
|
@ -27,15 +27,11 @@ import org.chromium.net.CronetEngine;
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
public final class CronetDataSourceFactory extends BaseFactory {
|
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 =
|
public static final int DEFAULT_CONNECT_TIMEOUT_MILLIS =
|
||||||
CronetDataSource.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 =
|
public static final int DEFAULT_READ_TIMEOUT_MILLIS =
|
||||||
CronetDataSource.DEFAULT_READ_TIMEOUT_MILLIS;
|
CronetDataSource.DEFAULT_READ_TIMEOUT_MILLIS;
|
||||||
|
|
||||||
@ -338,8 +334,8 @@ public final class CronetDataSourceFactory extends BaseFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected HttpDataSource createDataSourceInternal(HttpDataSource.RequestProperties
|
protected HttpDataSource createDataSourceInternal(
|
||||||
defaultRequestProperties) {
|
HttpDataSource.RequestProperties defaultRequestProperties) {
|
||||||
@Nullable CronetEngine cronetEngine = cronetEngineWrapper.getCronetEngine();
|
@Nullable CronetEngine cronetEngine = cronetEngineWrapper.getCronetEngine();
|
||||||
if (cronetEngine == null) {
|
if (cronetEngine == null) {
|
||||||
return fallbackFactory.createDataSource();
|
return fallbackFactory.createDataSource();
|
||||||
@ -357,5 +353,4 @@ public final class CronetDataSourceFactory extends BaseFactory {
|
|||||||
}
|
}
|
||||||
return dataSource;
|
return dataSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -49,25 +49,15 @@ public final class CronetEngineWrapper {
|
|||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@IntDef({SOURCE_NATIVE, SOURCE_GMS, SOURCE_UNKNOWN, SOURCE_USER_PROVIDED, SOURCE_UNAVAILABLE})
|
@IntDef({SOURCE_NATIVE, SOURCE_GMS, SOURCE_UNKNOWN, SOURCE_USER_PROVIDED, SOURCE_UNAVAILABLE})
|
||||||
public @interface CronetEngineSource {}
|
public @interface CronetEngineSource {}
|
||||||
/**
|
/** Natively bundled Cronet implementation. */
|
||||||
* Natively bundled Cronet implementation.
|
|
||||||
*/
|
|
||||||
public static final int SOURCE_NATIVE = 0;
|
public static final int SOURCE_NATIVE = 0;
|
||||||
/**
|
/** Cronet implementation from GMSCore. */
|
||||||
* Cronet implementation from GMSCore.
|
|
||||||
*/
|
|
||||||
public static final int SOURCE_GMS = 1;
|
public static final int SOURCE_GMS = 1;
|
||||||
/**
|
/** Other (unknown) Cronet implementation. */
|
||||||
* Other (unknown) Cronet implementation.
|
|
||||||
*/
|
|
||||||
public static final int SOURCE_UNKNOWN = 2;
|
public static final int SOURCE_UNKNOWN = 2;
|
||||||
/**
|
/** User-provided Cronet engine. */
|
||||||
* User-provided Cronet engine.
|
|
||||||
*/
|
|
||||||
public static final int SOURCE_USER_PROVIDED = 3;
|
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;
|
public static final int SOURCE_UNAVAILABLE = 4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -124,10 +114,14 @@ public final class CronetEngineWrapper {
|
|||||||
}
|
}
|
||||||
Log.d(TAG, "CronetEngine built using " + providerName);
|
Log.d(TAG, "CronetEngine built using " + providerName);
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
Log.w(TAG, "Failed to build CronetEngine. Please check if current process has "
|
Log.w(
|
||||||
|
TAG,
|
||||||
|
"Failed to build CronetEngine. Please check if current process has "
|
||||||
+ "android.permission.ACCESS_NETWORK_STATE.");
|
+ "android.permission.ACCESS_NETWORK_STATE.");
|
||||||
} catch (UnsatisfiedLinkError e) {
|
} catch (UnsatisfiedLinkError e) {
|
||||||
Log.w(TAG, "Failed to link Cronet binaries. Please check if native Cronet binaries are "
|
Log.w(
|
||||||
|
TAG,
|
||||||
|
"Failed to link Cronet binaries. Please check if native Cronet binaries are "
|
||||||
+ "bundled into your app.");
|
+ "bundled into your app.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -215,8 +209,7 @@ public final class CronetEngineWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert Cronet provider name into a sortable preference value.
|
* Convert Cronet provider name into a sortable preference value. Smaller values are preferred.
|
||||||
* Smaller values are preferred.
|
|
||||||
*/
|
*/
|
||||||
private int evaluateCronetProviderType(String providerName) {
|
private int evaluateCronetProviderType(String providerName) {
|
||||||
if (isNativeProvider(providerName)) {
|
if (isNativeProvider(providerName)) {
|
||||||
@ -229,9 +222,7 @@ public final class CronetEngineWrapper {
|
|||||||
return -1;
|
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) {
|
private static int compareVersionStrings(String versionLeft, String versionRight) {
|
||||||
if (versionLeft == null || versionRight == null) {
|
if (versionLeft == null || versionRight == null) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -253,5 +244,4 @@ public final class CronetEngineWrapper {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -79,10 +79,7 @@ public final class FfmpegAudioRenderer extends DecoderAudioRenderer<FfmpegAudioD
|
|||||||
@Nullable Handler eventHandler,
|
@Nullable Handler eventHandler,
|
||||||
@Nullable AudioRendererEventListener eventListener,
|
@Nullable AudioRendererEventListener eventListener,
|
||||||
AudioSink audioSink) {
|
AudioSink audioSink) {
|
||||||
super(
|
super(eventHandler, eventListener, audioSink);
|
||||||
eventHandler,
|
|
||||||
eventListener,
|
|
||||||
audioSink);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -50,9 +50,7 @@ public final class FfmpegLibrary {
|
|||||||
LOADER.setLibraries(libraries);
|
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() {
|
public static boolean isAvailable() {
|
||||||
return LOADER.isAvailable();
|
return LOADER.isAvailable();
|
||||||
}
|
}
|
||||||
|
@ -28,9 +28,7 @@ import com.google.android.exoplayer2.util.Util;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
/**
|
/** JNI wrapper for the libflac Flac decoder. */
|
||||||
* JNI wrapper for the libflac Flac decoder.
|
|
||||||
*/
|
|
||||||
/* package */ final class FlacDecoderJni {
|
/* package */ final class FlacDecoderJni {
|
||||||
|
|
||||||
/** Exception to be thrown if {@link #decodeSample(ByteBuffer)} fails to decode a frame. */
|
/** 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() {
|
public long getDecodePosition() {
|
||||||
return flacGetDecodePosition(nativeDecoderContext);
|
return flacGetDecodePosition(nativeDecoderContext);
|
||||||
}
|
}
|
||||||
@ -303,5 +299,4 @@ import java.nio.ByteBuffer;
|
|||||||
private native void flacReset(long context, long newPosition);
|
private native void flacReset(long context, long newPosition);
|
||||||
|
|
||||||
private native void flacRelease(long context);
|
private native void flacRelease(long context);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -40,11 +40,8 @@ public final class FlacLibrary {
|
|||||||
LOADER.setLibraries(libraries);
|
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() {
|
public static boolean isAvailable() {
|
||||||
return LOADER.isAvailable();
|
return LOADER.isAvailable();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -67,10 +67,7 @@ public final class LibflacAudioRenderer extends DecoderAudioRenderer<FlacDecoder
|
|||||||
@Nullable Handler eventHandler,
|
@Nullable Handler eventHandler,
|
||||||
@Nullable AudioRendererEventListener eventListener,
|
@Nullable AudioRendererEventListener eventListener,
|
||||||
AudioSink audioSink) {
|
AudioSink audioSink) {
|
||||||
super(
|
super(eventHandler, eventListener, audioSink);
|
||||||
eventHandler,
|
|
||||||
eventListener,
|
|
||||||
audioSink);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -233,9 +233,7 @@ public final class ImaPlaybackTest {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected MediaSource buildSource(
|
protected MediaSource buildSource(
|
||||||
HostActivity host,
|
HostActivity host, DrmSessionManager drmSessionManager, FrameLayout overlayFrameLayout) {
|
||||||
DrmSessionManager drmSessionManager,
|
|
||||||
FrameLayout overlayFrameLayout) {
|
|
||||||
Context context = host.getApplicationContext();
|
Context context = host.getApplicationContext();
|
||||||
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(context);
|
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(context);
|
||||||
MediaSource contentMediaSource =
|
MediaSource contentMediaSource =
|
||||||
|
@ -77,12 +77,12 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
|
|||||||
/**
|
/**
|
||||||
* Sets the {@link ControlDispatcher}.
|
* Sets the {@link ControlDispatcher}.
|
||||||
*
|
*
|
||||||
* @param controlDispatcher The {@link ControlDispatcher}, or null to use
|
* @param controlDispatcher The {@link ControlDispatcher}, or null to use {@link
|
||||||
* {@link DefaultControlDispatcher}.
|
* DefaultControlDispatcher}.
|
||||||
*/
|
*/
|
||||||
public void setControlDispatcher(@Nullable ControlDispatcher controlDispatcher) {
|
public void setControlDispatcher(@Nullable ControlDispatcher controlDispatcher) {
|
||||||
this.controlDispatcher = controlDispatcher == null ? new DefaultControlDispatcher()
|
this.controlDispatcher =
|
||||||
: controlDispatcher;
|
controlDispatcher == null ? new DefaultControlDispatcher() : controlDispatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -132,7 +132,8 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
|
|||||||
@Override
|
@Override
|
||||||
public boolean isPlaying() {
|
public boolean isPlaying() {
|
||||||
int playbackState = player.getPlaybackState();
|
int playbackState = player.getPlaybackState();
|
||||||
return playbackState != Player.STATE_IDLE && playbackState != Player.STATE_ENDED
|
return playbackState != Player.STATE_IDLE
|
||||||
|
&& playbackState != Player.STATE_ENDED
|
||||||
&& player.getPlayWhenReady();
|
&& player.getPlayWhenReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +260,10 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
|
|||||||
Pair<Integer, String> errorMessage = errorMessageProvider.getErrorMessage(exception);
|
Pair<Integer, String> errorMessage = errorMessageProvider.getErrorMessage(exception);
|
||||||
callback.onError(LeanbackPlayerAdapter.this, errorMessage.first, errorMessage.second);
|
callback.onError(LeanbackPlayerAdapter.this, errorMessage.first, errorMessage.second);
|
||||||
} else {
|
} else {
|
||||||
callback.onError(LeanbackPlayerAdapter.this, exception.type, context.getString(
|
callback.onError(
|
||||||
|
LeanbackPlayerAdapter.this,
|
||||||
|
exception.type,
|
||||||
|
context.getString(
|
||||||
R.string.lb_media_player_error, exception.type, exception.rendererIndex));
|
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() {
|
public void onRenderedFirstFrame() {
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -168,10 +168,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
SimpleExoPlayer simpleExoPlayer = null;
|
SimpleExoPlayer simpleExoPlayer = null;
|
||||||
SessionPlayerConnector playerConnector = null;
|
SessionPlayerConnector playerConnector = null;
|
||||||
try {
|
try {
|
||||||
simpleExoPlayer =
|
simpleExoPlayer = new SimpleExoPlayer.Builder(context).setLooper(Looper.myLooper()).build();
|
||||||
new SimpleExoPlayer.Builder(context)
|
|
||||||
.setLooper(Looper.myLooper())
|
|
||||||
.build();
|
|
||||||
playerConnector =
|
playerConnector =
|
||||||
new SessionPlayerConnector(simpleExoPlayer, new DefaultMediaItemConverter());
|
new SessionPlayerConnector(simpleExoPlayer, new DefaultMediaItemConverter());
|
||||||
playerConnector.setControlDispatcher(controlDispatcher);
|
playerConnector.setControlDispatcher(controlDispatcher);
|
||||||
|
@ -89,7 +89,6 @@ import com.google.android.exoplayer2.audio.AudioAttributes;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Utils() {
|
private Utils() {
|
||||||
// Prevent instantiation.
|
// Prevent instantiation.
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,7 @@ public final class RepeatModeActionProvider implements MediaSessionConnector.Cus
|
|||||||
|
|
||||||
private static final String ACTION_REPEAT_MODE = "ACTION_EXO_REPEAT_MODE";
|
private static final String ACTION_REPEAT_MODE = "ACTION_EXO_REPEAT_MODE";
|
||||||
|
|
||||||
@RepeatModeUtil.RepeatToggleModes
|
@RepeatModeUtil.RepeatToggleModes private final int repeatToggleModes;
|
||||||
private final int repeatToggleModes;
|
|
||||||
private final CharSequence repeatAllDescription;
|
private final CharSequence repeatAllDescription;
|
||||||
private final CharSequence repeatOneDescription;
|
private final CharSequence repeatOneDescription;
|
||||||
private final CharSequence repeatOffDescription;
|
private final CharSequence repeatOffDescription;
|
||||||
@ -93,9 +92,9 @@ public final class RepeatModeActionProvider implements MediaSessionConnector.Cus
|
|||||||
iconResourceId = R.drawable.exo_media_action_repeat_off;
|
iconResourceId = R.drawable.exo_media_action_repeat_off;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
PlaybackStateCompat.CustomAction.Builder repeatBuilder = new PlaybackStateCompat.CustomAction
|
PlaybackStateCompat.CustomAction.Builder repeatBuilder =
|
||||||
.Builder(ACTION_REPEAT_MODE, actionLabel, iconResourceId);
|
new PlaybackStateCompat.CustomAction.Builder(
|
||||||
|
ACTION_REPEAT_MODE, actionLabel, iconResourceId);
|
||||||
return repeatBuilder.build();
|
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
|
* 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
|
* application about changes in the queue to sync the data structure backing the {@link
|
||||||
* {@link MediaSessionConnector}.
|
* MediaSessionConnector}.
|
||||||
*/
|
*/
|
||||||
public interface QueueDataAdapter {
|
public interface QueueDataAdapter {
|
||||||
/**
|
/**
|
||||||
@ -83,9 +83,7 @@ public final class TimelineQueueEditor
|
|||||||
void move(int from, int to);
|
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 {
|
interface MediaDescriptionEqualityChecker {
|
||||||
/**
|
/**
|
||||||
* Returns {@code true} whether the descriptions are considered equal.
|
* 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}.
|
* 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}.
|
* @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.
|
* 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},
|
* <p>If the number of windows in the {@link Player}'s {@link Timeline} exceeds {@code
|
||||||
* the media session queue will correspond to {@code maxQueueSize} windows centered on the one
|
* maxQueueSize}, the media session queue will correspond to {@code maxQueueSize} windows centered
|
||||||
* currently being played.
|
* on the one currently being played.
|
||||||
*
|
*
|
||||||
* @param mediaSession The {@link MediaSessionCompat}.
|
* @param mediaSession The {@link MediaSessionCompat}.
|
||||||
* @param maxQueueSize The maximum queue size.
|
* @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
|
* Reads up to {@code length} bytes of data and stores them into {@code buffer}, starting at index
|
||||||
* index {@code offset}.
|
* {@code offset}.
|
||||||
* <p>
|
*
|
||||||
* This method blocks until at least one byte of data can be read, the end of the opened range is
|
* <p>This method blocks until at least one byte of data can be read, the end of the opened range
|
||||||
* detected, or an exception is thrown.
|
* is detected, or an exception is thrown.
|
||||||
*
|
*
|
||||||
* @param buffer The buffer into which the read data should be stored.
|
* @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.
|
* @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;
|
return read;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Closes the current connection quietly, if there is one. */
|
||||||
* Closes the current connection quietly, if there is one.
|
|
||||||
*/
|
|
||||||
private void closeConnectionQuietly() {
|
private void closeConnectionQuietly() {
|
||||||
if (response != null) {
|
if (response != null) {
|
||||||
Assertions.checkNotNull(response.body()).close();
|
Assertions.checkNotNull(response.body()).close();
|
||||||
@ -508,5 +506,4 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource {
|
|||||||
}
|
}
|
||||||
responseByteStream = null;
|
responseByteStream = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -104,11 +104,7 @@ public final class OkHttpDataSourceFactory extends BaseFactory {
|
|||||||
protected OkHttpDataSource createDataSourceInternal(
|
protected OkHttpDataSource createDataSourceInternal(
|
||||||
HttpDataSource.RequestProperties defaultRequestProperties) {
|
HttpDataSource.RequestProperties defaultRequestProperties) {
|
||||||
OkHttpDataSource dataSource =
|
OkHttpDataSource dataSource =
|
||||||
new OkHttpDataSource(
|
new OkHttpDataSource(callFactory, userAgent, cacheControl, defaultRequestProperties);
|
||||||
callFactory,
|
|
||||||
userAgent,
|
|
||||||
cacheControl,
|
|
||||||
defaultRequestProperties);
|
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
dataSource.addTransferListener(listener);
|
dataSource.addTransferListener(listener);
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,5 @@ public class OpusPlaybackTest {
|
|||||||
Looper.myLooper().quit();
|
Looper.myLooper().quit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,5 +27,4 @@ public final class OpusDecoderException extends DecoderException {
|
|||||||
/* package */ OpusDecoderException(String message, Throwable cause) {
|
/* package */ OpusDecoderException(String message, Throwable cause) {
|
||||||
super(message, cause);
|
super(message, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -48,9 +48,7 @@ public final class OpusLibrary {
|
|||||||
OpusLibrary.exoMediaCryptoType = exoMediaCryptoType;
|
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() {
|
public static boolean isAvailable() {
|
||||||
return LOADER.isAvailable();
|
return LOADER.isAvailable();
|
||||||
}
|
}
|
||||||
@ -71,5 +69,6 @@ public final class OpusLibrary {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static native String opusGetVersion();
|
public static native String opusGetVersion();
|
||||||
|
|
||||||
public static native boolean opusIsSecureDecodeSupported();
|
public static native boolean opusIsSecureDecodeSupported();
|
||||||
}
|
}
|
||||||
|
@ -80,5 +80,4 @@ public final class RtmpDataSource extends BaseDataSource {
|
|||||||
public Uri getUri() {
|
public Uri getUri() {
|
||||||
return uri;
|
return uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,5 +42,4 @@ public final class RtmpDataSourceFactory implements DataSource.Factory {
|
|||||||
}
|
}
|
||||||
return dataSource;
|
return dataSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -157,5 +157,4 @@ public class VpxPlaybackTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -145,8 +145,8 @@ public final class VpxDecoder
|
|||||||
if (result != NO_ERROR) {
|
if (result != NO_ERROR) {
|
||||||
if (result == DRM_ERROR) {
|
if (result == DRM_ERROR) {
|
||||||
String message = "Drm error: " + vpxGetErrorMessage(vpxDecContext);
|
String message = "Drm error: " + vpxGetErrorMessage(vpxDecContext);
|
||||||
DecryptionException cause = new DecryptionException(
|
DecryptionException cause =
|
||||||
vpxGetErrorCode(vpxDecContext), message);
|
new DecryptionException(vpxGetErrorCode(vpxDecContext), message);
|
||||||
return new VpxDecoderException(message, cause);
|
return new VpxDecoderException(message, cause);
|
||||||
} else {
|
} else {
|
||||||
return new VpxDecoderException("Decode error: " + vpxGetErrorMessage(vpxDecContext));
|
return new VpxDecoderException("Decode error: " + vpxGetErrorMessage(vpxDecContext));
|
||||||
@ -209,6 +209,7 @@ public final class VpxDecoder
|
|||||||
boolean disableLoopFilter, boolean enableRowMultiThreadMode, int threads);
|
boolean disableLoopFilter, boolean enableRowMultiThreadMode, int threads);
|
||||||
|
|
||||||
private native long vpxClose(long context);
|
private native long vpxClose(long context);
|
||||||
|
|
||||||
private native long vpxDecode(long context, ByteBuffer encoded, int length);
|
private native long vpxDecode(long context, ByteBuffer encoded, int length);
|
||||||
|
|
||||||
private native long vpxSecureDecode(
|
private native long vpxSecureDecode(
|
||||||
@ -239,6 +240,6 @@ public final class VpxDecoder
|
|||||||
private native int vpxReleaseFrame(long context, VideoDecoderOutputBuffer outputBuffer);
|
private native int vpxReleaseFrame(long context, VideoDecoderOutputBuffer outputBuffer);
|
||||||
|
|
||||||
private native int vpxGetErrorCode(long context);
|
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;
|
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() {
|
public static boolean isAvailable() {
|
||||||
return LOADER.isAvailable();
|
return LOADER.isAvailable();
|
||||||
}
|
}
|
||||||
@ -70,13 +68,10 @@ public final class VpxLibrary {
|
|||||||
return isAvailable() ? vpxGetBuildConfig() : null;
|
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() {
|
public static boolean isHighBitDepthSupported() {
|
||||||
String config = getBuildConfig();
|
String config = getBuildConfig();
|
||||||
int indexHbd = config != null
|
int indexHbd = config != null ? config.indexOf("--enable-vp9-highbitdepth") : -1;
|
||||||
? config.indexOf("--enable-vp9-highbitdepth") : -1;
|
|
||||||
return indexHbd >= 0;
|
return indexHbd >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +85,8 @@ public final class VpxLibrary {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static native String vpxGetVersion();
|
private static native String vpxGetVersion();
|
||||||
private static native String vpxGetBuildConfig();
|
|
||||||
public static native boolean vpxIsSecureDecodeSupported();
|
|
||||||
|
|
||||||
|
private static native String vpxGetBuildConfig();
|
||||||
|
|
||||||
|
public static native boolean vpxIsSecureDecodeSupported();
|
||||||
}
|
}
|
||||||
|
@ -49,14 +49,10 @@ public final class C {
|
|||||||
*/
|
*/
|
||||||
public static final long TIME_UNSET = Long.MIN_VALUE + 1;
|
public static final long TIME_UNSET = Long.MIN_VALUE + 1;
|
||||||
|
|
||||||
/**
|
/** Represents an unset or unknown index. */
|
||||||
* Represents an unset or unknown index.
|
|
||||||
*/
|
|
||||||
public static final int INDEX_UNSET = -1;
|
public static final int INDEX_UNSET = -1;
|
||||||
|
|
||||||
/**
|
/** Represents an unset or unknown position. */
|
||||||
* Represents an unset or unknown position.
|
|
||||||
*/
|
|
||||||
public static final int POSITION_UNSET = -1;
|
public static final int POSITION_UNSET = -1;
|
||||||
|
|
||||||
/** Represents an unset or unknown rate. */
|
/** Represents an unset or unknown rate. */
|
||||||
@ -74,9 +70,7 @@ public final class C {
|
|||||||
/** The number of microseconds in one second. */
|
/** The number of microseconds in one second. */
|
||||||
public static final long MICROS_PER_SECOND = 1000000L;
|
public static final long MICROS_PER_SECOND = 1000000L;
|
||||||
|
|
||||||
/**
|
/** The number of nanoseconds in one second. */
|
||||||
* The number of nanoseconds in one second.
|
|
||||||
*/
|
|
||||||
public static final long NANOS_PER_SECOND = 1000000000L;
|
public static final long NANOS_PER_SECOND = 1000000000L;
|
||||||
|
|
||||||
/** The number of bits per byte. */
|
/** The number of bits per byte. */
|
||||||
@ -115,14 +109,10 @@ public final class C {
|
|||||||
*/
|
*/
|
||||||
@Deprecated public static final String UTF16LE_NAME = "UTF-16LE";
|
@Deprecated public static final String UTF16LE_NAME = "UTF-16LE";
|
||||||
|
|
||||||
/**
|
/** The name of the serif font family. */
|
||||||
* The name of the serif font family.
|
|
||||||
*/
|
|
||||||
public static final String SERIF_NAME = "serif";
|
public static final String SERIF_NAME = "serif";
|
||||||
|
|
||||||
/**
|
/** The name of the sans-serif font family. */
|
||||||
* The name of the sans-serif font family.
|
|
||||||
*/
|
|
||||||
public static final String SANS_SERIF_NAME = "sans-serif";
|
public static final String SANS_SERIF_NAME = "sans-serif";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -133,22 +123,16 @@ public final class C {
|
|||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@IntDef({CRYPTO_MODE_UNENCRYPTED, CRYPTO_MODE_AES_CTR, CRYPTO_MODE_AES_CBC})
|
@IntDef({CRYPTO_MODE_UNENCRYPTED, CRYPTO_MODE_AES_CTR, CRYPTO_MODE_AES_CBC})
|
||||||
public @interface CryptoMode {}
|
public @interface CryptoMode {}
|
||||||
/**
|
/** @see MediaCodec#CRYPTO_MODE_UNENCRYPTED */
|
||||||
* @see MediaCodec#CRYPTO_MODE_UNENCRYPTED
|
|
||||||
*/
|
|
||||||
public static final int CRYPTO_MODE_UNENCRYPTED = MediaCodec.CRYPTO_MODE_UNENCRYPTED;
|
public static final int CRYPTO_MODE_UNENCRYPTED = MediaCodec.CRYPTO_MODE_UNENCRYPTED;
|
||||||
/**
|
/** @see MediaCodec#CRYPTO_MODE_AES_CTR */
|
||||||
* @see MediaCodec#CRYPTO_MODE_AES_CTR
|
|
||||||
*/
|
|
||||||
public static final int CRYPTO_MODE_AES_CTR = MediaCodec.CRYPTO_MODE_AES_CTR;
|
public static final int CRYPTO_MODE_AES_CTR = MediaCodec.CRYPTO_MODE_AES_CTR;
|
||||||
/**
|
/** @see MediaCodec#CRYPTO_MODE_AES_CBC */
|
||||||
* @see MediaCodec#CRYPTO_MODE_AES_CBC
|
|
||||||
*/
|
|
||||||
public static final int CRYPTO_MODE_AES_CBC = MediaCodec.CRYPTO_MODE_AES_CBC;
|
public static final int CRYPTO_MODE_AES_CBC = MediaCodec.CRYPTO_MODE_AES_CBC;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an unset {@link android.media.AudioTrack} session identifier. Equal to
|
* Represents an unset {@link android.media.AudioTrack} session identifier. Equal to {@link
|
||||||
* {@link AudioManager#AUDIO_SESSION_ID_GENERATE}.
|
* AudioManager#AUDIO_SESSION_ID_GENERATE}.
|
||||||
*/
|
*/
|
||||||
public static final int AUDIO_SESSION_ID_UNSET = AudioManager.AUDIO_SESSION_ID_GENERATE;
|
public static final int AUDIO_SESSION_ID_UNSET = AudioManager.AUDIO_SESSION_ID_GENERATE;
|
||||||
|
|
||||||
@ -267,33 +251,19 @@ public final class C {
|
|||||||
STREAM_TYPE_VOICE_CALL
|
STREAM_TYPE_VOICE_CALL
|
||||||
})
|
})
|
||||||
public @interface StreamType {}
|
public @interface StreamType {}
|
||||||
/**
|
/** @see AudioManager#STREAM_ALARM */
|
||||||
* @see AudioManager#STREAM_ALARM
|
|
||||||
*/
|
|
||||||
public static final int STREAM_TYPE_ALARM = AudioManager.STREAM_ALARM;
|
public static final int STREAM_TYPE_ALARM = AudioManager.STREAM_ALARM;
|
||||||
/**
|
/** @see AudioManager#STREAM_DTMF */
|
||||||
* @see AudioManager#STREAM_DTMF
|
|
||||||
*/
|
|
||||||
public static final int STREAM_TYPE_DTMF = AudioManager.STREAM_DTMF;
|
public static final int STREAM_TYPE_DTMF = AudioManager.STREAM_DTMF;
|
||||||
/**
|
/** @see AudioManager#STREAM_MUSIC */
|
||||||
* @see AudioManager#STREAM_MUSIC
|
|
||||||
*/
|
|
||||||
public static final int STREAM_TYPE_MUSIC = AudioManager.STREAM_MUSIC;
|
public static final int STREAM_TYPE_MUSIC = AudioManager.STREAM_MUSIC;
|
||||||
/**
|
/** @see AudioManager#STREAM_NOTIFICATION */
|
||||||
* @see AudioManager#STREAM_NOTIFICATION
|
|
||||||
*/
|
|
||||||
public static final int STREAM_TYPE_NOTIFICATION = AudioManager.STREAM_NOTIFICATION;
|
public static final int STREAM_TYPE_NOTIFICATION = AudioManager.STREAM_NOTIFICATION;
|
||||||
/**
|
/** @see AudioManager#STREAM_RING */
|
||||||
* @see AudioManager#STREAM_RING
|
|
||||||
*/
|
|
||||||
public static final int STREAM_TYPE_RING = AudioManager.STREAM_RING;
|
public static final int STREAM_TYPE_RING = AudioManager.STREAM_RING;
|
||||||
/**
|
/** @see AudioManager#STREAM_SYSTEM */
|
||||||
* @see AudioManager#STREAM_SYSTEM
|
|
||||||
*/
|
|
||||||
public static final int STREAM_TYPE_SYSTEM = AudioManager.STREAM_SYSTEM;
|
public static final int STREAM_TYPE_SYSTEM = AudioManager.STREAM_SYSTEM;
|
||||||
/**
|
/** @see AudioManager#STREAM_VOICE_CALL */
|
||||||
* @see AudioManager#STREAM_VOICE_CALL
|
|
||||||
*/
|
|
||||||
public static final int STREAM_TYPE_VOICE_CALL = AudioManager.STREAM_VOICE_CALL;
|
public static final int STREAM_TYPE_VOICE_CALL = AudioManager.STREAM_VOICE_CALL;
|
||||||
/** The default stream type used by audio renderers. Equal to {@link #STREAM_TYPE_MUSIC}. */
|
/** The default stream type used by audio renderers. Equal to {@link #STREAM_TYPE_MUSIC}. */
|
||||||
public static final int STREAM_TYPE_DEFAULT = STREAM_TYPE_MUSIC;
|
public static final int STREAM_TYPE_DEFAULT = STREAM_TYPE_MUSIC;
|
||||||
@ -313,29 +283,17 @@ public final class C {
|
|||||||
CONTENT_TYPE_UNKNOWN
|
CONTENT_TYPE_UNKNOWN
|
||||||
})
|
})
|
||||||
public @interface AudioContentType {}
|
public @interface AudioContentType {}
|
||||||
/**
|
/** @see android.media.AudioAttributes#CONTENT_TYPE_MOVIE */
|
||||||
* @see android.media.AudioAttributes#CONTENT_TYPE_MOVIE
|
|
||||||
*/
|
|
||||||
public static final int CONTENT_TYPE_MOVIE = android.media.AudioAttributes.CONTENT_TYPE_MOVIE;
|
public static final int CONTENT_TYPE_MOVIE = android.media.AudioAttributes.CONTENT_TYPE_MOVIE;
|
||||||
/**
|
/** @see android.media.AudioAttributes#CONTENT_TYPE_MUSIC */
|
||||||
* @see android.media.AudioAttributes#CONTENT_TYPE_MUSIC
|
|
||||||
*/
|
|
||||||
public static final int CONTENT_TYPE_MUSIC = android.media.AudioAttributes.CONTENT_TYPE_MUSIC;
|
public static final int CONTENT_TYPE_MUSIC = android.media.AudioAttributes.CONTENT_TYPE_MUSIC;
|
||||||
/**
|
/** @see android.media.AudioAttributes#CONTENT_TYPE_SONIFICATION */
|
||||||
* @see android.media.AudioAttributes#CONTENT_TYPE_SONIFICATION
|
|
||||||
*/
|
|
||||||
public static final int CONTENT_TYPE_SONIFICATION =
|
public static final int CONTENT_TYPE_SONIFICATION =
|
||||||
android.media.AudioAttributes.CONTENT_TYPE_SONIFICATION;
|
android.media.AudioAttributes.CONTENT_TYPE_SONIFICATION;
|
||||||
/**
|
/** @see android.media.AudioAttributes#CONTENT_TYPE_SPEECH */
|
||||||
* @see android.media.AudioAttributes#CONTENT_TYPE_SPEECH
|
public static final int CONTENT_TYPE_SPEECH = android.media.AudioAttributes.CONTENT_TYPE_SPEECH;
|
||||||
*/
|
/** @see android.media.AudioAttributes#CONTENT_TYPE_UNKNOWN */
|
||||||
public static final int CONTENT_TYPE_SPEECH =
|
public static final int CONTENT_TYPE_UNKNOWN = android.media.AudioAttributes.CONTENT_TYPE_UNKNOWN;
|
||||||
android.media.AudioAttributes.CONTENT_TYPE_SPEECH;
|
|
||||||
/**
|
|
||||||
* @see android.media.AudioAttributes#CONTENT_TYPE_UNKNOWN
|
|
||||||
*/
|
|
||||||
public static final int CONTENT_TYPE_UNKNOWN =
|
|
||||||
android.media.AudioAttributes.CONTENT_TYPE_UNKNOWN;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flags for audio attributes. Possible flag value is {@link #FLAG_AUDIBILITY_ENFORCED}.
|
* Flags for audio attributes. Possible flag value is {@link #FLAG_AUDIBILITY_ENFORCED}.
|
||||||
@ -349,9 +307,7 @@ public final class C {
|
|||||||
flag = true,
|
flag = true,
|
||||||
value = {FLAG_AUDIBILITY_ENFORCED})
|
value = {FLAG_AUDIBILITY_ENFORCED})
|
||||||
public @interface AudioFlags {}
|
public @interface AudioFlags {}
|
||||||
/**
|
/** @see android.media.AudioAttributes#FLAG_AUDIBILITY_ENFORCED */
|
||||||
* @see android.media.AudioAttributes#FLAG_AUDIBILITY_ENFORCED
|
|
||||||
*/
|
|
||||||
public static final int FLAG_AUDIBILITY_ENFORCED =
|
public static final int FLAG_AUDIBILITY_ENFORCED =
|
||||||
android.media.AudioAttributes.FLAG_AUDIBILITY_ENFORCED;
|
android.media.AudioAttributes.FLAG_AUDIBILITY_ENFORCED;
|
||||||
|
|
||||||
@ -386,74 +342,46 @@ public final class C {
|
|||||||
USAGE_VOICE_COMMUNICATION_SIGNALLING
|
USAGE_VOICE_COMMUNICATION_SIGNALLING
|
||||||
})
|
})
|
||||||
public @interface AudioUsage {}
|
public @interface AudioUsage {}
|
||||||
/**
|
/** @see android.media.AudioAttributes#USAGE_ALARM */
|
||||||
* @see android.media.AudioAttributes#USAGE_ALARM
|
|
||||||
*/
|
|
||||||
public static final int USAGE_ALARM = android.media.AudioAttributes.USAGE_ALARM;
|
public static final int USAGE_ALARM = android.media.AudioAttributes.USAGE_ALARM;
|
||||||
/** @see android.media.AudioAttributes#USAGE_ASSISTANCE_ACCESSIBILITY */
|
/** @see android.media.AudioAttributes#USAGE_ASSISTANCE_ACCESSIBILITY */
|
||||||
public static final int USAGE_ASSISTANCE_ACCESSIBILITY =
|
public static final int USAGE_ASSISTANCE_ACCESSIBILITY =
|
||||||
android.media.AudioAttributes.USAGE_ASSISTANCE_ACCESSIBILITY;
|
android.media.AudioAttributes.USAGE_ASSISTANCE_ACCESSIBILITY;
|
||||||
/**
|
/** @see android.media.AudioAttributes#USAGE_ASSISTANCE_NAVIGATION_GUIDANCE */
|
||||||
* @see android.media.AudioAttributes#USAGE_ASSISTANCE_NAVIGATION_GUIDANCE
|
|
||||||
*/
|
|
||||||
public static final int USAGE_ASSISTANCE_NAVIGATION_GUIDANCE =
|
public static final int USAGE_ASSISTANCE_NAVIGATION_GUIDANCE =
|
||||||
android.media.AudioAttributes.USAGE_ASSISTANCE_NAVIGATION_GUIDANCE;
|
android.media.AudioAttributes.USAGE_ASSISTANCE_NAVIGATION_GUIDANCE;
|
||||||
/**
|
/** @see android.media.AudioAttributes#USAGE_ASSISTANCE_SONIFICATION */
|
||||||
* @see android.media.AudioAttributes#USAGE_ASSISTANCE_SONIFICATION
|
|
||||||
*/
|
|
||||||
public static final int USAGE_ASSISTANCE_SONIFICATION =
|
public static final int USAGE_ASSISTANCE_SONIFICATION =
|
||||||
android.media.AudioAttributes.USAGE_ASSISTANCE_SONIFICATION;
|
android.media.AudioAttributes.USAGE_ASSISTANCE_SONIFICATION;
|
||||||
/** @see android.media.AudioAttributes#USAGE_ASSISTANT */
|
/** @see android.media.AudioAttributes#USAGE_ASSISTANT */
|
||||||
public static final int USAGE_ASSISTANT = android.media.AudioAttributes.USAGE_ASSISTANT;
|
public static final int USAGE_ASSISTANT = android.media.AudioAttributes.USAGE_ASSISTANT;
|
||||||
/**
|
/** @see android.media.AudioAttributes#USAGE_GAME */
|
||||||
* @see android.media.AudioAttributes#USAGE_GAME
|
|
||||||
*/
|
|
||||||
public static final int USAGE_GAME = android.media.AudioAttributes.USAGE_GAME;
|
public static final int USAGE_GAME = android.media.AudioAttributes.USAGE_GAME;
|
||||||
/**
|
/** @see android.media.AudioAttributes#USAGE_MEDIA */
|
||||||
* @see android.media.AudioAttributes#USAGE_MEDIA
|
|
||||||
*/
|
|
||||||
public static final int USAGE_MEDIA = android.media.AudioAttributes.USAGE_MEDIA;
|
public static final int USAGE_MEDIA = android.media.AudioAttributes.USAGE_MEDIA;
|
||||||
/**
|
/** @see android.media.AudioAttributes#USAGE_NOTIFICATION */
|
||||||
* @see android.media.AudioAttributes#USAGE_NOTIFICATION
|
|
||||||
*/
|
|
||||||
public static final int USAGE_NOTIFICATION = android.media.AudioAttributes.USAGE_NOTIFICATION;
|
public static final int USAGE_NOTIFICATION = android.media.AudioAttributes.USAGE_NOTIFICATION;
|
||||||
/**
|
/** @see android.media.AudioAttributes#USAGE_NOTIFICATION_COMMUNICATION_DELAYED */
|
||||||
* @see android.media.AudioAttributes#USAGE_NOTIFICATION_COMMUNICATION_DELAYED
|
|
||||||
*/
|
|
||||||
public static final int USAGE_NOTIFICATION_COMMUNICATION_DELAYED =
|
public static final int USAGE_NOTIFICATION_COMMUNICATION_DELAYED =
|
||||||
android.media.AudioAttributes.USAGE_NOTIFICATION_COMMUNICATION_DELAYED;
|
android.media.AudioAttributes.USAGE_NOTIFICATION_COMMUNICATION_DELAYED;
|
||||||
/**
|
/** @see android.media.AudioAttributes#USAGE_NOTIFICATION_COMMUNICATION_INSTANT */
|
||||||
* @see android.media.AudioAttributes#USAGE_NOTIFICATION_COMMUNICATION_INSTANT
|
|
||||||
*/
|
|
||||||
public static final int USAGE_NOTIFICATION_COMMUNICATION_INSTANT =
|
public static final int USAGE_NOTIFICATION_COMMUNICATION_INSTANT =
|
||||||
android.media.AudioAttributes.USAGE_NOTIFICATION_COMMUNICATION_INSTANT;
|
android.media.AudioAttributes.USAGE_NOTIFICATION_COMMUNICATION_INSTANT;
|
||||||
/**
|
/** @see android.media.AudioAttributes#USAGE_NOTIFICATION_COMMUNICATION_REQUEST */
|
||||||
* @see android.media.AudioAttributes#USAGE_NOTIFICATION_COMMUNICATION_REQUEST
|
|
||||||
*/
|
|
||||||
public static final int USAGE_NOTIFICATION_COMMUNICATION_REQUEST =
|
public static final int USAGE_NOTIFICATION_COMMUNICATION_REQUEST =
|
||||||
android.media.AudioAttributes.USAGE_NOTIFICATION_COMMUNICATION_REQUEST;
|
android.media.AudioAttributes.USAGE_NOTIFICATION_COMMUNICATION_REQUEST;
|
||||||
/**
|
/** @see android.media.AudioAttributes#USAGE_NOTIFICATION_EVENT */
|
||||||
* @see android.media.AudioAttributes#USAGE_NOTIFICATION_EVENT
|
|
||||||
*/
|
|
||||||
public static final int USAGE_NOTIFICATION_EVENT =
|
public static final int USAGE_NOTIFICATION_EVENT =
|
||||||
android.media.AudioAttributes.USAGE_NOTIFICATION_EVENT;
|
android.media.AudioAttributes.USAGE_NOTIFICATION_EVENT;
|
||||||
/**
|
/** @see android.media.AudioAttributes#USAGE_NOTIFICATION_RINGTONE */
|
||||||
* @see android.media.AudioAttributes#USAGE_NOTIFICATION_RINGTONE
|
|
||||||
*/
|
|
||||||
public static final int USAGE_NOTIFICATION_RINGTONE =
|
public static final int USAGE_NOTIFICATION_RINGTONE =
|
||||||
android.media.AudioAttributes.USAGE_NOTIFICATION_RINGTONE;
|
android.media.AudioAttributes.USAGE_NOTIFICATION_RINGTONE;
|
||||||
/**
|
/** @see android.media.AudioAttributes#USAGE_UNKNOWN */
|
||||||
* @see android.media.AudioAttributes#USAGE_UNKNOWN
|
|
||||||
*/
|
|
||||||
public static final int USAGE_UNKNOWN = android.media.AudioAttributes.USAGE_UNKNOWN;
|
public static final int USAGE_UNKNOWN = android.media.AudioAttributes.USAGE_UNKNOWN;
|
||||||
/**
|
/** @see android.media.AudioAttributes#USAGE_VOICE_COMMUNICATION */
|
||||||
* @see android.media.AudioAttributes#USAGE_VOICE_COMMUNICATION
|
|
||||||
*/
|
|
||||||
public static final int USAGE_VOICE_COMMUNICATION =
|
public static final int USAGE_VOICE_COMMUNICATION =
|
||||||
android.media.AudioAttributes.USAGE_VOICE_COMMUNICATION;
|
android.media.AudioAttributes.USAGE_VOICE_COMMUNICATION;
|
||||||
/**
|
/** @see android.media.AudioAttributes#USAGE_VOICE_COMMUNICATION_SIGNALLING */
|
||||||
* @see android.media.AudioAttributes#USAGE_VOICE_COMMUNICATION_SIGNALLING
|
|
||||||
*/
|
|
||||||
public static final int USAGE_VOICE_COMMUNICATION_SIGNALLING =
|
public static final int USAGE_VOICE_COMMUNICATION_SIGNALLING =
|
||||||
android.media.AudioAttributes.USAGE_VOICE_COMMUNICATION_SIGNALLING;
|
android.media.AudioAttributes.USAGE_VOICE_COMMUNICATION_SIGNALLING;
|
||||||
|
|
||||||
@ -518,13 +446,9 @@ public final class C {
|
|||||||
BUFFER_FLAG_DECODE_ONLY
|
BUFFER_FLAG_DECODE_ONLY
|
||||||
})
|
})
|
||||||
public @interface BufferFlags {}
|
public @interface BufferFlags {}
|
||||||
/**
|
/** Indicates that a buffer holds a synchronization sample. */
|
||||||
* Indicates that a buffer holds a synchronization sample.
|
|
||||||
*/
|
|
||||||
public static final int BUFFER_FLAG_KEY_FRAME = MediaCodec.BUFFER_FLAG_KEY_FRAME;
|
public static final int BUFFER_FLAG_KEY_FRAME = MediaCodec.BUFFER_FLAG_KEY_FRAME;
|
||||||
/**
|
/** Flag for empty buffers that signal that the end of the stream was reached. */
|
||||||
* Flag for empty buffers that signal that the end of the stream was reached.
|
|
||||||
*/
|
|
||||||
public static final int BUFFER_FLAG_END_OF_STREAM = MediaCodec.BUFFER_FLAG_END_OF_STREAM;
|
public static final int BUFFER_FLAG_END_OF_STREAM = MediaCodec.BUFFER_FLAG_END_OF_STREAM;
|
||||||
/** Indicates that a buffer has supplemental data. */
|
/** Indicates that a buffer has supplemental data. */
|
||||||
public static final int BUFFER_FLAG_HAS_SUPPLEMENTAL_DATA = 1 << 28; // 0x10000000
|
public static final int BUFFER_FLAG_HAS_SUPPLEMENTAL_DATA = 1 << 28; // 0x10000000
|
||||||
@ -577,9 +501,7 @@ public final class C {
|
|||||||
flag = true,
|
flag = true,
|
||||||
value = {SELECTION_FLAG_DEFAULT, SELECTION_FLAG_FORCED, SELECTION_FLAG_AUTOSELECT})
|
value = {SELECTION_FLAG_DEFAULT, SELECTION_FLAG_FORCED, SELECTION_FLAG_AUTOSELECT})
|
||||||
public @interface SelectionFlags {}
|
public @interface SelectionFlags {}
|
||||||
/**
|
/** Indicates that the track should be selected if user preferences do not state otherwise. */
|
||||||
* Indicates that the track should be selected if user preferences do not state otherwise.
|
|
||||||
*/
|
|
||||||
public static final int SELECTION_FLAG_DEFAULT = 1;
|
public static final int SELECTION_FLAG_DEFAULT = 1;
|
||||||
/**
|
/**
|
||||||
* Indicates that the track should be selected if its language matches the language of the
|
* Indicates that the track should be selected if its language matches the language of the
|
||||||
@ -608,17 +530,11 @@ public final class C {
|
|||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@IntDef({TYPE_DASH, TYPE_SS, TYPE_HLS, TYPE_RTSP, TYPE_OTHER})
|
@IntDef({TYPE_DASH, TYPE_SS, TYPE_HLS, TYPE_RTSP, TYPE_OTHER})
|
||||||
public @interface ContentType {}
|
public @interface ContentType {}
|
||||||
/**
|
/** Value returned by {@link Util#inferContentType(String)} for DASH manifests. */
|
||||||
* Value returned by {@link Util#inferContentType(String)} for DASH manifests.
|
|
||||||
*/
|
|
||||||
public static final int TYPE_DASH = 0;
|
public static final int TYPE_DASH = 0;
|
||||||
/**
|
/** Value returned by {@link Util#inferContentType(String)} for Smooth Streaming manifests. */
|
||||||
* Value returned by {@link Util#inferContentType(String)} for Smooth Streaming manifests.
|
|
||||||
*/
|
|
||||||
public static final int TYPE_SS = 1;
|
public static final int TYPE_SS = 1;
|
||||||
/**
|
/** Value returned by {@link Util#inferContentType(String)} for HLS manifests. */
|
||||||
* Value returned by {@link Util#inferContentType(String)} for HLS manifests.
|
|
||||||
*/
|
|
||||||
public static final int TYPE_HLS = 2;
|
public static final int TYPE_HLS = 2;
|
||||||
/** Value returned by {@link Util#inferContentType(String)} for RTSP. */
|
/** Value returned by {@link Util#inferContentType(String)} for RTSP. */
|
||||||
public static final int TYPE_RTSP = 3;
|
public static final int TYPE_RTSP = 3;
|
||||||
@ -628,25 +544,17 @@ public final class C {
|
|||||||
*/
|
*/
|
||||||
public static final int TYPE_OTHER = 4;
|
public static final int TYPE_OTHER = 4;
|
||||||
|
|
||||||
/**
|
/** A return value for methods where the end of an input was encountered. */
|
||||||
* A return value for methods where the end of an input was encountered.
|
|
||||||
*/
|
|
||||||
public static final int RESULT_END_OF_INPUT = -1;
|
public static final int RESULT_END_OF_INPUT = -1;
|
||||||
/**
|
/**
|
||||||
* A return value for methods where the length of parsed data exceeds the maximum length allowed.
|
* A return value for methods where the length of parsed data exceeds the maximum length allowed.
|
||||||
*/
|
*/
|
||||||
public static final int RESULT_MAX_LENGTH_EXCEEDED = -2;
|
public static final int RESULT_MAX_LENGTH_EXCEEDED = -2;
|
||||||
/**
|
/** A return value for methods where nothing was read. */
|
||||||
* A return value for methods where nothing was read.
|
|
||||||
*/
|
|
||||||
public static final int RESULT_NOTHING_READ = -3;
|
public static final int RESULT_NOTHING_READ = -3;
|
||||||
/**
|
/** A return value for methods where a buffer was read. */
|
||||||
* A return value for methods where a buffer was read.
|
|
||||||
*/
|
|
||||||
public static final int RESULT_BUFFER_READ = -4;
|
public static final int RESULT_BUFFER_READ = -4;
|
||||||
/**
|
/** A return value for methods where a format was read. */
|
||||||
* A return value for methods where a format was read.
|
|
||||||
*/
|
|
||||||
public static final int RESULT_FORMAT_READ = -5;
|
public static final int RESULT_FORMAT_READ = -5;
|
||||||
|
|
||||||
/** A data type constant for data of unknown or unspecified type. */
|
/** A data type constant for data of unknown or unspecified type. */
|
||||||
@ -697,25 +605,15 @@ public final class C {
|
|||||||
*/
|
*/
|
||||||
public static final int TRACK_TYPE_CUSTOM_BASE = 10000;
|
public static final int TRACK_TYPE_CUSTOM_BASE = 10000;
|
||||||
|
|
||||||
/**
|
/** A selection reason constant for selections whose reasons are unknown or unspecified. */
|
||||||
* A selection reason constant for selections whose reasons are unknown or unspecified.
|
|
||||||
*/
|
|
||||||
public static final int SELECTION_REASON_UNKNOWN = 0;
|
public static final int SELECTION_REASON_UNKNOWN = 0;
|
||||||
/**
|
/** A selection reason constant for an initial track selection. */
|
||||||
* A selection reason constant for an initial track selection.
|
|
||||||
*/
|
|
||||||
public static final int SELECTION_REASON_INITIAL = 1;
|
public static final int SELECTION_REASON_INITIAL = 1;
|
||||||
/**
|
/** A selection reason constant for an manual (i.e. user initiated) track selection. */
|
||||||
* A selection reason constant for an manual (i.e. user initiated) track selection.
|
|
||||||
*/
|
|
||||||
public static final int SELECTION_REASON_MANUAL = 2;
|
public static final int SELECTION_REASON_MANUAL = 2;
|
||||||
/**
|
/** A selection reason constant for an adaptive track selection. */
|
||||||
* A selection reason constant for an adaptive track selection.
|
|
||||||
*/
|
|
||||||
public static final int SELECTION_REASON_ADAPTIVE = 3;
|
public static final int SELECTION_REASON_ADAPTIVE = 3;
|
||||||
/**
|
/** A selection reason constant for a trick play track selection. */
|
||||||
* A selection reason constant for a trick play track selection.
|
|
||||||
*/
|
|
||||||
public static final int SELECTION_REASON_TRICK_PLAY = 4;
|
public static final int SELECTION_REASON_TRICK_PLAY = 4;
|
||||||
/**
|
/**
|
||||||
* Applications or extensions may define custom {@code SELECTION_REASON_*} constants greater than
|
* Applications or extensions may define custom {@code SELECTION_REASON_*} constants greater than
|
||||||
@ -743,36 +641,36 @@ public final class C {
|
|||||||
public static final String CENC_TYPE_cbcs = "cbcs";
|
public static final String CENC_TYPE_cbcs = "cbcs";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Nil UUID as defined by
|
* The Nil UUID as defined by <a
|
||||||
* <a href="https://tools.ietf.org/html/rfc4122#section-4.1.7">RFC4122</a>.
|
* href="https://tools.ietf.org/html/rfc4122#section-4.1.7">RFC4122</a>.
|
||||||
*/
|
*/
|
||||||
public static final UUID UUID_NIL = new UUID(0L, 0L);
|
public static final UUID UUID_NIL = new UUID(0L, 0L);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UUID for the W3C
|
* UUID for the W3C <a
|
||||||
* <a href="https://w3c.github.io/encrypted-media/format-registry/initdata/cenc.html">Common PSSH
|
* href="https://w3c.github.io/encrypted-media/format-registry/initdata/cenc.html">Common PSSH
|
||||||
* box</a>.
|
* box</a>.
|
||||||
*/
|
*/
|
||||||
public static final UUID COMMON_PSSH_UUID = new UUID(0x1077EFECC0B24D02L, 0xACE33C1E52E2FB4BL);
|
public static final UUID COMMON_PSSH_UUID = new UUID(0x1077EFECC0B24D02L, 0xACE33C1E52E2FB4BL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UUID for the ClearKey DRM scheme.
|
* UUID for the ClearKey DRM scheme.
|
||||||
* <p>
|
*
|
||||||
* ClearKey is supported on Android devices running Android 5.0 (API Level 21) and up.
|
* <p>ClearKey is supported on Android devices running Android 5.0 (API Level 21) and up.
|
||||||
*/
|
*/
|
||||||
public static final UUID CLEARKEY_UUID = new UUID(0xE2719D58A985B3C9L, 0x781AB030AF78D30EL);
|
public static final UUID CLEARKEY_UUID = new UUID(0xE2719D58A985B3C9L, 0x781AB030AF78D30EL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UUID for the Widevine DRM scheme.
|
* UUID for the Widevine DRM scheme.
|
||||||
* <p>
|
*
|
||||||
* Widevine is supported on Android devices running Android 4.3 (API Level 18) and up.
|
* <p>Widevine is supported on Android devices running Android 4.3 (API Level 18) and up.
|
||||||
*/
|
*/
|
||||||
public static final UUID WIDEVINE_UUID = new UUID(0xEDEF8BA979D64ACEL, 0xA3C827DCD51D21EDL);
|
public static final UUID WIDEVINE_UUID = new UUID(0xEDEF8BA979D64ACEL, 0xA3C827DCD51D21EDL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UUID for the PlayReady DRM scheme.
|
* UUID for the PlayReady DRM scheme.
|
||||||
* <p>
|
*
|
||||||
* PlayReady is supported on all AndroidTV devices. Note that most other Android devices do not
|
* <p>PlayReady is supported on all AndroidTV devices. Note that most other Android devices do not
|
||||||
* provide PlayReady support.
|
* provide PlayReady support.
|
||||||
*/
|
*/
|
||||||
public static final UUID PLAYREADY_UUID = new UUID(0x9A04F07998404286L, 0xAB92E65BE0885F95L);
|
public static final UUID PLAYREADY_UUID = new UUID(0x9A04F07998404286L, 0xAB92E65BE0885F95L);
|
||||||
@ -816,21 +714,15 @@ public final class C {
|
|||||||
STEREO_MODE_STEREO_MESH
|
STEREO_MODE_STEREO_MESH
|
||||||
})
|
})
|
||||||
public @interface StereoMode {}
|
public @interface StereoMode {}
|
||||||
/**
|
/** Indicates Monoscopic stereo layout, used with 360/3D/VR videos. */
|
||||||
* Indicates Monoscopic stereo layout, used with 360/3D/VR videos.
|
|
||||||
*/
|
|
||||||
public static final int STEREO_MODE_MONO = 0;
|
public static final int STEREO_MODE_MONO = 0;
|
||||||
/**
|
/** Indicates Top-Bottom stereo layout, used with 360/3D/VR videos. */
|
||||||
* Indicates Top-Bottom stereo layout, used with 360/3D/VR videos.
|
|
||||||
*/
|
|
||||||
public static final int STEREO_MODE_TOP_BOTTOM = 1;
|
public static final int STEREO_MODE_TOP_BOTTOM = 1;
|
||||||
/**
|
/** Indicates Left-Right stereo layout, used with 360/3D/VR videos. */
|
||||||
* Indicates Left-Right stereo layout, used with 360/3D/VR videos.
|
|
||||||
*/
|
|
||||||
public static final int STEREO_MODE_LEFT_RIGHT = 2;
|
public static final int STEREO_MODE_LEFT_RIGHT = 2;
|
||||||
/**
|
/**
|
||||||
* Indicates a stereo layout where the left and right eyes have separate meshes,
|
* Indicates a stereo layout where the left and right eyes have separate meshes, used with
|
||||||
* used with 360/3D/VR videos.
|
* 360/3D/VR videos.
|
||||||
*/
|
*/
|
||||||
public static final int STEREO_MODE_STEREO_MESH = 3;
|
public static final int STEREO_MODE_STEREO_MESH = 3;
|
||||||
|
|
||||||
@ -842,17 +734,11 @@ public final class C {
|
|||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@IntDef({Format.NO_VALUE, COLOR_SPACE_BT709, COLOR_SPACE_BT601, COLOR_SPACE_BT2020})
|
@IntDef({Format.NO_VALUE, COLOR_SPACE_BT709, COLOR_SPACE_BT601, COLOR_SPACE_BT2020})
|
||||||
public @interface ColorSpace {}
|
public @interface ColorSpace {}
|
||||||
/**
|
/** @see MediaFormat#COLOR_STANDARD_BT709 */
|
||||||
* @see MediaFormat#COLOR_STANDARD_BT709
|
|
||||||
*/
|
|
||||||
public static final int COLOR_SPACE_BT709 = MediaFormat.COLOR_STANDARD_BT709;
|
public static final int COLOR_SPACE_BT709 = MediaFormat.COLOR_STANDARD_BT709;
|
||||||
/**
|
/** @see MediaFormat#COLOR_STANDARD_BT601_PAL */
|
||||||
* @see MediaFormat#COLOR_STANDARD_BT601_PAL
|
|
||||||
*/
|
|
||||||
public static final int COLOR_SPACE_BT601 = MediaFormat.COLOR_STANDARD_BT601_PAL;
|
public static final int COLOR_SPACE_BT601 = MediaFormat.COLOR_STANDARD_BT601_PAL;
|
||||||
/**
|
/** @see MediaFormat#COLOR_STANDARD_BT2020 */
|
||||||
* @see MediaFormat#COLOR_STANDARD_BT2020
|
|
||||||
*/
|
|
||||||
public static final int COLOR_SPACE_BT2020 = MediaFormat.COLOR_STANDARD_BT2020;
|
public static final int COLOR_SPACE_BT2020 = MediaFormat.COLOR_STANDARD_BT2020;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -863,17 +749,11 @@ public final class C {
|
|||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@IntDef({Format.NO_VALUE, COLOR_TRANSFER_SDR, COLOR_TRANSFER_ST2084, COLOR_TRANSFER_HLG})
|
@IntDef({Format.NO_VALUE, COLOR_TRANSFER_SDR, COLOR_TRANSFER_ST2084, COLOR_TRANSFER_HLG})
|
||||||
public @interface ColorTransfer {}
|
public @interface ColorTransfer {}
|
||||||
/**
|
/** @see MediaFormat#COLOR_TRANSFER_SDR_VIDEO */
|
||||||
* @see MediaFormat#COLOR_TRANSFER_SDR_VIDEO
|
|
||||||
*/
|
|
||||||
public static final int COLOR_TRANSFER_SDR = MediaFormat.COLOR_TRANSFER_SDR_VIDEO;
|
public static final int COLOR_TRANSFER_SDR = MediaFormat.COLOR_TRANSFER_SDR_VIDEO;
|
||||||
/**
|
/** @see MediaFormat#COLOR_TRANSFER_ST2084 */
|
||||||
* @see MediaFormat#COLOR_TRANSFER_ST2084
|
|
||||||
*/
|
|
||||||
public static final int COLOR_TRANSFER_ST2084 = MediaFormat.COLOR_TRANSFER_ST2084;
|
public static final int COLOR_TRANSFER_ST2084 = MediaFormat.COLOR_TRANSFER_ST2084;
|
||||||
/**
|
/** @see MediaFormat#COLOR_TRANSFER_HLG */
|
||||||
* @see MediaFormat#COLOR_TRANSFER_HLG
|
|
||||||
*/
|
|
||||||
public static final int COLOR_TRANSFER_HLG = MediaFormat.COLOR_TRANSFER_HLG;
|
public static final int COLOR_TRANSFER_HLG = MediaFormat.COLOR_TRANSFER_HLG;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -884,13 +764,9 @@ public final class C {
|
|||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@IntDef({Format.NO_VALUE, COLOR_RANGE_LIMITED, COLOR_RANGE_FULL})
|
@IntDef({Format.NO_VALUE, COLOR_RANGE_LIMITED, COLOR_RANGE_FULL})
|
||||||
public @interface ColorRange {}
|
public @interface ColorRange {}
|
||||||
/**
|
/** @see MediaFormat#COLOR_RANGE_LIMITED */
|
||||||
* @see MediaFormat#COLOR_RANGE_LIMITED
|
|
||||||
*/
|
|
||||||
public static final int COLOR_RANGE_LIMITED = MediaFormat.COLOR_RANGE_LIMITED;
|
public static final int COLOR_RANGE_LIMITED = MediaFormat.COLOR_RANGE_LIMITED;
|
||||||
/**
|
/** @see MediaFormat#COLOR_RANGE_FULL */
|
||||||
* @see MediaFormat#COLOR_RANGE_FULL
|
|
||||||
*/
|
|
||||||
public static final int COLOR_RANGE_FULL = MediaFormat.COLOR_RANGE_FULL;
|
public static final int COLOR_RANGE_FULL = MediaFormat.COLOR_RANGE_FULL;
|
||||||
|
|
||||||
/** Video projection types. */
|
/** Video projection types. */
|
||||||
@ -1150,8 +1026,8 @@ public final class C {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a time in milliseconds to the corresponding time in microseconds, preserving
|
* Converts a time in milliseconds to the corresponding time in microseconds, preserving {@link
|
||||||
* {@link #TIME_UNSET} values and {@link #TIME_END_OF_SOURCE} values.
|
* #TIME_UNSET} values and {@link #TIME_END_OF_SOURCE} values.
|
||||||
*
|
*
|
||||||
* @param timeMs The time in milliseconds.
|
* @param timeMs The time in milliseconds.
|
||||||
* @return The corresponding time in microseconds.
|
* @return The corresponding time in microseconds.
|
||||||
|
@ -59,8 +59,8 @@ public final class ExoPlaybackException extends Exception implements Bundleable
|
|||||||
public static final int TYPE_RENDERER = 1;
|
public static final int TYPE_RENDERER = 1;
|
||||||
/**
|
/**
|
||||||
* The error was an unexpected {@link RuntimeException}.
|
* 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;
|
public static final int TYPE_UNEXPECTED = 2;
|
||||||
/**
|
/**
|
||||||
|
@ -21,9 +21,7 @@ import java.util.HashSet;
|
|||||||
/** Information about the ExoPlayer library. */
|
/** Information about the ExoPlayer library. */
|
||||||
public final class ExoPlayerLibraryInfo {
|
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";
|
public static final String TAG = "ExoPlayer";
|
||||||
|
|
||||||
/** The version of the library expressed as a string, for example "1.2.3". */
|
/** 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.
|
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() {
|
public static synchronized String registeredModules() {
|
||||||
return registeredModulesString;
|
return registeredModulesString;
|
||||||
}
|
}
|
||||||
@ -90,5 +86,4 @@ public final class ExoPlayerLibraryInfo {
|
|||||||
registeredModulesString = registeredModulesString + ", " + name;
|
registeredModulesString = registeredModulesString + ", " + name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -681,8 +681,8 @@ public final class Format implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
public final int maxInputSize;
|
public final int maxInputSize;
|
||||||
/**
|
/**
|
||||||
* Initialization data that must be provided to the decoder. Will not be null, but may be empty
|
* Initialization data that must be provided to the decoder. Will not be null, but may be empty if
|
||||||
* if initialization data is not required.
|
* initialization data is not required.
|
||||||
*/
|
*/
|
||||||
public final List<byte[]> initializationData;
|
public final List<byte[]> initializationData;
|
||||||
/** DRM initialization data if the stream is protected, or null otherwise. */
|
/** DRM initialization data if the stream is protected, or null otherwise. */
|
||||||
@ -697,17 +697,11 @@ public final class Format implements Parcelable {
|
|||||||
|
|
||||||
// Video specific.
|
// 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;
|
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;
|
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;
|
public final float frameRate;
|
||||||
/**
|
/**
|
||||||
* The clockwise rotation that should be applied to the video for it to be rendered in the correct
|
* 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.
|
// 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;
|
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;
|
public final int sampleRate;
|
||||||
/** The {@link C.PcmEncoding} for PCM audio. Set to {@link #NO_VALUE} for other media types. */
|
/** The {@link C.PcmEncoding} for PCM audio. Set to {@link #NO_VALUE} for other media types. */
|
||||||
@C.PcmEncoding public final int pcmEncoding;
|
@C.PcmEncoding public final int pcmEncoding;
|
||||||
@ -1549,7 +1539,8 @@ public final class Format implements Parcelable {
|
|||||||
dest.writeInt(accessibilityChannel);
|
dest.writeInt(accessibilityChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Creator<Format> CREATOR = new Creator<Format>() {
|
public static final Creator<Format> CREATOR =
|
||||||
|
new Creator<Format>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Format createFromParcel(Parcel in) {
|
public Format createFromParcel(Parcel in) {
|
||||||
@ -1560,6 +1551,5 @@ public final class Format implements Parcelable {
|
|||||||
public Format[] newArray(int size) {
|
public Format[] newArray(int size) {
|
||||||
return new Format[size];
|
return new Format[size];
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -21,17 +21,11 @@ package com.google.android.exoplayer2;
|
|||||||
*/
|
*/
|
||||||
public final class IllegalSeekPositionException extends IllegalStateException {
|
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;
|
public final Timeline timeline;
|
||||||
/**
|
/** The index of the window being seeked to. */
|
||||||
* The index of the window being seeked to.
|
|
||||||
*/
|
|
||||||
public final int windowIndex;
|
public final int windowIndex;
|
||||||
/**
|
/** The seek position in the specified window. */
|
||||||
* The seek position in the specified window.
|
|
||||||
*/
|
|
||||||
public final long positionMs;
|
public final long positionMs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -44,5 +38,4 @@ public final class IllegalSeekPositionException extends IllegalStateException {
|
|||||||
this.windowIndex = windowIndex;
|
this.windowIndex = windowIndex;
|
||||||
this.positionMs = positionMs;
|
this.positionMs = positionMs;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -559,9 +559,7 @@ public final class MediaItem implements Bundleable {
|
|||||||
return this;
|
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() {
|
public MediaItem build() {
|
||||||
checkState(drmLicenseUri == null || drmUuid != null);
|
checkState(drmLicenseUri == null || drmUuid != null);
|
||||||
@Nullable PlaybackProperties playbackProperties = null;
|
@Nullable PlaybackProperties playbackProperties = null;
|
||||||
|
@ -24,16 +24,12 @@ public class ParserException extends IOException {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @param message The detail message for the exception. */
|
||||||
* @param message The detail message for the exception.
|
|
||||||
*/
|
|
||||||
public ParserException(String message) {
|
public ParserException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @param cause The cause for the exception. */
|
||||||
* @param cause The cause for the exception.
|
|
||||||
*/
|
|
||||||
public ParserException(Throwable cause) {
|
public ParserException(Throwable cause) {
|
||||||
super(cause);
|
super(cause);
|
||||||
}
|
}
|
||||||
@ -45,5 +41,4 @@ public class ParserException extends IOException {
|
|||||||
public ParserException(String message, Throwable cause) {
|
public ParserException(String message, Throwable cause) {
|
||||||
super(message, cause);
|
super(message, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -229,9 +229,7 @@ public abstract class Timeline implements Bundleable {
|
|||||||
*/
|
*/
|
||||||
public long defaultPositionUs;
|
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;
|
public long durationUs;
|
||||||
|
|
||||||
/** The index of the first period that belongs to this window. */
|
/** The index of the first period that belongs to this window. */
|
||||||
@ -312,16 +310,12 @@ public abstract class Timeline implements Bundleable {
|
|||||||
return defaultPositionUs;
|
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() {
|
public long getDurationMs() {
|
||||||
return C.usToMs(durationUs);
|
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() {
|
public long getDurationUs() {
|
||||||
return durationUs;
|
return durationUs;
|
||||||
}
|
}
|
||||||
@ -572,14 +566,10 @@ public abstract class Timeline implements Bundleable {
|
|||||||
*/
|
*/
|
||||||
@Nullable public Object uid;
|
@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;
|
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;
|
public long durationUs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -660,16 +650,12 @@ public abstract class Timeline implements Bundleable {
|
|||||||
return this;
|
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() {
|
public long getDurationMs() {
|
||||||
return C.usToMs(durationUs);
|
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() {
|
public long getDurationUs() {
|
||||||
return durationUs;
|
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
|
* Returns the number of ads in the ad group at index {@code adGroupIndex}, or {@link
|
||||||
* {@link C#LENGTH_UNSET} if not yet known.
|
* C#LENGTH_UNSET} if not yet known.
|
||||||
*
|
*
|
||||||
* @param adGroupIndex The ad group index.
|
* @param adGroupIndex The ad group index.
|
||||||
* @return The number of ads in the ad group, or {@link C#LENGTH_UNSET} if not yet known.
|
* @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
|
* Returns the duration of the ad at index {@code adIndexInAdGroup} in the ad group at {@code
|
||||||
* {@code adGroupIndex}, in microseconds, or {@link C#TIME_UNSET} if not yet known.
|
* adGroupIndex}, in microseconds, or {@link C#TIME_UNSET} if not yet known.
|
||||||
*
|
*
|
||||||
* @param adGroupIndex The ad group index.
|
* @param adGroupIndex The ad group index.
|
||||||
* @param adIndexInAdGroup The ad index in the ad group.
|
* @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() {
|
public final boolean isEmpty() {
|
||||||
return getWindowCount() == 0;
|
return getWindowCount() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Returns the number of windows in the timeline. */
|
||||||
* Returns the number of windows in the timeline.
|
|
||||||
*/
|
|
||||||
public abstract int getWindowCount();
|
public abstract int getWindowCount();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -974,13 +956,15 @@ public abstract class Timeline implements Bundleable {
|
|||||||
int windowIndex, @Player.RepeatMode int repeatMode, boolean shuffleModeEnabled) {
|
int windowIndex, @Player.RepeatMode int repeatMode, boolean shuffleModeEnabled) {
|
||||||
switch (repeatMode) {
|
switch (repeatMode) {
|
||||||
case Player.REPEAT_MODE_OFF:
|
case Player.REPEAT_MODE_OFF:
|
||||||
return windowIndex == getLastWindowIndex(shuffleModeEnabled) ? C.INDEX_UNSET
|
return windowIndex == getLastWindowIndex(shuffleModeEnabled)
|
||||||
|
? C.INDEX_UNSET
|
||||||
: windowIndex + 1;
|
: windowIndex + 1;
|
||||||
case Player.REPEAT_MODE_ONE:
|
case Player.REPEAT_MODE_ONE:
|
||||||
return windowIndex;
|
return windowIndex;
|
||||||
case Player.REPEAT_MODE_ALL:
|
case Player.REPEAT_MODE_ALL:
|
||||||
return windowIndex == getLastWindowIndex(shuffleModeEnabled)
|
return windowIndex == getLastWindowIndex(shuffleModeEnabled)
|
||||||
? getFirstWindowIndex(shuffleModeEnabled) : windowIndex + 1;
|
? getFirstWindowIndex(shuffleModeEnabled)
|
||||||
|
: windowIndex + 1;
|
||||||
default:
|
default:
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
@ -999,13 +983,15 @@ public abstract class Timeline implements Bundleable {
|
|||||||
int windowIndex, @Player.RepeatMode int repeatMode, boolean shuffleModeEnabled) {
|
int windowIndex, @Player.RepeatMode int repeatMode, boolean shuffleModeEnabled) {
|
||||||
switch (repeatMode) {
|
switch (repeatMode) {
|
||||||
case Player.REPEAT_MODE_OFF:
|
case Player.REPEAT_MODE_OFF:
|
||||||
return windowIndex == getFirstWindowIndex(shuffleModeEnabled) ? C.INDEX_UNSET
|
return windowIndex == getFirstWindowIndex(shuffleModeEnabled)
|
||||||
|
? C.INDEX_UNSET
|
||||||
: windowIndex - 1;
|
: windowIndex - 1;
|
||||||
case Player.REPEAT_MODE_ONE:
|
case Player.REPEAT_MODE_ONE:
|
||||||
return windowIndex;
|
return windowIndex;
|
||||||
case Player.REPEAT_MODE_ALL:
|
case Player.REPEAT_MODE_ALL:
|
||||||
return windowIndex == getFirstWindowIndex(shuffleModeEnabled)
|
return windowIndex == getFirstWindowIndex(shuffleModeEnabled)
|
||||||
? getLastWindowIndex(shuffleModeEnabled) : windowIndex - 1;
|
? getLastWindowIndex(shuffleModeEnabled)
|
||||||
|
: windowIndex - 1;
|
||||||
default:
|
default:
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
@ -1064,9 +1050,7 @@ public abstract class Timeline implements Bundleable {
|
|||||||
public abstract Window getWindow(
|
public abstract Window getWindow(
|
||||||
int windowIndex, Window window, long defaultPositionProjectionUs);
|
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();
|
public abstract int getPeriodCount();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -66,21 +66,13 @@ public final class Ac3Util {
|
|||||||
* #STREAM_TYPE_UNDEFINED} otherwise.
|
* #STREAM_TYPE_UNDEFINED} otherwise.
|
||||||
*/
|
*/
|
||||||
public final @StreamType int streamType;
|
public final @StreamType int streamType;
|
||||||
/**
|
/** The audio sampling rate in Hz. */
|
||||||
* The audio sampling rate in Hz.
|
|
||||||
*/
|
|
||||||
public final int sampleRate;
|
public final int sampleRate;
|
||||||
/**
|
/** The number of audio channels */
|
||||||
* The number of audio channels
|
|
||||||
*/
|
|
||||||
public final int channelCount;
|
public final int channelCount;
|
||||||
/**
|
/** The size of the frame. */
|
||||||
* The size of the frame.
|
|
||||||
*/
|
|
||||||
public final int frameSize;
|
public final int frameSize;
|
||||||
/**
|
/** Number of audio samples in the frame. */
|
||||||
* Number of audio samples in the frame.
|
|
||||||
*/
|
|
||||||
public final int sampleCount;
|
public final int sampleCount;
|
||||||
|
|
||||||
private SyncFrameInfo(
|
private SyncFrameInfo(
|
||||||
@ -97,7 +89,6 @@ public final class Ac3Util {
|
|||||||
this.frameSize = frameSize;
|
this.frameSize = frameSize;
|
||||||
this.sampleCount = sampleCount;
|
this.sampleCount = sampleCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Maximum rate for an AC-3 audio stream, in bytes per second. */
|
/** 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;
|
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;
|
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. */
|
/** 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;
|
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};
|
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};
|
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};
|
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};
|
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.) */
|
/** Nominal bitrates in kbps, indexed by frmsizecod / 2. (See table 4.13.) */
|
||||||
private static final int[] BITRATE_BY_HALF_FRMSIZECOD =
|
private static final int[] BITRATE_BY_HALF_FRMSIZECOD =
|
||||||
@ -316,7 +297,7 @@ public final class Ac3Util {
|
|||||||
}
|
}
|
||||||
if (streamType == SyncFrameInfo.STREAM_TYPE_TYPE0) {
|
if (streamType == SyncFrameInfo.STREAM_TYPE_TYPE0) {
|
||||||
if (data.readBit()) { // pgmscle
|
if (data.readBit()) { // pgmscle
|
||||||
data.skipBits(6); //pgmscl
|
data.skipBits(6); // pgmscl
|
||||||
}
|
}
|
||||||
if (acmod == 0 && data.readBit()) { // pgmscl2e
|
if (acmod == 0 && data.readBit()) { // pgmscl2e
|
||||||
data.skipBits(6); // pgmscl2
|
data.skipBits(6); // pgmscl2
|
||||||
@ -562,7 +543,9 @@ public final class Ac3Util {
|
|||||||
|
|
||||||
private static int getAc3SyncframeSize(int fscod, int frmsizecod) {
|
private static int getAc3SyncframeSize(int fscod, int frmsizecod) {
|
||||||
int halfFrmsizecod = frmsizecod / 2;
|
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) {
|
|| halfFrmsizecod >= SYNCFRAME_SIZE_WORDS_BY_HALF_FRMSIZECOD_44_1.length) {
|
||||||
// Invalid values provided.
|
// Invalid values provided.
|
||||||
return C.LENGTH_UNSET;
|
return C.LENGTH_UNSET;
|
||||||
@ -580,5 +563,4 @@ public final class Ac3Util {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Ac3Util() {}
|
private Ac3Util() {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -41,9 +41,7 @@ public final class AudioAttributes implements Bundleable {
|
|||||||
|
|
||||||
public static final AudioAttributes DEFAULT = new Builder().build();
|
public static final AudioAttributes DEFAULT = new Builder().build();
|
||||||
|
|
||||||
/**
|
/** Builder for {@link AudioAttributes}. */
|
||||||
* Builder for {@link AudioAttributes}.
|
|
||||||
*/
|
|
||||||
public static final class Builder {
|
public static final class Builder {
|
||||||
|
|
||||||
private @C.AudioContentType int contentType;
|
private @C.AudioContentType int contentType;
|
||||||
@ -64,25 +62,19 @@ public final class AudioAttributes implements Bundleable {
|
|||||||
allowedCapturePolicy = C.ALLOW_CAPTURE_BY_ALL;
|
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) {
|
public Builder setContentType(@C.AudioContentType int contentType) {
|
||||||
this.contentType = contentType;
|
this.contentType = contentType;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @see android.media.AudioAttributes.Builder#setFlags(int) */
|
||||||
* @see android.media.AudioAttributes.Builder#setFlags(int)
|
|
||||||
*/
|
|
||||||
public Builder setFlags(@C.AudioFlags int flags) {
|
public Builder setFlags(@C.AudioFlags int flags) {
|
||||||
this.flags = flags;
|
this.flags = flags;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @see android.media.AudioAttributes.Builder#setUsage(int) */
|
||||||
* @see android.media.AudioAttributes.Builder#setUsage(int)
|
|
||||||
*/
|
|
||||||
public Builder setUsage(@C.AudioUsage int usage) {
|
public Builder setUsage(@C.AudioUsage int usage) {
|
||||||
this.usage = usage;
|
this.usage = usage;
|
||||||
return this;
|
return this;
|
||||||
@ -98,7 +90,6 @@ public final class AudioAttributes implements Bundleable {
|
|||||||
public AudioAttributes build() {
|
public AudioAttributes build() {
|
||||||
return new AudioAttributes(contentType, flags, usage, allowedCapturePolicy);
|
return new AudioAttributes(contentType, flags, usage, allowedCapturePolicy);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final @C.AudioContentType int contentType;
|
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_LE = (byte) (SYNC_VALUE_LE >>> 24);
|
||||||
private static final byte FIRST_BYTE_14B_LE = (byte) (SYNC_VALUE_14B_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. */
|
||||||
* 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};
|
||||||
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. */
|
||||||
* 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[] {
|
||||||
private static final int[] SAMPLE_RATE_BY_SFREQ = new int[] {-1, 8000, 16000, 32000, -1, -1,
|
-1, 8000, 16000, 32000, -1, -1, 11025, 22050, 44100, -1, -1, 12000, 24000, 48000, -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. */
|
||||||
* 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[] {
|
||||||
private static final int[] TWICE_BITRATE_KBPS_BY_RATE = new int[] {64, 112, 128, 192, 224, 256,
|
64, 112, 128, 192, 224, 256, 384, 448, 512, 640, 768, 896, 1024, 1152, 1280, 1536, 1920,
|
||||||
384, 448, 512, 640, 768, 896, 1024, 1152, 1280, 1536, 1920, 2048, 2304, 2560, 2688, 2816,
|
2048, 2304, 2560, 2688, 2816, 2823, 2944, 3072, 3840, 4096, 6144, 7680
|
||||||
2823, 2944, 3072, 3840, 4096, 6144, 7680};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether a given integer matches a DTS sync word. Synchronization and storage modes are
|
* Returns whether a given integer matches a DTS sync word. Synchronization and storage modes are
|
||||||
@ -99,7 +97,9 @@ public final class DtsUtil {
|
|||||||
int sfreq = frameBits.readBits(4);
|
int sfreq = frameBits.readBits(4);
|
||||||
int sampleRate = SAMPLE_RATE_BY_SFREQ[sfreq];
|
int sampleRate = SAMPLE_RATE_BY_SFREQ[sfreq];
|
||||||
int rate = frameBits.readBits(5);
|
int rate = frameBits.readBits(5);
|
||||||
int bitrate = rate >= TWICE_BITRATE_KBPS_BY_RATE.length ? Format.NO_VALUE
|
int bitrate =
|
||||||
|
rate >= TWICE_BITRATE_KBPS_BY_RATE.length
|
||||||
|
? Format.NO_VALUE
|
||||||
: TWICE_BITRATE_KBPS_BY_RATE[rate] * 1000 / 2;
|
: TWICE_BITRATE_KBPS_BY_RATE[rate] * 1000 / 2;
|
||||||
frameBits.skipBits(10); // MIX, DYNF, TIMEF, AUXF, HDCD, EXT_AUDIO_ID, EXT_AUDIO, ASPF
|
frameBits.skipBits(10); // MIX, DYNF, TIMEF, AUXF, HDCD, EXT_AUDIO_ID, EXT_AUDIO, ASPF
|
||||||
channelCount += frameBits.readBits(2) > 0 ? 1 : 0; // LFF
|
channelCount += frameBits.readBits(2) > 0 ? 1 : 0; // LFF
|
||||||
@ -230,5 +230,4 @@ public final class DtsUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private DtsUtil() {}
|
private DtsUtil() {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,33 +20,24 @@ import com.google.android.exoplayer2.C;
|
|||||||
/** Base class for buffers with flags. */
|
/** Base class for buffers with flags. */
|
||||||
public abstract class Buffer {
|
public abstract class Buffer {
|
||||||
|
|
||||||
@C.BufferFlags
|
@C.BufferFlags private int flags;
|
||||||
private int flags;
|
|
||||||
|
|
||||||
/**
|
/** Clears the buffer. */
|
||||||
* Clears the buffer.
|
|
||||||
*/
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
flags = 0;
|
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() {
|
public final boolean isDecodeOnly() {
|
||||||
return getFlag(C.BUFFER_FLAG_DECODE_ONLY);
|
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() {
|
public final boolean isEndOfStream() {
|
||||||
return getFlag(C.BUFFER_FLAG_END_OF_STREAM);
|
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() {
|
public final boolean isKeyFrame() {
|
||||||
return getFlag(C.BUFFER_FLAG_KEY_FRAME);
|
return getFlag(C.BUFFER_FLAG_KEY_FRAME);
|
||||||
}
|
}
|
||||||
@ -69,8 +60,8 @@ public abstract class Buffer {
|
|||||||
/**
|
/**
|
||||||
* Adds the {@code flag} to this buffer's flags.
|
* 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
|
* @param flag The flag to add to this buffer's flags, which should be one of the {@code
|
||||||
* {@code C.BUFFER_FLAG_*} constants.
|
* C.BUFFER_FLAG_*} constants.
|
||||||
*/
|
*/
|
||||||
public final void addFlag(@C.BufferFlags int flag) {
|
public final void addFlag(@C.BufferFlags int flag) {
|
||||||
flags |= flag;
|
flags |= flag;
|
||||||
@ -94,5 +85,4 @@ public abstract class Buffer {
|
|||||||
protected final boolean getFlag(@C.BufferFlags int flag) {
|
protected final boolean getFlag(@C.BufferFlags int flag) {
|
||||||
return (flags & flag) == flag;
|
return (flags & flag) == flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -63,13 +63,9 @@ public final class CryptoInfo {
|
|||||||
* @see android.media.MediaCodec.CryptoInfo#numSubSamples
|
* @see android.media.MediaCodec.CryptoInfo#numSubSamples
|
||||||
*/
|
*/
|
||||||
public int numSubSamples;
|
public int numSubSamples;
|
||||||
/**
|
/** @see android.media.MediaCodec.CryptoInfo.Pattern */
|
||||||
* @see android.media.MediaCodec.CryptoInfo.Pattern
|
|
||||||
*/
|
|
||||||
public int encryptedBlocks;
|
public int encryptedBlocks;
|
||||||
/**
|
/** @see android.media.MediaCodec.CryptoInfo.Pattern */
|
||||||
* @see android.media.MediaCodec.CryptoInfo.Pattern
|
|
||||||
*/
|
|
||||||
public int clearBlocks;
|
public int clearBlocks;
|
||||||
|
|
||||||
private final android.media.MediaCodec.CryptoInfo frameworkCryptoInfo;
|
private final android.media.MediaCodec.CryptoInfo frameworkCryptoInfo;
|
||||||
@ -80,11 +76,16 @@ public final class CryptoInfo {
|
|||||||
patternHolder = Util.SDK_INT >= 24 ? new PatternHolderV24(frameworkCryptoInfo) : null;
|
patternHolder = Util.SDK_INT >= 24 ? new PatternHolderV24(frameworkCryptoInfo) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @see android.media.MediaCodec.CryptoInfo#set(int, int[], int[], byte[], byte[], int) */
|
||||||
* @see android.media.MediaCodec.CryptoInfo#set(int, int[], int[], byte[], byte[], int)
|
public void set(
|
||||||
*/
|
int numSubSamples,
|
||||||
public void set(int numSubSamples, int[] numBytesOfClearData, int[] numBytesOfEncryptedData,
|
int[] numBytesOfClearData,
|
||||||
byte[] key, byte[] iv, @C.CryptoMode int mode, int encryptedBlocks, int clearBlocks) {
|
int[] numBytesOfEncryptedData,
|
||||||
|
byte[] key,
|
||||||
|
byte[] iv,
|
||||||
|
@C.CryptoMode int mode,
|
||||||
|
int encryptedBlocks,
|
||||||
|
int clearBlocks) {
|
||||||
this.numSubSamples = numSubSamples;
|
this.numSubSamples = numSubSamples;
|
||||||
this.numBytesOfClearData = numBytesOfClearData;
|
this.numBytesOfClearData = numBytesOfClearData;
|
||||||
this.numBytesOfEncryptedData = numBytesOfEncryptedData;
|
this.numBytesOfEncryptedData = numBytesOfEncryptedData;
|
||||||
@ -157,7 +158,5 @@ public final class CryptoInfo {
|
|||||||
pattern.set(encryptedBlocks, clearBlocks);
|
pattern.set(encryptedBlocks, clearBlocks);
|
||||||
frameworkCryptoInfo.setPattern(pattern);
|
frameworkCryptoInfo.setPattern(pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -66,22 +66,14 @@ public class DecoderInputBuffer extends Buffer {
|
|||||||
BUFFER_REPLACEMENT_MODE_DIRECT
|
BUFFER_REPLACEMENT_MODE_DIRECT
|
||||||
})
|
})
|
||||||
public @interface BufferReplacementMode {}
|
public @interface BufferReplacementMode {}
|
||||||
/**
|
/** Disallows buffer replacement. */
|
||||||
* Disallows buffer replacement.
|
|
||||||
*/
|
|
||||||
public static final int BUFFER_REPLACEMENT_MODE_DISABLED = 0;
|
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;
|
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;
|
public static final int BUFFER_REPLACEMENT_MODE_DIRECT = 2;
|
||||||
|
|
||||||
/**
|
/** {@link CryptoInfo} for encrypted data. */
|
||||||
* {@link CryptoInfo} for encrypted data.
|
|
||||||
*/
|
|
||||||
public final CryptoInfo cryptoInfo;
|
public final CryptoInfo cryptoInfo;
|
||||||
|
|
||||||
/** The buffer's data, or {@code null} if no data has been set. */
|
/** 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;
|
public boolean waitingForKeys;
|
||||||
|
|
||||||
/**
|
/** The time at which the sample should be presented. */
|
||||||
* The time at which the sample should be presented.
|
|
||||||
*/
|
|
||||||
public long timeUs;
|
public long timeUs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -194,9 +184,7 @@ public class DecoderInputBuffer extends Buffer {
|
|||||||
data = newData;
|
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() {
|
public final boolean isEncrypted() {
|
||||||
return getFlag(C.BUFFER_FLAG_ENCRYPTED);
|
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. */
|
/** The protection scheme type, or null if not applicable or unknown. */
|
||||||
@Nullable public final String schemeType;
|
@Nullable public final String schemeType;
|
||||||
|
|
||||||
/**
|
/** Number of {@link SchemeData}s. */
|
||||||
* Number of {@link SchemeData}s.
|
|
||||||
*/
|
|
||||||
public final int schemeDataCount;
|
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) {
|
public DrmInitData(List<SchemeData> schemeDatas) {
|
||||||
this(null, false, schemeDatas.toArray(new SchemeData[0]));
|
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]));
|
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) {
|
public DrmInitData(SchemeData... schemeDatas) {
|
||||||
this(null, schemeDatas);
|
this(null, schemeDatas);
|
||||||
}
|
}
|
||||||
@ -122,8 +116,8 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
|
|||||||
this(schemeType, true, schemeDatas);
|
this(schemeType, true, schemeDatas);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DrmInitData(@Nullable String schemeType, boolean cloneSchemeDatas,
|
private DrmInitData(
|
||||||
SchemeData... schemeDatas) {
|
@Nullable String schemeType, boolean cloneSchemeDatas, SchemeData... schemeDatas) {
|
||||||
this.schemeType = schemeType;
|
this.schemeType = schemeType;
|
||||||
if (cloneSchemeDatas) {
|
if (cloneSchemeDatas) {
|
||||||
schemeDatas = schemeDatas.clone();
|
schemeDatas = schemeDatas.clone();
|
||||||
@ -208,7 +202,8 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(SchemeData first, SchemeData second) {
|
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);
|
: first.uuid.compareTo(second.uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +232,6 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
|
|||||||
public DrmInitData[] newArray(int size) {
|
public DrmInitData[] newArray(int size) {
|
||||||
return new DrmInitData[size];
|
return new DrmInitData[size];
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Internal methods.
|
// Internal methods.
|
||||||
@ -252,9 +246,7 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Scheme initialization data. */
|
||||||
* Scheme initialization data.
|
|
||||||
*/
|
|
||||||
public static final class SchemeData implements Parcelable {
|
public static final class SchemeData implements Parcelable {
|
||||||
|
|
||||||
// Lazily initialized hashcode.
|
// Lazily initialized hashcode.
|
||||||
@ -324,9 +316,7 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
|
|||||||
return hasData() && !other.hasData() && matches(other.uuid);
|
return hasData() && !other.hasData() && matches(other.uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Returns whether {@link #data} is non-null. */
|
||||||
* Returns whether {@link #data} is non-null.
|
|
||||||
*/
|
|
||||||
public boolean hasData() {
|
public boolean hasData() {
|
||||||
return data != null;
|
return data != null;
|
||||||
}
|
}
|
||||||
@ -396,9 +386,6 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
|
|||||||
public SchemeData[] newArray(int size) {
|
public SchemeData[] newArray(int size) {
|
||||||
return new SchemeData[size];
|
return new SchemeData[size];
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -62,16 +62,12 @@ public final class Metadata implements Parcelable {
|
|||||||
|
|
||||||
private final Entry[] entries;
|
private final Entry[] entries;
|
||||||
|
|
||||||
/**
|
/** @param entries The metadata entries. */
|
||||||
* @param entries The metadata entries.
|
|
||||||
*/
|
|
||||||
public Metadata(Entry... entries) {
|
public Metadata(Entry... entries) {
|
||||||
this.entries = entries;
|
this.entries = entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @param entries The metadata entries. */
|
||||||
* @param entries The metadata entries.
|
|
||||||
*/
|
|
||||||
public Metadata(List<? extends Entry> entries) {
|
public Metadata(List<? extends Entry> entries) {
|
||||||
this.entries = entries.toArray(new Entry[0]);
|
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() {
|
public int length() {
|
||||||
return entries.length;
|
return entries.length;
|
||||||
}
|
}
|
||||||
|
@ -22,13 +22,12 @@ import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
|
|||||||
public final class MetadataInputBuffer extends DecoderInputBuffer {
|
public final class MetadataInputBuffer extends DecoderInputBuffer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An offset that must be added to the metadata's timestamps after it's been decoded, or
|
* An offset that must be added to the metadata's timestamps after it's been decoded, or {@link
|
||||||
* {@link Format#OFFSET_SAMPLE_RELATIVE} if {@link #timeUs} should be added.
|
* Format#OFFSET_SAMPLE_RELATIVE} if {@link #timeUs} should be added.
|
||||||
*/
|
*/
|
||||||
public long subsampleOffsetUs;
|
public long subsampleOffsetUs;
|
||||||
|
|
||||||
public MetadataInputBuffer() {
|
public MetadataInputBuffer() {
|
||||||
super(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_NORMAL);
|
super(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -57,24 +57,16 @@ public final class EventMessage implements Metadata.Entry {
|
|||||||
/** The message scheme. */
|
/** The message scheme. */
|
||||||
public final String schemeIdUri;
|
public final String schemeIdUri;
|
||||||
|
|
||||||
/**
|
/** The value for the event. */
|
||||||
* The value for the event.
|
|
||||||
*/
|
|
||||||
public final String value;
|
public final String value;
|
||||||
|
|
||||||
/**
|
/** The duration of the event in milliseconds. */
|
||||||
* The duration of the event in milliseconds.
|
|
||||||
*/
|
|
||||||
public final long durationMs;
|
public final long durationMs;
|
||||||
|
|
||||||
/**
|
/** The instance identifier. */
|
||||||
* The instance identifier.
|
|
||||||
*/
|
|
||||||
public final long id;
|
public final long id;
|
||||||
|
|
||||||
/**
|
/** The body of the message. */
|
||||||
* The body of the message.
|
|
||||||
*/
|
|
||||||
public final byte[] messageData;
|
public final byte[] messageData;
|
||||||
|
|
||||||
// Lazily initialized hashcode.
|
// Lazily initialized hashcode.
|
||||||
@ -194,7 +186,5 @@ public final class EventMessage implements Metadata.Entry {
|
|||||||
public EventMessage[] newArray(int size) {
|
public EventMessage[] newArray(int size) {
|
||||||
return new EventMessage[size];
|
return new EventMessage[size];
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -69,5 +69,4 @@ public final class EventMessageEncoder {
|
|||||||
outputStream.writeByte((int) (value >>> 8) & 0xFF);
|
outputStream.writeByte((int) (value >>> 8) & 0xFF);
|
||||||
outputStream.writeByte((int) value & 0xFF);
|
outputStream.writeByte((int) value & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,8 @@ public final class ApicFrame extends Id3Frame {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ApicFrame other = (ApicFrame) obj;
|
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)
|
&& Util.areEqual(description, other.description)
|
||||||
&& Arrays.equals(pictureData, other.pictureData);
|
&& Arrays.equals(pictureData, other.pictureData);
|
||||||
}
|
}
|
||||||
@ -89,7 +90,8 @@ public final class ApicFrame extends Id3Frame {
|
|||||||
dest.writeByteArray(pictureData);
|
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
|
@Override
|
||||||
public ApicFrame createFromParcel(Parcel in) {
|
public ApicFrame createFromParcel(Parcel in) {
|
||||||
@ -100,7 +102,5 @@ public final class ApicFrame extends Id3Frame {
|
|||||||
public ApicFrame[] newArray(int size) {
|
public ApicFrame[] newArray(int size) {
|
||||||
return new ApicFrame[size];
|
return new ApicFrame[size];
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,5 @@ public final class BinaryFrame extends Id3Frame {
|
|||||||
public BinaryFrame[] newArray(int size) {
|
public BinaryFrame[] newArray(int size) {
|
||||||
return new BinaryFrame[size];
|
return new BinaryFrame[size];
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,18 +31,20 @@ public final class ChapterFrame extends Id3Frame {
|
|||||||
public final String chapterId;
|
public final String chapterId;
|
||||||
public final int startTimeMs;
|
public final int startTimeMs;
|
||||||
public final int endTimeMs;
|
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;
|
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;
|
public final long endOffset;
|
||||||
|
|
||||||
private final Id3Frame[] subFrames;
|
private final Id3Frame[] subFrames;
|
||||||
|
|
||||||
public ChapterFrame(String chapterId, int startTimeMs, int endTimeMs, long startOffset,
|
public ChapterFrame(
|
||||||
long endOffset, Id3Frame[] subFrames) {
|
String chapterId,
|
||||||
|
int startTimeMs,
|
||||||
|
int endTimeMs,
|
||||||
|
long startOffset,
|
||||||
|
long endOffset,
|
||||||
|
Id3Frame[] subFrames) {
|
||||||
super(ID);
|
super(ID);
|
||||||
this.chapterId = chapterId;
|
this.chapterId = chapterId;
|
||||||
this.startTimeMs = startTimeMs;
|
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() {
|
public int getSubFrameCount() {
|
||||||
return subFrames.length;
|
return subFrames.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Returns the sub-frame at {@code index}. */
|
||||||
* Returns the sub-frame at {@code index}.
|
|
||||||
*/
|
|
||||||
public Id3Frame getSubFrame(int index) {
|
public Id3Frame getSubFrame(int index) {
|
||||||
return subFrames[index];
|
return subFrames[index];
|
||||||
}
|
}
|
||||||
@ -126,7 +124,8 @@ public final class ChapterFrame extends Id3Frame {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Creator<ChapterFrame> CREATOR = new Creator<ChapterFrame>() {
|
public static final Creator<ChapterFrame> CREATOR =
|
||||||
|
new Creator<ChapterFrame>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChapterFrame createFromParcel(Parcel in) {
|
public ChapterFrame createFromParcel(Parcel in) {
|
||||||
@ -137,7 +136,5 @@ public final class ChapterFrame extends Id3Frame {
|
|||||||
public ChapterFrame[] newArray(int size) {
|
public ChapterFrame[] newArray(int size) {
|
||||||
return new ChapterFrame[size];
|
return new ChapterFrame[size];
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,11 @@ public final class ChapterTocFrame extends Id3Frame {
|
|||||||
public final String[] children;
|
public final String[] children;
|
||||||
private final Id3Frame[] subFrames;
|
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) {
|
Id3Frame[] subFrames) {
|
||||||
super(ID);
|
super(ID);
|
||||||
this.elementId = elementId;
|
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() {
|
public int getSubFrameCount() {
|
||||||
return subFrames.length;
|
return subFrames.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Returns the sub-frame at {@code index}. */
|
||||||
* Returns the sub-frame at {@code index}.
|
|
||||||
*/
|
|
||||||
public Id3Frame getSubFrame(int index) {
|
public Id3Frame getSubFrame(int index) {
|
||||||
return subFrames[index];
|
return subFrames[index];
|
||||||
}
|
}
|
||||||
@ -107,7 +107,8 @@ 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
|
@Override
|
||||||
public ChapterTocFrame createFromParcel(Parcel in) {
|
public ChapterTocFrame createFromParcel(Parcel in) {
|
||||||
@ -118,7 +119,5 @@ public final class ChapterTocFrame extends Id3Frame {
|
|||||||
public ChapterTocFrame[] newArray(int size) {
|
public ChapterTocFrame[] newArray(int size) {
|
||||||
return new ChapterTocFrame[size];
|
return new ChapterTocFrame[size];
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,8 @@ public final class CommentFrame extends Id3Frame {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CommentFrame other = (CommentFrame) obj;
|
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);
|
&& Util.areEqual(text, other.text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +94,5 @@ public final class CommentFrame extends Id3Frame {
|
|||||||
public CommentFrame[] newArray(int size) {
|
public CommentFrame[] newArray(int size) {
|
||||||
return new CommentFrame[size];
|
return new CommentFrame[size];
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -58,8 +58,10 @@ public final class GeobFrame extends Id3Frame {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
GeobFrame other = (GeobFrame) obj;
|
GeobFrame other = (GeobFrame) obj;
|
||||||
return Util.areEqual(mimeType, other.mimeType) && Util.areEqual(filename, other.filename)
|
return Util.areEqual(mimeType, other.mimeType)
|
||||||
&& Util.areEqual(description, other.description) && Arrays.equals(data, other.data);
|
&& Util.areEqual(filename, other.filename)
|
||||||
|
&& Util.areEqual(description, other.description)
|
||||||
|
&& Arrays.equals(data, other.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -93,7 +95,8 @@ public final class GeobFrame extends Id3Frame {
|
|||||||
dest.writeByteArray(data);
|
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
|
@Override
|
||||||
public GeobFrame createFromParcel(Parcel in) {
|
public GeobFrame createFromParcel(Parcel in) {
|
||||||
@ -104,7 +107,5 @@ public final class GeobFrame extends Id3Frame {
|
|||||||
public GeobFrame[] newArray(int size) {
|
public GeobFrame[] newArray(int size) {
|
||||||
return new GeobFrame[size];
|
return new GeobFrame[size];
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -35,9 +35,7 @@ import java.util.Locale;
|
|||||||
/** Decodes ID3 tags. */
|
/** Decodes ID3 tags. */
|
||||||
public final class Id3Decoder extends SimpleMetadataDecoder {
|
public final class Id3Decoder extends SimpleMetadataDecoder {
|
||||||
|
|
||||||
/**
|
/** A predicate for determining whether individual frames should be decoded. */
|
||||||
* A predicate for determining whether individual frames should be decoded.
|
|
||||||
*/
|
|
||||||
public interface FramePredicate {
|
public interface FramePredicate {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,7 +49,6 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
|||||||
* @return Whether the frame should be decoded.
|
* @return Whether the frame should be decoded.
|
||||||
*/
|
*/
|
||||||
boolean evaluate(int majorVersion, int id0, int id1, int id2, int id3);
|
boolean evaluate(int majorVersion, int id0, int id1, int id2, int id3);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A predicate that indicates no frames should be decoded. */
|
/** A predicate that indicates no frames should be decoded. */
|
||||||
@ -62,9 +59,7 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
|||||||
|
|
||||||
/** The first three bytes of a well formed ID3 tag header. */
|
/** The first three bytes of a well formed ID3 tag header. */
|
||||||
public static final int ID3_TAG = 0x00494433;
|
public static final int ID3_TAG = 0x00494433;
|
||||||
/**
|
/** Length of an ID3 tag header. */
|
||||||
* Length of an ID3 tag header.
|
|
||||||
*/
|
|
||||||
public static final int ID3_HEADER_LENGTH = 10;
|
public static final int ID3_HEADER_LENGTH = 10;
|
||||||
|
|
||||||
private static final int FRAME_FLAG_V3_IS_COMPRESSED = 0x0080;
|
private static final int FRAME_FLAG_V3_IS_COMPRESSED = 0x0080;
|
||||||
@ -210,8 +205,11 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
|||||||
return new Id3Header(majorVersion, isUnsynchronized, framesSize);
|
return new Id3Header(majorVersion, isUnsynchronized, framesSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean validateFrames(ParsableByteArray id3Data, int majorVersion,
|
private static boolean validateFrames(
|
||||||
int frameHeaderSize, boolean unsignedIntFrameSizeHack) {
|
ParsableByteArray id3Data,
|
||||||
|
int majorVersion,
|
||||||
|
int frameHeaderSize,
|
||||||
|
boolean unsignedIntFrameSizeHack) {
|
||||||
int startPosition = id3Data.getPosition();
|
int startPosition = id3Data.getPosition();
|
||||||
try {
|
try {
|
||||||
while (id3Data.bytesLeft() >= frameHeaderSize) {
|
while (id3Data.bytesLeft() >= frameHeaderSize) {
|
||||||
@ -238,8 +236,11 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
|||||||
if ((frameSize & 0x808080L) != 0) {
|
if ((frameSize & 0x808080L) != 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
frameSize = (frameSize & 0xFF) | (((frameSize >> 8) & 0xFF) << 7)
|
frameSize =
|
||||||
| (((frameSize >> 16) & 0xFF) << 14) | (((frameSize >> 24) & 0xFF) << 21);
|
(frameSize & 0xFF)
|
||||||
|
| (((frameSize >> 8) & 0xFF) << 7)
|
||||||
|
| (((frameSize >> 16) & 0xFF) << 14)
|
||||||
|
| (((frameSize >> 24) & 0xFF) << 21);
|
||||||
}
|
}
|
||||||
boolean hasGroupIdentifier = false;
|
boolean hasGroupIdentifier = false;
|
||||||
boolean hasDataLength = false;
|
boolean hasDataLength = false;
|
||||||
@ -289,8 +290,11 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
|||||||
if (majorVersion == 4) {
|
if (majorVersion == 4) {
|
||||||
frameSize = id3Data.readUnsignedIntToInt();
|
frameSize = id3Data.readUnsignedIntToInt();
|
||||||
if (!unsignedIntFrameSizeHack) {
|
if (!unsignedIntFrameSizeHack) {
|
||||||
frameSize = (frameSize & 0xFF) | (((frameSize >> 8) & 0xFF) << 7)
|
frameSize =
|
||||||
| (((frameSize >> 16) & 0xFF) << 14) | (((frameSize >> 24) & 0xFF) << 21);
|
(frameSize & 0xFF)
|
||||||
|
| (((frameSize >> 8) & 0xFF) << 7)
|
||||||
|
| (((frameSize >> 16) & 0xFF) << 14)
|
||||||
|
| (((frameSize >> 24) & 0xFF) << 21);
|
||||||
}
|
}
|
||||||
} else if (majorVersion == 3) {
|
} else if (majorVersion == 3) {
|
||||||
frameSize = id3Data.readUnsignedIntToInt();
|
frameSize = id3Data.readUnsignedIntToInt();
|
||||||
@ -299,7 +303,11 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int flags = majorVersion >= 3 ? id3Data.readUnsignedShort() : 0;
|
int flags = majorVersion >= 3 ? id3Data.readUnsignedShort() : 0;
|
||||||
if (frameId0 == 0 && frameId1 == 0 && frameId2 == 0 && frameId3 == 0 && frameSize == 0
|
if (frameId0 == 0
|
||||||
|
&& frameId1 == 0
|
||||||
|
&& frameId2 == 0
|
||||||
|
&& frameId3 == 0
|
||||||
|
&& frameSize == 0
|
||||||
&& flags == 0) {
|
&& flags == 0) {
|
||||||
// We must be reading zero padding at the end of the tag.
|
// We must be reading zero padding at the end of the tag.
|
||||||
id3Data.setPosition(id3Data.limit());
|
id3Data.setPosition(id3Data.limit());
|
||||||
@ -360,13 +368,17 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Id3Frame frame;
|
Id3Frame frame;
|
||||||
if (frameId0 == 'T' && frameId1 == 'X' && frameId2 == 'X'
|
if (frameId0 == 'T'
|
||||||
|
&& frameId1 == 'X'
|
||||||
|
&& frameId2 == 'X'
|
||||||
&& (majorVersion == 2 || frameId3 == 'X')) {
|
&& (majorVersion == 2 || frameId3 == 'X')) {
|
||||||
frame = decodeTxxxFrame(id3Data, frameSize);
|
frame = decodeTxxxFrame(id3Data, frameSize);
|
||||||
} else if (frameId0 == 'T') {
|
} else if (frameId0 == 'T') {
|
||||||
String id = getFrameId(majorVersion, frameId0, frameId1, frameId2, frameId3);
|
String id = getFrameId(majorVersion, frameId0, frameId1, frameId2, frameId3);
|
||||||
frame = decodeTextInformationFrame(id3Data, frameSize, id);
|
frame = decodeTextInformationFrame(id3Data, frameSize, id);
|
||||||
} else if (frameId0 == 'W' && frameId1 == 'X' && frameId2 == 'X'
|
} else if (frameId0 == 'W'
|
||||||
|
&& frameId1 == 'X'
|
||||||
|
&& frameId2 == 'X'
|
||||||
&& (majorVersion == 2 || frameId3 == 'X')) {
|
&& (majorVersion == 2 || frameId3 == 'X')) {
|
||||||
frame = decodeWxxxFrame(id3Data, frameSize);
|
frame = decodeWxxxFrame(id3Data, frameSize);
|
||||||
} else if (frameId0 == 'W') {
|
} else if (frameId0 == 'W') {
|
||||||
@ -374,21 +386,38 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
|||||||
frame = decodeUrlLinkFrame(id3Data, frameSize, id);
|
frame = decodeUrlLinkFrame(id3Data, frameSize, id);
|
||||||
} else if (frameId0 == 'P' && frameId1 == 'R' && frameId2 == 'I' && frameId3 == 'V') {
|
} else if (frameId0 == 'P' && frameId1 == 'R' && frameId2 == 'I' && frameId3 == 'V') {
|
||||||
frame = decodePrivFrame(id3Data, frameSize);
|
frame = decodePrivFrame(id3Data, frameSize);
|
||||||
} else if (frameId0 == 'G' && frameId1 == 'E' && frameId2 == 'O'
|
} else if (frameId0 == 'G'
|
||||||
|
&& frameId1 == 'E'
|
||||||
|
&& frameId2 == 'O'
|
||||||
&& (frameId3 == 'B' || majorVersion == 2)) {
|
&& (frameId3 == 'B' || majorVersion == 2)) {
|
||||||
frame = decodeGeobFrame(id3Data, frameSize);
|
frame = decodeGeobFrame(id3Data, frameSize);
|
||||||
} else if (majorVersion == 2 ? (frameId0 == 'P' && frameId1 == 'I' && frameId2 == 'C')
|
} else if (majorVersion == 2
|
||||||
|
? (frameId0 == 'P' && frameId1 == 'I' && frameId2 == 'C')
|
||||||
: (frameId0 == 'A' && frameId1 == 'P' && frameId2 == 'I' && frameId3 == 'C')) {
|
: (frameId0 == 'A' && frameId1 == 'P' && frameId2 == 'I' && frameId3 == 'C')) {
|
||||||
frame = decodeApicFrame(id3Data, frameSize, majorVersion);
|
frame = decodeApicFrame(id3Data, frameSize, majorVersion);
|
||||||
} else if (frameId0 == 'C' && frameId1 == 'O' && frameId2 == 'M'
|
} else if (frameId0 == 'C'
|
||||||
|
&& frameId1 == 'O'
|
||||||
|
&& frameId2 == 'M'
|
||||||
&& (frameId3 == 'M' || majorVersion == 2)) {
|
&& (frameId3 == 'M' || majorVersion == 2)) {
|
||||||
frame = decodeCommentFrame(id3Data, frameSize);
|
frame = decodeCommentFrame(id3Data, frameSize);
|
||||||
} else if (frameId0 == 'C' && frameId1 == 'H' && frameId2 == 'A' && frameId3 == 'P') {
|
} else if (frameId0 == 'C' && frameId1 == 'H' && frameId2 == 'A' && frameId3 == 'P') {
|
||||||
frame = decodeChapterFrame(id3Data, frameSize, majorVersion, unsignedIntFrameSizeHack,
|
frame =
|
||||||
frameHeaderSize, framePredicate);
|
decodeChapterFrame(
|
||||||
|
id3Data,
|
||||||
|
frameSize,
|
||||||
|
majorVersion,
|
||||||
|
unsignedIntFrameSizeHack,
|
||||||
|
frameHeaderSize,
|
||||||
|
framePredicate);
|
||||||
} else if (frameId0 == 'C' && frameId1 == 'T' && frameId2 == 'O' && frameId3 == 'C') {
|
} else if (frameId0 == 'C' && frameId1 == 'T' && frameId2 == 'O' && frameId3 == 'C') {
|
||||||
frame = decodeChapterTOCFrame(id3Data, frameSize, majorVersion, unsignedIntFrameSizeHack,
|
frame =
|
||||||
frameHeaderSize, framePredicate);
|
decodeChapterTOCFrame(
|
||||||
|
id3Data,
|
||||||
|
frameSize,
|
||||||
|
majorVersion,
|
||||||
|
unsignedIntFrameSizeHack,
|
||||||
|
frameHeaderSize,
|
||||||
|
framePredicate);
|
||||||
} else if (frameId0 == 'M' && frameId1 == 'L' && frameId2 == 'L' && frameId3 == 'T') {
|
} else if (frameId0 == 'M' && frameId1 == 'L' && frameId2 == 'L' && frameId3 == 'T') {
|
||||||
frame = decodeMlltFrame(id3Data, frameSize);
|
frame = decodeMlltFrame(id3Data, frameSize);
|
||||||
} else {
|
} else {
|
||||||
@ -396,8 +425,11 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
|||||||
frame = decodeBinaryFrame(id3Data, frameSize, id);
|
frame = decodeBinaryFrame(id3Data, frameSize, id);
|
||||||
}
|
}
|
||||||
if (frame == null) {
|
if (frame == null) {
|
||||||
Log.w(TAG, "Failed to decode frame: id="
|
Log.w(
|
||||||
+ getFrameId(majorVersion, frameId0, frameId1, frameId2, frameId3) + ", frameSize="
|
TAG,
|
||||||
|
"Failed to decode frame: id="
|
||||||
|
+ getFrameId(majorVersion, frameId0, frameId1, frameId2, frameId3)
|
||||||
|
+ ", frameSize="
|
||||||
+ frameSize);
|
+ frameSize);
|
||||||
}
|
}
|
||||||
return frame;
|
return frame;
|
||||||
@ -477,8 +509,8 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
|||||||
return new UrlLinkFrame("WXXX", description, url);
|
return new UrlLinkFrame("WXXX", description, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static UrlLinkFrame decodeUrlLinkFrame(ParsableByteArray id3Data, int frameSize,
|
private static UrlLinkFrame decodeUrlLinkFrame(
|
||||||
String id) throws UnsupportedEncodingException {
|
ParsableByteArray id3Data, int frameSize, String id) throws UnsupportedEncodingException {
|
||||||
byte[] data = new byte[frameSize];
|
byte[] data = new byte[frameSize];
|
||||||
id3Data.readBytes(data, 0, frameSize);
|
id3Data.readBytes(data, 0, frameSize);
|
||||||
|
|
||||||
@ -528,8 +560,9 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
|||||||
return new GeobFrame(mimeType, filename, description, objectData);
|
return new GeobFrame(mimeType, filename, description, objectData);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ApicFrame decodeApicFrame(ParsableByteArray id3Data, int frameSize,
|
private static ApicFrame decodeApicFrame(
|
||||||
int majorVersion) throws UnsupportedEncodingException {
|
ParsableByteArray id3Data, int frameSize, int majorVersion)
|
||||||
|
throws UnsupportedEncodingException {
|
||||||
int encoding = id3Data.readUnsignedByte();
|
int encoding = id3Data.readUnsignedByte();
|
||||||
String charset = getCharsetName(encoding);
|
String charset = getCharsetName(encoding);
|
||||||
|
|
||||||
@ -556,8 +589,9 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
|||||||
|
|
||||||
int descriptionStartIndex = mimeTypeEndIndex + 2;
|
int descriptionStartIndex = mimeTypeEndIndex + 2;
|
||||||
int descriptionEndIndex = indexOfEos(data, descriptionStartIndex, encoding);
|
int descriptionEndIndex = indexOfEos(data, descriptionStartIndex, encoding);
|
||||||
String description = new String(data, descriptionStartIndex,
|
String description =
|
||||||
descriptionEndIndex - descriptionStartIndex, charset);
|
new String(
|
||||||
|
data, descriptionStartIndex, descriptionEndIndex - descriptionStartIndex, charset);
|
||||||
|
|
||||||
int pictureDataStartIndex = descriptionEndIndex + delimiterLength(encoding);
|
int pictureDataStartIndex = descriptionEndIndex + delimiterLength(encoding);
|
||||||
byte[] pictureData = copyOfRangeIfValid(data, pictureDataStartIndex, data.length);
|
byte[] pictureData = copyOfRangeIfValid(data, pictureDataStartIndex, data.length);
|
||||||
@ -622,8 +656,9 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
|||||||
ArrayList<Id3Frame> subFrames = new ArrayList<>();
|
ArrayList<Id3Frame> subFrames = new ArrayList<>();
|
||||||
int limit = framePosition + frameSize;
|
int limit = framePosition + frameSize;
|
||||||
while (id3Data.getPosition() < limit) {
|
while (id3Data.getPosition() < limit) {
|
||||||
Id3Frame frame = decodeFrame(majorVersion, id3Data, unsignedIntFrameSizeHack,
|
Id3Frame frame =
|
||||||
frameHeaderSize, framePredicate);
|
decodeFrame(
|
||||||
|
majorVersion, id3Data, unsignedIntFrameSizeHack, frameHeaderSize, framePredicate);
|
||||||
if (frame != null) {
|
if (frame != null) {
|
||||||
subFrames.add(frame);
|
subFrames.add(frame);
|
||||||
}
|
}
|
||||||
@ -707,8 +742,8 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
|||||||
millisecondsDeviations);
|
millisecondsDeviations);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BinaryFrame decodeBinaryFrame(ParsableByteArray id3Data, int frameSize,
|
private static BinaryFrame decodeBinaryFrame(
|
||||||
String id) {
|
ParsableByteArray id3Data, int frameSize, String id) {
|
||||||
byte[] frame = new byte[frameSize];
|
byte[] frame = new byte[frameSize];
|
||||||
id3Data.readBytes(frame, 0, frameSize);
|
id3Data.readBytes(frame, 0, frameSize);
|
||||||
|
|
||||||
@ -716,8 +751,8 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs in-place removal of unsynchronization for {@code length} bytes starting from
|
* Performs in-place removal of unsynchronization for {@code length} bytes starting from {@link
|
||||||
* {@link ParsableByteArray#getPosition()}
|
* ParsableByteArray#getPosition()}
|
||||||
*
|
*
|
||||||
* @param data Contains the data to be processed.
|
* @param data Contains the data to be processed.
|
||||||
* @param length The length of the data to be processed.
|
* @param length The length of the data to be processed.
|
||||||
@ -756,9 +791,10 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getFrameId(int majorVersion, int frameId0, int frameId1, int frameId2,
|
private static String getFrameId(
|
||||||
int frameId3) {
|
int majorVersion, int frameId0, int frameId1, int frameId2, int frameId3) {
|
||||||
return majorVersion == 2 ? String.format(Locale.US, "%c%c%c", frameId0, frameId1, frameId2)
|
return majorVersion == 2
|
||||||
|
? String.format(Locale.US, "%c%c%c", frameId0, frameId1, frameId2)
|
||||||
: String.format(Locale.US, "%c%c%c%c", frameId0, frameId1, frameId2, frameId3);
|
: String.format(Locale.US, "%c%c%c%c", frameId0, frameId1, frameId2, frameId3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -792,7 +828,8 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
|||||||
|
|
||||||
private static int delimiterLength(int encodingByte) {
|
private static int delimiterLength(int encodingByte) {
|
||||||
return (encodingByte == ID3_TEXT_ENCODING_ISO_8859_1 || encodingByte == ID3_TEXT_ENCODING_UTF_8)
|
return (encodingByte == ID3_TEXT_ENCODING_ISO_8859_1 || encodingByte == ID3_TEXT_ENCODING_UTF_8)
|
||||||
? 1 : 2;
|
? 1
|
||||||
|
: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -841,7 +878,5 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
|||||||
this.isUnsynchronized = isUnsynchronized;
|
this.isUnsynchronized = isUnsynchronized;
|
||||||
this.framesSize = framesSize;
|
this.framesSize = framesSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,7 @@ import com.google.android.exoplayer2.metadata.Metadata;
|
|||||||
/** Base class for ID3 frames. */
|
/** Base class for ID3 frames. */
|
||||||
public abstract class Id3Frame implements Metadata.Entry {
|
public abstract class Id3Frame implements Metadata.Entry {
|
||||||
|
|
||||||
/**
|
/** The frame ID. */
|
||||||
* The frame ID.
|
|
||||||
*/
|
|
||||||
public final String id;
|
public final String id;
|
||||||
|
|
||||||
public Id3Frame(String id) {
|
public Id3Frame(String id) {
|
||||||
@ -38,5 +36,4 @@ public abstract class Id3Frame implements Metadata.Entry {
|
|||||||
public int describeContents() {
|
public int describeContents() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,8 @@ public final class PrivFrame extends Id3Frame {
|
|||||||
dest.writeByteArray(privateData);
|
dest.writeByteArray(privateData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Parcelable.Creator<PrivFrame> CREATOR = new Parcelable.Creator<PrivFrame>() {
|
public static final Parcelable.Creator<PrivFrame> CREATOR =
|
||||||
|
new Parcelable.Creator<PrivFrame>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PrivFrame createFromParcel(Parcel in) {
|
public PrivFrame createFromParcel(Parcel in) {
|
||||||
@ -86,7 +87,5 @@ public final class PrivFrame extends Id3Frame {
|
|||||||
public PrivFrame[] newArray(int size) {
|
public PrivFrame[] newArray(int size) {
|
||||||
return new PrivFrame[size];
|
return new PrivFrame[size];
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,8 @@ public final class UrlLinkFrame extends Id3Frame {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
UrlLinkFrame other = (UrlLinkFrame) obj;
|
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);
|
&& Util.areEqual(url, other.url);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +89,5 @@ public final class UrlLinkFrame extends Id3Frame {
|
|||||||
public UrlLinkFrame[] newArray(int size) {
|
public UrlLinkFrame[] newArray(int size) {
|
||||||
return new UrlLinkFrame[size];
|
return new UrlLinkFrame[size];
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,9 +37,7 @@ public final class TrackGroup implements Parcelable {
|
|||||||
// Lazily initialized hashcode.
|
// Lazily initialized hashcode.
|
||||||
private int 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) {
|
public TrackGroup(Format... formats) {
|
||||||
Assertions.checkState(formats.length > 0);
|
Assertions.checkState(formats.length > 0);
|
||||||
this.formats = formats;
|
this.formats = formats;
|
||||||
|
@ -58,9 +58,7 @@ public final class Cue {
|
|||||||
*/
|
*/
|
||||||
public static final int ANCHOR_TYPE_START = 0;
|
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;
|
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})
|
@IntDef({TYPE_UNSET, LINE_TYPE_FRACTION, LINE_TYPE_NUMBER})
|
||||||
public @interface LineType {}
|
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;
|
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;
|
public static final int LINE_TYPE_NUMBER = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -247,14 +241,10 @@ public final class Cue {
|
|||||||
*/
|
*/
|
||||||
public final float bitmapHeight;
|
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;
|
public final boolean windowColorSet;
|
||||||
|
|
||||||
/**
|
/** The fill color of the window. */
|
||||||
* The fill color of the window.
|
|
||||||
*/
|
|
||||||
public final int windowColor;
|
public final int windowColor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,14 +26,10 @@ import java.util.Map;
|
|||||||
/** Reads data from URI-identified resources. */
|
/** Reads data from URI-identified resources. */
|
||||||
public interface DataSource extends DataReader {
|
public interface DataSource extends DataReader {
|
||||||
|
|
||||||
/**
|
/** A factory for {@link DataSource} instances. */
|
||||||
* A factory for {@link DataSource} instances.
|
|
||||||
*/
|
|
||||||
interface Factory {
|
interface Factory {
|
||||||
|
|
||||||
/**
|
/** Creates a {@link DataSource} instance. */
|
||||||
* Creates a {@link DataSource} instance.
|
|
||||||
*/
|
|
||||||
DataSource createDataSource();
|
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.
|
* @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}
|
* 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}. */
|
/** The position of the data when read from {@link #uri}. */
|
||||||
public final long position;
|
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;
|
public final long length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -194,9 +194,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
|
|||||||
|
|
||||||
/** The default connection timeout, in milliseconds. */
|
/** The default connection timeout, in milliseconds. */
|
||||||
public static final int DEFAULT_CONNECT_TIMEOUT_MILLIS = 8 * 1000;
|
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;
|
public static final int DEFAULT_READ_TIMEOUT_MILLIS = 8 * 1000;
|
||||||
|
|
||||||
private static final String TAG = "DefaultHttpDataSource";
|
private static final String TAG = "DefaultHttpDataSource";
|
||||||
@ -325,9 +323,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
|
|||||||
requestProperties.clear();
|
requestProperties.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Opens the source to read the specified data. */
|
||||||
* Opens the source to read the specified data.
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public long open(DataSpec dataSpec) throws HttpDataSourceException {
|
public long open(DataSpec dataSpec) throws HttpDataSourceException {
|
||||||
this.dataSpec = dataSpec;
|
this.dataSpec = dataSpec;
|
||||||
@ -411,8 +407,8 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
|
|||||||
HttpUtil.getContentLength(
|
HttpUtil.getContentLength(
|
||||||
connection.getHeaderField(HttpHeaders.CONTENT_LENGTH),
|
connection.getHeaderField(HttpHeaders.CONTENT_LENGTH),
|
||||||
connection.getHeaderField(HttpHeaders.CONTENT_RANGE));
|
connection.getHeaderField(HttpHeaders.CONTENT_RANGE));
|
||||||
bytesToRead = contentLength != C.LENGTH_UNSET ? (contentLength - bytesToSkip)
|
bytesToRead =
|
||||||
: C.LENGTH_UNSET;
|
contentLength != C.LENGTH_UNSET ? (contentLength - bytesToSkip) : C.LENGTH_UNSET;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Gzip is enabled. If the server opts to use gzip then the content length in the response
|
// 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 {
|
private HttpURLConnection makeConnection(DataSpec dataSpec) throws IOException {
|
||||||
URL url = new URL(dataSpec.uri.toString());
|
URL url = new URL(dataSpec.uri.toString());
|
||||||
@HttpMethod int httpMethod = dataSpec.httpMethod;
|
@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
|
* Reads up to {@code length} bytes of data and stores them into {@code buffer}, starting at index
|
||||||
* index {@code offset}.
|
* {@code offset}.
|
||||||
* <p>
|
*
|
||||||
* This method blocks until at least one byte of data can be read, the end of the opened range is
|
* <p>This method blocks until at least one byte of data can be read, the end of the opened range
|
||||||
* detected, or an exception is thrown.
|
* is detected, or an exception is thrown.
|
||||||
*
|
*
|
||||||
* @param buffer The buffer into which the read data should be stored.
|
* @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.
|
* @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() {
|
private void closeConnectionQuietly() {
|
||||||
if (connection != null) {
|
if (connection != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -33,9 +33,7 @@ import java.util.Map;
|
|||||||
/** An HTTP {@link DataSource}. */
|
/** An HTTP {@link DataSource}. */
|
||||||
public interface HttpDataSource extends DataSource {
|
public interface HttpDataSource extends DataSource {
|
||||||
|
|
||||||
/**
|
/** A factory for {@link HttpDataSource} instances. */
|
||||||
* A factory for {@link HttpDataSource} instances.
|
|
||||||
*/
|
|
||||||
interface Factory extends DataSource.Factory {
|
interface Factory extends DataSource.Factory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -61,9 +59,9 @@ public interface HttpDataSource extends DataSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores HTTP request properties (aka HTTP headers) and provides methods to modify the headers
|
* Stores HTTP request properties (aka HTTP headers) and provides methods to modify the headers in
|
||||||
* in a thread safe way to avoid the potential of creating snapshots of an inconsistent or
|
* a thread safe way to avoid the potential of creating snapshots of an inconsistent or unintended
|
||||||
* unintended state.
|
* state.
|
||||||
*/
|
*/
|
||||||
final class RequestProperties {
|
final class RequestProperties {
|
||||||
|
|
||||||
@ -119,9 +117,7 @@ public interface HttpDataSource extends DataSource {
|
|||||||
requestProperties.remove(name);
|
requestProperties.remove(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Clears all request properties. */
|
||||||
* Clears all request properties.
|
|
||||||
*/
|
|
||||||
public synchronized void clear() {
|
public synchronized void clear() {
|
||||||
requestPropertiesSnapshot = null;
|
requestPropertiesSnapshot = null;
|
||||||
requestProperties.clear();
|
requestProperties.clear();
|
||||||
@ -191,9 +187,7 @@ public interface HttpDataSource extends DataSource {
|
|||||||
&& !contentType.contains("xml");
|
&& !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 {
|
class HttpDataSourceException extends IOException {
|
||||||
|
|
||||||
@Documented
|
@Documented
|
||||||
@ -207,9 +201,7 @@ public interface HttpDataSource extends DataSource {
|
|||||||
|
|
||||||
@Type public final int type;
|
@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 final DataSpec dataSpec;
|
||||||
|
|
||||||
public HttpDataSourceException(DataSpec dataSpec, @Type int type) {
|
public HttpDataSourceException(DataSpec dataSpec, @Type int type) {
|
||||||
@ -230,8 +222,8 @@ public interface HttpDataSource extends DataSource {
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpDataSourceException(String message, IOException cause, DataSpec dataSpec,
|
public HttpDataSourceException(
|
||||||
@Type int type) {
|
String message, IOException cause, DataSpec dataSpec, @Type int type) {
|
||||||
super(message, cause);
|
super(message, cause);
|
||||||
this.dataSpec = dataSpec;
|
this.dataSpec = dataSpec;
|
||||||
this.type = type;
|
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 {
|
final class InvalidContentTypeException extends HttpDataSourceException {
|
||||||
|
|
||||||
public final String contentType;
|
public final String contentType;
|
||||||
@ -274,17 +264,13 @@ public interface HttpDataSource extends DataSource {
|
|||||||
*/
|
*/
|
||||||
final class InvalidResponseCodeException extends HttpDataSourceException {
|
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;
|
public final int responseCode;
|
||||||
|
|
||||||
/** The http status message. */
|
/** The http status message. */
|
||||||
@Nullable public final String responseMessage;
|
@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;
|
public final Map<String, List<String>> headerFields;
|
||||||
|
|
||||||
/** The response body. */
|
/** The response body. */
|
||||||
@ -333,7 +319,6 @@ public interface HttpDataSource extends DataSource {
|
|||||||
this.headerFields = headerFields;
|
this.headerFields = headerFields;
|
||||||
this.responseBody = responseBody;
|
this.responseBody = responseBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -373,9 +358,7 @@ public interface HttpDataSource extends DataSource {
|
|||||||
*/
|
*/
|
||||||
void clearRequestProperty(String name);
|
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();
|
void clearAllRequestProperties();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -224,5 +224,4 @@ public final class Assertions {
|
|||||||
throw new IllegalStateException("Not in applications main thread");
|
throw new IllegalStateException("Not in applications main thread");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,9 +25,7 @@ import androidx.annotation.Nullable;
|
|||||||
*/
|
*/
|
||||||
public interface Clock {
|
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();
|
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.
|
* during one {@link Looper} message queue iteration were handled by the listeners.
|
||||||
*/
|
*/
|
||||||
public ListenerSet(Looper looper, Clock clock, IterationFinishedEvent<T> iterationFinishedEvent) {
|
public ListenerSet(Looper looper, Clock clock, IterationFinishedEvent<T> iterationFinishedEvent) {
|
||||||
this(
|
this(/* listeners= */ new CopyOnWriteArraySet<>(), looper, clock, iterationFinishedEvent);
|
||||||
/* listeners= */ new CopyOnWriteArraySet<>(),
|
|
||||||
looper,
|
|
||||||
clock,
|
|
||||||
iterationFinishedEvent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ListenerSet(
|
private ListenerSet(
|
||||||
|
@ -29,9 +29,7 @@ public final class LongArray {
|
|||||||
this(DEFAULT_INITIAL_CAPACITY);
|
this(DEFAULT_INITIAL_CAPACITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @param initialCapacity The initial capacity of the array. */
|
||||||
* @param initialCapacity The initial capacity of the array.
|
|
||||||
*/
|
|
||||||
public LongArray(int initialCapacity) {
|
public LongArray(int initialCapacity) {
|
||||||
values = new long[initialCapacity];
|
values = new long[initialCapacity];
|
||||||
}
|
}
|
||||||
@ -63,9 +61,7 @@ public final class LongArray {
|
|||||||
return values[index];
|
return values[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Returns the current size of the array. */
|
||||||
* Returns the current size of the array.
|
|
||||||
*/
|
|
||||||
public int size() {
|
public int size() {
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
@ -78,5 +74,4 @@ public final class LongArray {
|
|||||||
public long[] toArray() {
|
public long[] toArray() {
|
||||||
return Arrays.copyOf(values, size);
|
return Arrays.copyOf(values, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,9 +24,7 @@ public final class NalUnitUtil {
|
|||||||
|
|
||||||
private static final String TAG = "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 static final class SpsData {
|
||||||
|
|
||||||
public final int profileIdc;
|
public final int profileIdc;
|
||||||
@ -71,25 +69,23 @@ public final class NalUnitUtil {
|
|||||||
this.picOrderCntLsbLength = picOrderCntLsbLength;
|
this.picOrderCntLsbLength = picOrderCntLsbLength;
|
||||||
this.deltaPicOrderAlwaysZeroFlag = deltaPicOrderAlwaysZeroFlag;
|
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 static final class PpsData {
|
||||||
|
|
||||||
public final int picParameterSetId;
|
public final int picParameterSetId;
|
||||||
public final int seqParameterSetId;
|
public final int seqParameterSetId;
|
||||||
public final boolean bottomFieldPicOrderInFramePresentFlag;
|
public final boolean bottomFieldPicOrderInFramePresentFlag;
|
||||||
|
|
||||||
public PpsData(int picParameterSetId, int seqParameterSetId,
|
public PpsData(
|
||||||
|
int picParameterSetId,
|
||||||
|
int seqParameterSetId,
|
||||||
boolean bottomFieldPicOrderInFramePresentFlag) {
|
boolean bottomFieldPicOrderInFramePresentFlag) {
|
||||||
this.picParameterSetId = picParameterSetId;
|
this.picParameterSetId = picParameterSetId;
|
||||||
this.seqParameterSetId = seqParameterSetId;
|
this.seqParameterSetId = seqParameterSetId;
|
||||||
this.bottomFieldPicOrderInFramePresentFlag = bottomFieldPicOrderInFramePresentFlag;
|
this.bottomFieldPicOrderInFramePresentFlag = bottomFieldPicOrderInFramePresentFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Four initial bytes that must prefix NAL units for decoding. */
|
/** Four initial bytes that must prefix NAL units for decoding. */
|
||||||
@ -98,7 +94,8 @@ public final class NalUnitUtil {
|
|||||||
/** Value for aspect_ratio_idc indicating an extended aspect ratio, in H.264 and H.265 SPSs. */
|
/** Value for aspect_ratio_idc indicating an extended aspect ratio, in H.264 and H.265 SPSs. */
|
||||||
public static final int EXTENDED_SAR = 0xFF;
|
public static final int EXTENDED_SAR = 0xFF;
|
||||||
/** Aspect ratios indexed by aspect_ratio_idc, in H.264 and H.265 SPSs. */
|
/** Aspect ratios indexed by aspect_ratio_idc, in H.264 and H.265 SPSs. */
|
||||||
public static final float[] ASPECT_RATIO_IDC_VALUES = new float[] {
|
public static final float[] ASPECT_RATIO_IDC_VALUES =
|
||||||
|
new float[] {
|
||||||
1f /* Unspecified. Assume square */,
|
1f /* Unspecified. Assume square */,
|
||||||
1f,
|
1f,
|
||||||
12f / 11f,
|
12f / 11f,
|
||||||
@ -131,10 +128,10 @@ public final class NalUnitUtil {
|
|||||||
private static int[] scratchEscapePositions = new int[10];
|
private static int[] scratchEscapePositions = new int[10];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unescapes {@code data} up to the specified limit, replacing occurrences of [0, 0, 3] with
|
* Unescapes {@code data} up to the specified limit, replacing occurrences of [0, 0, 3] with [0,
|
||||||
* [0, 0]. The unescaped data is returned in-place, with the return value indicating its length.
|
* 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
|
* <p>Executions of this method are mutually exclusive, so it should not be called with very large
|
||||||
* buffers.
|
* buffers.
|
||||||
*
|
*
|
||||||
* @param data The data to unescape.
|
* @param data The data to unescape.
|
||||||
@ -150,8 +147,8 @@ public final class NalUnitUtil {
|
|||||||
if (position < limit) {
|
if (position < limit) {
|
||||||
if (scratchEscapePositions.length <= scratchEscapeCount) {
|
if (scratchEscapePositions.length <= scratchEscapeCount) {
|
||||||
// Grow scratchEscapePositions to hold a larger number of positions.
|
// Grow scratchEscapePositions to hold a larger number of positions.
|
||||||
scratchEscapePositions = Arrays.copyOf(scratchEscapePositions,
|
scratchEscapePositions =
|
||||||
scratchEscapePositions.length * 2);
|
Arrays.copyOf(scratchEscapePositions, scratchEscapePositions.length * 2);
|
||||||
}
|
}
|
||||||
scratchEscapePositions[scratchEscapeCount++] = position;
|
scratchEscapePositions[scratchEscapeCount++] = position;
|
||||||
position += 3;
|
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
|
* Discards data from the buffer up to the first SPS, where {@code data.position()} is interpreted
|
||||||
* as the length of the buffer.
|
* as the length of the buffer.
|
||||||
* <p>
|
*
|
||||||
* When the method returns, {@code data.position()} will contain the new length of the buffer. If
|
* <p>When the method returns, {@code data.position()} will contain the new length of the buffer.
|
||||||
* the buffer is not empty it is guaranteed to start with an SPS.
|
* If the buffer is not empty it is guaranteed to start with an SPS.
|
||||||
*
|
*
|
||||||
* @param data Buffer containing start code delimited NAL units.
|
* @param data Buffer containing start code delimited NAL units.
|
||||||
*/
|
*/
|
||||||
@ -273,9 +270,16 @@ public final class NalUnitUtil {
|
|||||||
|
|
||||||
int chromaFormatIdc = 1; // Default is 4:2:0
|
int chromaFormatIdc = 1; // Default is 4:2:0
|
||||||
boolean separateColorPlaneFlag = false;
|
boolean separateColorPlaneFlag = false;
|
||||||
if (profileIdc == 100 || profileIdc == 110 || profileIdc == 122 || profileIdc == 244
|
if (profileIdc == 100
|
||||||
|| profileIdc == 44 || profileIdc == 83 || profileIdc == 86 || profileIdc == 118
|
|| profileIdc == 110
|
||||||
|| profileIdc == 128 || profileIdc == 138) {
|
|| profileIdc == 122
|
||||||
|
|| profileIdc == 244
|
||||||
|
|| profileIdc == 44
|
||||||
|
|| profileIdc == 83
|
||||||
|
|| profileIdc == 86
|
||||||
|
|| profileIdc == 118
|
||||||
|
|| profileIdc == 128
|
||||||
|
|| profileIdc == 138) {
|
||||||
chromaFormatIdc = data.readUnsignedExpGolombCodedInt();
|
chromaFormatIdc = data.readUnsignedExpGolombCodedInt();
|
||||||
if (chromaFormatIdc == 3) {
|
if (chromaFormatIdc == 3) {
|
||||||
separateColorPlaneFlag = data.readBit();
|
separateColorPlaneFlag = data.readBit();
|
||||||
@ -403,16 +407,16 @@ public final class NalUnitUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the first NAL unit in {@code data}.
|
* 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.
|
* 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
|
* <p>When {@code prefixFlags} is non-null, this method supports finding NAL units whose first
|
||||||
* bytes span {@code data} arrays passed to successive calls. To use this feature, pass the same
|
* four bytes span {@code data} arrays passed to successive calls. To use this feature, pass the
|
||||||
* {@code prefixFlags} parameter to successive calls. State maintained in this parameter enables
|
* same {@code prefixFlags} parameter to successive calls. State maintained in this parameter
|
||||||
* the detection of such NAL units. Note that when using this feature, the return value may be 3,
|
* enables the detection of such NAL units. Note that when using this feature, the return value
|
||||||
* 2 or 1 less than {@code startOffset}, to indicate a NAL unit starting 3, 2 or 1 bytes before
|
* may be 3, 2 or 1 less than {@code startOffset}, to indicate a NAL unit starting 3, 2 or 1 bytes
|
||||||
* the first byte in the current array.
|
* before the first byte in the current array.
|
||||||
*
|
*
|
||||||
* @param data The data to search.
|
* @param data The data to search.
|
||||||
* @param startOffset The offset (inclusive) in the data to start the 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.
|
* must be at least 3 elements long.
|
||||||
* @return The offset of the NAL unit, or {@code endOffset} if a NAL unit was not found.
|
* @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,
|
public static int findNalUnit(
|
||||||
boolean[] prefixFlags) {
|
byte[] data, int startOffset, int endOffset, boolean[] prefixFlags) {
|
||||||
int length = endOffset - startOffset;
|
int length = endOffset - startOffset;
|
||||||
|
|
||||||
Assertions.checkState(length >= 0);
|
Assertions.checkState(length >= 0);
|
||||||
@ -515,5 +519,4 @@ public final class NalUnitUtil {
|
|||||||
private NalUnitUtil() {
|
private NalUnitUtil() {
|
||||||
// Prevent instantiation.
|
// Prevent instantiation.
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -89,16 +89,12 @@ public final class ParsableBitArray {
|
|||||||
byteLimit = limit;
|
byteLimit = limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Returns the number of bits yet to be read. */
|
||||||
* Returns the number of bits yet to be read.
|
|
||||||
*/
|
|
||||||
public int bitsLeft() {
|
public int bitsLeft() {
|
||||||
return (byteLimit - byteOffset) * 8 - bitOffset;
|
return (byteLimit - byteOffset) * 8 - bitOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Returns the current bit offset. */
|
||||||
* Returns the current bit offset.
|
|
||||||
*/
|
|
||||||
public int getPosition() {
|
public int getPosition() {
|
||||||
return byteOffset * 8 + bitOffset;
|
return byteOffset * 8 + bitOffset;
|
||||||
}
|
}
|
||||||
@ -124,9 +120,7 @@ public final class ParsableBitArray {
|
|||||||
assertValidOffset();
|
assertValidOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Skips a single bit. */
|
||||||
* Skips a single bit.
|
|
||||||
*/
|
|
||||||
public void skipBit() {
|
public void skipBit() {
|
||||||
if (++bitOffset == 8) {
|
if (++bitOffset == 8) {
|
||||||
bitOffset = 0;
|
bitOffset = 0;
|
||||||
@ -344,8 +338,7 @@ public final class ParsableBitArray {
|
|||||||
|
|
||||||
private void assertValidOffset() {
|
private void assertValidOffset() {
|
||||||
// It is fine for position to be at the end of the array, but no further.
|
// It is fine for position to be at the end of the array, but no further.
|
||||||
Assertions.checkState(byteOffset >= 0
|
Assertions.checkState(
|
||||||
&& (byteOffset < byteLimit || (byteOffset == byteLimit && bitOffset == 0)));
|
byteOffset >= 0 && (byteOffset < byteLimit || (byteOffset == byteLimit && bitOffset == 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -120,9 +120,7 @@ public final class ParsableByteArray {
|
|||||||
return limit - position;
|
return limit - position;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Returns the limit. */
|
||||||
* Returns the limit.
|
|
||||||
*/
|
|
||||||
public int limit() {
|
public int limit() {
|
||||||
return limit;
|
return limit;
|
||||||
}
|
}
|
||||||
@ -137,9 +135,7 @@ public final class ParsableByteArray {
|
|||||||
this.limit = limit;
|
this.limit = limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Returns the current offset in the array, in bytes. */
|
||||||
* Returns the current offset in the array, in bytes.
|
|
||||||
*/
|
|
||||||
public int getPosition() {
|
public int getPosition() {
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
@ -186,8 +182,8 @@ public final class ParsableByteArray {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the next {@code length} bytes into {@code bitArray}, and resets the position of
|
* Reads the next {@code length} bytes into {@code bitArray}, and resets the position of {@code
|
||||||
* {@code bitArray} to zero.
|
* bitArray} to zero.
|
||||||
*
|
*
|
||||||
* @param bitArray The {@link ParsableBitArray} into which the bytes should be read.
|
* @param bitArray The {@link ParsableBitArray} into which the bytes should be read.
|
||||||
* @param length The number of bytes to write.
|
* @param length The number of bytes to write.
|
||||||
@ -222,97 +218,70 @@ public final class ParsableByteArray {
|
|||||||
position += length;
|
position += length;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Peeks at the next byte as an unsigned value. */
|
||||||
* Peeks at the next byte as an unsigned value.
|
|
||||||
*/
|
|
||||||
public int peekUnsignedByte() {
|
public int peekUnsignedByte() {
|
||||||
return (data[position] & 0xFF);
|
return (data[position] & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Peeks at the next char. */
|
||||||
* Peeks at the next char.
|
|
||||||
*/
|
|
||||||
public char peekChar() {
|
public char peekChar() {
|
||||||
return (char) ((data[position] & 0xFF) << 8
|
return (char) ((data[position] & 0xFF) << 8 | (data[position + 1] & 0xFF));
|
||||||
| (data[position + 1] & 0xFF));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Reads the next byte as an unsigned value. */
|
||||||
* Reads the next byte as an unsigned value.
|
|
||||||
*/
|
|
||||||
public int readUnsignedByte() {
|
public int readUnsignedByte() {
|
||||||
return (data[position++] & 0xFF);
|
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() {
|
public int readUnsignedShort() {
|
||||||
return (data[position++] & 0xFF) << 8
|
return (data[position++] & 0xFF) << 8 | (data[position++] & 0xFF);
|
||||||
| (data[position++] & 0xFF);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Reads the next two bytes as an unsigned value. */
|
||||||
* Reads the next two bytes as an unsigned value.
|
|
||||||
*/
|
|
||||||
public int readLittleEndianUnsignedShort() {
|
public int readLittleEndianUnsignedShort() {
|
||||||
return (data[position++] & 0xFF) | (data[position++] & 0xFF) << 8;
|
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() {
|
public short readShort() {
|
||||||
return (short) ((data[position++] & 0xFF) << 8
|
return (short) ((data[position++] & 0xFF) << 8 | (data[position++] & 0xFF));
|
||||||
| (data[position++] & 0xFF));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Reads the next two bytes as a signed value. */
|
||||||
* Reads the next two bytes as a signed value.
|
|
||||||
*/
|
|
||||||
public short readLittleEndianShort() {
|
public short readLittleEndianShort() {
|
||||||
return (short) ((data[position++] & 0xFF) | (data[position++] & 0xFF) << 8);
|
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() {
|
public int readUnsignedInt24() {
|
||||||
return (data[position++] & 0xFF) << 16
|
return (data[position++] & 0xFF) << 16
|
||||||
| (data[position++] & 0xFF) << 8
|
| (data[position++] & 0xFF) << 8
|
||||||
| (data[position++] & 0xFF);
|
| (data[position++] & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Reads the next three bytes as a signed value. */
|
||||||
* Reads the next three bytes as a signed value.
|
|
||||||
*/
|
|
||||||
public int readInt24() {
|
public int readInt24() {
|
||||||
return ((data[position++] & 0xFF) << 24) >> 8
|
return ((data[position++] & 0xFF) << 24) >> 8
|
||||||
| (data[position++] & 0xFF) << 8
|
| (data[position++] & 0xFF) << 8
|
||||||
| (data[position++] & 0xFF);
|
| (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() {
|
public int readLittleEndianInt24() {
|
||||||
return (data[position++] & 0xFF)
|
return (data[position++] & 0xFF)
|
||||||
| (data[position++] & 0xFF) << 8
|
| (data[position++] & 0xFF) << 8
|
||||||
| (data[position++] & 0xFF) << 16;
|
| (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() {
|
public int readLittleEndianUnsignedInt24() {
|
||||||
return (data[position++] & 0xFF)
|
return (data[position++] & 0xFF)
|
||||||
| (data[position++] & 0xFF) << 8
|
| (data[position++] & 0xFF) << 8
|
||||||
| (data[position++] & 0xFF) << 16;
|
| (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() {
|
public long readUnsignedInt() {
|
||||||
return (data[position++] & 0xFFL) << 24
|
return (data[position++] & 0xFFL) << 24
|
||||||
| (data[position++] & 0xFFL) << 16
|
| (data[position++] & 0xFFL) << 16
|
||||||
@ -320,9 +289,7 @@ public final class ParsableByteArray {
|
|||||||
| (data[position++] & 0xFFL);
|
| (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() {
|
public long readLittleEndianUnsignedInt() {
|
||||||
return (data[position++] & 0xFFL)
|
return (data[position++] & 0xFFL)
|
||||||
| (data[position++] & 0xFFL) << 8
|
| (data[position++] & 0xFFL) << 8
|
||||||
@ -330,9 +297,7 @@ public final class ParsableByteArray {
|
|||||||
| (data[position++] & 0xFFL) << 24;
|
| (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() {
|
public int readInt() {
|
||||||
return (data[position++] & 0xFF) << 24
|
return (data[position++] & 0xFF) << 24
|
||||||
| (data[position++] & 0xFF) << 16
|
| (data[position++] & 0xFF) << 16
|
||||||
@ -340,9 +305,7 @@ public final class ParsableByteArray {
|
|||||||
| (data[position++] & 0xFF);
|
| (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() {
|
public int readLittleEndianInt() {
|
||||||
return (data[position++] & 0xFF)
|
return (data[position++] & 0xFF)
|
||||||
| (data[position++] & 0xFF) << 8
|
| (data[position++] & 0xFF) << 8
|
||||||
@ -350,9 +313,7 @@ public final class ParsableByteArray {
|
|||||||
| (data[position++] & 0xFF) << 24;
|
| (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() {
|
public long readLong() {
|
||||||
return (data[position++] & 0xFFL) << 56
|
return (data[position++] & 0xFFL) << 56
|
||||||
| (data[position++] & 0xFFL) << 48
|
| (data[position++] & 0xFFL) << 48
|
||||||
@ -364,9 +325,7 @@ public final class ParsableByteArray {
|
|||||||
| (data[position++] & 0xFFL);
|
| (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() {
|
public long readLittleEndianLong() {
|
||||||
return (data[position++] & 0xFFL)
|
return (data[position++] & 0xFFL)
|
||||||
| (data[position++] & 0xFFL) << 8
|
| (data[position++] & 0xFFL) << 8
|
||||||
@ -378,20 +337,17 @@ public final class ParsableByteArray {
|
|||||||
| (data[position++] & 0xFFL) << 56;
|
| (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() {
|
public int readUnsignedFixedPoint1616() {
|
||||||
int result = (data[position++] & 0xFF) << 8
|
int result = (data[position++] & 0xFF) << 8 | (data[position++] & 0xFF);
|
||||||
| (data[position++] & 0xFF);
|
|
||||||
position += 2; // Skip the non-integer portion.
|
position += 2; // Skip the non-integer portion.
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads a Synchsafe integer.
|
* 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.
|
* store 28 bits of information.
|
||||||
*
|
*
|
||||||
* @return The parsed value.
|
* @return The parsed value.
|
||||||
@ -444,16 +400,12 @@ public final class ParsableByteArray {
|
|||||||
return result;
|
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() {
|
public float readFloat() {
|
||||||
return Float.intBitsToFloat(readInt());
|
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() {
|
public double readDouble() {
|
||||||
return Double.longBitsToDouble(readLong());
|
return Double.longBitsToDouble(readLong());
|
||||||
}
|
}
|
||||||
@ -555,8 +507,10 @@ public final class ParsableByteArray {
|
|||||||
while (lineLimit < limit && !Util.isLinebreak(data[lineLimit])) {
|
while (lineLimit < limit && !Util.isLinebreak(data[lineLimit])) {
|
||||||
lineLimit++;
|
lineLimit++;
|
||||||
}
|
}
|
||||||
if (lineLimit - position >= 3 && data[position] == (byte) 0xEF
|
if (lineLimit - position >= 3
|
||||||
&& data[position + 1] == (byte) 0xBB && data[position + 2] == (byte) 0xBF) {
|
&& 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.
|
// There's a UTF-8 byte order mark at the start of the line. Discard it.
|
||||||
position += 3;
|
position += 3;
|
||||||
}
|
}
|
||||||
@ -611,5 +565,4 @@ public final class ParsableByteArray {
|
|||||||
position += length;
|
position += length;
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -55,9 +55,7 @@ public final class ParsableNalUnitBitArray {
|
|||||||
assertValidOffset();
|
assertValidOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Skips a single bit. */
|
||||||
* Skips a single bit.
|
|
||||||
*/
|
|
||||||
public void skipBit() {
|
public void skipBit() {
|
||||||
if (++bitOffset == 8) {
|
if (++bitOffset == 8) {
|
||||||
bitOffset = 0;
|
bitOffset = 0;
|
||||||
@ -198,14 +196,16 @@ public final class ParsableNalUnitBitArray {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldSkipByte(int offset) {
|
private boolean shouldSkipByte(int offset) {
|
||||||
return 2 <= offset && offset < byteLimit && data[offset] == (byte) 0x03
|
return 2 <= offset
|
||||||
&& data[offset - 2] == (byte) 0x00 && data[offset - 1] == (byte) 0x00;
|
&& offset < byteLimit
|
||||||
|
&& data[offset] == (byte) 0x03
|
||||||
|
&& data[offset - 2] == (byte) 0x00
|
||||||
|
&& data[offset - 1] == (byte) 0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertValidOffset() {
|
private void assertValidOffset() {
|
||||||
// It is fine for position to be at the end of the array, but no further.
|
// It is fine for position to be at the end of the array, but no further.
|
||||||
Assertions.checkState(byteOffset >= 0
|
Assertions.checkState(
|
||||||
&& (byteOffset < byteLimit || (byteOffset == byteLimit && bitOffset == 0)));
|
byteOffset >= 0 && (byteOffset < byteLimit || (byteOffset == byteLimit && bitOffset == 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -35,13 +35,9 @@ public final class RepeatModeUtil {
|
|||||||
flag = true,
|
flag = true,
|
||||||
value = {REPEAT_TOGGLE_MODE_NONE, REPEAT_TOGGLE_MODE_ONE, REPEAT_TOGGLE_MODE_ALL})
|
value = {REPEAT_TOGGLE_MODE_NONE, REPEAT_TOGGLE_MODE_ONE, REPEAT_TOGGLE_MODE_ALL})
|
||||||
public @interface RepeatToggleModes {}
|
public @interface RepeatToggleModes {}
|
||||||
/**
|
/** All repeat mode buttons disabled. */
|
||||||
* All repeat mode buttons disabled.
|
|
||||||
*/
|
|
||||||
public static final int REPEAT_TOGGLE_MODE_NONE = 0;
|
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;
|
public static final int REPEAT_TOGGLE_MODE_ONE = 1;
|
||||||
/** "Repeat All" button enabled. */
|
/** "Repeat All" button enabled. */
|
||||||
public static final int REPEAT_TOGGLE_MODE_ALL = 1 << 1; // 2
|
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.
|
* @param enabledModes Bitmask of enabled modes.
|
||||||
* @return The next repeat mode.
|
* @return The next repeat mode.
|
||||||
*/
|
*/
|
||||||
public static @Player.RepeatMode int getNextRepeatMode(@Player.RepeatMode int currentMode,
|
public static @Player.RepeatMode int getNextRepeatMode(
|
||||||
int enabledModes) {
|
@Player.RepeatMode int currentMode, int enabledModes) {
|
||||||
for (int offset = 1; offset <= 2; offset++) {
|
for (int offset = 1; offset <= 2; offset++) {
|
||||||
@Player.RepeatMode int proposedMode = (currentMode + offset) % 3;
|
@Player.RepeatMode int proposedMode = (currentMode + offset) % 3;
|
||||||
if (isRepeatModeEnabled(proposedMode, enabledModes)) {
|
if (isRepeatModeEnabled(proposedMode, enabledModes)) {
|
||||||
|
@ -56,5 +56,4 @@ public final class TraceUtil {
|
|||||||
private static void endSectionV18() {
|
private static void endSectionV18() {
|
||||||
android.os.Trace.endSection();
|
android.os.Trace.endSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -126,22 +126,22 @@ public final class Util {
|
|||||||
*/
|
*/
|
||||||
public static final String MODEL = Build.MODEL;
|
public static final String MODEL = Build.MODEL;
|
||||||
|
|
||||||
/**
|
/** A concise description of the device that it can be useful to log for debugging purposes. */
|
||||||
* 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;
|
||||||
public static final String DEVICE_DEBUG_INFO = DEVICE + ", " + MODEL + ", " + MANUFACTURER + ", "
|
|
||||||
+ SDK_INT;
|
|
||||||
|
|
||||||
/** An empty byte array. */
|
/** An empty byte array. */
|
||||||
public static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
|
public static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
|
||||||
|
|
||||||
private static final String TAG = "Util";
|
private static final String TAG = "Util";
|
||||||
private static final Pattern XS_DATE_TIME_PATTERN = Pattern.compile(
|
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\\d)[Tt]"
|
||||||
+ "(\\d\\d):(\\d\\d):(\\d\\d)([\\.,](\\d+))?"
|
+ "(\\d\\d):(\\d\\d):(\\d\\d)([\\.,](\\d+))?"
|
||||||
+ "([Zz]|((\\+|\\-)(\\d?\\d):?(\\d\\d)))?");
|
+ "([Zz]|((\\+|\\-)(\\d?\\d):?(\\d\\d)))?");
|
||||||
private static final Pattern XS_DURATION_PATTERN =
|
private static final Pattern XS_DURATION_PATTERN =
|
||||||
Pattern.compile("^(-)?P(([0-9]*)Y)?(([0-9]*)M)?(([0-9]*)D)?"
|
Pattern.compile(
|
||||||
|
"^(-)?P(([0-9]*)Y)?(([0-9]*)M)?(([0-9]*)D)?"
|
||||||
+ "(T(([0-9]*)H)?(([0-9]*)M)?(([0-9.]*)S)?)?$");
|
+ "(T(([0-9]*)H)?(([0-9]*)M)?(([0-9.]*)S)?)?$");
|
||||||
private static final Pattern ESCAPED_CHARACTER_PATTERN = Pattern.compile("%([A-Fa-f0-9]{2})");
|
private static final Pattern ESCAPED_CHARACTER_PATTERN = Pattern.compile("%([A-Fa-f0-9]{2})");
|
||||||
|
|
||||||
@ -930,8 +930,8 @@ public final class Util {
|
|||||||
/**
|
/**
|
||||||
* Returns the index of the largest element in {@code array} that is less than (or optionally
|
* Returns the index of the largest element in {@code array} that is less than (or optionally
|
||||||
* equal to) a specified {@code value}.
|
* 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
|
* array contains multiple elements equal to {@code value} and {@code inclusive} is true, the
|
||||||
* index of the first one will be returned.
|
* 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
|
* @return The index of the largest element in {@code array} that is less than (or optionally
|
||||||
* equal to) {@code value}.
|
* equal to) {@code value}.
|
||||||
*/
|
*/
|
||||||
public static int binarySearchFloor(long[] array, long value, boolean inclusive,
|
public static int binarySearchFloor(
|
||||||
boolean stayInBounds) {
|
long[] array, long value, boolean inclusive, boolean stayInBounds) {
|
||||||
int index = Arrays.binarySearch(array, value);
|
int index = Arrays.binarySearch(array, value);
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
index = -(index + 2);
|
index = -(index + 2);
|
||||||
@ -1226,8 +1226,8 @@ public final class Util {
|
|||||||
} else if (matcher.group(9).equalsIgnoreCase("Z")) {
|
} else if (matcher.group(9).equalsIgnoreCase("Z")) {
|
||||||
timezoneShift = 0;
|
timezoneShift = 0;
|
||||||
} else {
|
} else {
|
||||||
timezoneShift = ((Integer.parseInt(matcher.group(12)) * 60
|
timezoneShift =
|
||||||
+ Integer.parseInt(matcher.group(13))));
|
((Integer.parseInt(matcher.group(12)) * 60 + Integer.parseInt(matcher.group(13))));
|
||||||
if ("-".equals(matcher.group(11))) {
|
if ("-".equals(matcher.group(11))) {
|
||||||
timezoneShift *= -1;
|
timezoneShift *= -1;
|
||||||
}
|
}
|
||||||
@ -1237,7 +1237,8 @@ public final class Util {
|
|||||||
|
|
||||||
dateTime.clear();
|
dateTime.clear();
|
||||||
// Note: The month value is 0-based, hence the -1 on group(2)
|
// Note: The month value is 0-based, hence the -1 on group(2)
|
||||||
dateTime.set(Integer.parseInt(matcher.group(1)),
|
dateTime.set(
|
||||||
|
Integer.parseInt(matcher.group(1)),
|
||||||
Integer.parseInt(matcher.group(2)) - 1,
|
Integer.parseInt(matcher.group(2)) - 1,
|
||||||
Integer.parseInt(matcher.group(3)),
|
Integer.parseInt(matcher.group(3)),
|
||||||
Integer.parseInt(matcher.group(4)),
|
Integer.parseInt(matcher.group(4)),
|
||||||
@ -1259,9 +1260,9 @@ public final class Util {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Scales a large timestamp.
|
* Scales a large timestamp.
|
||||||
* <p>
|
*
|
||||||
* Logically, scaling consists of a multiplication followed by a division. The actual operations
|
* <p>Logically, scaling consists of a multiplication followed by a division. The actual
|
||||||
* performed are designed to minimize the probability of overflow.
|
* operations performed are designed to minimize the probability of overflow.
|
||||||
*
|
*
|
||||||
* @param timestamp The timestamp to scale.
|
* @param timestamp The timestamp to scale.
|
||||||
* @param multiplier The multiplier.
|
* @param multiplier The multiplier.
|
||||||
@ -1431,7 +1432,9 @@ public final class Util {
|
|||||||
byte[] data = new byte[hexString.length() / 2];
|
byte[] data = new byte[hexString.length() / 2];
|
||||||
for (int i = 0; i < data.length; i++) {
|
for (int i = 0; i < data.length; i++) {
|
||||||
int stringOffset = i * 2;
|
int stringOffset = i * 2;
|
||||||
data[i] = (byte) ((Character.digit(hexString.charAt(stringOffset), 16) << 4)
|
data[i] =
|
||||||
|
(byte)
|
||||||
|
((Character.digit(hexString.charAt(stringOffset), 16) << 4)
|
||||||
+ Character.digit(hexString.charAt(stringOffset + 1), 16));
|
+ Character.digit(hexString.charAt(stringOffset + 1), 16));
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
@ -1486,8 +1489,13 @@ public final class Util {
|
|||||||
} catch (NameNotFoundException e) {
|
} catch (NameNotFoundException e) {
|
||||||
versionName = "?";
|
versionName = "?";
|
||||||
}
|
}
|
||||||
return applicationName + "/" + versionName + " (Linux;Android " + Build.VERSION.RELEASE
|
return applicationName
|
||||||
+ ") " + ExoPlayerLibraryInfo.VERSION_SLASHY;
|
+ "/"
|
||||||
|
+ versionName
|
||||||
|
+ " (Linux;Android "
|
||||||
|
+ Build.VERSION.RELEASE
|
||||||
|
+ ") "
|
||||||
|
+ ExoPlayerLibraryInfo.VERSION_SLASHY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the number of codec strings in {@code codecs} whose type matches {@code trackType}. */
|
/** 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
|
@C.AudioUsage
|
||||||
public static int getAudioUsageForStreamType(@C.StreamType int streamType) {
|
public static int getAudioUsageForStreamType(@C.StreamType int streamType) {
|
||||||
switch (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
|
@C.AudioContentType
|
||||||
public static int getAudioContentTypeForStreamType(@C.StreamType int streamType) {
|
public static int getAudioContentTypeForStreamType(@C.StreamType int streamType) {
|
||||||
switch (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
|
@C.StreamType
|
||||||
public static int getStreamTypeForAudioUsage(@C.AudioUsage int usage) {
|
public static int getStreamTypeForAudioUsage(@C.AudioUsage int usage) {
|
||||||
switch (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
|
* 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.
|
* 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:
|
* <p>For simplicity, this only handles common characters known to be illegal on FAT32: <,
|
||||||
* <, >, :, ", /, \, |, ?, and *. % is also escaped since it is used as the escape
|
* >, :, ", /, \, |, ?, and *. % is also escaped since it is used as the escape character.
|
||||||
* character. Escaping is performed in a consistent way so that no collisions occur and
|
* Escaping is performed in a consistent way so that no collisions occur and {@link
|
||||||
* {@link #unescapeFileName(String)} can be used to retrieve the original file name.
|
* #unescapeFileName(String)} can be used to retrieve the original file name.
|
||||||
*
|
*
|
||||||
* @param fileName File name to be escaped.
|
* @param fileName File name to be escaped.
|
||||||
* @return An escaped file name which will be safe for use on at least FAT32 filesystems.
|
* @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,
|
* A hacky method that always throws {@code t} even if {@code t} is a checked exception, and is
|
||||||
* and is not declared to be thrown.
|
* not declared to be thrown.
|
||||||
*/
|
*/
|
||||||
public static void sneakyThrow(Throwable t) {
|
public static void sneakyThrow(Throwable t) {
|
||||||
sneakyThrowInternal(t);
|
sneakyThrowInternal(t);
|
||||||
@ -2082,7 +2084,8 @@ public final class Util {
|
|||||||
*/
|
*/
|
||||||
public static int crc32(byte[] bytes, int start, int end, int initialValue) {
|
public static int crc32(byte[] bytes, int start, int end, int initialValue) {
|
||||||
for (int i = start; i < end; i++) {
|
for (int i = start; i < end; i++) {
|
||||||
initialValue = (initialValue << 8)
|
initialValue =
|
||||||
|
(initialValue << 8)
|
||||||
^ CRC32_BYTES_MSBF[((initialValue >>> 24) ^ (bytes[i] & 0xFF)) & 0xFF];
|
^ CRC32_BYTES_MSBF[((initialValue >>> 24) ^ (bytes[i] & 0xFF)) & 0xFF];
|
||||||
}
|
}
|
||||||
return initialValue;
|
return initialValue;
|
||||||
|
@ -66,8 +66,9 @@ public final class AvcConfig {
|
|||||||
@Nullable String codecs = null;
|
@Nullable String codecs = null;
|
||||||
if (numSequenceParameterSets > 0) {
|
if (numSequenceParameterSets > 0) {
|
||||||
byte[] sps = initializationData.get(0);
|
byte[] sps = initializationData.get(0);
|
||||||
SpsData spsData = NalUnitUtil.parseSpsNalUnit(initializationData.get(0),
|
SpsData spsData =
|
||||||
nalUnitLengthFieldLength, sps.length);
|
NalUnitUtil.parseSpsNalUnit(
|
||||||
|
initializationData.get(0), nalUnitLengthFieldLength, sps.length);
|
||||||
width = spsData.width;
|
width = spsData.width;
|
||||||
height = spsData.height;
|
height = spsData.height;
|
||||||
pixelWidthAspectRatio = spsData.pixelWidthAspectRatio;
|
pixelWidthAspectRatio = spsData.pixelWidthAspectRatio;
|
||||||
@ -109,5 +110,4 @@ public final class AvcConfig {
|
|||||||
data.skipBytes(length);
|
data.skipBytes(length);
|
||||||
return CodecSpecificDataUtil.buildNalUnit(data.getData(), offset, 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
|
* 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#COLOR_SPACE_BT709}, {@link C#COLOR_SPACE_BT2020} or {@link Format#NO_VALUE} if unknown.
|
||||||
*/
|
*/
|
||||||
@C.ColorSpace
|
@C.ColorSpace public final int colorSpace;
|
||||||
public final int colorSpace;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The color range of the video. Valid values are {@link C#COLOR_RANGE_LIMITED}, {@link
|
* 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#COLOR_RANGE_FULL} or {@link Format#NO_VALUE} if unknown.
|
||||||
*/
|
*/
|
||||||
@C.ColorRange
|
@C.ColorRange public final int colorRange;
|
||||||
public final int colorRange;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The color transfer characteristics of the video. Valid values are {@link C#COLOR_TRANSFER_HLG},
|
* 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
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ColorInfo(" + colorSpace + ", " + colorRange + ", " + colorTransfer
|
return "ColorInfo("
|
||||||
+ ", " + (hdrStaticInfo != null) + ")";
|
+ colorSpace
|
||||||
|
+ ", "
|
||||||
|
+ colorRange
|
||||||
|
+ ", "
|
||||||
|
+ colorTransfer
|
||||||
|
+ ", "
|
||||||
|
+ (hdrStaticInfo != null)
|
||||||
|
+ ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -64,7 +64,11 @@ public final class HevcConfig {
|
|||||||
int numberOfNalUnits = data.readUnsignedShort();
|
int numberOfNalUnits = data.readUnsignedShort();
|
||||||
for (int j = 0; j < numberOfNalUnits; j++) {
|
for (int j = 0; j < numberOfNalUnits; j++) {
|
||||||
int nalUnitLength = data.readUnsignedShort();
|
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);
|
NalUnitUtil.NAL_START_CODE.length);
|
||||||
bufferPosition += NalUnitUtil.NAL_START_CODE.length;
|
bufferPosition += NalUnitUtil.NAL_START_CODE.length;
|
||||||
System.arraycopy(
|
System.arraycopy(
|
||||||
@ -116,5 +120,4 @@ public final class HevcConfig {
|
|||||||
this.nalUnitLengthFieldLength = nalUnitLengthFieldLength;
|
this.nalUnitLengthFieldLength = nalUnitLengthFieldLength;
|
||||||
this.codecs = codecs;
|
this.codecs = codecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ public final class EventMessageDecoderTest {
|
|||||||
assertThat(eventMessage.value).isEqualTo("123");
|
assertThat(eventMessage.value).isEqualTo("123");
|
||||||
assertThat(eventMessage.durationMs).isEqualTo(3000);
|
assertThat(eventMessage.durationMs).isEqualTo(3000);
|
||||||
assertThat(eventMessage.id).isEqualTo(1000403);
|
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
|
@Test
|
||||||
|
@ -39,5 +39,4 @@ public final class EventMessageTest {
|
|||||||
// Assert equals.
|
// Assert equals.
|
||||||
assertThat(fromParcelEventMessage).isEqualTo(eventMessage);
|
assertThat(fromParcelEventMessage).isEqualTo(eventMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,8 @@ public final class ChapterFrameTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void parcelable() {
|
public void parcelable() {
|
||||||
Id3Frame[] subFrames = new Id3Frame[] {
|
Id3Frame[] subFrames =
|
||||||
|
new Id3Frame[] {
|
||||||
new TextInformationFrame("TIT2", null, "title"),
|
new TextInformationFrame("TIT2", null, "title"),
|
||||||
new UrlLinkFrame("WXXX", "description", "url")
|
new UrlLinkFrame("WXXX", "description", "url")
|
||||||
};
|
};
|
||||||
@ -43,5 +44,4 @@ public final class ChapterFrameTest {
|
|||||||
|
|
||||||
parcel.recycle();
|
parcel.recycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,12 +29,13 @@ public final class ChapterTocFrameTest {
|
|||||||
@Test
|
@Test
|
||||||
public void parcelable() {
|
public void parcelable() {
|
||||||
String[] children = new String[] {"child0", "child1"};
|
String[] children = new String[] {"child0", "child1"};
|
||||||
Id3Frame[] subFrames = new Id3Frame[] {
|
Id3Frame[] subFrames =
|
||||||
|
new Id3Frame[] {
|
||||||
new TextInformationFrame("TIT2", null, "title"),
|
new TextInformationFrame("TIT2", null, "title"),
|
||||||
new UrlLinkFrame("WXXX", "description", "url")
|
new UrlLinkFrame("WXXX", "description", "url")
|
||||||
};
|
};
|
||||||
ChapterTocFrame chapterTocFrameToParcel = new ChapterTocFrame("id", false, true, children,
|
ChapterTocFrame chapterTocFrameToParcel =
|
||||||
subFrames);
|
new ChapterTocFrame("id", false, true, children, subFrames);
|
||||||
|
|
||||||
Parcel parcel = Parcel.obtain();
|
Parcel parcel = Parcel.obtain();
|
||||||
chapterTocFrameToParcel.writeToParcel(parcel, 0);
|
chapterTocFrameToParcel.writeToParcel(parcel, 0);
|
||||||
@ -45,5 +46,4 @@ public final class ChapterTocFrameTest {
|
|||||||
|
|
||||||
parcel.recycle();
|
parcel.recycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -38,8 +38,13 @@ public final class Id3DecoderTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void decodeTxxxFrame() {
|
public void decodeTxxxFrame() {
|
||||||
byte[] rawId3 = buildSingleFrameTag("TXXX", new byte[] {3, 0, 109, 100, 105, 97, 108, 111, 103,
|
byte[] rawId3 =
|
||||||
95, 86, 73, 78, 68, 73, 67, 79, 49, 53, 50, 55, 54, 54, 52, 95, 115, 116, 97, 114, 116, 0});
|
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();
|
Id3Decoder decoder = new Id3Decoder();
|
||||||
Metadata metadata = decoder.decode(rawId3, rawId3.length);
|
Metadata metadata = decoder.decode(rawId3, rawId3.length);
|
||||||
assertThat(metadata.length()).isEqualTo(1);
|
assertThat(metadata.length()).isEqualTo(1);
|
||||||
@ -65,8 +70,9 @@ public final class Id3DecoderTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void decodeTextInformationFrame() {
|
public void decodeTextInformationFrame() {
|
||||||
byte[] rawId3 = buildSingleFrameTag("TIT2", new byte[] {3, 72, 101, 108, 108, 111, 32, 87, 111,
|
byte[] rawId3 =
|
||||||
114, 108, 100, 0});
|
buildSingleFrameTag(
|
||||||
|
"TIT2", new byte[] {3, 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 0});
|
||||||
Id3Decoder decoder = new Id3Decoder();
|
Id3Decoder decoder = new Id3Decoder();
|
||||||
Metadata metadata = decoder.decode(rawId3, rawId3.length);
|
Metadata metadata = decoder.decode(rawId3, rawId3.length);
|
||||||
assertThat(metadata.length()).isEqualTo(1);
|
assertThat(metadata.length()).isEqualTo(1);
|
||||||
@ -92,9 +98,41 @@ public final class Id3DecoderTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void decodeWxxxFrame() {
|
public void decodeWxxxFrame() {
|
||||||
byte[] rawId3 = buildSingleFrameTag("WXXX", new byte[] {ID3_TEXT_ENCODING_UTF_8, 116, 101, 115,
|
byte[] rawId3 =
|
||||||
116, 0, 104, 116, 116, 112, 115, 58, 47, 47, 116, 101, 115, 116, 46, 99, 111, 109, 47, 97,
|
buildSingleFrameTag(
|
||||||
98, 99, 63, 100, 101, 102});
|
"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();
|
Id3Decoder decoder = new Id3Decoder();
|
||||||
Metadata metadata = decoder.decode(rawId3, rawId3.length);
|
Metadata metadata = decoder.decode(rawId3, rawId3.length);
|
||||||
assertThat(metadata.length()).isEqualTo(1);
|
assertThat(metadata.length()).isEqualTo(1);
|
||||||
@ -120,8 +158,13 @@ public final class Id3DecoderTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void decodeUrlLinkFrame() {
|
public void decodeUrlLinkFrame() {
|
||||||
byte[] rawId3 = buildSingleFrameTag("WCOM", new byte[] {104, 116, 116, 112, 115, 58, 47, 47,
|
byte[] rawId3 =
|
||||||
116, 101, 115, 116, 46, 99, 111, 109, 47, 97, 98, 99, 63, 100, 101, 102});
|
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();
|
Id3Decoder decoder = new Id3Decoder();
|
||||||
Metadata metadata = decoder.decode(rawId3, rawId3.length);
|
Metadata metadata = decoder.decode(rawId3, rawId3.length);
|
||||||
assertThat(metadata.length()).isEqualTo(1);
|
assertThat(metadata.length()).isEqualTo(1);
|
||||||
@ -148,7 +191,7 @@ public final class Id3DecoderTest {
|
|||||||
assertThat(metadata.length()).isEqualTo(1);
|
assertThat(metadata.length()).isEqualTo(1);
|
||||||
PrivFrame privFrame = (PrivFrame) metadata.get(0);
|
PrivFrame privFrame = (PrivFrame) metadata.get(0);
|
||||||
assertThat(privFrame.owner).isEqualTo("test");
|
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.
|
// Test empty.
|
||||||
rawId3 = buildSingleFrameTag("PRIV", new byte[0]);
|
rawId3 = buildSingleFrameTag("PRIV", new byte[0]);
|
||||||
@ -161,9 +204,13 @@ public final class Id3DecoderTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void decodeApicFrame() {
|
public void decodeApicFrame() {
|
||||||
byte[] rawId3 = buildSingleFrameTag("APIC", new byte[] {3, 105, 109, 97, 103, 101, 47, 106, 112,
|
byte[] rawId3 =
|
||||||
101, 103, 0, 16, 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 0, 1, 2, 3, 4, 5, 6, 7,
|
buildSingleFrameTag(
|
||||||
8, 9, 0});
|
"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();
|
Id3Decoder decoder = new Id3Decoder();
|
||||||
Metadata metadata = decoder.decode(rawId3, rawId3.length);
|
Metadata metadata = decoder.decode(rawId3, rawId3.length);
|
||||||
assertThat(metadata.length()).isEqualTo(1);
|
assertThat(metadata.length()).isEqualTo(1);
|
||||||
@ -172,13 +219,37 @@ public final class Id3DecoderTest {
|
|||||||
assertThat(apicFrame.pictureType).isEqualTo(16);
|
assertThat(apicFrame.pictureType).isEqualTo(16);
|
||||||
assertThat(apicFrame.description).isEqualTo("Hello World");
|
assertThat(apicFrame.description).isEqualTo("Hello World");
|
||||||
assertThat(apicFrame.pictureData).hasLength(10);
|
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
|
@Test
|
||||||
public void decodeCommentFrame() {
|
public void decodeCommentFrame() {
|
||||||
byte[] rawId3 = buildSingleFrameTag("COMM", new byte[] {ID3_TEXT_ENCODING_UTF_8, 101, 110, 103,
|
byte[] rawId3 =
|
||||||
100, 101, 115, 99, 114, 105, 112, 116, 105, 111, 110, 0, 116, 101, 120, 116, 0});
|
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();
|
Id3Decoder decoder = new Id3Decoder();
|
||||||
Metadata metadata = decoder.decode(rawId3, rawId3.length);
|
Metadata metadata = decoder.decode(rawId3, rawId3.length);
|
||||||
assertThat(metadata.length()).isEqualTo(1);
|
assertThat(metadata.length()).isEqualTo(1);
|
||||||
|
@ -45,5 +45,4 @@ public final class MlltFrameTest {
|
|||||||
|
|
||||||
parcel.recycle();
|
parcel.recycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,9 +29,10 @@ public final class NalUnitUtilTest {
|
|||||||
|
|
||||||
private static final int TEST_PARTIAL_NAL_POSITION = 4;
|
private static final int TEST_PARTIAL_NAL_POSITION = 4;
|
||||||
private static final int TEST_NAL_POSITION = 10;
|
private static final int TEST_NAL_POSITION = 10;
|
||||||
private static final byte[] SPS_TEST_DATA = createByteArray(0x00, 0x00, 0x01, 0x67, 0x4D, 0x40,
|
private static final byte[] SPS_TEST_DATA =
|
||||||
0x16, 0xEC, 0xA0, 0x50, 0x17, 0xFC, 0xB8, 0x08, 0x80, 0x00, 0x00, 0x03, 0x00, 0x80, 0x00,
|
createByteArray(
|
||||||
0x00, 0x0F, 0x47, 0x8B, 0x16, 0xCB);
|
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;
|
private static final int SPS_TEST_DATA_OFFSET = 3;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -121,8 +122,8 @@ public final class NalUnitUtilTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void parseSpsNalUnit() {
|
public void parseSpsNalUnit() {
|
||||||
NalUnitUtil.SpsData data = NalUnitUtil.parseSpsNalUnit(SPS_TEST_DATA, SPS_TEST_DATA_OFFSET,
|
NalUnitUtil.SpsData data =
|
||||||
SPS_TEST_DATA.length);
|
NalUnitUtil.parseSpsNalUnit(SPS_TEST_DATA, SPS_TEST_DATA_OFFSET, SPS_TEST_DATA.length);
|
||||||
assertThat(data.width).isEqualTo(640);
|
assertThat(data.width).isEqualTo(640);
|
||||||
assertThat(data.height).isEqualTo(360);
|
assertThat(data.height).isEqualTo(360);
|
||||||
assertThat(data.deltaPicOrderAlwaysZeroFlag).isFalse();
|
assertThat(data.deltaPicOrderAlwaysZeroFlag).isFalse();
|
||||||
|
@ -79,8 +79,8 @@ public final class ParsableByteArrayTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void testReadShort(short testValue) {
|
private static void testReadShort(short testValue) {
|
||||||
ParsableByteArray testArray = new ParsableByteArray(
|
ParsableByteArray testArray =
|
||||||
ByteBuffer.allocate(4).putShort(testValue).array());
|
new ParsableByteArray(ByteBuffer.allocate(4).putShort(testValue).array());
|
||||||
int readValue = testArray.readShort();
|
int readValue = testArray.readShort();
|
||||||
|
|
||||||
// Assert that the value we read was the value we wrote.
|
// Assert that the value we read was the value we wrote.
|
||||||
@ -105,8 +105,8 @@ public final class ParsableByteArrayTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void testReadInt(int testValue) {
|
private static void testReadInt(int testValue) {
|
||||||
ParsableByteArray testArray = new ParsableByteArray(
|
ParsableByteArray testArray =
|
||||||
ByteBuffer.allocate(4).putInt(testValue).array());
|
new ParsableByteArray(ByteBuffer.allocate(4).putInt(testValue).array());
|
||||||
int readValue = testArray.readInt();
|
int readValue = testArray.readInt();
|
||||||
|
|
||||||
// Assert that the value we read was the value we wrote.
|
// Assert that the value we read was the value we wrote.
|
||||||
@ -131,7 +131,8 @@ public final class ParsableByteArrayTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void testReadUnsignedInt(long testValue) {
|
private static void testReadUnsignedInt(long testValue) {
|
||||||
ParsableByteArray testArray = new ParsableByteArray(
|
ParsableByteArray testArray =
|
||||||
|
new ParsableByteArray(
|
||||||
Arrays.copyOfRange(ByteBuffer.allocate(8).putLong(testValue).array(), 4, 8));
|
Arrays.copyOfRange(ByteBuffer.allocate(8).putLong(testValue).array(), 4, 8));
|
||||||
long readValue = testArray.readUnsignedInt();
|
long readValue = testArray.readUnsignedInt();
|
||||||
|
|
||||||
@ -167,8 +168,8 @@ public final class ParsableByteArrayTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void testReadUnsignedIntToInt(int testValue) {
|
private static void testReadUnsignedIntToInt(int testValue) {
|
||||||
ParsableByteArray testArray = new ParsableByteArray(
|
ParsableByteArray testArray =
|
||||||
ByteBuffer.allocate(4).putInt(testValue).array());
|
new ParsableByteArray(ByteBuffer.allocate(4).putInt(testValue).array());
|
||||||
int readValue = testArray.readUnsignedIntToInt();
|
int readValue = testArray.readUnsignedIntToInt();
|
||||||
|
|
||||||
// Assert that the value we read was the value we wrote.
|
// Assert that the value we read was the value we wrote.
|
||||||
@ -203,8 +204,8 @@ public final class ParsableByteArrayTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void testReadUnsignedLongToLong(long testValue) {
|
private static void testReadUnsignedLongToLong(long testValue) {
|
||||||
ParsableByteArray testArray = new ParsableByteArray(
|
ParsableByteArray testArray =
|
||||||
ByteBuffer.allocate(8).putLong(testValue).array());
|
new ParsableByteArray(ByteBuffer.allocate(8).putLong(testValue).array());
|
||||||
long readValue = testArray.readUnsignedLongToLong();
|
long readValue = testArray.readUnsignedLongToLong();
|
||||||
|
|
||||||
// Assert that the value we read was the value we wrote.
|
// Assert that the value we read was the value we wrote.
|
||||||
@ -229,8 +230,8 @@ public final class ParsableByteArrayTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void testReadLong(long testValue) {
|
private static void testReadLong(long testValue) {
|
||||||
ParsableByteArray testArray = new ParsableByteArray(
|
ParsableByteArray testArray =
|
||||||
ByteBuffer.allocate(8).putLong(testValue).array());
|
new ParsableByteArray(ByteBuffer.allocate(8).putLong(testValue).array());
|
||||||
long readValue = testArray.readLong();
|
long readValue = testArray.readLong();
|
||||||
|
|
||||||
// Assert that the value we read was the value we wrote.
|
// Assert that the value we read was the value we wrote.
|
||||||
@ -327,28 +328,22 @@ public final class ParsableByteArrayTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void readLittleEndianLong() {
|
public void readLittleEndianLong() {
|
||||||
ParsableByteArray byteArray = new ParsableByteArray(new byte[] {
|
ParsableByteArray byteArray =
|
||||||
0x01, 0x00, 0x00, 0x00,
|
new ParsableByteArray(new byte[] {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0xFF});
|
||||||
0x00, 0x00, 0x00, (byte) 0xFF
|
|
||||||
});
|
|
||||||
assertThat(byteArray.readLittleEndianLong()).isEqualTo(0xFF00000000000001L);
|
assertThat(byteArray.readLittleEndianLong()).isEqualTo(0xFF00000000000001L);
|
||||||
assertThat(byteArray.getPosition()).isEqualTo(8);
|
assertThat(byteArray.getPosition()).isEqualTo(8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void readLittleEndianUnsignedInt() {
|
public void readLittleEndianUnsignedInt() {
|
||||||
ParsableByteArray byteArray = new ParsableByteArray(new byte[] {
|
ParsableByteArray byteArray = new ParsableByteArray(new byte[] {0x10, 0x00, 0x00, (byte) 0xFF});
|
||||||
0x10, 0x00, 0x00, (byte) 0xFF
|
|
||||||
});
|
|
||||||
assertThat(byteArray.readLittleEndianUnsignedInt()).isEqualTo(0xFF000010L);
|
assertThat(byteArray.readLittleEndianUnsignedInt()).isEqualTo(0xFF000010L);
|
||||||
assertThat(byteArray.getPosition()).isEqualTo(4);
|
assertThat(byteArray.getPosition()).isEqualTo(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void readLittleEndianInt() {
|
public void readLittleEndianInt() {
|
||||||
ParsableByteArray byteArray = new ParsableByteArray(new byte[] {
|
ParsableByteArray byteArray = new ParsableByteArray(new byte[] {0x01, 0x00, 0x00, (byte) 0xFF});
|
||||||
0x01, 0x00, 0x00, (byte) 0xFF
|
|
||||||
});
|
|
||||||
assertThat(byteArray.readLittleEndianInt()).isEqualTo(0xFF000001);
|
assertThat(byteArray.readLittleEndianInt()).isEqualTo(0xFF000001);
|
||||||
assertThat(byteArray.getPosition()).isEqualTo(4);
|
assertThat(byteArray.getPosition()).isEqualTo(4);
|
||||||
}
|
}
|
||||||
@ -379,9 +374,8 @@ public final class ParsableByteArrayTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void readLittleEndianUnsignedShort() {
|
public void readLittleEndianUnsignedShort() {
|
||||||
ParsableByteArray byteArray = new ParsableByteArray(new byte[] {
|
ParsableByteArray byteArray =
|
||||||
0x01, (byte) 0xFF, 0x02, (byte) 0xFF
|
new ParsableByteArray(new byte[] {0x01, (byte) 0xFF, 0x02, (byte) 0xFF});
|
||||||
});
|
|
||||||
assertThat(byteArray.readLittleEndianUnsignedShort()).isEqualTo(0xFF01);
|
assertThat(byteArray.readLittleEndianUnsignedShort()).isEqualTo(0xFF01);
|
||||||
assertThat(byteArray.getPosition()).isEqualTo(2);
|
assertThat(byteArray.getPosition()).isEqualTo(2);
|
||||||
assertThat(byteArray.readLittleEndianUnsignedShort()).isEqualTo(0xFF02);
|
assertThat(byteArray.readLittleEndianUnsignedShort()).isEqualTo(0xFF02);
|
||||||
@ -390,9 +384,8 @@ public final class ParsableByteArrayTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void readLittleEndianShort() {
|
public void readLittleEndianShort() {
|
||||||
ParsableByteArray byteArray = new ParsableByteArray(new byte[] {
|
ParsableByteArray byteArray =
|
||||||
0x01, (byte) 0xFF, 0x02, (byte) 0xFF
|
new ParsableByteArray(new byte[] {0x01, (byte) 0xFF, 0x02, (byte) 0xFF});
|
||||||
});
|
|
||||||
assertThat(byteArray.readLittleEndianShort()).isEqualTo((short) 0xFF01);
|
assertThat(byteArray.readLittleEndianShort()).isEqualTo((short) 0xFF01);
|
||||||
assertThat(byteArray.getPosition()).isEqualTo(2);
|
assertThat(byteArray.getPosition()).isEqualTo(2);
|
||||||
assertThat(byteArray.readLittleEndianShort()).isEqualTo((short) 0xFF02);
|
assertThat(byteArray.readLittleEndianShort()).isEqualTo((short) 0xFF02);
|
||||||
@ -402,13 +395,29 @@ public final class ParsableByteArrayTest {
|
|||||||
@Test
|
@Test
|
||||||
public void readString() {
|
public void readString() {
|
||||||
byte[] data = {
|
byte[] data = {
|
||||||
(byte) 0xC3, (byte) 0xA4, (byte) 0x20,
|
(byte) 0xC3,
|
||||||
(byte) 0xC3, (byte) 0xB6, (byte) 0x20,
|
(byte) 0xA4,
|
||||||
(byte) 0xC2, (byte) 0xAE, (byte) 0x20,
|
(byte) 0x20,
|
||||||
(byte) 0xCF, (byte) 0x80, (byte) 0x20,
|
(byte) 0xC3,
|
||||||
(byte) 0xE2, (byte) 0x88, (byte) 0x9A, (byte) 0x20,
|
(byte) 0xB6,
|
||||||
(byte) 0xC2, (byte) 0xB1, (byte) 0x20,
|
(byte) 0x20,
|
||||||
(byte) 0xE8, (byte) 0xB0, (byte) 0xA2, (byte) 0x20,
|
(byte) 0xC2,
|
||||||
|
(byte) 0xAE,
|
||||||
|
(byte) 0x20,
|
||||||
|
(byte) 0xCF,
|
||||||
|
(byte) 0x80,
|
||||||
|
(byte) 0x20,
|
||||||
|
(byte) 0xE2,
|
||||||
|
(byte) 0x88,
|
||||||
|
(byte) 0x9A,
|
||||||
|
(byte) 0x20,
|
||||||
|
(byte) 0xC2,
|
||||||
|
(byte) 0xB1,
|
||||||
|
(byte) 0x20,
|
||||||
|
(byte) 0xE8,
|
||||||
|
(byte) 0xB0,
|
||||||
|
(byte) 0xA2,
|
||||||
|
(byte) 0x20,
|
||||||
};
|
};
|
||||||
ParsableByteArray byteArray = new ParsableByteArray(data);
|
ParsableByteArray byteArray = new ParsableByteArray(data);
|
||||||
assertThat(byteArray.readString(data.length)).isEqualTo("ä ö ® π √ ± 谢 ");
|
assertThat(byteArray.readString(data.length)).isEqualTo("ä ö ® π √ ± 谢 ");
|
||||||
@ -425,9 +434,7 @@ public final class ParsableByteArrayTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void readStringOutOfBoundsDoesNotMovePosition() {
|
public void readStringOutOfBoundsDoesNotMovePosition() {
|
||||||
byte[] data = {
|
byte[] data = {(byte) 0xC3, (byte) 0xA4, (byte) 0x20};
|
||||||
(byte) 0xC3, (byte) 0xA4, (byte) 0x20
|
|
||||||
};
|
|
||||||
ParsableByteArray byteArray = new ParsableByteArray(data);
|
ParsableByteArray byteArray = new ParsableByteArray(data);
|
||||||
try {
|
try {
|
||||||
byteArray.readString(data.length + 1);
|
byteArray.readString(data.length + 1);
|
||||||
@ -446,9 +453,7 @@ public final class ParsableByteArrayTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void readNullTerminatedStringWithLengths() {
|
public void readNullTerminatedStringWithLengths() {
|
||||||
byte[] bytes = new byte[] {
|
byte[] bytes = new byte[] {'f', 'o', 'o', 0, 'b', 'a', 'r', 0};
|
||||||
'f', 'o', 'o', 0, 'b', 'a', 'r', 0
|
|
||||||
};
|
|
||||||
// Test with lengths that match NUL byte positions.
|
// Test with lengths that match NUL byte positions.
|
||||||
ParsableByteArray parser = new ParsableByteArray(bytes);
|
ParsableByteArray parser = new ParsableByteArray(bytes);
|
||||||
assertThat(parser.readNullTerminatedString(4)).isEqualTo("foo");
|
assertThat(parser.readNullTerminatedString(4)).isEqualTo("foo");
|
||||||
@ -481,9 +486,7 @@ public final class ParsableByteArrayTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void readNullTerminatedString() {
|
public void readNullTerminatedString() {
|
||||||
byte[] bytes = new byte[] {
|
byte[] bytes = new byte[] {'f', 'o', 'o', 0, 'b', 'a', 'r', 0};
|
||||||
'f', 'o', 'o', 0, 'b', 'a', 'r', 0
|
|
||||||
};
|
|
||||||
// Test normal case.
|
// Test normal case.
|
||||||
ParsableByteArray parser = new ParsableByteArray(bytes);
|
ParsableByteArray parser = new ParsableByteArray(bytes);
|
||||||
assertThat(parser.readNullTerminatedString()).isEqualTo("foo");
|
assertThat(parser.readNullTerminatedString()).isEqualTo("foo");
|
||||||
@ -505,9 +508,7 @@ public final class ParsableByteArrayTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void readNullTerminatedStringWithoutEndingNull() {
|
public void readNullTerminatedStringWithoutEndingNull() {
|
||||||
byte[] bytes = new byte[] {
|
byte[] bytes = new byte[] {'f', 'o', 'o', 0, 'b', 'a', 'r'};
|
||||||
'f', 'o', 'o', 0, 'b', 'a', 'r'
|
|
||||||
};
|
|
||||||
ParsableByteArray parser = new ParsableByteArray(bytes);
|
ParsableByteArray parser = new ParsableByteArray(bytes);
|
||||||
assertThat(parser.readNullTerminatedString()).isEqualTo("foo");
|
assertThat(parser.readNullTerminatedString()).isEqualTo("foo");
|
||||||
assertThat(parser.readNullTerminatedString()).isEqualTo("bar");
|
assertThat(parser.readNullTerminatedString()).isEqualTo("bar");
|
||||||
@ -548,9 +549,7 @@ public final class ParsableByteArrayTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void readSingleLineWithoutEndingTrail() {
|
public void readSingleLineWithoutEndingTrail() {
|
||||||
byte[] bytes = new byte[] {
|
byte[] bytes = new byte[] {'f', 'o', 'o'};
|
||||||
'f', 'o', 'o'
|
|
||||||
};
|
|
||||||
ParsableByteArray parser = new ParsableByteArray(bytes);
|
ParsableByteArray parser = new ParsableByteArray(bytes);
|
||||||
assertThat(parser.readLine()).isEqualTo("foo");
|
assertThat(parser.readLine()).isEqualTo("foo");
|
||||||
assertThat(parser.readLine()).isNull();
|
assertThat(parser.readLine()).isNull();
|
||||||
@ -558,9 +557,7 @@ public final class ParsableByteArrayTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void readSingleLineWithEndingLf() {
|
public void readSingleLineWithEndingLf() {
|
||||||
byte[] bytes = new byte[] {
|
byte[] bytes = new byte[] {'f', 'o', 'o', '\n'};
|
||||||
'f', 'o', 'o', '\n'
|
|
||||||
};
|
|
||||||
ParsableByteArray parser = new ParsableByteArray(bytes);
|
ParsableByteArray parser = new ParsableByteArray(bytes);
|
||||||
assertThat(parser.readLine()).isEqualTo("foo");
|
assertThat(parser.readLine()).isEqualTo("foo");
|
||||||
assertThat(parser.readLine()).isNull();
|
assertThat(parser.readLine()).isNull();
|
||||||
@ -568,9 +565,7 @@ public final class ParsableByteArrayTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void readTwoLinesWithCrFollowedByLf() {
|
public void readTwoLinesWithCrFollowedByLf() {
|
||||||
byte[] bytes = new byte[] {
|
byte[] bytes = new byte[] {'f', 'o', 'o', '\r', '\n', 'b', 'a', 'r'};
|
||||||
'f', 'o', 'o', '\r', '\n', 'b', 'a', 'r'
|
|
||||||
};
|
|
||||||
ParsableByteArray parser = new ParsableByteArray(bytes);
|
ParsableByteArray parser = new ParsableByteArray(bytes);
|
||||||
assertThat(parser.readLine()).isEqualTo("foo");
|
assertThat(parser.readLine()).isEqualTo("foo");
|
||||||
assertThat(parser.readLine()).isEqualTo("bar");
|
assertThat(parser.readLine()).isEqualTo("bar");
|
||||||
@ -579,9 +574,7 @@ public final class ParsableByteArrayTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void readThreeLinesWithEmptyLine() {
|
public void readThreeLinesWithEmptyLine() {
|
||||||
byte[] bytes = new byte[] {
|
byte[] bytes = new byte[] {'f', 'o', 'o', '\r', '\n', '\r', 'b', 'a', 'r'};
|
||||||
'f', 'o', 'o', '\r', '\n', '\r', 'b', 'a', 'r'
|
|
||||||
};
|
|
||||||
ParsableByteArray parser = new ParsableByteArray(bytes);
|
ParsableByteArray parser = new ParsableByteArray(bytes);
|
||||||
assertThat(parser.readLine()).isEqualTo("foo");
|
assertThat(parser.readLine()).isEqualTo("foo");
|
||||||
assertThat(parser.readLine()).isEqualTo("");
|
assertThat(parser.readLine()).isEqualTo("");
|
||||||
@ -591,9 +584,7 @@ public final class ParsableByteArrayTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void readFourLinesWithLfFollowedByCr() {
|
public void readFourLinesWithLfFollowedByCr() {
|
||||||
byte[] bytes = new byte[] {
|
byte[] bytes = new byte[] {'f', 'o', 'o', '\n', '\r', '\r', 'b', 'a', 'r', '\r', '\n'};
|
||||||
'f', 'o', 'o', '\n', '\r', '\r', 'b', 'a', 'r', '\r', '\n'
|
|
||||||
};
|
|
||||||
ParsableByteArray parser = new ParsableByteArray(bytes);
|
ParsableByteArray parser = new ParsableByteArray(bytes);
|
||||||
assertThat(parser.readLine()).isEqualTo("foo");
|
assertThat(parser.readLine()).isEqualTo("foo");
|
||||||
assertThat(parser.readLine()).isEqualTo("");
|
assertThat(parser.readLine()).isEqualTo("");
|
||||||
@ -601,5 +592,4 @@ public final class ParsableByteArrayTest {
|
|||||||
assertThat(parser.readLine()).isEqualTo("bar");
|
assertThat(parser.readLine()).isEqualTo("bar");
|
||||||
assertThat(parser.readLine()).isNull();
|
assertThat(parser.readLine()).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,10 @@ public final class ContentDataSourceTest {
|
|||||||
DataSpec dataSpec = new DataSpec(contentUri, offset, length);
|
DataSpec dataSpec = new DataSpec(contentUri, offset, length);
|
||||||
byte[] completeData =
|
byte[] completeData =
|
||||||
TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), DATA_PATH);
|
TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), DATA_PATH);
|
||||||
byte[] expectedData = Arrays.copyOfRange(completeData, offset,
|
byte[] expectedData =
|
||||||
|
Arrays.copyOfRange(
|
||||||
|
completeData,
|
||||||
|
offset,
|
||||||
length == C.LENGTH_UNSET ? completeData.length : offset + length);
|
length == C.LENGTH_UNSET ? completeData.length : offset + length);
|
||||||
TestUtil.assertDataSourceContent(dataSource, dataSpec, expectedData, !pipeMode);
|
TestUtil.assertDataSourceContent(dataSource, dataSpec, expectedData, !pipeMode);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -123,5 +123,4 @@ public final class TestContentProvider extends ContentProvider
|
|||||||
private static String getFileName(Uri uri) {
|
private static String getFileName(Uri uri) {
|
||||||
return uri.getPath().replaceFirst("/", "");
|
return uri.getPath().replaceFirst("/", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -45,8 +45,8 @@ public abstract class BaseRenderer implements Renderer, RendererCapabilities {
|
|||||||
private boolean throwRendererExceptionIsExecuting;
|
private boolean throwRendererExceptionIsExecuting;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param trackType The track type that the renderer handles. One of the {@link C}
|
* @param trackType The track type that the renderer handles. One of the {@link C} {@code
|
||||||
* {@code TRACK_TYPE_*} constants.
|
* TRACK_TYPE_*} constants.
|
||||||
*/
|
*/
|
||||||
public BaseRenderer(int trackType) {
|
public BaseRenderer(int trackType) {
|
||||||
this.trackType = trackType;
|
this.trackType = trackType;
|
||||||
@ -253,8 +253,8 @@ public abstract class BaseRenderer implements Renderer, RendererCapabilities {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the renderer is started.
|
* 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.
|
* @throws ExoPlaybackException If an error occurs.
|
||||||
*/
|
*/
|
||||||
@ -273,8 +273,8 @@ public abstract class BaseRenderer implements Renderer, RendererCapabilities {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the renderer is disabled.
|
* 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() {
|
protected void onDisabled() {
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
@ -325,9 +325,7 @@ public abstract class BaseRenderer implements Renderer, RendererCapabilities {
|
|||||||
return Assertions.checkNotNull(configuration);
|
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() {
|
protected final int getIndex() {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,8 @@ import com.google.android.exoplayer2.util.MediaClock;
|
|||||||
import com.google.android.exoplayer2.util.StandaloneMediaClock;
|
import com.google.android.exoplayer2.util.StandaloneMediaClock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default {@link MediaClock} which uses a renderer media clock and falls back to a
|
* Default {@link MediaClock} which uses a renderer media clock and falls back to a {@link
|
||||||
* {@link StandaloneMediaClock} if necessary.
|
* StandaloneMediaClock} if necessary.
|
||||||
*/
|
*/
|
||||||
/* package */ final class DefaultMediaClock implements MediaClock {
|
/* package */ final class DefaultMediaClock implements MediaClock {
|
||||||
|
|
||||||
@ -60,17 +60,13 @@ import com.google.android.exoplayer2.util.StandaloneMediaClock;
|
|||||||
isUsingStandaloneClock = true;
|
isUsingStandaloneClock = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Starts the standalone fallback clock. */
|
||||||
* Starts the standalone fallback clock.
|
|
||||||
*/
|
|
||||||
public void start() {
|
public void start() {
|
||||||
standaloneClockIsStarted = true;
|
standaloneClockIsStarted = true;
|
||||||
standaloneClock.start();
|
standaloneClock.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Stops the standalone fallback clock. */
|
||||||
* Stops the standalone fallback clock.
|
|
||||||
*/
|
|
||||||
public void stop() {
|
public void stop() {
|
||||||
standaloneClockIsStarted = false;
|
standaloneClockIsStarted = false;
|
||||||
standaloneClock.stop();
|
standaloneClock.stop();
|
||||||
|
@ -61,15 +61,13 @@ public class DefaultRenderersFactory implements RenderersFactory {
|
|||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@IntDef({EXTENSION_RENDERER_MODE_OFF, EXTENSION_RENDERER_MODE_ON, EXTENSION_RENDERER_MODE_PREFER})
|
@IntDef({EXTENSION_RENDERER_MODE_OFF, EXTENSION_RENDERER_MODE_ON, EXTENSION_RENDERER_MODE_PREFER})
|
||||||
public @interface ExtensionRendererMode {}
|
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;
|
public static final int EXTENSION_RENDERER_MODE_OFF = 0;
|
||||||
/**
|
/**
|
||||||
* Allow use of extension renderers. Extension renderers are indexed after core renderers of the
|
* 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
|
* 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
|
* prefer to use a core renderer to an extension renderer in the case that both are able to play a
|
||||||
* a given track.
|
* given track.
|
||||||
*/
|
*/
|
||||||
public static final int EXTENSION_RENDERER_MODE_ON = 1;
|
public static final int EXTENSION_RENDERER_MODE_ON = 1;
|
||||||
/**
|
/**
|
||||||
@ -331,10 +329,18 @@ public class DefaultRenderersFactory implements RenderersFactory {
|
|||||||
audioRendererEventListener,
|
audioRendererEventListener,
|
||||||
renderersList);
|
renderersList);
|
||||||
}
|
}
|
||||||
buildTextRenderers(context, textRendererOutput, eventHandler.getLooper(),
|
buildTextRenderers(
|
||||||
extensionRendererMode, renderersList);
|
context,
|
||||||
buildMetadataRenderers(context, metadataRendererOutput, eventHandler.getLooper(),
|
textRendererOutput,
|
||||||
extensionRendererMode, renderersList);
|
eventHandler.getLooper(),
|
||||||
|
extensionRendererMode,
|
||||||
|
renderersList);
|
||||||
|
buildMetadataRenderers(
|
||||||
|
context,
|
||||||
|
metadataRendererOutput,
|
||||||
|
eventHandler.getLooper(),
|
||||||
|
extensionRendererMode,
|
||||||
|
renderersList);
|
||||||
buildCameraMotionRenderers(context, extensionRendererMode, renderersList);
|
buildCameraMotionRenderers(context, extensionRendererMode, renderersList);
|
||||||
buildMiscellaneousRenderers(context, eventHandler, extensionRendererMode, renderersList);
|
buildMiscellaneousRenderers(context, eventHandler, extensionRendererMode, renderersList);
|
||||||
return renderersList.toArray(new Renderer[0]);
|
return renderersList.toArray(new Renderer[0]);
|
||||||
@ -626,8 +632,11 @@ public class DefaultRenderersFactory implements RenderersFactory {
|
|||||||
* @param extensionRendererMode The extension renderer mode.
|
* @param extensionRendererMode The extension renderer mode.
|
||||||
* @param out An array to which the built renderers should be appended.
|
* @param out An array to which the built renderers should be appended.
|
||||||
*/
|
*/
|
||||||
protected void buildMiscellaneousRenderers(Context context, Handler eventHandler,
|
protected void buildMiscellaneousRenderers(
|
||||||
@ExtensionRendererMode int extensionRendererMode, ArrayList<Renderer> out) {
|
Context context,
|
||||||
|
Handler eventHandler,
|
||||||
|
@ExtensionRendererMode int extensionRendererMode,
|
||||||
|
ArrayList<Renderer> out) {
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,8 +122,7 @@ public abstract class NoSampleRenderer implements Renderer, RendererCapabilities
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void maybeThrowStreamError() throws IOException {
|
public final void maybeThrowStreamError() throws IOException {}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void resetPosition(long positionUs) throws ExoPlaybackException {
|
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.
|
* 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.
|
* @param joining Whether this renderer is being enabled to join an ongoing playback.
|
||||||
* @throws ExoPlaybackException If an error occurs.
|
* @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.
|
* 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
|
* <p>The default implementation is a no-op.
|
||||||
* {@link #render(long, long)} to get the playback position with respect to the media.
|
*
|
||||||
|
* @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.
|
* @throws ExoPlaybackException If an error occurs.
|
||||||
*/
|
*/
|
||||||
protected void onRendererOffsetChanged(long offsetUs) throws ExoPlaybackException {
|
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
|
* Called when the position is reset. This occurs when the renderer is enabled after {@link
|
||||||
* {@link #onRendererOffsetChanged(long)} has been called, and also when a position
|
* #onRendererOffsetChanged(long)} has been called, and also when a position discontinuity is
|
||||||
* discontinuity is encountered.
|
* encountered.
|
||||||
* <p>
|
*
|
||||||
* The default implementation is a no-op.
|
* <p>The default implementation is a no-op.
|
||||||
*
|
*
|
||||||
* @param positionUs The new playback position in microseconds.
|
* @param positionUs The new playback position in microseconds.
|
||||||
* @param joining Whether this renderer is being enabled to join an ongoing playback.
|
* @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.
|
* 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.
|
* @throws ExoPlaybackException If an error occurs.
|
||||||
*/
|
*/
|
||||||
@ -248,8 +247,8 @@ public abstract class NoSampleRenderer implements Renderer, RendererCapabilities
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the renderer is disabled.
|
* 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() {
|
protected void onDisabled() {
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
@ -275,11 +274,8 @@ public abstract class NoSampleRenderer implements Renderer, RendererCapabilities
|
|||||||
return configuration;
|
return configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Returns the index of the renderer within the player. */
|
||||||
* Returns the index of the renderer within the player.
|
|
||||||
*/
|
|
||||||
protected final int getIndex() {
|
protected final int getIndex() {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,9 +25,7 @@ import com.google.android.exoplayer2.trackselection.TrackSelectorResult;
|
|||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/** Information about an ongoing playback. */
|
||||||
* Information about an ongoing playback.
|
|
||||||
*/
|
|
||||||
/* package */ final class PlaybackInfo {
|
/* 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
|
* Starts the renderer, meaning that calls to {@link #render(long, long)} will cause media to be
|
||||||
* rendered.
|
* rendered.
|
||||||
* <p>
|
*
|
||||||
* This method may be called when the renderer is in the following states:
|
* <p>This method may be called when the renderer is in the following states: {@link
|
||||||
* {@link #STATE_ENABLED}.
|
* #STATE_ENABLED}.
|
||||||
*
|
*
|
||||||
* @throws ExoPlaybackException If an error occurs.
|
* @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.
|
* 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:
|
* <p>This method may be called when the renderer is in the following states: {@link
|
||||||
* {@link #STATE_ENABLED}, {@link #STATE_STARTED}.
|
* #STATE_ENABLED}, {@link #STATE_STARTED}.
|
||||||
*/
|
*/
|
||||||
boolean hasReadStreamToEnd();
|
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
|
* Signals to the renderer that the current {@link SampleStream} will be the final one supplied
|
||||||
* before it is next disabled or reset.
|
* before it is next disabled or reset.
|
||||||
* <p>
|
*
|
||||||
* This method may be called when the renderer is in the following states:
|
* <p>This method may be called when the renderer is in the following states: {@link
|
||||||
* {@link #STATE_ENABLED}, {@link #STATE_STARTED}.
|
* #STATE_ENABLED}, {@link #STATE_STARTED}.
|
||||||
*/
|
*/
|
||||||
void setCurrentStreamFinal();
|
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
|
* Throws an error that's preventing the renderer from reading from its {@link SampleStream}. Does
|
||||||
* nothing if no such error exists.
|
* nothing if no such error exists.
|
||||||
* <p>
|
*
|
||||||
* This method may be called when the renderer is in the following states:
|
* <p>This method may be called when the renderer is in the following states: {@link
|
||||||
* {@link #STATE_ENABLED}, {@link #STATE_STARTED}.
|
* #STATE_ENABLED}, {@link #STATE_STARTED}.
|
||||||
*
|
*
|
||||||
* @throws IOException An error that's preventing the renderer from making progress or buffering
|
* @throws IOException An error that's preventing the renderer from making progress or buffering
|
||||||
* more data.
|
* more data.
|
||||||
@ -377,12 +377,12 @@ public interface Renderer extends PlayerMessage.Target {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Signals to the renderer that a position discontinuity has occurred.
|
* 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.
|
* samples starting from a key frame.
|
||||||
* <p>
|
*
|
||||||
* This method may be called when the renderer is in the following states:
|
* <p>This method may be called when the renderer is in the following states: {@link
|
||||||
* {@link #STATE_ENABLED}, {@link #STATE_STARTED}.
|
* #STATE_ENABLED}, {@link #STATE_STARTED}.
|
||||||
*
|
*
|
||||||
* @param positionUs The new playback position in microseconds.
|
* @param positionUs The new playback position in microseconds.
|
||||||
* @throws ExoPlaybackException If an error occurs handling the reset.
|
* @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.
|
* 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
|
* <p>If the renderer is in the {@link #STATE_STARTED} state then returning true indicates that
|
||||||
* renderer has everything that it needs to continue playback. Returning false 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.
|
* 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
|
* <p>If the renderer is in the {@link #STATE_ENABLED} state then returning true indicates that
|
||||||
* renderer is ready for playback to be started. Returning false indicates that it is not.
|
* 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:
|
* <p>This method may be called when the renderer is in the following states: {@link
|
||||||
* {@link #STATE_ENABLED}, {@link #STATE_STARTED}.
|
* #STATE_ENABLED}, {@link #STATE_STARTED}.
|
||||||
*
|
*
|
||||||
* @return Whether the renderer is ready to render media.
|
* @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.
|
* 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:
|
* <p>This method may be called when the renderer is in the following states: {@link
|
||||||
* {@link #STATE_ENABLED}.
|
* #STATE_ENABLED}.
|
||||||
*/
|
*/
|
||||||
void disable();
|
void disable();
|
||||||
|
|
||||||
|
@ -61,18 +61,14 @@ public interface RendererCapabilities {
|
|||||||
|
|
||||||
/** A mask to apply to {@link Capabilities} to obtain the {@link AdaptiveSupport} only. */
|
/** A mask to apply to {@link Capabilities} to obtain the {@link AdaptiveSupport} only. */
|
||||||
int ADAPTIVE_SUPPORT_MASK = 0b11000;
|
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;
|
int ADAPTIVE_SEAMLESS = 0b10000;
|
||||||
/**
|
/**
|
||||||
* The {@link Renderer} can adapt between formats, but may suffer a brief discontinuity
|
* The {@link Renderer} can adapt between formats, but may suffer a brief discontinuity
|
||||||
* (~50-100ms) when adaptation occurs.
|
* (~50-100ms) when adaptation occurs.
|
||||||
*/
|
*/
|
||||||
int ADAPTIVE_NOT_SEAMLESS = 0b01000;
|
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;
|
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. */
|
/** A mask to apply to {@link Capabilities} to obtain the {@link TunnelingSupport} only. */
|
||||||
int TUNNELING_SUPPORT_MASK = 0b100000;
|
int TUNNELING_SUPPORT_MASK = 0b100000;
|
||||||
/**
|
/** The {@link Renderer} supports tunneled output. */
|
||||||
* The {@link Renderer} supports tunneled output.
|
|
||||||
*/
|
|
||||||
int TUNNELING_SUPPORTED = 0b100000;
|
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;
|
int TUNNELING_NOT_SUPPORTED = 0b000000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -123,9 +123,7 @@ public final class AudioCapabilities {
|
|||||||
return Arrays.binarySearch(supportedEncodings, encoding) >= 0;
|
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() {
|
public int getMaxChannelCount() {
|
||||||
return maxChannelCount;
|
return maxChannelCount;
|
||||||
}
|
}
|
||||||
@ -150,8 +148,11 @@ public final class AudioCapabilities {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "AudioCapabilities[maxChannelCount=" + maxChannelCount
|
return "AudioCapabilities[maxChannelCount="
|
||||||
+ ", supportedEncodings=" + Arrays.toString(supportedEncodings) + "]";
|
+ maxChannelCount
|
||||||
|
+ ", supportedEncodings="
|
||||||
|
+ Arrays.toString(supportedEncodings)
|
||||||
|
+ "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean deviceMaySetExternalSurroundSoundGlobalSetting() {
|
private static boolean deviceMaySetExternalSurroundSoundGlobalSetting() {
|
||||||
|
@ -34,9 +34,7 @@ import com.google.android.exoplayer2.util.Util;
|
|||||||
*/
|
*/
|
||||||
public final class AudioCapabilitiesReceiver {
|
public final class AudioCapabilitiesReceiver {
|
||||||
|
|
||||||
/**
|
/** Listener notified when audio capabilities change. */
|
||||||
* Listener notified when audio capabilities change.
|
|
||||||
*/
|
|
||||||
public interface Listener {
|
public interface Listener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,7 +43,6 @@ public final class AudioCapabilitiesReceiver {
|
|||||||
* @param audioCapabilities The current audio capabilities for the device.
|
* @param audioCapabilities The current audio capabilities for the device.
|
||||||
*/
|
*/
|
||||||
void onAudioCapabilitiesChanged(AudioCapabilities audioCapabilities);
|
void onAudioCapabilitiesChanged(AudioCapabilities audioCapabilities);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Context context;
|
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
|
* 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
|
* occur. The current audio capabilities will be returned. It is important to call {@link
|
||||||
* {@link #unregister} when the receiver is no longer required.
|
* #unregister} when the receiver is no longer required.
|
||||||
*
|
*
|
||||||
* @return The current audio capabilities for the device.
|
* @return The current audio capabilities for the device.
|
||||||
*/
|
*/
|
||||||
@ -162,5 +159,4 @@ public final class AudioCapabilitiesReceiver {
|
|||||||
onNewAudioCapabilities(AudioCapabilities.getCapabilities(context));
|
onNewAudioCapabilities(AudioCapabilities.getCapabilities(context));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,6 @@ public interface AudioProcessor {
|
|||||||
public UnhandledAudioFormatException(AudioFormat inputAudioFormat) {
|
public UnhandledAudioFormatException(AudioFormat inputAudioFormat) {
|
||||||
super("Unhandled format: " + inputAudioFormat);
|
super("Unhandled format: " + inputAudioFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** An empty, direct {@link ByteBuffer}. */
|
/** An empty, direct {@link ByteBuffer}. */
|
||||||
@ -114,11 +113,11 @@ public interface AudioProcessor {
|
|||||||
void queueInput(ByteBuffer buffer);
|
void queueInput(ByteBuffer buffer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Queues an end of stream signal. After this method has been called,
|
* Queues an end of stream signal. After this method has been called, {@link
|
||||||
* {@link #queueInput(ByteBuffer)} may not be called until after the next call to
|
* #queueInput(ByteBuffer)} may not be called until after the next call to {@link #flush()}.
|
||||||
* {@link #flush()}. Calling {@link #getOutput()} will return any remaining output data. Multiple
|
* Calling {@link #getOutput()} will return any remaining output data. Multiple calls may be
|
||||||
* calls may be required to read all of the remaining output data. {@link #isEnded()} will return
|
* required to read all of the remaining output data. {@link #isEnded()} will return {@code true}
|
||||||
* {@code true} once all remaining output data has been read.
|
* once all remaining output data has been read.
|
||||||
*/
|
*/
|
||||||
void queueEndOfStream();
|
void queueEndOfStream();
|
||||||
|
|
||||||
|
@ -57,9 +57,7 @@ import java.nio.ByteBuffer;
|
|||||||
*/
|
*/
|
||||||
public interface AudioSink {
|
public interface AudioSink {
|
||||||
|
|
||||||
/**
|
/** Listener for audio sink events. */
|
||||||
* Listener for audio sink events.
|
|
||||||
*/
|
|
||||||
interface Listener {
|
interface Listener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -132,9 +130,7 @@ public interface AudioSink {
|
|||||||
default void onAudioSinkError(Exception audioSinkError) {}
|
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 {
|
final class ConfigurationException extends Exception {
|
||||||
|
|
||||||
/** Input {@link Format} of the sink when the configuration failure occurs. */
|
/** 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
|
* 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}, this will be the error value returned from {@link
|
||||||
* {@link AudioTrack#write(byte[], int, int)} or {@link AudioTrack#write(ByteBuffer, int, int)}.
|
* AudioTrack#write(byte[], int, int)} or {@link AudioTrack#write(ByteBuffer, int, int)}.
|
||||||
* Otherwise, the meaning of the error code depends on the sink implementation.
|
* Otherwise, the meaning of the error code depends on the sink implementation.
|
||||||
*/
|
*/
|
||||||
public final int errorCode;
|
public final int errorCode;
|
||||||
@ -223,7 +219,6 @@ public interface AudioSink {
|
|||||||
this.errorCode = errorCode;
|
this.errorCode = errorCode;
|
||||||
this.format = format;
|
this.format = format;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Thrown when the sink encounters an unexpected timestamp discontinuity. */
|
/** 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)
|
void configure(Format inputFormat, int specifiedBufferSize, @Nullable int[] outputChannels)
|
||||||
throws ConfigurationException;
|
throws ConfigurationException;
|
||||||
|
|
||||||
/**
|
/** Starts or resumes consuming audio if initialized. */
|
||||||
* Starts or resumes consuming audio if initialized.
|
|
||||||
*/
|
|
||||||
void play();
|
void play();
|
||||||
|
|
||||||
/** Signals to the sink that the next buffer may be discontinuous with the previous buffer. */
|
/** Signals to the sink that the next buffer may be discontinuous with the previous buffer. */
|
||||||
@ -370,9 +363,7 @@ public interface AudioSink {
|
|||||||
*/
|
*/
|
||||||
boolean isEnded();
|
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();
|
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
|
* 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.
|
* 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
|
* 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.
|
* if the sink is later re-configured into non-tunneled mode.
|
||||||
*
|
*
|
||||||
@ -432,9 +423,7 @@ public interface AudioSink {
|
|||||||
*/
|
*/
|
||||||
void setVolume(float volume);
|
void setVolume(float volume);
|
||||||
|
|
||||||
/**
|
/** Pauses playback. */
|
||||||
* Pauses playback.
|
|
||||||
*/
|
|
||||||
void pause();
|
void pause();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user