mirror of
https://github.com/androidx/media.git
synced 2025-05-17 12:39:52 +08:00
Add Effect marker interface.
This allows non-GL effects to be passed to custom FrameProcessor implementations. PiperOrigin-RevId: 463696384 (cherry picked from commit 580e44fc47ec5b62da5a133d12048a20d716e94f)
This commit is contained in:
parent
49a6511696
commit
6e390771a0
@ -44,6 +44,7 @@ import androidx.media3.exoplayer.util.DebugTextViewHelper;
|
|||||||
import androidx.media3.transformer.Contrast;
|
import androidx.media3.transformer.Contrast;
|
||||||
import androidx.media3.transformer.DebugViewProvider;
|
import androidx.media3.transformer.DebugViewProvider;
|
||||||
import androidx.media3.transformer.DefaultEncoderFactory;
|
import androidx.media3.transformer.DefaultEncoderFactory;
|
||||||
|
import androidx.media3.transformer.Effect;
|
||||||
import androidx.media3.transformer.GlEffect;
|
import androidx.media3.transformer.GlEffect;
|
||||||
import androidx.media3.transformer.GlTextureProcessor;
|
import androidx.media3.transformer.GlTextureProcessor;
|
||||||
import androidx.media3.transformer.ProgressHolder;
|
import androidx.media3.transformer.ProgressHolder;
|
||||||
@ -265,7 +266,7 @@ public final class TransformerActivity extends AppCompatActivity {
|
|||||||
.setEnableFallback(bundle.getBoolean(ConfigurationActivity.ENABLE_FALLBACK))
|
.setEnableFallback(bundle.getBoolean(ConfigurationActivity.ENABLE_FALLBACK))
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
ImmutableList.Builder<GlEffect> effects = new ImmutableList.Builder<>();
|
ImmutableList.Builder<Effect> effects = new ImmutableList.Builder<>();
|
||||||
@Nullable
|
@Nullable
|
||||||
boolean[] selectedEffects =
|
boolean[] selectedEffects =
|
||||||
bundle.getBooleanArray(ConfigurationActivity.DEMO_EFFECTS_SELECTIONS);
|
bundle.getBooleanArray(ConfigurationActivity.DEMO_EFFECTS_SELECTIONS);
|
||||||
@ -280,6 +281,7 @@ public final class TransformerActivity extends AppCompatActivity {
|
|||||||
clazz.getConstructor(
|
clazz.getConstructor(
|
||||||
Context.class, Boolean.class, String.class, String.class, String.class);
|
Context.class, Boolean.class, String.class, String.class, String.class);
|
||||||
effects.add(
|
effects.add(
|
||||||
|
(GlEffect)
|
||||||
(Context context, boolean useHdr) -> {
|
(Context context, boolean useHdr) -> {
|
||||||
try {
|
try {
|
||||||
return (GlTextureProcessor)
|
return (GlTextureProcessor)
|
||||||
@ -300,6 +302,7 @@ public final class TransformerActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
if (selectedEffects[2]) {
|
if (selectedEffects[2]) {
|
||||||
effects.add(
|
effects.add(
|
||||||
|
(GlEffect)
|
||||||
(Context context, boolean useHdr) ->
|
(Context context, boolean useHdr) ->
|
||||||
new PeriodicVignetteProcessor(
|
new PeriodicVignetteProcessor(
|
||||||
context,
|
context,
|
||||||
@ -316,7 +319,7 @@ public final class TransformerActivity extends AppCompatActivity {
|
|||||||
effects.add(MatrixTransformationFactory.createSpin3dEffect());
|
effects.add(MatrixTransformationFactory.createSpin3dEffect());
|
||||||
}
|
}
|
||||||
if (selectedEffects[4]) {
|
if (selectedEffects[4]) {
|
||||||
effects.add(BitmapOverlayProcessor::new);
|
effects.add((GlEffect) BitmapOverlayProcessor::new);
|
||||||
}
|
}
|
||||||
if (selectedEffects[5]) {
|
if (selectedEffects[5]) {
|
||||||
effects.add(MatrixTransformationFactory.createZoomInTransition());
|
effects.add(MatrixTransformationFactory.createZoomInTransition());
|
||||||
|
@ -295,7 +295,7 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
"processData_withManyComposedMatrixTransformations_producesSameOutputAsCombinedTransformation";
|
"processData_withManyComposedMatrixTransformations_producesSameOutputAsCombinedTransformation";
|
||||||
Crop centerCrop =
|
Crop centerCrop =
|
||||||
new Crop(/* left= */ -0.5f, /* right= */ 0.5f, /* bottom= */ -0.5f, /* top= */ 0.5f);
|
new Crop(/* left= */ -0.5f, /* right= */ 0.5f, /* bottom= */ -0.5f, /* top= */ 0.5f);
|
||||||
ImmutableList.Builder<GlEffect> full10StepRotationAndCenterCrop = new ImmutableList.Builder<>();
|
ImmutableList.Builder<Effect> full10StepRotationAndCenterCrop = new ImmutableList.Builder<>();
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
full10StepRotationAndCenterCrop.add(new Rotation(/* degrees= */ 36));
|
full10StepRotationAndCenterCrop.add(new Rotation(/* degrees= */ 36));
|
||||||
}
|
}
|
||||||
@ -336,7 +336,7 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
setUpAndPrepareFirstFrame(pixelWidthHeightRatio, asList(effects));
|
setUpAndPrepareFirstFrame(pixelWidthHeightRatio, asList(effects));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpAndPrepareFirstFrame(float pixelWidthHeightRatio, List<GlEffect> effects)
|
private void setUpAndPrepareFirstFrame(float pixelWidthHeightRatio, List<Effect> effects)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
// Set up the extractor to read the first video frame and get its format.
|
// Set up the extractor to read the first video frame and get its format.
|
||||||
MediaExtractor mediaExtractor = new MediaExtractor();
|
MediaExtractor mediaExtractor = new MediaExtractor();
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2022 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 androidx.media3.transformer;
|
||||||
|
|
||||||
|
import androidx.media3.common.util.UnstableApi;
|
||||||
|
|
||||||
|
/** Marker interface for a video frame effect. */
|
||||||
|
@UnstableApi
|
||||||
|
public interface Effect {}
|
@ -24,7 +24,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* Interface for a frame processor that applies changes to individual video frames.
|
* Interface for a frame processor that applies changes to individual video frames.
|
||||||
*
|
*
|
||||||
* <p>The changes are specified by {@link GlEffect} instances passed to the {@link Factory}.
|
* <p>The changes are specified by {@link Effect} instances passed to the {@link Factory}.
|
||||||
*
|
*
|
||||||
* <p>The frame processor manages its input {@link Surface} which can be accessed via {@link
|
* <p>The frame processor manages its input {@link Surface} which can be accessed via {@link
|
||||||
* #getInputSurface()}. The output {@link Surface} must be set by the caller using {@link
|
* #getInputSurface()}. The output {@link Surface} must be set by the caller using {@link
|
||||||
@ -44,7 +44,7 @@ public interface FrameProcessor {
|
|||||||
*
|
*
|
||||||
* @param context A {@link Context}.
|
* @param context A {@link Context}.
|
||||||
* @param listener A {@link Listener}.
|
* @param listener A {@link Listener}.
|
||||||
* @param effects The {@link GlEffect} instances to apply to each frame.
|
* @param effects The {@link Effect} instances to apply to each frame.
|
||||||
* @param debugViewProvider A {@link DebugViewProvider}.
|
* @param debugViewProvider A {@link DebugViewProvider}.
|
||||||
* @param useHdr Whether to process the input as an HDR signal.
|
* @param useHdr Whether to process the input as an HDR signal.
|
||||||
* @return A new instance.
|
* @return A new instance.
|
||||||
@ -54,7 +54,7 @@ public interface FrameProcessor {
|
|||||||
FrameProcessor create(
|
FrameProcessor create(
|
||||||
Context context,
|
Context context,
|
||||||
FrameProcessor.Listener listener,
|
FrameProcessor.Listener listener,
|
||||||
List<GlEffect> effects,
|
List<Effect> effects,
|
||||||
DebugViewProvider debugViewProvider,
|
DebugViewProvider debugViewProvider,
|
||||||
boolean useHdr)
|
boolean useHdr)
|
||||||
throws FrameProcessingException;
|
throws FrameProcessingException;
|
||||||
|
@ -26,7 +26,7 @@ import androidx.media3.common.util.UnstableApi;
|
|||||||
* the effect.
|
* the effect.
|
||||||
*/
|
*/
|
||||||
@UnstableApi
|
@UnstableApi
|
||||||
public interface GlEffect {
|
public interface GlEffect extends Effect {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a {@link SingleFrameGlTextureProcessor} that applies the effect.
|
* Returns a {@link SingleFrameGlTextureProcessor} that applies the effect.
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.transformer;
|
package androidx.media3.transformer;
|
||||||
|
|
||||||
|
import static androidx.media3.common.util.Assertions.checkArgument;
|
||||||
import static androidx.media3.common.util.Assertions.checkState;
|
import static androidx.media3.common.util.Assertions.checkState;
|
||||||
import static androidx.media3.common.util.Assertions.checkStateNotNull;
|
import static androidx.media3.common.util.Assertions.checkStateNotNull;
|
||||||
import static com.google.common.collect.Iterables.getLast;
|
import static com.google.common.collect.Iterables.getLast;
|
||||||
@ -53,13 +54,15 @@ public final class GlEffectsFrameProcessor implements FrameProcessor {
|
|||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*
|
*
|
||||||
|
* <p>All {@link Effect} instances must be {@link GlEffect} instances.
|
||||||
|
*
|
||||||
* <p>Using HDR requires the {@code EXT_YUV_target} OpenGL extension.
|
* <p>Using HDR requires the {@code EXT_YUV_target} OpenGL extension.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public GlEffectsFrameProcessor create(
|
public GlEffectsFrameProcessor create(
|
||||||
Context context,
|
Context context,
|
||||||
FrameProcessor.Listener listener,
|
FrameProcessor.Listener listener,
|
||||||
List<GlEffect> effects,
|
List<Effect> effects,
|
||||||
DebugViewProvider debugViewProvider,
|
DebugViewProvider debugViewProvider,
|
||||||
boolean useHdr)
|
boolean useHdr)
|
||||||
throws FrameProcessingException {
|
throws FrameProcessingException {
|
||||||
@ -93,6 +96,8 @@ public final class GlEffectsFrameProcessor implements FrameProcessor {
|
|||||||
* GlTextureProcessor} instances corresponding to the {@link GlEffect} instances, and returns a
|
* GlTextureProcessor} instances corresponding to the {@link GlEffect} instances, and returns a
|
||||||
* new {@code GlEffectsFrameProcessor}.
|
* new {@code GlEffectsFrameProcessor}.
|
||||||
*
|
*
|
||||||
|
* <p>All {@link Effect} instances must be {@link GlEffect} instances.
|
||||||
|
*
|
||||||
* <p>This method must be executed using the {@code singleThreadExecutorService}, as later OpenGL
|
* <p>This method must be executed using the {@code singleThreadExecutorService}, as later OpenGL
|
||||||
* commands will be called on that thread.
|
* commands will be called on that thread.
|
||||||
*/
|
*/
|
||||||
@ -100,7 +105,7 @@ public final class GlEffectsFrameProcessor implements FrameProcessor {
|
|||||||
private static GlEffectsFrameProcessor createOpenGlObjectsAndFrameProcessor(
|
private static GlEffectsFrameProcessor createOpenGlObjectsAndFrameProcessor(
|
||||||
Context context,
|
Context context,
|
||||||
FrameProcessor.Listener listener,
|
FrameProcessor.Listener listener,
|
||||||
List<GlEffect> effects,
|
List<Effect> effects,
|
||||||
DebugViewProvider debugViewProvider,
|
DebugViewProvider debugViewProvider,
|
||||||
boolean useHdr,
|
boolean useHdr,
|
||||||
ExecutorService singleThreadExecutorService)
|
ExecutorService singleThreadExecutorService)
|
||||||
@ -142,13 +147,15 @@ public final class GlEffectsFrameProcessor implements FrameProcessor {
|
|||||||
* MatrixTransformationProcessor} and converts all other {@link GlEffect} instances to separate
|
* MatrixTransformationProcessor} and converts all other {@link GlEffect} instances to separate
|
||||||
* {@link GlTextureProcessor} instances.
|
* {@link GlTextureProcessor} instances.
|
||||||
*
|
*
|
||||||
|
* <p>All {@link Effect} instances must be {@link GlEffect} instances.
|
||||||
|
*
|
||||||
* @return A non-empty list of {@link GlTextureProcessor} instances to apply in the given order.
|
* @return A non-empty list of {@link GlTextureProcessor} instances to apply in the given order.
|
||||||
* The first is an {@link ExternalTextureProcessor} and the last is a {@link
|
* The first is an {@link ExternalTextureProcessor} and the last is a {@link
|
||||||
* FinalMatrixTransformationProcessorWrapper}.
|
* FinalMatrixTransformationProcessorWrapper}.
|
||||||
*/
|
*/
|
||||||
private static ImmutableList<GlTextureProcessor> getGlTextureProcessorsForGlEffects(
|
private static ImmutableList<GlTextureProcessor> getGlTextureProcessorsForGlEffects(
|
||||||
Context context,
|
Context context,
|
||||||
List<GlEffect> effects,
|
List<Effect> effects,
|
||||||
EGLDisplay eglDisplay,
|
EGLDisplay eglDisplay,
|
||||||
EGLContext eglContext,
|
EGLContext eglContext,
|
||||||
FrameProcessor.Listener listener,
|
FrameProcessor.Listener listener,
|
||||||
@ -161,9 +168,11 @@ public final class GlEffectsFrameProcessor implements FrameProcessor {
|
|||||||
new ImmutableList.Builder<>();
|
new ImmutableList.Builder<>();
|
||||||
boolean sampleFromExternalTexture = true;
|
boolean sampleFromExternalTexture = true;
|
||||||
for (int i = 0; i < effects.size(); i++) {
|
for (int i = 0; i < effects.size(); i++) {
|
||||||
GlEffect effect = effects.get(i);
|
Effect effect = effects.get(i);
|
||||||
if (effect instanceof GlMatrixTransformation) {
|
checkArgument(effect instanceof GlEffect, "GlEffectsFrameProcessor only supports GlEffects");
|
||||||
matrixTransformationListBuilder.add((GlMatrixTransformation) effect);
|
GlEffect glEffect = (GlEffect) effect;
|
||||||
|
if (glEffect instanceof GlMatrixTransformation) {
|
||||||
|
matrixTransformationListBuilder.add((GlMatrixTransformation) glEffect);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ImmutableList<GlMatrixTransformation> matrixTransformations =
|
ImmutableList<GlMatrixTransformation> matrixTransformations =
|
||||||
@ -179,7 +188,7 @@ public final class GlEffectsFrameProcessor implements FrameProcessor {
|
|||||||
matrixTransformationListBuilder = new ImmutableList.Builder<>();
|
matrixTransformationListBuilder = new ImmutableList.Builder<>();
|
||||||
sampleFromExternalTexture = false;
|
sampleFromExternalTexture = false;
|
||||||
}
|
}
|
||||||
textureProcessorListBuilder.add(effect.toGlTextureProcessor(context, useHdr));
|
textureProcessorListBuilder.add(glEffect.toGlTextureProcessor(context, useHdr));
|
||||||
}
|
}
|
||||||
textureProcessorListBuilder.add(
|
textureProcessorListBuilder.add(
|
||||||
new FinalMatrixTransformationProcessorWrapper(
|
new FinalMatrixTransformationProcessorWrapper(
|
||||||
|
@ -103,7 +103,7 @@ public final class Transformer {
|
|||||||
private boolean removeVideo;
|
private boolean removeVideo;
|
||||||
private String containerMimeType;
|
private String containerMimeType;
|
||||||
private TransformationRequest transformationRequest;
|
private TransformationRequest transformationRequest;
|
||||||
private ImmutableList<GlEffect> videoEffects;
|
private ImmutableList<Effect> videoEffects;
|
||||||
private FrameProcessor.Factory frameProcessorFactory;
|
private FrameProcessor.Factory frameProcessorFactory;
|
||||||
private ListenerSet<Transformer.Listener> listeners;
|
private ListenerSet<Transformer.Listener> listeners;
|
||||||
private DebugViewProvider debugViewProvider;
|
private DebugViewProvider debugViewProvider;
|
||||||
@ -168,32 +168,36 @@ public final class Transformer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the {@linkplain GlEffect effects} to apply to each video frame.
|
* Sets the {@link Effect} instances to apply to each video frame.
|
||||||
*
|
*
|
||||||
* <p>The {@linkplain GlEffect effects} are applied before any {@linkplain
|
* <p>The {@link Effect} instances are applied before any {@linkplain
|
||||||
* TransformationRequest.Builder#setScale(float, float) scale}, {@linkplain
|
* TransformationRequest.Builder#setScale(float, float) scale}, {@linkplain
|
||||||
* TransformationRequest.Builder#setRotationDegrees(float) rotation}, or {@linkplain
|
* TransformationRequest.Builder#setRotationDegrees(float) rotation}, or {@linkplain
|
||||||
* TransformationRequest.Builder#setResolution(int) resolution} changes specified in the {@link
|
* TransformationRequest.Builder#setResolution(int) resolution} changes specified in the {@link
|
||||||
* #setTransformationRequest(TransformationRequest) TransformationRequest} but after {@linkplain
|
* #setTransformationRequest(TransformationRequest) TransformationRequest} but after {@linkplain
|
||||||
* TransformationRequest.Builder#setFlattenForSlowMotion(boolean) slow-motion flattening}.
|
* TransformationRequest.Builder#setFlattenForSlowMotion(boolean) slow-motion flattening}.
|
||||||
*
|
*
|
||||||
* @param effects The {@linkplain GlEffect effects} to apply to each video frame.
|
* <p>The default {@link FrameProcessor} only supports {@link GlEffect} instances. To use other
|
||||||
|
* effects, call {@link #setFrameProcessorFactory(FrameProcessor.Factory)} with a custom {@link
|
||||||
|
* FrameProcessor.Factory}.
|
||||||
|
*
|
||||||
|
* @param effects The {@link Effect} instances to apply to each video frame.
|
||||||
* @return This builder.
|
* @return This builder.
|
||||||
*/
|
*/
|
||||||
@CanIgnoreReturnValue
|
@CanIgnoreReturnValue
|
||||||
public Builder setVideoEffects(List<GlEffect> effects) {
|
public Builder setVideoEffects(List<Effect> effects) {
|
||||||
this.videoEffects = ImmutableList.copyOf(effects);
|
this.videoEffects = ImmutableList.copyOf(effects);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the {@link FrameProcessor.Factory} for the {@link FrameProcessor} to use when applying
|
* Sets the {@link FrameProcessor.Factory} for the {@link FrameProcessor} to use when applying
|
||||||
* {@linkplain GlEffect effects} to the video frames.
|
* {@linkplain Effect effects} to the video frames.
|
||||||
*
|
*
|
||||||
* <p>This factory will be used to create the {@link FrameProcessor} used for applying the
|
* <p>This factory will be used to create the {@link FrameProcessor} used for applying the
|
||||||
* {@link GlEffect} instances passed to {@link #setVideoEffects(List<GlEffect>)} and any
|
* {@link Effect} instances passed to {@link #setVideoEffects(List<Effect>)} and any additional
|
||||||
* additional {@link GlMatrixTransformation} instances derived from the {@link
|
* {@link GlMatrixTransformation} instances derived from the {@link TransformationRequest} set
|
||||||
* TransformationRequest} set using {@link #setTransformationRequest(TransformationRequest)}.
|
* using {@link #setTransformationRequest(TransformationRequest)}.
|
||||||
*
|
*
|
||||||
* <p>The default is {@link GlEffectsFrameProcessor.Factory}.
|
* <p>The default is {@link GlEffectsFrameProcessor.Factory}.
|
||||||
*
|
*
|
||||||
@ -571,7 +575,7 @@ public final class Transformer {
|
|||||||
private final boolean removeVideo;
|
private final boolean removeVideo;
|
||||||
private final String containerMimeType;
|
private final String containerMimeType;
|
||||||
private final TransformationRequest transformationRequest;
|
private final TransformationRequest transformationRequest;
|
||||||
private final ImmutableList<GlEffect> videoEffects;
|
private final ImmutableList<Effect> videoEffects;
|
||||||
private final FrameProcessor.Factory frameProcessorFactory;
|
private final FrameProcessor.Factory frameProcessorFactory;
|
||||||
private final Looper looper;
|
private final Looper looper;
|
||||||
private final Clock clock;
|
private final Clock clock;
|
||||||
@ -593,7 +597,7 @@ public final class Transformer {
|
|||||||
boolean removeVideo,
|
boolean removeVideo,
|
||||||
String containerMimeType,
|
String containerMimeType,
|
||||||
TransformationRequest transformationRequest,
|
TransformationRequest transformationRequest,
|
||||||
ImmutableList<GlEffect> videoEffects,
|
ImmutableList<Effect> videoEffects,
|
||||||
FrameProcessor.Factory frameProcessorFactory,
|
FrameProcessor.Factory frameProcessorFactory,
|
||||||
ListenerSet<Transformer.Listener> listeners,
|
ListenerSet<Transformer.Listener> listeners,
|
||||||
Looper looper,
|
Looper looper,
|
||||||
@ -874,7 +878,7 @@ public final class Transformer {
|
|||||||
private final boolean removeVideo;
|
private final boolean removeVideo;
|
||||||
private final TransformationRequest transformationRequest;
|
private final TransformationRequest transformationRequest;
|
||||||
private final boolean clippingStartsAtKeyFrame;
|
private final boolean clippingStartsAtKeyFrame;
|
||||||
private final ImmutableList<GlEffect> videoEffects;
|
private final ImmutableList<Effect> videoEffects;
|
||||||
private final FrameProcessor.Factory frameProcessorFactory;
|
private final FrameProcessor.Factory frameProcessorFactory;
|
||||||
private final Codec.EncoderFactory encoderFactory;
|
private final Codec.EncoderFactory encoderFactory;
|
||||||
private final Codec.DecoderFactory decoderFactory;
|
private final Codec.DecoderFactory decoderFactory;
|
||||||
@ -889,7 +893,7 @@ public final class Transformer {
|
|||||||
boolean removeVideo,
|
boolean removeVideo,
|
||||||
TransformationRequest transformationRequest,
|
TransformationRequest transformationRequest,
|
||||||
boolean clippingStartsAtKeyFrame,
|
boolean clippingStartsAtKeyFrame,
|
||||||
ImmutableList<GlEffect> videoEffects,
|
ImmutableList<Effect> videoEffects,
|
||||||
FrameProcessor.Factory frameProcessorFactory,
|
FrameProcessor.Factory frameProcessorFactory,
|
||||||
Codec.EncoderFactory encoderFactory,
|
Codec.EncoderFactory encoderFactory,
|
||||||
Codec.DecoderFactory decoderFactory,
|
Codec.DecoderFactory decoderFactory,
|
||||||
|
@ -38,7 +38,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
|||||||
|
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private final boolean clippingStartsAtKeyFrame;
|
private final boolean clippingStartsAtKeyFrame;
|
||||||
private final ImmutableList<GlEffect> effects;
|
private final ImmutableList<Effect> effects;
|
||||||
private final FrameProcessor.Factory frameProcessorFactory;
|
private final FrameProcessor.Factory frameProcessorFactory;
|
||||||
private final Codec.EncoderFactory encoderFactory;
|
private final Codec.EncoderFactory encoderFactory;
|
||||||
private final Codec.DecoderFactory decoderFactory;
|
private final Codec.DecoderFactory decoderFactory;
|
||||||
@ -53,7 +53,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
|||||||
TransformerMediaClock mediaClock,
|
TransformerMediaClock mediaClock,
|
||||||
TransformationRequest transformationRequest,
|
TransformationRequest transformationRequest,
|
||||||
boolean clippingStartsAtKeyFrame,
|
boolean clippingStartsAtKeyFrame,
|
||||||
ImmutableList<GlEffect> effects,
|
ImmutableList<Effect> effects,
|
||||||
FrameProcessor.Factory frameProcessorFactory,
|
FrameProcessor.Factory frameProcessorFactory,
|
||||||
Codec.EncoderFactory encoderFactory,
|
Codec.EncoderFactory encoderFactory,
|
||||||
Codec.DecoderFactory decoderFactory,
|
Codec.DecoderFactory decoderFactory,
|
||||||
|
@ -57,7 +57,7 @@ import org.checkerframework.dataflow.qual.Pure;
|
|||||||
Format inputFormat,
|
Format inputFormat,
|
||||||
long streamOffsetUs,
|
long streamOffsetUs,
|
||||||
TransformationRequest transformationRequest,
|
TransformationRequest transformationRequest,
|
||||||
ImmutableList<GlEffect> effects,
|
ImmutableList<Effect> effects,
|
||||||
FrameProcessor.Factory frameProcessorFactory,
|
FrameProcessor.Factory frameProcessorFactory,
|
||||||
Codec.DecoderFactory decoderFactory,
|
Codec.DecoderFactory decoderFactory,
|
||||||
Codec.EncoderFactory encoderFactory,
|
Codec.EncoderFactory encoderFactory,
|
||||||
@ -78,8 +78,8 @@ import org.checkerframework.dataflow.qual.Pure;
|
|||||||
int decodedHeight =
|
int decodedHeight =
|
||||||
(inputFormat.rotationDegrees % 180 == 0) ? inputFormat.height : inputFormat.width;
|
(inputFormat.rotationDegrees % 180 == 0) ? inputFormat.height : inputFormat.width;
|
||||||
|
|
||||||
ImmutableList.Builder<GlEffect> effectsListBuilder =
|
ImmutableList.Builder<Effect> effectsListBuilder =
|
||||||
new ImmutableList.Builder<GlEffect>().addAll(effects);
|
new ImmutableList.Builder<Effect>().addAll(effects);
|
||||||
if (transformationRequest.scaleX != 1f
|
if (transformationRequest.scaleX != 1f
|
||||||
|| transformationRequest.scaleY != 1f
|
|| transformationRequest.scaleY != 1f
|
||||||
|| transformationRequest.rotationDegrees != 0f) {
|
|| transformationRequest.rotationDegrees != 0f) {
|
||||||
@ -136,7 +136,7 @@ import org.checkerframework.dataflow.qual.Pure;
|
|||||||
debugViewProvider,
|
debugViewProvider,
|
||||||
// HDR is only used if the MediaCodec encoder supports FEATURE_HdrEditing. This
|
// HDR is only used if the MediaCodec encoder supports FEATURE_HdrEditing. This
|
||||||
// implies that the OpenGL EXT_YUV_target extension is supported and hence the
|
// implies that the OpenGL EXT_YUV_target extension is supported and hence the
|
||||||
// GlEffectsFrameProcessor also supports HDR.
|
// default FrameProcessor, GlEffectsFrameProcessor, also supports HDR.
|
||||||
/* useHdr= */ encoderWrapper.isHdrEditingEnabled());
|
/* useHdr= */ encoderWrapper.isHdrEditingEnabled());
|
||||||
} catch (FrameProcessingException e) {
|
} catch (FrameProcessingException e) {
|
||||||
throw TransformationException.createForFrameProcessingException(
|
throw TransformationException.createForFrameProcessingException(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user