Commit 553d5351 by krocard Committed by Oliver Woodman

Move Renderer.VideoScalingMode back to C

As Player depends on VideoScalingMode, and
Renderer should not move to common,
to move Player to common, VideoScalingMode
needs to move first.

#player-to-common

PiperOrigin-RevId: 345314448
parent affdff65
...@@ -557,24 +557,21 @@ public final class C { ...@@ -557,24 +557,21 @@ public final class C {
// ../../../../../../../../../extensions/vp9/src/main/jni/vpx_jni.cc // ../../../../../../../../../extensions/vp9/src/main/jni/vpx_jni.cc
// ) // )
/** @deprecated Use {@code Renderer.VideoScalingMode}. */ /**
@SuppressWarnings("deprecation") * Video scaling modes for {@link MediaCodec}-based renderers. One of {@link
* #VIDEO_SCALING_MODE_SCALE_TO_FIT} or {@link #VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING}.
*/
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@IntDef(value = {VIDEO_SCALING_MODE_SCALE_TO_FIT, VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING}) @IntDef(value = {VIDEO_SCALING_MODE_SCALE_TO_FIT, VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING})
@Deprecated
public @interface VideoScalingMode {} public @interface VideoScalingMode {}
/** @deprecated Use {@code Renderer.VIDEO_SCALING_MODE_SCALE_TO_FIT}. */ /** See {@link MediaCodec#VIDEO_SCALING_MODE_SCALE_TO_FIT}. */
@Deprecated
public static final int VIDEO_SCALING_MODE_SCALE_TO_FIT = public static final int VIDEO_SCALING_MODE_SCALE_TO_FIT =
MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT; MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT;
/** @deprecated Use {@code Renderer.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING}. */ /** See {@link MediaCodec#VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING}. */
@Deprecated
public static final int VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING = public static final int VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING =
MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING; MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING;
/** @deprecated Use {@code Renderer.VIDEO_SCALING_MODE_DEFAULT}. */ /** A default video scaling mode for {@link MediaCodec}-based renderers. */
@SuppressWarnings("deprecation")
@Deprecated
public static final int VIDEO_SCALING_MODE_DEFAULT = VIDEO_SCALING_MODE_SCALE_TO_FIT; public static final int VIDEO_SCALING_MODE_DEFAULT = VIDEO_SCALING_MODE_SCALE_TO_FIT;
/** /**
......
...@@ -176,14 +176,14 @@ public interface Player { ...@@ -176,14 +176,14 @@ public interface Player {
interface VideoComponent { interface VideoComponent {
/** /**
* Sets the {@link Renderer.VideoScalingMode}. * Sets the {@link C.VideoScalingMode}.
* *
* @param videoScalingMode The {@link Renderer.VideoScalingMode}. * @param videoScalingMode The {@link C.VideoScalingMode}.
*/ */
void setVideoScalingMode(@Renderer.VideoScalingMode int videoScalingMode); void setVideoScalingMode(@C.VideoScalingMode int videoScalingMode);
/** Returns the {@link Renderer.VideoScalingMode}. */ /** Returns the {@link C.VideoScalingMode}. */
@Renderer.VideoScalingMode @C.VideoScalingMode
int getVideoScalingMode(); int getVideoScalingMode();
/** /**
......
...@@ -114,7 +114,7 @@ public interface Renderer extends PlayerMessage.Target { ...@@ -114,7 +114,7 @@ public interface Renderer extends PlayerMessage.Target {
/** /**
* The type of a message that can be passed to a {@link MediaCodec}-based video renderer via * The type of a message that can be passed to a {@link MediaCodec}-based video renderer via
* {@link ExoPlayer#createMessage(Target)}. The message payload should be one of the integer * {@link ExoPlayer#createMessage(Target)}. The message payload should be one of the integer
* scaling modes in {@link VideoScalingMode}. * scaling modes in {@link C.VideoScalingMode}.
* *
* <p>Note that the scaling mode only applies if the {@link Surface} targeted by the renderer is * <p>Note that the scaling mode only applies if the {@link Surface} targeted by the renderer is
* owned by a {@link android.view.SurfaceView}. * owned by a {@link android.view.SurfaceView}.
...@@ -180,12 +180,9 @@ public interface Renderer extends PlayerMessage.Target { ...@@ -180,12 +180,9 @@ public interface Renderer extends PlayerMessage.Target {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
int MSG_CUSTOM_BASE = C.MSG_CUSTOM_BASE; int MSG_CUSTOM_BASE = C.MSG_CUSTOM_BASE;
/** /** @deprecated Use {@link C.VideoScalingMode}. */
* Video scaling modes for {@link MediaCodec}-based renderers. One of {@link
* #VIDEO_SCALING_MODE_SCALE_TO_FIT} or {@link #VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING}.
*/
// VIDEO_SCALING_MODE_DEFAULT is an intentionally duplicated constant. // VIDEO_SCALING_MODE_DEFAULT is an intentionally duplicated constant.
@SuppressWarnings("UniqueConstants") @SuppressWarnings({"UniqueConstants", "Deprecation"})
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@IntDef( @IntDef(
...@@ -194,17 +191,16 @@ public interface Renderer extends PlayerMessage.Target { ...@@ -194,17 +191,16 @@ public interface Renderer extends PlayerMessage.Target {
VIDEO_SCALING_MODE_SCALE_TO_FIT, VIDEO_SCALING_MODE_SCALE_TO_FIT,
VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING
}) })
@Deprecated
@interface VideoScalingMode {} @interface VideoScalingMode {}
/** See {@link MediaCodec#VIDEO_SCALING_MODE_SCALE_TO_FIT}. */ /** @deprecated Use {@link C#VIDEO_SCALING_MODE_SCALE_TO_FIT}. */
@SuppressWarnings("deprecation") @Deprecated int VIDEO_SCALING_MODE_SCALE_TO_FIT = C.VIDEO_SCALING_MODE_SCALE_TO_FIT;
int VIDEO_SCALING_MODE_SCALE_TO_FIT = C.VIDEO_SCALING_MODE_SCALE_TO_FIT; /** @deprecated Use {@link C#VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING}. */
/** See {@link MediaCodec#VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING}. */ @Deprecated
@SuppressWarnings("deprecation")
int VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING = int VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING =
C.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING; C.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING;
/** A default video scaling mode for {@link MediaCodec}-based renderers. */ /** @deprecated Use {@code C.VIDEO_SCALING_MODE_DEFAULT}. */
@SuppressWarnings("deprecation") @Deprecated int VIDEO_SCALING_MODE_DEFAULT = C.VIDEO_SCALING_MODE_DEFAULT;
int VIDEO_SCALING_MODE_DEFAULT = C.VIDEO_SCALING_MODE_DEFAULT;
/** /**
* The renderer states. One of {@link #STATE_DISABLED}, {@link #STATE_ENABLED} or {@link * The renderer states. One of {@link #STATE_DISABLED}, {@link #STATE_ENABLED} or {@link
......
...@@ -112,7 +112,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -112,7 +112,7 @@ public class SimpleExoPlayer extends BasePlayer
@C.WakeMode private int wakeMode; @C.WakeMode private int wakeMode;
private boolean handleAudioBecomingNoisy; private boolean handleAudioBecomingNoisy;
private boolean skipSilenceEnabled; private boolean skipSilenceEnabled;
@Renderer.VideoScalingMode private int videoScalingMode; @C.VideoScalingMode private int videoScalingMode;
private boolean useLazyPreparation; private boolean useLazyPreparation;
private SeekParameters seekParameters; private SeekParameters seekParameters;
private LivePlaybackSpeedControl livePlaybackSpeedControl; private LivePlaybackSpeedControl livePlaybackSpeedControl;
...@@ -149,7 +149,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -149,7 +149,7 @@ public class SimpleExoPlayer extends BasePlayer
* <li>{@link C.WakeMode}: {@link C#WAKE_MODE_NONE} * <li>{@link C.WakeMode}: {@link C#WAKE_MODE_NONE}
* <li>{@code handleAudioBecomingNoisy}: {@code true} * <li>{@code handleAudioBecomingNoisy}: {@code true}
* <li>{@code skipSilenceEnabled}: {@code false} * <li>{@code skipSilenceEnabled}: {@code false}
* <li>{@link Renderer.VideoScalingMode}: {@link Renderer#VIDEO_SCALING_MODE_DEFAULT} * <li>{@link C.VideoScalingMode}: {@link C#VIDEO_SCALING_MODE_DEFAULT}
* <li>{@code useLazyPreparation}: {@code true} * <li>{@code useLazyPreparation}: {@code true}
* <li>{@link SeekParameters}: {@link SeekParameters#DEFAULT} * <li>{@link SeekParameters}: {@link SeekParameters#DEFAULT}
* <li>{@code releaseTimeoutMs}: {@link ExoPlayer#DEFAULT_RELEASE_TIMEOUT_MS} * <li>{@code releaseTimeoutMs}: {@link ExoPlayer#DEFAULT_RELEASE_TIMEOUT_MS}
...@@ -246,7 +246,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -246,7 +246,7 @@ public class SimpleExoPlayer extends BasePlayer
looper = Util.getCurrentOrMainLooper(); looper = Util.getCurrentOrMainLooper();
audioAttributes = AudioAttributes.DEFAULT; audioAttributes = AudioAttributes.DEFAULT;
wakeMode = C.WAKE_MODE_NONE; wakeMode = C.WAKE_MODE_NONE;
videoScalingMode = Renderer.VIDEO_SCALING_MODE_DEFAULT; videoScalingMode = C.VIDEO_SCALING_MODE_DEFAULT;
useLazyPreparation = true; useLazyPreparation = true;
seekParameters = SeekParameters.DEFAULT; seekParameters = SeekParameters.DEFAULT;
livePlaybackSpeedControl = new DefaultLivePlaybackSpeedControl.Builder().build(); livePlaybackSpeedControl = new DefaultLivePlaybackSpeedControl.Builder().build();
...@@ -424,17 +424,17 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -424,17 +424,17 @@ public class SimpleExoPlayer extends BasePlayer
} }
/** /**
* Sets the {@link Renderer.VideoScalingMode} that will be used by the player. * Sets the {@link C.VideoScalingMode} that will be used by the player.
* *
* <p>Note that the scaling mode only applies if a {@link MediaCodec}-based video {@link * <p>Note that the scaling mode only applies if a {@link MediaCodec}-based video {@link
* Renderer} is enabled and if the output surface is owned by a {@link * Renderer} is enabled and if the output surface is owned by a {@link
* android.view.SurfaceView}. * android.view.SurfaceView}.
* *
* @param videoScalingMode A {@link Renderer.VideoScalingMode}. * @param videoScalingMode A {@link C.VideoScalingMode}.
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
public Builder setVideoScalingMode(@Renderer.VideoScalingMode int videoScalingMode) { public Builder setVideoScalingMode(@C.VideoScalingMode int videoScalingMode) {
Assertions.checkState(!buildCalled); Assertions.checkState(!buildCalled);
this.videoScalingMode = videoScalingMode; this.videoScalingMode = videoScalingMode;
return this; return this;
...@@ -609,7 +609,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -609,7 +609,7 @@ public class SimpleExoPlayer extends BasePlayer
@Nullable private VideoDecoderOutputBufferRenderer videoDecoderOutputBufferRenderer; @Nullable private VideoDecoderOutputBufferRenderer videoDecoderOutputBufferRenderer;
@Nullable private Surface surface; @Nullable private Surface surface;
private boolean ownsSurface; private boolean ownsSurface;
@Renderer.VideoScalingMode private int videoScalingMode; @C.VideoScalingMode private int videoScalingMode;
@Nullable private SurfaceHolder surfaceHolder; @Nullable private SurfaceHolder surfaceHolder;
@Nullable private TextureView textureView; @Nullable private TextureView textureView;
private int surfaceWidth; private int surfaceWidth;
...@@ -780,17 +780,17 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -780,17 +780,17 @@ public class SimpleExoPlayer extends BasePlayer
* <p>Note that the scaling mode only applies if a {@link MediaCodec}-based video {@link Renderer} * <p>Note that the scaling mode only applies if a {@link MediaCodec}-based video {@link Renderer}
* is enabled and if the output surface is owned by a {@link android.view.SurfaceView}. * is enabled and if the output surface is owned by a {@link android.view.SurfaceView}.
* *
* @param videoScalingMode The {@link Renderer.VideoScalingMode}. * @param videoScalingMode The {@link C.VideoScalingMode}.
*/ */
@Override @Override
public void setVideoScalingMode(@Renderer.VideoScalingMode int videoScalingMode) { public void setVideoScalingMode(@C.VideoScalingMode int videoScalingMode) {
verifyApplicationThread(); verifyApplicationThread();
this.videoScalingMode = videoScalingMode; this.videoScalingMode = videoScalingMode;
sendRendererMessage(C.TRACK_TYPE_VIDEO, Renderer.MSG_SET_SCALING_MODE, videoScalingMode); sendRendererMessage(C.TRACK_TYPE_VIDEO, Renderer.MSG_SET_SCALING_MODE, videoScalingMode);
} }
@Override @Override
@Renderer.VideoScalingMode @C.VideoScalingMode
public int getVideoScalingMode() { public int getVideoScalingMode() {
return videoScalingMode; return videoScalingMode;
} }
......
...@@ -28,7 +28,6 @@ import androidx.annotation.Nullable; ...@@ -28,7 +28,6 @@ import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Renderer.VideoScalingMode;
import com.google.android.exoplayer2.decoder.CryptoInfo; import com.google.android.exoplayer2.decoder.CryptoInfo;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
...@@ -220,7 +219,7 @@ import java.nio.ByteBuffer; ...@@ -220,7 +219,7 @@ import java.nio.ByteBuffer;
} }
@Override @Override
public void setVideoScalingMode(@VideoScalingMode int scalingMode) { public void setVideoScalingMode(@C.VideoScalingMode int scalingMode) {
maybeBlockOnQueueing(); maybeBlockOnQueueing();
codec.setVideoScalingMode(scalingMode); codec.setVideoScalingMode(scalingMode);
} }
......
...@@ -24,7 +24,7 @@ import android.os.Handler; ...@@ -24,7 +24,7 @@ import android.os.Handler;
import android.view.Surface; import android.view.Surface;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import com.google.android.exoplayer2.Renderer.VideoScalingMode; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.decoder.CryptoInfo; import com.google.android.exoplayer2.decoder.CryptoInfo;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
...@@ -187,5 +187,5 @@ public interface MediaCodecAdapter { ...@@ -187,5 +187,5 @@ public interface MediaCodecAdapter {
* *
* @see MediaCodec#setVideoScalingMode(int) * @see MediaCodec#setVideoScalingMode(int)
*/ */
void setVideoScalingMode(@VideoScalingMode int scalingMode); void setVideoScalingMode(@C.VideoScalingMode int scalingMode);
} }
...@@ -26,7 +26,7 @@ import android.os.Handler; ...@@ -26,7 +26,7 @@ import android.os.Handler;
import android.view.Surface; import android.view.Surface;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import com.google.android.exoplayer2.Renderer.VideoScalingMode; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.decoder.CryptoInfo; import com.google.android.exoplayer2.decoder.CryptoInfo;
import com.google.android.exoplayer2.util.Util; import com.google.android.exoplayer2.util.Util;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
...@@ -164,7 +164,7 @@ import java.nio.ByteBuffer; ...@@ -164,7 +164,7 @@ import java.nio.ByteBuffer;
} }
@Override @Override
public void setVideoScalingMode(@VideoScalingMode int scalingMode) { public void setVideoScalingMode(@C.VideoScalingMode int scalingMode) {
codec.setVideoScalingMode(scalingMode); codec.setVideoScalingMode(scalingMode);
} }
} }
...@@ -79,7 +79,7 @@ import java.util.List; ...@@ -79,7 +79,7 @@ import java.util.List;
* <li>Message with type {@link #MSG_SET_SURFACE} to set the output surface. The message payload * <li>Message with type {@link #MSG_SET_SURFACE} to set the output surface. The message payload
* should be the target {@link Surface}, or null. * should be the target {@link Surface}, or null.
* <li>Message with type {@link #MSG_SET_SCALING_MODE} to set the video scaling mode. The message * <li>Message with type {@link #MSG_SET_SCALING_MODE} to set the video scaling mode. The message
* payload should be one of the integer scaling modes in {@link VideoScalingMode}. Note that * payload should be one of the integer scaling modes in {@link C.VideoScalingMode}. Note that
* the scaling mode only applies if the {@link Surface} targeted by this renderer is owned by * the scaling mode only applies if the {@link Surface} targeted by this renderer is owned by
* a {@link android.view.SurfaceView}. * a {@link android.view.SurfaceView}.
* <li>Message with type {@link #MSG_SET_VIDEO_FRAME_METADATA_LISTENER} to set a listener for * <li>Message with type {@link #MSG_SET_VIDEO_FRAME_METADATA_LISTENER} to set a listener for
...@@ -126,7 +126,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -126,7 +126,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
private float surfaceFrameRate; private float surfaceFrameRate;
@Nullable private Surface dummySurface; @Nullable private Surface dummySurface;
private boolean haveReportedFirstFrameRenderedForCurrentSurface; private boolean haveReportedFirstFrameRenderedForCurrentSurface;
@VideoScalingMode private int scalingMode; @C.VideoScalingMode private int scalingMode;
private boolean renderedFirstFrameAfterReset; private boolean renderedFirstFrameAfterReset;
private boolean mayRenderFirstFrameAfterEnableIfNotStarted; private boolean mayRenderFirstFrameAfterEnableIfNotStarted;
private boolean renderedFirstFrameAfterEnable; private boolean renderedFirstFrameAfterEnable;
...@@ -245,7 +245,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -245,7 +245,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
currentWidth = Format.NO_VALUE; currentWidth = Format.NO_VALUE;
currentHeight = Format.NO_VALUE; currentHeight = Format.NO_VALUE;
currentPixelWidthHeightRatio = Format.NO_VALUE; currentPixelWidthHeightRatio = Format.NO_VALUE;
scalingMode = VIDEO_SCALING_MODE_DEFAULT; scalingMode = C.VIDEO_SCALING_MODE_DEFAULT;
clearReportedVideoSize(); clearReportedVideoSize();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment