Effect: Remove inputColorInfo from create() methods.
Transformer export and ExoPlayer previewing both read inputColorInfo from registerInputStream now, instead of maintaining a consistent input color throughout multiple streams in a sequence. Therefore, we can remove inputColor-related arguments and methods now. PiperOrigin-RevId: 603423509
This commit is contained in:
parent
dd7846ee1c
commit
a27511cc50
@ -31,7 +31,6 @@ public interface PreviewingVideoGraph extends VideoGraph {
|
||||
* Creates a new {@link PreviewingVideoGraph} instance.
|
||||
*
|
||||
* @param context A {@link Context}.
|
||||
* @param inputColorInfo The {@link ColorInfo} for the input frames.
|
||||
* @param outputColorInfo The {@link ColorInfo} for the output frames.
|
||||
* @param debugViewProvider A {@link DebugViewProvider}.
|
||||
* @param listener A {@link Listener}.
|
||||
@ -44,7 +43,6 @@ public interface PreviewingVideoGraph extends VideoGraph {
|
||||
*/
|
||||
PreviewingVideoGraph create(
|
||||
Context context,
|
||||
ColorInfo inputColorInfo,
|
||||
ColorInfo outputColorInfo,
|
||||
DebugViewProvider debugViewProvider,
|
||||
Listener listener,
|
||||
|
@ -67,7 +67,6 @@ public abstract class MultipleInputVideoGraph implements VideoGraph {
|
||||
|
||||
private final Context context;
|
||||
|
||||
private final ColorInfo inputColorInfo;
|
||||
private final ColorInfo outputColorInfo;
|
||||
private final GlObjectsProvider glObjectsProvider;
|
||||
private final DebugViewProvider debugViewProvider;
|
||||
@ -98,16 +97,14 @@ public abstract class MultipleInputVideoGraph implements VideoGraph {
|
||||
|
||||
protected MultipleInputVideoGraph(
|
||||
Context context,
|
||||
ColorInfo inputColorInfo,
|
||||
ColorInfo outputColorInfo,
|
||||
DebugViewProvider debugViewProvider,
|
||||
VideoGraph.Listener listener,
|
||||
Listener listener,
|
||||
Executor listenerExecutor,
|
||||
VideoCompositorSettings videoCompositorSettings,
|
||||
List<Effect> compositionEffects,
|
||||
long initialTimestampOffsetUs) {
|
||||
this.context = context;
|
||||
this.inputColorInfo = inputColorInfo;
|
||||
this.outputColorInfo = outputColorInfo;
|
||||
this.debugViewProvider = debugViewProvider;
|
||||
this.listener = listener;
|
||||
@ -311,10 +308,6 @@ public abstract class MultipleInputVideoGraph implements VideoGraph {
|
||||
released = true;
|
||||
}
|
||||
|
||||
protected ColorInfo getInputColorInfo() {
|
||||
return inputColorInfo;
|
||||
}
|
||||
|
||||
protected long getInitialTimestampOffsetUs() {
|
||||
return initialTimestampOffsetUs;
|
||||
}
|
||||
|
@ -59,7 +59,6 @@ public final class PreviewingSingleInputVideoGraph extends SingleInputVideoGraph
|
||||
@Override
|
||||
public PreviewingVideoGraph create(
|
||||
Context context,
|
||||
ColorInfo inputColorInfo,
|
||||
ColorInfo outputColorInfo,
|
||||
DebugViewProvider debugViewProvider,
|
||||
Listener listener,
|
||||
@ -76,7 +75,6 @@ public final class PreviewingSingleInputVideoGraph extends SingleInputVideoGraph
|
||||
return new PreviewingSingleInputVideoGraph(
|
||||
context,
|
||||
videoFrameProcessorFactory,
|
||||
inputColorInfo,
|
||||
outputColorInfo,
|
||||
debugViewProvider,
|
||||
listener,
|
||||
@ -89,7 +87,6 @@ public final class PreviewingSingleInputVideoGraph extends SingleInputVideoGraph
|
||||
private PreviewingSingleInputVideoGraph(
|
||||
Context context,
|
||||
VideoFrameProcessor.Factory videoFrameProcessorFactory,
|
||||
ColorInfo inputColorInfo,
|
||||
ColorInfo outputColorInfo,
|
||||
DebugViewProvider debugViewProvider,
|
||||
Listener listener,
|
||||
@ -99,7 +96,6 @@ public final class PreviewingSingleInputVideoGraph extends SingleInputVideoGraph
|
||||
super(
|
||||
context,
|
||||
videoFrameProcessorFactory,
|
||||
inputColorInfo,
|
||||
outputColorInfo,
|
||||
listener,
|
||||
debugViewProvider,
|
||||
|
@ -43,7 +43,6 @@ public abstract class SingleInputVideoGraph implements VideoGraph {
|
||||
|
||||
private final Context context;
|
||||
private final VideoFrameProcessor.Factory videoFrameProcessorFactory;
|
||||
private final ColorInfo inputColorInfo;
|
||||
private final ColorInfo outputColorInfo;
|
||||
private final Listener listener;
|
||||
private final DebugViewProvider debugViewProvider;
|
||||
@ -63,11 +62,9 @@ public abstract class SingleInputVideoGraph implements VideoGraph {
|
||||
*
|
||||
* <p>{@code videoCompositorSettings} must be {@link VideoCompositorSettings#DEFAULT}.
|
||||
*/
|
||||
// TODO: b/307952514 - Remove inputColorInfo reference in VideoGraph constructor.
|
||||
public SingleInputVideoGraph(
|
||||
Context context,
|
||||
VideoFrameProcessor.Factory videoFrameProcessorFactory,
|
||||
ColorInfo inputColorInfo,
|
||||
ColorInfo outputColorInfo,
|
||||
Listener listener,
|
||||
DebugViewProvider debugViewProvider,
|
||||
@ -82,7 +79,6 @@ public abstract class SingleInputVideoGraph implements VideoGraph {
|
||||
+ " VideoCompositorSettings");
|
||||
this.context = context;
|
||||
this.videoFrameProcessorFactory = videoFrameProcessorFactory;
|
||||
this.inputColorInfo = inputColorInfo;
|
||||
this.outputColorInfo = outputColorInfo;
|
||||
this.listener = listener;
|
||||
this.debugViewProvider = debugViewProvider;
|
||||
@ -197,10 +193,6 @@ public abstract class SingleInputVideoGraph implements VideoGraph {
|
||||
released = true;
|
||||
}
|
||||
|
||||
protected ColorInfo getInputColorInfo() {
|
||||
return inputColorInfo;
|
||||
}
|
||||
|
||||
protected long getInitialTimestampOffsetUs() {
|
||||
return initialTimestampOffsetUs;
|
||||
}
|
||||
|
@ -203,7 +203,6 @@ public final class CompositingVideoSinkProvider
|
||||
videoGraph =
|
||||
previewingVideoGraphFactory.create(
|
||||
context,
|
||||
inputColorInfo,
|
||||
outputColorInfo,
|
||||
DebugViewProvider.NONE,
|
||||
/* listener= */ thisRef,
|
||||
@ -785,7 +784,6 @@ public final class CompositingVideoSinkProvider
|
||||
@Override
|
||||
public PreviewingVideoGraph create(
|
||||
Context context,
|
||||
ColorInfo inputColorInfo,
|
||||
ColorInfo outputColorInfo,
|
||||
DebugViewProvider debugViewProvider,
|
||||
VideoGraph.Listener listener,
|
||||
@ -803,7 +801,6 @@ public final class CompositingVideoSinkProvider
|
||||
.newInstance(videoFrameProcessorFactory);
|
||||
return factory.create(
|
||||
context,
|
||||
inputColorInfo,
|
||||
outputColorInfo,
|
||||
debugViewProvider,
|
||||
listener,
|
||||
|
@ -182,7 +182,6 @@ public final class CompositingVideoSinkProviderTest {
|
||||
@Override
|
||||
public PreviewingVideoGraph create(
|
||||
Context context,
|
||||
ColorInfo inputColorInfo,
|
||||
ColorInfo outputColorInfo,
|
||||
DebugViewProvider debugViewProvider,
|
||||
VideoGraph.Listener listener,
|
||||
|
@ -21,7 +21,6 @@ import android.graphics.Bitmap;
|
||||
import android.view.Surface;
|
||||
import androidx.annotation.IntDef;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.media3.common.ColorInfo;
|
||||
import androidx.media3.common.OnInputFrameProcessedListener;
|
||||
import androidx.media3.common.util.TimestampIterator;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
@ -156,15 +155,6 @@ public interface SampleConsumer {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the expected input {@link ColorInfo}.
|
||||
*
|
||||
* <p>Should only be used for raw video data.
|
||||
*/
|
||||
default ColorInfo getExpectedInputColorInfo() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of input video frames pending in the consumer. Pending input frames are
|
||||
* frames that have been {@linkplain #registerVideoFrame(long) registered} but not processed off
|
||||
|
@ -28,7 +28,6 @@ import android.os.Looper;
|
||||
import android.view.Surface;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.media3.common.C;
|
||||
import androidx.media3.common.ColorInfo;
|
||||
import androidx.media3.common.Format;
|
||||
import androidx.media3.common.MediaItem;
|
||||
import androidx.media3.common.MimeTypes;
|
||||
@ -454,11 +453,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
return sampleConsumer.getInputSurface();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColorInfo getExpectedInputColorInfo() {
|
||||
return sampleConsumer.getExpectedInputColorInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPendingVideoFrameCount() {
|
||||
return sampleConsumer.getPendingVideoFrameCount();
|
||||
|
@ -39,7 +39,6 @@ import java.util.concurrent.Executor;
|
||||
@Override
|
||||
public TransformerMultipleInputVideoGraph create(
|
||||
Context context,
|
||||
ColorInfo inputColorInfo,
|
||||
ColorInfo outputColorInfo,
|
||||
DebugViewProvider debugViewProvider,
|
||||
VideoGraph.Listener listener,
|
||||
@ -49,7 +48,6 @@ import java.util.concurrent.Executor;
|
||||
long initialTimestampOffsetUs) {
|
||||
return new TransformerMultipleInputVideoGraph(
|
||||
context,
|
||||
inputColorInfo,
|
||||
outputColorInfo,
|
||||
debugViewProvider,
|
||||
listener,
|
||||
@ -62,7 +60,6 @@ import java.util.concurrent.Executor;
|
||||
|
||||
private TransformerMultipleInputVideoGraph(
|
||||
Context context,
|
||||
ColorInfo inputColorInfo,
|
||||
ColorInfo outputColorInfo,
|
||||
DebugViewProvider debugViewProvider,
|
||||
Listener listener,
|
||||
@ -72,7 +69,6 @@ import java.util.concurrent.Executor;
|
||||
long initialTimestampOffsetUs) {
|
||||
super(
|
||||
context,
|
||||
inputColorInfo,
|
||||
outputColorInfo,
|
||||
debugViewProvider,
|
||||
listener,
|
||||
@ -86,9 +82,6 @@ import java.util.concurrent.Executor;
|
||||
public GraphInput createInput() throws VideoFrameProcessingException {
|
||||
int inputId = registerInput();
|
||||
return new VideoFrameProcessingWrapper(
|
||||
getProcessor(inputId),
|
||||
getInputColorInfo(),
|
||||
/* presentation= */ null,
|
||||
getInitialTimestampOffsetUs());
|
||||
getProcessor(inputId), /* presentation= */ null, getInitialTimestampOffsetUs());
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
@Override
|
||||
public TransformerSingleInputVideoGraph create(
|
||||
Context context,
|
||||
ColorInfo inputColorInfo,
|
||||
ColorInfo outputColorInfo,
|
||||
DebugViewProvider debugViewProvider,
|
||||
Listener listener,
|
||||
@ -69,7 +68,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
return new TransformerSingleInputVideoGraph(
|
||||
context,
|
||||
videoFrameProcessorFactory,
|
||||
inputColorInfo,
|
||||
outputColorInfo,
|
||||
listener,
|
||||
debugViewProvider,
|
||||
@ -86,7 +84,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
private TransformerSingleInputVideoGraph(
|
||||
Context context,
|
||||
VideoFrameProcessor.Factory videoFrameProcessorFactory,
|
||||
ColorInfo inputColorInfo,
|
||||
ColorInfo outputColorInfo,
|
||||
Listener listener,
|
||||
DebugViewProvider debugViewProvider,
|
||||
@ -98,7 +95,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
super(
|
||||
context,
|
||||
videoFrameProcessorFactory,
|
||||
inputColorInfo,
|
||||
outputColorInfo,
|
||||
listener,
|
||||
debugViewProvider,
|
||||
@ -115,10 +111,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
int inputId = registerInput();
|
||||
videoFrameProcessingWrapper =
|
||||
new VideoFrameProcessingWrapper(
|
||||
getProcessor(inputId),
|
||||
getInputColorInfo(),
|
||||
getPresentation(),
|
||||
getInitialTimestampOffsetUs());
|
||||
getProcessor(inputId), getPresentation(), getInitialTimestampOffsetUs());
|
||||
return videoFrameProcessingWrapper;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,6 @@ import java.util.concurrent.Executor;
|
||||
* Creates a new {@link TransformerVideoGraph} instance.
|
||||
*
|
||||
* @param context A {@link Context}.
|
||||
* @param inputColorInfo The {@link ColorInfo} for the input frames.
|
||||
* @param outputColorInfo The {@link ColorInfo} for the output frames.
|
||||
* @param debugViewProvider A {@link DebugViewProvider}.
|
||||
* @param listener A {@link Listener}.
|
||||
@ -51,7 +50,6 @@ import java.util.concurrent.Executor;
|
||||
*/
|
||||
TransformerVideoGraph create(
|
||||
Context context,
|
||||
ColorInfo inputColorInfo,
|
||||
ColorInfo outputColorInfo,
|
||||
DebugViewProvider debugViewProvider,
|
||||
Listener listener,
|
||||
|
@ -24,7 +24,6 @@ import static androidx.media3.common.util.Assertions.checkNotNull;
|
||||
import android.graphics.Bitmap;
|
||||
import android.view.Surface;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.media3.common.ColorInfo;
|
||||
import androidx.media3.common.Effect;
|
||||
import androidx.media3.common.Format;
|
||||
import androidx.media3.common.FrameInfo;
|
||||
@ -42,19 +41,15 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
/* package */ final class VideoFrameProcessingWrapper implements GraphInput {
|
||||
private final VideoFrameProcessor videoFrameProcessor;
|
||||
private final AtomicLong mediaItemOffsetUs;
|
||||
private final ColorInfo inputColorInfo;
|
||||
private final long initialTimestampOffsetUs;
|
||||
@Nullable final Presentation presentation;
|
||||
|
||||
public VideoFrameProcessingWrapper(
|
||||
VideoFrameProcessor videoFrameProcessor,
|
||||
ColorInfo inputColorInfo,
|
||||
@Nullable Presentation presentation,
|
||||
long initialTimestampOffsetUs) {
|
||||
this.videoFrameProcessor = videoFrameProcessor;
|
||||
this.mediaItemOffsetUs = new AtomicLong();
|
||||
// TODO: b/307952514 - Remove inputColorInfo reference.
|
||||
this.inputColorInfo = inputColorInfo;
|
||||
this.initialTimestampOffsetUs = initialTimestampOffsetUs;
|
||||
this.presentation = presentation;
|
||||
}
|
||||
@ -106,11 +101,6 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
return videoFrameProcessor.getInputSurface();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColorInfo getExpectedInputColorInfo() {
|
||||
return inputColorInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPendingVideoFrameCount() {
|
||||
return videoFrameProcessor.getPendingInputFrameCount();
|
||||
|
@ -156,7 +156,6 @@ import org.checkerframework.dataflow.qual.Pure;
|
||||
hasMultipleInputs
|
||||
? new TransformerMultipleInputVideoGraph.Factory()
|
||||
: new TransformerSingleInputVideoGraph.Factory(videoFrameProcessorFactory),
|
||||
videoGraphInputColor,
|
||||
videoGraphOutputColor,
|
||||
errorConsumer,
|
||||
debugViewProvider,
|
||||
@ -484,7 +483,6 @@ import org.checkerframework.dataflow.qual.Pure;
|
||||
public VideoGraphWrapper(
|
||||
Context context,
|
||||
TransformerVideoGraph.Factory videoGraphFactory,
|
||||
ColorInfo videoFrameProcessorInputColor,
|
||||
ColorInfo videoFrameProcessorOutputColor,
|
||||
Consumer<ExportException> errorConsumer,
|
||||
DebugViewProvider debugViewProvider,
|
||||
@ -500,7 +498,6 @@ import org.checkerframework.dataflow.qual.Pure;
|
||||
videoGraph =
|
||||
videoGraphFactory.create(
|
||||
context,
|
||||
videoFrameProcessorInputColor,
|
||||
videoFrameProcessorOutputColor,
|
||||
debugViewProvider,
|
||||
/* listener= */ thisRef,
|
||||
|
Loading…
x
Reference in New Issue
Block a user