mirror of
https://github.com/samsonjs/media.git
synced 2026-03-29 10:05:48 +00:00
Fix usage of deprecated IntDef.
And allow default value constant to be assigned as valid value. PiperOrigin-RevId: 309708888
This commit is contained in:
parent
3100f5938d
commit
3ebad15338
3 changed files with 18 additions and 11 deletions
|
|
@ -23,7 +23,6 @@ import android.view.SurfaceView;
|
|||
import android.view.TextureView;
|
||||
import androidx.annotation.IntDef;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.exoplayer2.C.VideoScalingMode;
|
||||
import com.google.android.exoplayer2.audio.AudioAttributes;
|
||||
import com.google.android.exoplayer2.audio.AudioListener;
|
||||
import com.google.android.exoplayer2.audio.AuxEffectInfo;
|
||||
|
|
@ -173,14 +172,14 @@ public interface Player {
|
|||
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}. */
|
||||
@VideoScalingMode
|
||||
/** Returns the {@link Renderer.VideoScalingMode}. */
|
||||
@Renderer.VideoScalingMode
|
||||
int getVideoScalingMode();
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -148,9 +148,16 @@ public interface Renderer extends PlayerMessage.Target {
|
|||
* 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.
|
||||
@SuppressWarnings("UniqueConstants")
|
||||
@Documented
|
||||
@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 {}
|
||||
/** See {@link MediaCodec#VIDEO_SCALING_MODE_SCALE_TO_FIT}. */
|
||||
@SuppressWarnings("deprecation")
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@ public class SimpleExoPlayer extends BasePlayer
|
|||
@Nullable private VideoDecoderOutputBufferRenderer videoDecoderOutputBufferRenderer;
|
||||
@Nullable private Surface surface;
|
||||
private boolean ownsSurface;
|
||||
private @C.VideoScalingMode int videoScalingMode;
|
||||
@Renderer.VideoScalingMode private int videoScalingMode;
|
||||
@Nullable private SurfaceHolder surfaceHolder;
|
||||
@Nullable private TextureView textureView;
|
||||
private int surfaceWidth;
|
||||
|
|
@ -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}
|
||||
* 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
|
||||
public void setVideoScalingMode(@C.VideoScalingMode int videoScalingMode) {
|
||||
public void setVideoScalingMode(@Renderer.VideoScalingMode int videoScalingMode) {
|
||||
verifyApplicationThread();
|
||||
this.videoScalingMode = videoScalingMode;
|
||||
for (Renderer renderer : renderers) {
|
||||
|
|
@ -528,7 +528,8 @@ public class SimpleExoPlayer extends BasePlayer
|
|||
}
|
||||
|
||||
@Override
|
||||
public @C.VideoScalingMode int getVideoScalingMode() {
|
||||
@Renderer.VideoScalingMode
|
||||
public int getVideoScalingMode() {
|
||||
return videoScalingMode;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue