Commit 3ebad153 by tonihei Committed by Oliver Woodman

Fix usage of deprecated IntDef.

And allow default value constant to be assigned as valid value.

PiperOrigin-RevId: 309708888
parent 3100f593
...@@ -23,7 +23,6 @@ import android.view.SurfaceView; ...@@ -23,7 +23,6 @@ import android.view.SurfaceView;
import android.view.TextureView; import android.view.TextureView;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C.VideoScalingMode;
import com.google.android.exoplayer2.audio.AudioAttributes; import com.google.android.exoplayer2.audio.AudioAttributes;
import com.google.android.exoplayer2.audio.AudioListener; import com.google.android.exoplayer2.audio.AudioListener;
import com.google.android.exoplayer2.audio.AuxEffectInfo; import com.google.android.exoplayer2.audio.AuxEffectInfo;
...@@ -173,14 +172,14 @@ public interface Player { ...@@ -173,14 +172,14 @@ public interface Player {
interface VideoComponent { interface VideoComponent {
/** /**
* Sets the {@link VideoScalingMode}. * Sets the {@link Renderer.VideoScalingMode}.
* *
* @param videoScalingMode The {@link VideoScalingMode}. * @param videoScalingMode The {@link Renderer.VideoScalingMode}.
*/ */
void setVideoScalingMode(@VideoScalingMode int videoScalingMode); void setVideoScalingMode(@Renderer.VideoScalingMode int videoScalingMode);
/** Returns the {@link VideoScalingMode}. */ /** Returns the {@link Renderer.VideoScalingMode}. */
@VideoScalingMode @Renderer.VideoScalingMode
int getVideoScalingMode(); int getVideoScalingMode();
/** /**
......
...@@ -148,9 +148,16 @@ public interface Renderer extends PlayerMessage.Target { ...@@ -148,9 +148,16 @@ public interface Renderer extends PlayerMessage.Target {
* Video scaling modes for {@link MediaCodec}-based renderers. One of {@link * 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_SCALE_TO_FIT} or {@link #VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING}.
*/ */
// VIDEO_SCALING_MODE_DEFAULT is an intentionally duplicated constant.
@SuppressWarnings("UniqueConstants")
@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_DEFAULT,
VIDEO_SCALING_MODE_SCALE_TO_FIT,
VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING
})
@interface VideoScalingMode {} @interface VideoScalingMode {}
/** See {@link MediaCodec#VIDEO_SCALING_MODE_SCALE_TO_FIT}. */ /** See {@link MediaCodec#VIDEO_SCALING_MODE_SCALE_TO_FIT}. */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
......
...@@ -367,7 +367,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -367,7 +367,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;
private @C.VideoScalingMode int videoScalingMode; @Renderer.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;
...@@ -510,10 +510,10 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -510,10 +510,10 @@ 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 video scaling mode. * @param videoScalingMode The {@link Renderer.VideoScalingMode}.
*/ */
@Override @Override
public void setVideoScalingMode(@C.VideoScalingMode int videoScalingMode) { public void setVideoScalingMode(@Renderer.VideoScalingMode int videoScalingMode) {
verifyApplicationThread(); verifyApplicationThread();
this.videoScalingMode = videoScalingMode; this.videoScalingMode = videoScalingMode;
for (Renderer renderer : renderers) { for (Renderer renderer : renderers) {
...@@ -528,7 +528,8 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -528,7 +528,8 @@ public class SimpleExoPlayer extends BasePlayer
} }
@Override @Override
public @C.VideoScalingMode int getVideoScalingMode() { @Renderer.VideoScalingMode
public int getVideoScalingMode() {
return videoScalingMode; return videoScalingMode;
} }
......
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