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
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.
*
* @param sequences The {@link EditedMediaItemSequence} instances to compose. {@link MediaItem}
* instances from different sequences that are overlapping in time will be mixed in the
* output.
* @param effects The {@link Effects} to apply to the composition.
* @param sequences The {@link #sequences}.
* @param effects The {@link #effects}.
*/
public Composition(ImmutableList<EditedMediaItemSequence> sequences, Effects effects) {
this.sequences = sequences;

View File

@ -88,19 +88,7 @@ public final class EditedMediaItem {
*
* <p>The default value is {@code false}.
*
* <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>
* <p>See {@link #flattenForSlowMotion} for more information about slow motion flattening.
*
* <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
@ -150,11 +138,32 @@ public final class EditedMediaItem {
}
}
/* package */ final MediaItem mediaItem;
/* package */ final boolean removeAudio;
/* package */ final boolean removeVideo;
/* package */ final boolean flattenForSlowMotion;
/* package */ final Effects effects;
/** The {@link MediaItem} on which transformations are applied. */
public final MediaItem mediaItem;
/** Whether to remove the audio from the {@link #mediaItem}. */
public final boolean removeAudio;
/** 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(
MediaItem mediaItem,

View File

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

View File

@ -27,9 +27,22 @@ import com.google.common.collect.ImmutableList;
@UnstableApi
public final class Effects {
/* package */ final ImmutableList<AudioProcessor> audioProcessors;
/* package */ final ImmutableList<Effect> videoEffects;
/* package */ final FrameProcessor.Factory frameProcessorFactory;
/**
* The list of {@linkplain AudioProcessor audio processors} to apply to audio buffers. They are
* 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}.
@ -45,13 +58,9 @@ public final class Effects {
/**
* Creates an instance.
*
* @param audioProcessors The list of {@link AudioProcessor} instances to apply to audio buffers.
* They are 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.
* @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.
* @param audioProcessors The {@link #audioProcessors}.
* @param videoEffects The {@link #videoEffects}.
* @param frameProcessorFactory The {@link #frameProcessorFactory}.
*/
public Effects(
ImmutableList<AudioProcessor> audioProcessors,