diff --git a/extensions/vp9/src/main/java/com/google/android/exoplayer2/ext/vp9/LibvpxVideoRenderer.java b/extensions/vp9/src/main/java/com/google/android/exoplayer2/ext/vp9/LibvpxVideoRenderer.java index 5a2093b2b7..101f05cd82 100644 --- a/extensions/vp9/src/main/java/com/google/android/exoplayer2/ext/vp9/LibvpxVideoRenderer.java +++ b/extensions/vp9/src/main/java/com/google/android/exoplayer2/ext/vp9/LibvpxVideoRenderer.java @@ -30,6 +30,7 @@ import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.Format; 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.DecoderInputBuffer; import com.google.android.exoplayer2.drm.DrmSession; @@ -45,7 +46,20 @@ import com.google.android.exoplayer2.video.VideoRendererEventListener.EventDispa import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -/** Decodes and renders video using the native VP9 decoder. */ +/** + * Decodes and renders video using the native VP9 decoder. + * + *

This renderer accepts the following messages sent via {@link ExoPlayer#createMessage(Target)} + * on the playback thread: + * + *

+ */ public class LibvpxVideoRenderer extends BaseRenderer { @Retention(RetentionPolicy.SOURCE) @@ -70,9 +84,9 @@ public class LibvpxVideoRenderer extends BaseRenderer { 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 - * {@link ExoPlayer#sendMessages} or {@link ExoPlayer#blockingSendMessages}. The message object - * should be the target {@link VpxOutputBufferRenderer}, or null. + * 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 + * VpxOutputBufferRenderer}, or null. */ public static final int MSG_SET_OUTPUT_BUFFER_RENDERER = C.MSG_CUSTOM_BASE; diff --git a/library/core/src/main/java/com/google/android/exoplayer2/C.java b/library/core/src/main/java/com/google/android/exoplayer2/C.java index d6e61c12b1..045f3bfc6e 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/C.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/C.java @@ -23,6 +23,7 @@ import android.media.MediaCodec; import android.media.MediaFormat; import android.support.annotation.IntDef; import android.view.Surface; +import com.google.android.exoplayer2.PlayerMessage.Target; import com.google.android.exoplayer2.util.Util; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -642,37 +643,37 @@ public final class C { 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 - * {@link ExoPlayer#sendMessages} or {@link ExoPlayer#blockingSendMessages}. The message object - * should be the target {@link Surface}, or null. + * The type of a message that can be passed to a video {@link Renderer} via {@link + * ExoPlayer#createMessage(Target)}. The message payload should be the target {@link Surface}, or + * null. */ public static final int MSG_SET_SURFACE = 1; /** - * A type of a message that can be passed to an audio {@link Renderer} via - * {@link ExoPlayer#sendMessages} or {@link ExoPlayer#blockingSendMessages}. The message object - * should be a {@link Float} with 0 being silence and 1 being unity gain. + * A type of a message that can be passed to an audio {@link Renderer} via {@link + * ExoPlayer#createMessage(Target)}. The message payload should be a {@link Float} with 0 being + * silence and 1 being unity gain. */ public static final int MSG_SET_VOLUME = 2; /** - * A type of a message that can be passed to an audio {@link Renderer} via - * {@link ExoPlayer#sendMessages} or {@link ExoPlayer#blockingSendMessages}. The message object - * should be an {@link com.google.android.exoplayer2.audio.AudioAttributes} instance that will - * configure the underlying audio track. If not set, the default audio attributes will be used. - * They are suitable for general media playback. - *

- * Setting the audio attributes during playback may introduce a short gap in audio output as the - * audio track is recreated. A new audio session id will also be generated. - *

- * If tunneling is enabled by the track selector, the specified audio attributes will be ignored, - * but they will take effect if audio is later played without tunneling. - *

- * If the device is running a build before platform API version 21, audio attributes cannot be set - * directly on the underlying audio track. In this case, the usage will be mapped onto an + * A type of a message that can be passed to an audio {@link Renderer} via {@link + * ExoPlayer#createMessage(Target)}. The message payload should be an {@link + * com.google.android.exoplayer2.audio.AudioAttributes} instance that will configure the + * underlying audio track. If not set, the default audio attributes will be used. They are + * suitable for general media playback. + * + *

Setting the audio attributes during playback may introduce a short gap in audio output as + * the audio track is recreated. A new audio session id will also be generated. + * + *

If tunneling is enabled by the track selector, the specified audio attributes will be + * ignored, but they will take effect if audio is later played without tunneling. + * + *

If the device is running a build before platform API version 21, audio attributes cannot be + * 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)}. - *

- * To get audio attributes that are equivalent to a legacy stream type, pass the stream type to + * + *

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 * an audio attributes instance. */ @@ -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} - * via {@link ExoPlayer#sendMessages} or {@link ExoPlayer#blockingSendMessages}. The message - * object 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 the renderer is + * via {@link ExoPlayer#createMessage(Target)}. 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 the renderer is * owned by a {@link android.view.SurfaceView}. */ public static final int MSG_SET_SCALING_MODE = 4; /** - * Applications or extensions may define custom {@code MSG_*} constants greater than or equal to - * this value. + * 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. */ public static final int MSG_CUSTOM_BASE = 10000; diff --git a/library/core/src/main/java/com/google/android/exoplayer2/audio/MediaCodecAudioRenderer.java b/library/core/src/main/java/com/google/android/exoplayer2/audio/MediaCodecAudioRenderer.java index f73d63616b..a7063e5a7f 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/audio/MediaCodecAudioRenderer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/audio/MediaCodecAudioRenderer.java @@ -24,8 +24,10 @@ import android.os.Handler; import android.support.annotation.Nullable; import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.ExoPlaybackException; +import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.Format; 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.drm.DrmInitData; import com.google.android.exoplayer2.drm.DrmSessionManager; @@ -41,6 +43,17 @@ import java.nio.ByteBuffer; /** * Decodes and renders audio using {@link MediaCodec} and an {@link AudioSink}. + * + *

This renderer accepts the following messages sent via {@link ExoPlayer#createMessage(Target)} + * on the playback thread: + * + *

*/ @TargetApi(16) public class MediaCodecAudioRenderer extends MediaCodecRenderer implements MediaClock { diff --git a/library/core/src/main/java/com/google/android/exoplayer2/audio/SimpleDecoderAudioRenderer.java b/library/core/src/main/java/com/google/android/exoplayer2/audio/SimpleDecoderAudioRenderer.java index eda8cfb15d..2f5e7bcf97 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/audio/SimpleDecoderAudioRenderer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/audio/SimpleDecoderAudioRenderer.java @@ -23,9 +23,11 @@ import android.support.annotation.IntDef; import com.google.android.exoplayer2.BaseRenderer; import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.ExoPlaybackException; +import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.FormatHolder; 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.decoder.DecoderCounters; import com.google.android.exoplayer2.decoder.DecoderInputBuffer; @@ -45,6 +47,17 @@ import java.lang.annotation.RetentionPolicy; /** * Decodes and renders audio using a {@link SimpleDecoder}. + * + *

This renderer accepts the following messages sent via {@link ExoPlayer#createMessage(Target)} + * on the playback thread: + * + *

*/ public abstract class SimpleDecoderAudioRenderer extends BaseRenderer implements MediaClock { diff --git a/library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java b/library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java index 895e290a75..f26db1054f 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java @@ -32,7 +32,9 @@ import android.util.Log; import android.view.Surface; import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.ExoPlaybackException; +import com.google.android.exoplayer2.ExoPlayer; 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.drm.DrmInitData; import com.google.android.exoplayer2.drm.DrmSessionManager; @@ -51,6 +53,18 @@ import java.nio.ByteBuffer; /** * Decodes and renders video using {@link MediaCodec}. + * + *

This renderer accepts the following messages sent via {@link ExoPlayer#createMessage(Target)} + * on the playback thread: + * + *

*/ @TargetApi(16) public class MediaCodecVideoRenderer extends MediaCodecRenderer {