forked from google/ExoPlayer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This class will be used in a follow-up CL. PiperOrigin-RevId: 502615323
- Loading branch information
1 parent
5461d5c
commit 6b6e499
Showing
2 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
.../transformer/src/main/java/com/google/android/exoplayer2/transformer/EditedMediaItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright 2023 The Android Open Source Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.google.android.exoplayer2.transformer; | ||
|
||
import com.google.android.exoplayer2.MediaItem; | ||
import com.google.common.collect.ImmutableList; | ||
|
||
/** A {@link MediaItem} with the transformations to apply to it. */ | ||
public class EditedMediaItem { | ||
|
||
/* package */ final MediaItem mediaItem; | ||
/* package */ final Effects effects; | ||
|
||
/** | ||
* Creates an instance with no {@link Effects}. | ||
* | ||
* @param mediaItem The {@link MediaItem} to edit. | ||
*/ | ||
public EditedMediaItem(MediaItem mediaItem) { | ||
this(mediaItem, new Effects(ImmutableList.of(), ImmutableList.of())); | ||
} | ||
|
||
/** | ||
* Creates an instance. | ||
* | ||
* @param mediaItem The {@link MediaItem} to edit. | ||
* @param effects The {@link Effects} to apply to the {@code mediaItem}. | ||
*/ | ||
public EditedMediaItem(MediaItem mediaItem, Effects effects) { | ||
this.mediaItem = mediaItem; | ||
this.effects = effects; | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/Effects.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright 2023 The Android Open Source Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.google.android.exoplayer2.transformer; | ||
|
||
import com.google.android.exoplayer2.MediaItem; | ||
import com.google.android.exoplayer2.audio.AudioProcessor; | ||
import com.google.android.exoplayer2.effect.GlEffectsFrameProcessor; | ||
import com.google.android.exoplayer2.util.Effect; | ||
import com.google.android.exoplayer2.util.FrameProcessor; | ||
import com.google.common.collect.ImmutableList; | ||
|
||
/** Effects to apply to a {@link MediaItem}. */ | ||
public final class Effects { | ||
|
||
/* package */ final ImmutableList<AudioProcessor> audioProcessors; | ||
/* package */ final ImmutableList<Effect> videoEffects; | ||
/* package */ final FrameProcessor.Factory frameProcessorFactory; | ||
|
||
/** | ||
* Creates an instance using a {@link GlEffectsFrameProcessor.Factory}. | ||
* | ||
* <p>This is equivalent to calling {@link Effects#Effects(ImmutableList, ImmutableList, | ||
* FrameProcessor.Factory)} with a {@link GlEffectsFrameProcessor.Factory}. | ||
*/ | ||
public Effects( | ||
ImmutableList<AudioProcessor> audioProcessors, ImmutableList<Effect> videoEffects) { | ||
this(audioProcessors, videoEffects, new GlEffectsFrameProcessor.Factory()); | ||
} | ||
|
||
/** | ||
* 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, after {@linkplain | ||
* TransformationRequest.Builder#setFlattenForSlowMotion(boolean) slow-motion flattening}. | ||
* @param frameProcessorFactory The {@link FrameProcessor.Factory} for the {@link FrameProcessor} | ||
* to use when applying the {@code videoEffects} to the video frames. | ||
*/ | ||
public Effects( | ||
ImmutableList<AudioProcessor> audioProcessors, | ||
ImmutableList<Effect> videoEffects, | ||
FrameProcessor.Factory frameProcessorFactory) { | ||
this.audioProcessors = audioProcessors; | ||
this.videoEffects = videoEffects; | ||
this.frameProcessorFactory = frameProcessorFactory; | ||
} | ||
} |