Make Composition fields public

Transformer callbacks will take a Composition instead of a MediaItem.
Apps should be able to see what this Composition contains.

PiperOrigin-RevId: 505976561
This commit is contained in:
kimvde 2023-01-31 13:50:42 +00:00 committed by christosts
parent 2d3156f87e
commit d5035123b4
4 changed files with 58 additions and 36 deletions

View File

@ -28,16 +28,19 @@ import com.google.common.collect.ImmutableList;
@UnstableApi @UnstableApi
public final class Composition { public final class Composition {
/* package */ final ImmutableList<EditedMediaItemSequence> sequences; /**
/* package */ final Effects effects; * The {@link EditedMediaItemSequence} instances to compose. {@link MediaItem} instances from
* different sequences that are overlapping in time will be mixed in the output.
*/
public final ImmutableList<EditedMediaItemSequence> sequences;
/** The {@link Effects} to apply to the composition. */
public final Effects effects;
/** /**
* Creates an instance. * Creates an instance.
* *
* @param sequences The {@link EditedMediaItemSequence} instances to compose. {@link MediaItem} * @param sequences The {@link #sequences}.
* instances from different sequences that are overlapping in time will be mixed in the * @param effects The {@link #effects}.
* output.
* @param effects The {@link Effects} to apply to the composition.
*/ */
public Composition(ImmutableList<EditedMediaItemSequence> sequences, Effects effects) { public Composition(ImmutableList<EditedMediaItemSequence> sequences, Effects effects) {
this.sequences = sequences; this.sequences = sequences;

View File

@ -88,19 +88,7 @@ public final class EditedMediaItem {
* *
* <p>The default value is {@code false}. * <p>The default value is {@code false}.
* *
* <p>The flattened output is obtained by removing the slow motion metadata and by actually * <p>See {@link #flattenForSlowMotion} for more information about slow motion flattening.
* slowing down the parts of the video and audio streams defined in this metadata.
*
* <p>Only Samsung Extension Format (SEF) slow motion metadata type is supported. Flattening has
* no effect if the input does not contain this metadata type.
*
* <p>For SEF slow motion media, the following assumptions are made on the input:
*
* <ul>
* <li>The input container format is (unfragmented) MP4.
* <li>The input contains an AVC video elementary stream with temporal SVC.
* <li>The recording frame rate of the video is 120 or 240 fps.
* </ul>
* *
* <p>If using an {@link ExoPlayerAssetLoader.Factory} with a provided {@link * <p>If using an {@link ExoPlayerAssetLoader.Factory} with a provided {@link
* MediaSource.Factory}, make sure that {@link Mp4Extractor#FLAG_READ_SEF_DATA} is set on the * MediaSource.Factory}, make sure that {@link Mp4Extractor#FLAG_READ_SEF_DATA} is set on the
@ -150,11 +138,32 @@ public final class EditedMediaItem {
} }
} }
/* package */ final MediaItem mediaItem; /** The {@link MediaItem} on which transformations are applied. */
/* package */ final boolean removeAudio; public final MediaItem mediaItem;
/* package */ final boolean removeVideo; /** Whether to remove the audio from the {@link #mediaItem}. */
/* package */ final boolean flattenForSlowMotion; public final boolean removeAudio;
/* package */ final Effects effects; /** Whether to remove the video from the {@link #mediaItem}. */
public final boolean removeVideo;
/**
* Whether to flatten the {@link #mediaItem} if it contains slow motion markers.
*
* <p>The flattened output is obtained by removing the slow motion metadata and by actually
* slowing down the parts of the video and audio streams defined in this metadata.
*
* <p>Only Samsung Extension Format (SEF) slow motion metadata type is supported. Flattening has
* no effect if the input does not contain this metadata type.
*
* <p>For SEF slow motion media, the following assumptions are made on the input:
*
* <ul>
* <li>The input container format is (unfragmented) MP4.
* <li>The input contains an AVC video elementary stream with temporal SVC.
* <li>The recording frame rate of the video is 120 or 240 fps.
* </ul>
*/
public final boolean flattenForSlowMotion;
/** The {@link Effects} to apply to the {@link #mediaItem}. */
public final Effects effects;
private EditedMediaItem( private EditedMediaItem(
MediaItem mediaItem, MediaItem mediaItem,

View File

@ -26,12 +26,13 @@ import com.google.common.collect.ImmutableList;
@UnstableApi @UnstableApi
public final class EditedMediaItemSequence { public final class EditedMediaItemSequence {
/* package */ final ImmutableList<EditedMediaItem> editedMediaItems; /** The {@link EditedMediaItem} instances in the sequence. */
public final ImmutableList<EditedMediaItem> editedMediaItems;
/** /**
* Creates an instance. * Creates an instance.
* *
* @param editedMediaItems The {@link EditedMediaItem} instances in the sequence. * @param editedMediaItems The {@link #editedMediaItems}.
*/ */
public EditedMediaItemSequence(ImmutableList<EditedMediaItem> editedMediaItems) { public EditedMediaItemSequence(ImmutableList<EditedMediaItem> editedMediaItems) {
this.editedMediaItems = editedMediaItems; this.editedMediaItems = editedMediaItems;

View File

@ -27,9 +27,22 @@ import com.google.common.collect.ImmutableList;
@UnstableApi @UnstableApi
public final class Effects { public final class Effects {
/* package */ final ImmutableList<AudioProcessor> audioProcessors; /**
/* package */ final ImmutableList<Effect> videoEffects; * The list of {@linkplain AudioProcessor audio processors} to apply to audio buffers. They are
/* package */ final FrameProcessor.Factory frameProcessorFactory; * applied in the order of the list, and buffers will only be modified by that {@link
* AudioProcessor} if it {@link AudioProcessor#isActive()} based on the current configuration.
*/
public final ImmutableList<AudioProcessor> audioProcessors;
/**
* The list of {@linkplain Effect video effects} to apply to each frame. They are applied in the
* order of the list.
*/
public final ImmutableList<Effect> videoEffects;
/**
* The {@link FrameProcessor.Factory} for the {@link FrameProcessor} to use when applying the
* {@code videoEffects} to the video frames.
*/
public final FrameProcessor.Factory frameProcessorFactory;
/** /**
* Creates an instance using a {@link GlEffectsFrameProcessor.Factory}. * Creates an instance using a {@link GlEffectsFrameProcessor.Factory}.
@ -45,13 +58,9 @@ public final class Effects {
/** /**
* Creates an instance. * Creates an instance.
* *
* @param audioProcessors The list of {@link AudioProcessor} instances to apply to audio buffers. * @param audioProcessors The {@link #audioProcessors}.
* They are applied in the order of the list, and buffers will only be modified by that {@link * @param videoEffects The {@link #videoEffects}.
* AudioProcessor} if it {@link AudioProcessor#isActive()} based on the current configuration. * @param frameProcessorFactory The {@link #frameProcessorFactory}.
* @param videoEffects The list of {@link Effect} instances to apply to each video frame. They are
* applied in the order of the list.
* @param frameProcessorFactory The {@link FrameProcessor.Factory} for the {@link FrameProcessor}
* to use when applying the {@code videoEffects} to the video frames.
*/ */
public Effects( public Effects(
ImmutableList<AudioProcessor> audioProcessors, ImmutableList<AudioProcessor> audioProcessors,