Add render messages for setting video output resolution
An AndroidTest is needed to test the message sending from ExoPlayerImpl to a video renderer (MCVR in this case). The test will be added later. PiperOrigin-RevId: 493602259
This commit is contained in:
parent
03276d1eb0
commit
e6bf908b5a
@ -28,6 +28,7 @@ import static com.google.android.exoplayer2.Renderer.MSG_SET_SCALING_MODE;
|
||||
import static com.google.android.exoplayer2.Renderer.MSG_SET_SKIP_SILENCE_ENABLED;
|
||||
import static com.google.android.exoplayer2.Renderer.MSG_SET_VIDEO_FRAME_METADATA_LISTENER;
|
||||
import static com.google.android.exoplayer2.Renderer.MSG_SET_VIDEO_OUTPUT;
|
||||
import static com.google.android.exoplayer2.Renderer.MSG_SET_VIDEO_OUTPUT_RESOLUTION;
|
||||
import static com.google.android.exoplayer2.Renderer.MSG_SET_VOLUME;
|
||||
import static com.google.android.exoplayer2.util.Assertions.checkNotNull;
|
||||
import static com.google.android.exoplayer2.util.Assertions.checkState;
|
||||
@ -2945,6 +2946,8 @@ import java.util.concurrent.TimeoutException;
|
||||
@Override
|
||||
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
|
||||
maybeNotifySurfaceSizeChanged(width, height);
|
||||
sendRendererMessage(
|
||||
TRACK_TYPE_VIDEO, MSG_SET_VIDEO_OUTPUT_RESOLUTION, Pair.create(width, height));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,6 +18,7 @@ package com.google.android.exoplayer2;
|
||||
import static java.lang.annotation.ElementType.TYPE_USE;
|
||||
|
||||
import android.media.MediaCodec;
|
||||
import android.util.Pair;
|
||||
import android.view.Surface;
|
||||
import androidx.annotation.IntDef;
|
||||
import androidx.annotation.Nullable;
|
||||
@ -25,6 +26,7 @@ import com.google.android.exoplayer2.analytics.PlayerId;
|
||||
import com.google.android.exoplayer2.audio.AudioAttributes;
|
||||
import com.google.android.exoplayer2.audio.AuxEffectInfo;
|
||||
import com.google.android.exoplayer2.source.SampleStream;
|
||||
import com.google.android.exoplayer2.util.Effect;
|
||||
import com.google.android.exoplayer2.util.MediaClock;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
import com.google.android.exoplayer2.video.VideoDecoderOutputBufferRenderer;
|
||||
@ -80,8 +82,9 @@ public interface Renderer extends PlayerMessage.Target {
|
||||
* #MSG_SET_SCALING_MODE}, {@link #MSG_SET_CHANGE_FRAME_RATE_STRATEGY}, {@link
|
||||
* #MSG_SET_AUX_EFFECT_INFO}, {@link #MSG_SET_VIDEO_FRAME_METADATA_LISTENER}, {@link
|
||||
* #MSG_SET_CAMERA_MOTION_LISTENER}, {@link #MSG_SET_SKIP_SILENCE_ENABLED}, {@link
|
||||
* #MSG_SET_AUDIO_SESSION_ID} or {@link #MSG_SET_WAKEUP_LISTENER}. May also be an app-defined
|
||||
* value (see {@link #MSG_CUSTOM_BASE}).
|
||||
* #MSG_SET_AUDIO_SESSION_ID}, {@link #MSG_SET_WAKEUP_LISTENER} or {@link
|
||||
* #MSG_SET_VIDEO_OUTPUT_RESOLUTION}. May also be an app-defined value (see {@link
|
||||
* #MSG_CUSTOM_BASE}).
|
||||
*/
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@ -99,7 +102,8 @@ public interface Renderer extends PlayerMessage.Target {
|
||||
MSG_SET_CAMERA_MOTION_LISTENER,
|
||||
MSG_SET_SKIP_SILENCE_ENABLED,
|
||||
MSG_SET_AUDIO_SESSION_ID,
|
||||
MSG_SET_WAKEUP_LISTENER
|
||||
MSG_SET_WAKEUP_LISTENER,
|
||||
MSG_SET_VIDEO_OUTPUT_RESOLUTION
|
||||
})
|
||||
public @interface MessageType {}
|
||||
/**
|
||||
@ -201,6 +205,13 @@ public interface Renderer extends PlayerMessage.Target {
|
||||
* restore the default.
|
||||
*/
|
||||
int MSG_SET_PREFERRED_AUDIO_DEVICE = 12;
|
||||
/**
|
||||
* The type of a message that can be passed to a video renderer to set the desired output
|
||||
* resolution. The message payload should be a {@link Pair} containing the desired output width
|
||||
* and height, in {@link Integer} instances. Use this method only when playing with video {@link
|
||||
* Effect}.
|
||||
*/
|
||||
int MSG_SET_VIDEO_OUTPUT_RESOLUTION = 13;
|
||||
/**
|
||||
* Applications or extensions may define custom {@code MSG_*} constants that can be passed to
|
||||
* renderers. These custom constants must be greater than or equal to this value.
|
||||
|
Loading…
x
Reference in New Issue
Block a user