Commit 430579dc by tonihei Committed by Oliver Woodman

Update developer guide for sending messages again.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184119097
parent 6ee87b7a
...@@ -30,6 +30,7 @@ import com.google.android.exoplayer2.ExoPlaybackException; ...@@ -30,6 +30,7 @@ import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.FormatHolder; import com.google.android.exoplayer2.FormatHolder;
import com.google.android.exoplayer2.PlayerMessage.Target;
import com.google.android.exoplayer2.decoder.DecoderCounters; import com.google.android.exoplayer2.decoder.DecoderCounters;
import com.google.android.exoplayer2.decoder.DecoderInputBuffer; import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
import com.google.android.exoplayer2.drm.DrmSession; import com.google.android.exoplayer2.drm.DrmSession;
...@@ -45,7 +46,20 @@ import com.google.android.exoplayer2.video.VideoRendererEventListener.EventDispa ...@@ -45,7 +46,20 @@ import com.google.android.exoplayer2.video.VideoRendererEventListener.EventDispa
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
/** Decodes and renders video using the native VP9 decoder. */ /**
* Decodes and renders video using the native VP9 decoder.
*
* <p>This renderer accepts the following messages sent via {@link ExoPlayer#createMessage(Target)}
* on the playback thread:
*
* <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
* renderer. The message payload should be the target {@link VpxOutputBufferRenderer}, or
* null.
* </ul>
*/
public class LibvpxVideoRenderer extends BaseRenderer { public class LibvpxVideoRenderer extends BaseRenderer {
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
...@@ -70,9 +84,9 @@ public class LibvpxVideoRenderer extends BaseRenderer { ...@@ -70,9 +84,9 @@ public class LibvpxVideoRenderer extends BaseRenderer {
private static final int REINITIALIZATION_STATE_WAIT_END_OF_STREAM = 2; private static final int REINITIALIZATION_STATE_WAIT_END_OF_STREAM = 2;
/** /**
* The type of a message that can be passed to an instance of this class via * The type of a message that can be passed to an instance of this class via {@link
* {@link ExoPlayer#sendMessages} or {@link ExoPlayer#blockingSendMessages}. The message object * ExoPlayer#createMessage(Target)}. The message payload should be the target {@link
* should be the target {@link VpxOutputBufferRenderer}, or null. * VpxOutputBufferRenderer}, or null.
*/ */
public static final int MSG_SET_OUTPUT_BUFFER_RENDERER = C.MSG_CUSTOM_BASE; public static final int MSG_SET_OUTPUT_BUFFER_RENDERER = C.MSG_CUSTOM_BASE;
......
...@@ -23,6 +23,7 @@ import android.media.MediaCodec; ...@@ -23,6 +23,7 @@ import android.media.MediaCodec;
import android.media.MediaFormat; import android.media.MediaFormat;
import android.support.annotation.IntDef; import android.support.annotation.IntDef;
import android.view.Surface; import android.view.Surface;
import com.google.android.exoplayer2.PlayerMessage.Target;
import com.google.android.exoplayer2.util.Util; import com.google.android.exoplayer2.util.Util;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
...@@ -642,37 +643,37 @@ public final class C { ...@@ -642,37 +643,37 @@ public final class C {
public static final UUID PLAYREADY_UUID = new UUID(0x9A04F07998404286L, 0xAB92E65BE0885F95L); public static final UUID PLAYREADY_UUID = new UUID(0x9A04F07998404286L, 0xAB92E65BE0885F95L);
/** /**
* The type of a message that can be passed to a video {@link Renderer} via * The type of a message that can be passed to a video {@link Renderer} via {@link
* {@link ExoPlayer#sendMessages} or {@link ExoPlayer#blockingSendMessages}. The message object * ExoPlayer#createMessage(Target)}. The message payload should be the target {@link Surface}, or
* should be the target {@link Surface}, or null. * null.
*/ */
public static final int MSG_SET_SURFACE = 1; public static final int MSG_SET_SURFACE = 1;
/** /**
* A type of a message that can be passed to an audio {@link Renderer} via * A type of a message that can be passed to an audio {@link Renderer} via {@link
* {@link ExoPlayer#sendMessages} or {@link ExoPlayer#blockingSendMessages}. The message object * ExoPlayer#createMessage(Target)}. The message payload should be a {@link Float} with 0 being
* should be a {@link Float} with 0 being silence and 1 being unity gain. * silence and 1 being unity gain.
*/ */
public static final int MSG_SET_VOLUME = 2; public static final int MSG_SET_VOLUME = 2;
/** /**
* A type of a message that can be passed to an audio {@link Renderer} via * A type of a message that can be passed to an audio {@link Renderer} via {@link
* {@link ExoPlayer#sendMessages} or {@link ExoPlayer#blockingSendMessages}. The message object * ExoPlayer#createMessage(Target)}. The message payload should be an {@link
* should be an {@link com.google.android.exoplayer2.audio.AudioAttributes} instance that will * com.google.android.exoplayer2.audio.AudioAttributes} instance that will configure the
* configure the underlying audio track. If not set, the default audio attributes will be used. * underlying audio track. If not set, the default audio attributes will be used. They are
* They are suitable for general media playback. * suitable for general media playback.
* <p> *
* Setting the audio attributes during playback may introduce a short gap in audio output as the * <p>Setting the audio attributes during playback may introduce a short gap in audio output as
* audio track is recreated. A new audio session id will also be generated. * the audio track is recreated. A new audio session id will also be generated.
* <p> *
* If tunneling is enabled by the track selector, the specified audio attributes will be ignored, * <p>If tunneling is enabled by the track selector, the specified audio attributes will be
* but they will take effect if audio is later played without tunneling. * ignored, but they will take effect if audio is later played without tunneling.
* <p> *
* If the device is running a build before platform API version 21, audio attributes cannot be set * <p>If the device is running a build before platform API version 21, audio attributes cannot be
* directly on the underlying audio track. In this case, the usage will be mapped onto an * set directly on the underlying audio track. In this case, the usage will be mapped onto an
* equivalent stream type using {@link Util#getStreamTypeForAudioUsage(int)}. * equivalent stream type using {@link Util#getStreamTypeForAudioUsage(int)}.
* <p> *
* To get audio attributes that are equivalent to a legacy stream type, pass the stream type to * <p>To get audio attributes that are equivalent to a legacy stream type, pass the stream type to
* {@link Util#getAudioUsageForStreamType(int)} and use the returned {@link C.AudioUsage} to build * {@link Util#getAudioUsageForStreamType(int)} and use the returned {@link C.AudioUsage} to build
* an audio attributes instance. * an audio attributes instance.
*/ */
...@@ -680,17 +681,17 @@ public final class C { ...@@ -680,17 +681,17 @@ public final class C {
/** /**
* The type of a message that can be passed to a {@link MediaCodec}-based video {@link Renderer} * The type of a message that can be passed to a {@link MediaCodec}-based video {@link Renderer}
* via {@link ExoPlayer#sendMessages} or {@link ExoPlayer#blockingSendMessages}. The message * via {@link ExoPlayer#createMessage(Target)}. The message payload should be one of the integer
* object should be one of the integer scaling modes in {@link C.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}.
*/ */
public static final int MSG_SET_SCALING_MODE = 4; public static final int MSG_SET_SCALING_MODE = 4;
/** /**
* Applications or extensions may define custom {@code MSG_*} constants greater than or equal to * Applications or extensions may define custom {@code MSG_*} constants that can be passed to
* this value. * {@link Renderer}s. These custom constants must be greater than or equal to this value.
*/ */
public static final int MSG_CUSTOM_BASE = 10000; public static final int MSG_CUSTOM_BASE = 10000;
......
...@@ -24,8 +24,10 @@ import android.os.Handler; ...@@ -24,8 +24,10 @@ import android.os.Handler;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.PlayerMessage.Target;
import com.google.android.exoplayer2.audio.AudioRendererEventListener.EventDispatcher; import com.google.android.exoplayer2.audio.AudioRendererEventListener.EventDispatcher;
import com.google.android.exoplayer2.drm.DrmInitData; import com.google.android.exoplayer2.drm.DrmInitData;
import com.google.android.exoplayer2.drm.DrmSessionManager; import com.google.android.exoplayer2.drm.DrmSessionManager;
...@@ -41,6 +43,17 @@ import java.nio.ByteBuffer; ...@@ -41,6 +43,17 @@ import java.nio.ByteBuffer;
/** /**
* Decodes and renders audio using {@link MediaCodec} and an {@link AudioSink}. * Decodes and renders audio using {@link MediaCodec} and an {@link AudioSink}.
*
* <p>This renderer accepts the following messages sent via {@link ExoPlayer#createMessage(Target)}
* on the playback thread:
*
* <ul>
* <li>Message with type {@link C#MSG_SET_VOLUME} to set the volume. The message payload should be
* a {@link Float} with 0 being silence and 1 being unity gain.
* <li>Message with type {@link C#MSG_SET_AUDIO_ATTRIBUTES} to set the audio attributes. The
* message payload should be an {@link com.google.android.exoplayer2.audio.AudioAttributes}
* instance that will configure the underlying audio track.
* </ul>
*/ */
@TargetApi(16) @TargetApi(16)
public class MediaCodecAudioRenderer extends MediaCodecRenderer implements MediaClock { public class MediaCodecAudioRenderer extends MediaCodecRenderer implements MediaClock {
......
...@@ -23,9 +23,11 @@ import android.support.annotation.IntDef; ...@@ -23,9 +23,11 @@ import android.support.annotation.IntDef;
import com.google.android.exoplayer2.BaseRenderer; import com.google.android.exoplayer2.BaseRenderer;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.FormatHolder; import com.google.android.exoplayer2.FormatHolder;
import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.PlayerMessage.Target;
import com.google.android.exoplayer2.audio.AudioRendererEventListener.EventDispatcher; import com.google.android.exoplayer2.audio.AudioRendererEventListener.EventDispatcher;
import com.google.android.exoplayer2.decoder.DecoderCounters; import com.google.android.exoplayer2.decoder.DecoderCounters;
import com.google.android.exoplayer2.decoder.DecoderInputBuffer; import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
...@@ -45,6 +47,17 @@ import java.lang.annotation.RetentionPolicy; ...@@ -45,6 +47,17 @@ import java.lang.annotation.RetentionPolicy;
/** /**
* Decodes and renders audio using a {@link SimpleDecoder}. * Decodes and renders audio using a {@link SimpleDecoder}.
*
* <p>This renderer accepts the following messages sent via {@link ExoPlayer#createMessage(Target)}
* on the playback thread:
*
* <ul>
* <li>Message with type {@link C#MSG_SET_VOLUME} to set the volume. The message payload should be
* a {@link Float} with 0 being silence and 1 being unity gain.
* <li>Message with type {@link C#MSG_SET_AUDIO_ATTRIBUTES} to set the audio attributes. The
* message payload should be an {@link com.google.android.exoplayer2.audio.AudioAttributes}
* instance that will configure the underlying audio track.
* </ul>
*/ */
public abstract class SimpleDecoderAudioRenderer extends BaseRenderer implements MediaClock { public abstract class SimpleDecoderAudioRenderer extends BaseRenderer implements MediaClock {
......
...@@ -32,7 +32,9 @@ import android.util.Log; ...@@ -32,7 +32,9 @@ import android.util.Log;
import android.view.Surface; import android.view.Surface;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.PlayerMessage.Target;
import com.google.android.exoplayer2.decoder.DecoderInputBuffer; import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
import com.google.android.exoplayer2.drm.DrmInitData; import com.google.android.exoplayer2.drm.DrmInitData;
import com.google.android.exoplayer2.drm.DrmSessionManager; import com.google.android.exoplayer2.drm.DrmSessionManager;
...@@ -51,6 +53,18 @@ import java.nio.ByteBuffer; ...@@ -51,6 +53,18 @@ import java.nio.ByteBuffer;
/** /**
* Decodes and renders video using {@link MediaCodec}. * Decodes and renders video using {@link MediaCodec}.
*
* <p>This renderer accepts the following messages sent via {@link ExoPlayer#createMessage(Target)}
* on the playback thread:
*
* <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 C#MSG_SET_SCALING_MODE} to set the video scaling mode. The message
* 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
* a {@link android.view.SurfaceView}.
* </ul>
*/ */
@TargetApi(16) @TargetApi(16)
public class MediaCodecVideoRenderer extends MediaCodecRenderer { public class MediaCodecVideoRenderer extends MediaCodecRenderer {
......
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