Skip to content

Commit

Permalink
Import correct nullable annotation
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 668521379
  • Loading branch information
kim-vde authored and copybara-github committed Aug 28, 2024
1 parent 5c2dc7e commit 8367e42
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import android.graphics.Bitmap;
import android.net.Uri;
import android.opengl.Matrix;
import androidx.annotation.Nullable;
import androidx.media3.common.C;
import androidx.media3.common.VideoFrameProcessingException;
import androidx.media3.common.util.BitmapLoader;
Expand All @@ -31,7 +32,6 @@
import com.google.common.util.concurrent.ListenableFuture;
import java.util.concurrent.ExecutionException;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.Nullable;

/**
* Creates {@link TextureOverlay}s from {@link Bitmap}s.
Expand All @@ -45,7 +45,7 @@ public abstract class BitmapOverlay extends TextureOverlay {

private int lastTextureId;
private int lastBitmapGenerationId;
private @Nullable Bitmap lastBitmap;
@Nullable private Bitmap lastBitmap;

public BitmapOverlay() {
float[] temp = GlUtil.create4x4IdentityMatrix();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import static androidx.media3.effect.DebugTraceUtil.EVENT_SIGNAL_EOS;

import android.graphics.Bitmap;
import androidx.annotation.Nullable;
import androidx.media3.common.C;
import androidx.media3.common.FrameInfo;
import androidx.media3.common.GlObjectsProvider;
Expand All @@ -35,7 +36,6 @@
import java.util.Queue;
import java.util.concurrent.LinkedBlockingQueue;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.Nullable;

/**
* Forwards a video frame produced from a {@link Bitmap} to a {@link GlShaderProgram} for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import android.content.Context;
import android.util.SparseArray;
import android.view.Surface;
import androidx.annotation.Nullable;
import androidx.media3.common.ColorInfo;
import androidx.media3.common.FrameInfo;
import androidx.media3.common.GlObjectsProvider;
Expand All @@ -39,7 +40,6 @@
import androidx.media3.effect.DefaultVideoFrameProcessor.WorkingColorSpace;
import java.util.concurrent.Executor;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.Nullable;

/**
* A switcher to switch between {@linkplain TextureManager texture managers} of different
Expand Down Expand Up @@ -269,11 +269,13 @@ public void setChainingListener(GatedChainingListenerWrapper gatedChainingListen
checkNotNull(samplingGlShaderProgram).setOutputListener(gatedChainingListenerWrapper);
}

public @Nullable ExternalShaderProgram getSamplingGlShaderProgram() {
@Nullable
public ExternalShaderProgram getSamplingGlShaderProgram() {
return samplingGlShaderProgram;
}

public @Nullable ColorInfo getInputColorInfo() {
@Nullable
public ColorInfo getInputColorInfo() {
return inputColorInfo;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import android.graphics.Bitmap;
import android.os.SystemClock;
import androidx.annotation.IntDef;
import androidx.annotation.Nullable;
import androidx.media3.common.C;
import androidx.media3.common.Format;
import androidx.media3.common.PlaybackException;
Expand All @@ -48,7 +49,6 @@
import java.util.ArrayDeque;
import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.checker.nullness.qual.RequiresNonNull;

/** A {@link Renderer} implementation for images. */
Expand Down Expand Up @@ -108,14 +108,14 @@ public class ImageRenderer extends BaseRenderer {
private long largestQueuedPresentationTimeUs;
private @ReinitializationState int decoderReinitializationState;
private @C.FirstFrameState int firstFrameState;
private @Nullable Format inputFormat;
private @Nullable ImageDecoder decoder;
private @Nullable DecoderInputBuffer inputBuffer;
@Nullable private Format inputFormat;
@Nullable private ImageDecoder decoder;
@Nullable private DecoderInputBuffer inputBuffer;
private ImageOutput imageOutput;
private @Nullable Bitmap outputBitmap;
@Nullable private Bitmap outputBitmap;
private boolean readyToOutputTiles;
private @Nullable TileInfo tileInfo;
private @Nullable TileInfo nextTileInfo;
@Nullable private TileInfo tileInfo;
@Nullable private TileInfo nextTileInfo;
private int currentTileIndex;

/**
Expand Down Expand Up @@ -274,8 +274,8 @@ public void handleMessage(@MessageType int messageType, @Nullable Object message
throws ExoPlaybackException {
switch (messageType) {
case MSG_SET_IMAGE_OUTPUT:
@Nullable ImageOutput imageOutput =
message instanceof ImageOutput ? (ImageOutput) message : null;
@Nullable
ImageOutput imageOutput = message instanceof ImageOutput ? (ImageOutput) message : null;
setImageOutput(imageOutput);
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

package androidx.media3.exoplayer.rtsp.reader;

import androidx.annotation.Nullable;
import androidx.media3.common.ParserException;
import androidx.media3.common.util.ParsableByteArray;
import androidx.media3.common.util.UnstableApi;
import androidx.media3.exoplayer.rtsp.RtpPayloadFormat;
import androidx.media3.extractor.ExtractorOutput;
import org.checkerframework.checker.nullness.qual.Nullable;

/** Extracts media samples from the payload of received RTP packets. */
@UnstableApi
Expand All @@ -37,7 +37,8 @@ interface Factory {
* @return A {@link RtpPayloadReader} for the packet stream, or {@code null} if the stream
* format is not supported.
*/
@Nullable RtpPayloadReader createPayloadReader(RtpPayloadFormat payloadFormat);
@Nullable
RtpPayloadReader createPayloadReader(RtpPayloadFormat payloadFormat);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import android.text.style.StyleSpan;
import android.text.style.TypefaceSpan;
import android.util.Pair;
import androidx.annotation.Nullable;
import androidx.media3.common.C;
import androidx.media3.common.ColorInfo;
import androidx.media3.common.Effect;
Expand Down Expand Up @@ -74,7 +75,6 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.atomic.AtomicReference;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
Expand Down Expand Up @@ -645,7 +645,7 @@ private static final class VideoCompositorTestRunner {
private final LinkedHashMap<Long, Bitmap> outputTimestampsToBitmaps;
private final List<VideoFrameProcessorTestRunner> inputVideoFrameProcessorTestRunners;
private final VideoCompositor videoCompositor;
private final @Nullable ExecutorService sharedExecutorService;
@Nullable private final ExecutorService sharedExecutorService;
private final AtomicReference<VideoFrameProcessingException> compositionException;
private final CountDownLatch compositorEnded;
private final String testId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import android.content.Context;
import android.net.Uri;
import androidx.annotation.Nullable;
import androidx.media3.common.C;
import androidx.media3.common.Format;
import androidx.media3.common.MediaItem;
Expand All @@ -51,7 +52,6 @@
import androidx.test.ext.junit.runners.AndroidJUnit4;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.junit.AssumptionViolatedException;
import org.junit.Before;
import org.junit.Rule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package androidx.media3.transformer;

import android.media.MediaCodec.BufferInfo;
import androidx.annotation.Nullable;
import androidx.media3.common.C;
import androidx.media3.common.Format;
import androidx.media3.common.Metadata;
Expand All @@ -33,7 +34,6 @@
import java.nio.ByteBuffer;
import java.util.LinkedHashSet;
import java.util.Set;
import org.checkerframework.checker.nullness.qual.Nullable;

/** {@link Muxer} implementation that uses an {@link Mp4Muxer} or {@link FragmentedMp4Muxer}. */
@UnstableApi
Expand All @@ -59,7 +59,7 @@ public static final class Factory implements Muxer.Factory {

/** A builder for {@link Factory} instances. */
public static final class Builder {
private @Nullable MetadataProvider metadataProvider;
@Nullable private MetadataProvider metadataProvider;
private boolean outputFragmentedMp4;
private long fragmentDurationMs;

Expand Down Expand Up @@ -123,7 +123,7 @@ public Factory build() {
MimeTypes.AUDIO_OPUS,
MimeTypes.AUDIO_VORBIS);

private final @Nullable MetadataProvider metadataProvider;
@Nullable private final MetadataProvider metadataProvider;
private final boolean outputFragmentedMp4;
private final long fragmentDurationMs;

Expand Down Expand Up @@ -168,7 +168,7 @@ public ImmutableList<String> getSupportedSampleMimeTypes(@C.TrackType int trackT
}

private final androidx.media3.muxer.Muxer muxer;
private final @Nullable MetadataProvider metadataProvider;
@Nullable private final MetadataProvider metadataProvider;
private final Set<Metadata.Entry> metadataEntries;

private InAppMuxer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static java.lang.Math.min;

import android.content.Context;
import androidx.annotation.Nullable;
import androidx.media3.common.C;
import androidx.media3.common.DataReader;
import androidx.media3.common.Format;
Expand All @@ -40,7 +41,6 @@
import java.util.HashMap;
import java.util.Map;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.Nullable;

/**
* Provides some specific MP4 metadata about an mp4 file such as the duration, last sync sample
Expand Down Expand Up @@ -70,10 +70,10 @@
public final boolean isFirstVideoSampleAfterTimeUsSyncSample;

/** The video {@link Format} or {@code null} if there is no video track. */
public final @Nullable Format videoFormat;
@Nullable public final Format videoFormat;

/** The audio {@link Format} or {@code null} if there is no audio track. */
public final @Nullable Format audioFormat;
@Nullable public final Format audioFormat;

private Mp4Info(
long durationUs,
Expand Down

0 comments on commit 8367e42

Please sign in to comment.