Move MetadataComponent from Player to ExoPlayer

PiperOrigin-RevId: 368418142
This commit is contained in:
krocard 2021-04-14 14:32:06 +01:00 committed by Andrew Lewis
parent f4f312738b
commit 40d3e12853
4 changed files with 26 additions and 31 deletions

View File

@ -286,12 +286,6 @@ public final class CastPlayer extends BasePlayer {
return null;
}
@Override
@Nullable
public MetadataComponent getMetadataComponent() {
return null;
}
@Override
@Nullable
public DeviceComponent getDeviceComponent() {

View File

@ -227,24 +227,6 @@ public interface Player {
List<Cue> getCurrentCues();
}
/** The metadata component of a {@link Player}. */
interface MetadataComponent {
/**
* Adds a {@link MetadataOutput} to receive metadata.
*
* @param output The output to register.
*/
void addMetadataOutput(MetadataOutput output);
/**
* Removes a {@link MetadataOutput}.
*
* @param output The output to remove.
*/
void removeMetadataOutput(MetadataOutput output);
}
/** The device component of a {@link Player}. */
interface DeviceComponent {
@ -1173,12 +1155,6 @@ public interface Player {
@Nullable
TextComponent getTextComponent();
/**
* Returns the component of this player for metadata output, or null if metadata is not supported.
*/
@Nullable
MetadataComponent getMetadataComponent();
/** Returns the component of this player for playback device, or null if it's not supported. */
@Nullable
DeviceComponent getDeviceComponent();

View File

@ -28,6 +28,7 @@ import com.google.android.exoplayer2.audio.AudioSink;
import com.google.android.exoplayer2.audio.AuxEffectInfo;
import com.google.android.exoplayer2.audio.DefaultAudioSink;
import com.google.android.exoplayer2.audio.MediaCodecAudioRenderer;
import com.google.android.exoplayer2.metadata.MetadataOutput;
import com.google.android.exoplayer2.metadata.MetadataRenderer;
import com.google.android.exoplayer2.source.DefaultMediaSourceFactory;
import com.google.android.exoplayer2.source.MediaSource;
@ -218,6 +219,24 @@ public interface ExoPlayer extends Player {
boolean getSkipSilenceEnabled();
}
/** The metadata component of an {@link ExoPlayer}. */
interface MetadataComponent {
/**
* Adds a {@link MetadataOutput} to receive metadata.
*
* @param output The output to register.
*/
void addMetadataOutput(MetadataOutput output);
/**
* Removes a {@link MetadataOutput}.
*
* @param output The output to remove.
*/
void removeMetadataOutput(MetadataOutput output);
}
/**
* The default timeout for calls to {@link #release} and {@link #setForegroundMode}, in
* milliseconds.
@ -561,6 +580,12 @@ public interface ExoPlayer extends Player {
@Nullable
AudioComponent getAudioComponent();
/**
* Returns the component of this player for metadata output, or null if metadata is not supported.
*/
@Nullable
MetadataComponent getMetadataComponent();
/**
* Adds a listener to receive audio offload events.
*

View File

@ -81,7 +81,7 @@ public class SimpleExoPlayer extends BasePlayer
ExoPlayer.AudioComponent,
Player.VideoComponent,
Player.TextComponent,
Player.MetadataComponent,
ExoPlayer.MetadataComponent,
Player.DeviceComponent {
/** The default timeout for detaching a surface from the player, in milliseconds. */