Move vpx constant for setting output renderer to common constants file

This will be used by both av1 and vp9 extensions.

PiperOrigin-RevId: 271949754
This commit is contained in:
sofijajvc 2019-09-30 11:49:40 +01:00 committed by Oliver Woodman
parent bab12af597
commit 7c199eb1ad
4 changed files with 18 additions and 10 deletions

View File

@ -75,6 +75,11 @@
* Add `Player.onPlaybackSuppressionReasonChanged` to allow listeners to
detect playbacks suppressions (e.g. audio focus loss) directly
([#6203](https://github.com/google/ExoPlayer/issues/6203)).
* VP9 extension:
* Rename `VpxVideoSurfaceView` to `VideoDecoderSurfaceView`
and move it to the core library.
* Move `LibvpxVideoRenderer.MSG_SET_OUTPUT_BUFFER_RENDERER` to
`C.MSG_SET_OUTPUT_BUFFER_RENDERER`.
### 2.10.5 (2019-09-20) ###

View File

@ -23,6 +23,7 @@ import android.net.Uri;
import android.os.Looper;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Player;
@ -122,7 +123,7 @@ public class VpxPlaybackTest {
.createMediaSource(uri);
player
.createMessage(videoRenderer)
.setType(LibvpxVideoRenderer.MSG_SET_OUTPUT_BUFFER_RENDERER)
.setType(C.MSG_SET_OUTPUT_BUFFER_RENDERER)
.setPayload(new VideoDecoderSurfaceView(context))
.send();
player.prepare(mediaSource);

View File

@ -48,20 +48,13 @@ import com.google.android.exoplayer2.video.VideoRendererEventListener;
* <ul>
* <li>Message with type {@link C#MSG_SET_SURFACE} to set the output surface. The message payload
* should be the target {@link Surface}, or null.
* <li>Message with type {@link #MSG_SET_OUTPUT_BUFFER_RENDERER} to set the output buffer
* <li>Message with type {@link C#MSG_SET_OUTPUT_BUFFER_RENDERER} to set the output buffer
* renderer. The message payload should be the target {@link
* VideoDecoderOutputBufferRenderer}, or null.
* </ul>
*/
public class LibvpxVideoRenderer extends SimpleDecoderVideoRenderer {
/**
* The type of a message that can be passed to an instance of this class via {@link
* ExoPlayer#createMessage(Target)}. The message payload should be the target {@link
* VideoDecoderOutputBufferRenderer}, or null.
*/
public static final int MSG_SET_OUTPUT_BUFFER_RENDERER = C.MSG_CUSTOM_BASE;
/** The number of input buffers. */
private final int numInputBuffers;
/**
@ -298,7 +291,7 @@ public class LibvpxVideoRenderer extends SimpleDecoderVideoRenderer {
public void handleMessage(int messageType, @Nullable Object message) throws ExoPlaybackException {
if (messageType == C.MSG_SET_SURFACE) {
setOutput((Surface) message, null);
} else if (messageType == MSG_SET_OUTPUT_BUFFER_RENDERER) {
} else if (messageType == C.MSG_SET_OUTPUT_BUFFER_RENDERER) {
setOutput(null, (VideoDecoderOutputBufferRenderer) message);
} else if (messageType == C.MSG_SET_VIDEO_FRAME_METADATA_LISTENER) {
frameMetadataListener = (VideoFrameMetadataListener) message;

View File

@ -27,6 +27,8 @@ import androidx.annotation.IntDef;
import com.google.android.exoplayer2.PlayerMessage.Target;
import com.google.android.exoplayer2.audio.AuxEffectInfo;
import com.google.android.exoplayer2.util.Util;
import com.google.android.exoplayer2.video.SimpleDecoderVideoRenderer;
import com.google.android.exoplayer2.video.VideoDecoderOutputBufferRenderer;
import com.google.android.exoplayer2.video.VideoFrameMetadataListener;
import com.google.android.exoplayer2.video.spherical.CameraMotionListener;
import java.lang.annotation.Documented;
@ -823,6 +825,13 @@ public final class C {
*/
public static final int MSG_SET_CAMERA_MOTION_LISTENER = 7;
/**
* The type of a message that can be passed to a {@link SimpleDecoderVideoRenderer} via {@link
* ExoPlayer#createMessage(Target)}. The message payload should be the target {@link
* VideoDecoderOutputBufferRenderer}, or null.
*/
public static final int MSG_SET_OUTPUT_BUFFER_RENDERER = 8;
/**
* Applications or extensions may define custom {@code MSG_*} constants that can be passed to
* {@link Renderer}s. These custom constants must be greater than or equal to this value.