fix naming and formatting

This commit is contained in:
Patrik Aradi 2024-02-06 11:14:14 +08:00 committed by Luyuan Chen
parent b909162daa
commit 84df55c6e8
6 changed files with 17 additions and 21 deletions

View File

@ -27,7 +27,6 @@ import android.opengl.EGLDisplay;
import android.opengl.EGLSurface; import android.opengl.EGLSurface;
import android.opengl.GLES20; import android.opengl.GLES20;
import android.util.SparseArray; import android.util.SparseArray;
import androidx.annotation.GuardedBy; import androidx.annotation.GuardedBy;
import androidx.annotation.IntRange; import androidx.annotation.IntRange;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@ -43,18 +42,15 @@ import androidx.media3.common.util.LongArrayQueue;
import androidx.media3.common.util.Size; import androidx.media3.common.util.Size;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util; import androidx.media3.common.util.Util;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayDeque; import java.util.ArrayDeque;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Queue; import java.util.Queue;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/** /**
* A basic {@link VideoCompositor} implementation that takes in frames from input sources' streams * A basic {@link VideoCompositor} implementation that takes in frames from input sources' streams
@ -146,9 +142,9 @@ public final class DefaultVideoCompositor implements VideoCompositor {
} }
@Override @Override
public synchronized int registerInputSource(int sequenceId) { public synchronized int registerInputSource(int sequenceIndex) {
inputSources.put(sequenceId, new InputSource()); inputSources.put(sequenceIndex, new InputSource());
return sequenceId; return sequenceIndex;
} }
@Override @Override

View File

@ -257,7 +257,6 @@ public abstract class MultipleInputVideoGraph implements VideoGraph {
onPreProcessingVideoFrameProcessorEnded(videoCompositorInputId); onPreProcessingVideoFrameProcessorEnded(videoCompositorInputId);
} }
}); });
preProcessors.put(videoCompositorInputId, preProcessor); preProcessors.put(videoCompositorInputId, preProcessor);
return videoCompositorInputId; return videoCompositorInputId;
} }

View File

@ -49,10 +49,10 @@ public interface VideoCompositor extends GlTextureProducer {
* Registers a new input source, and returns a unique {@code inputId} corresponding to this * Registers a new input source, and returns a unique {@code inputId} corresponding to this
* source, to be used in {@link #queueInputTexture}. * source, to be used in {@link #queueInputTexture}.
* *
* @param sequenceId The sequence ID of the input source, which is can be used to determine the * @param sequenceIndex The sequence index of the input source, which is can be used to determine
* order of the input sources. * the order of the input sources.
*/ */
int registerInputSource(int sequenceId); int registerInputSource(int sequenceIndex);
/** /**
* Signals that no more frames will come from the upstream {@link GlTextureProducer.Listener}. * Signals that no more frames will come from the upstream {@link GlTextureProducer.Listener}.
* *

View File

@ -67,7 +67,8 @@ import java.util.List;
* @param sequenceIndex The sequence index of the input. * @param sequenceIndex The sequence index of the input.
* @throws ExportException If an error occurs getting the input. * @throws ExportException If an error occurs getting the input.
*/ */
public abstract GraphInput getInput(EditedMediaItem editedMediaItem, Format format, int sequenceIndex) throws ExportException; public abstract GraphInput getInput(
EditedMediaItem editedMediaItem, Format format, int sequenceIndex) throws ExportException;
/** /**
* Processes the input data and returns whether it may be possible to process more data by calling * Processes the input data and returns whether it may be possible to process more data by calling

View File

@ -637,7 +637,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
} }
GraphInput sampleExporterInput = GraphInput sampleExporterInput =
sampleExporter.getInput(firstEditedMediaItem, assetLoaderOutputFormat, sequenceIndex); sampleExporter.getInput(firstEditedMediaItem, assetLoaderOutputFormat, sequenceIndex);
OnMediaItemChangedListener onMediaItemChangedListener = OnMediaItemChangedListener onMediaItemChangedListener =
(editedMediaItem, durationUs, decodedFormat, isLast) -> { (editedMediaItem, durationUs, decodedFormat, isLast) -> {
onMediaItemChanged(trackType, durationUs, isLast); onMediaItemChanged(trackType, durationUs, isLast);

View File

@ -59,8 +59,6 @@ import java.util.Objects;
import org.checkerframework.checker.initialization.qual.Initialized; import org.checkerframework.checker.initialization.qual.Initialized;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.dataflow.qual.Pure;
import java.nio.ByteBuffer;
import java.util.List;
/** Processes, encodes and muxes raw video frames. */ /** Processes, encodes and muxes raw video frames. */
/* package */ final class VideoSampleExporter extends SampleExporter { /* package */ final class VideoSampleExporter extends SampleExporter {
@ -276,14 +274,16 @@ import java.util.List;
ImmutableList<MediaCodecInfo> hdrEncoders = ImmutableList<MediaCodecInfo> hdrEncoders =
getSupportedEncodersForHdrEditing(requestedOutputMimeType, inputFormat.colorInfo); getSupportedEncodersForHdrEditing(requestedOutputMimeType, inputFormat.colorInfo);
if (hdrEncoders.isEmpty()) { if (hdrEncoders.isEmpty()) {
// Fallback H.265/HEVC codecs for HDR content to avoid tonemapping. @Nullable
hdrEncoders = String alternativeMimeType = MediaCodecUtil.getAlternativeCodecMimeType(inputFormat);
getSupportedEncodersForHdrEditing(MimeTypes.VIDEO_H265, inputFormat.colorInfo); if (alternativeMimeType != null) {
requestedOutputMimeType = alternativeMimeType;
hdrEncoders =
getSupportedEncodersForHdrEditing(alternativeMimeType, inputFormat.colorInfo);
}
} }
if (hdrEncoders.isEmpty()) { if (hdrEncoders.isEmpty()) {
hdrMode = HDR_MODE_TONE_MAP_HDR_TO_SDR_USING_OPEN_GL; hdrMode = HDR_MODE_TONE_MAP_HDR_TO_SDR_USING_OPEN_GL;
} else {
requestedOutputMimeType = MimeTypes.VIDEO_H265;
} }
} }