Move FrameProcessor and related interfaces to common.

This will allow effects preview in ExoPlayer to use the
Effect and FrameProcessor interface (and the interfaces
they depend on) without depending on transformer or the
future effects module.

PiperOrigin-RevId: 464060047
This commit is contained in:
Googler 2022-07-29 12:54:30 +00:00 committed by Marc Baechinger
parent 9df0d40583
commit 06d41c2775
33 changed files with 61 additions and 13 deletions

View File

@ -29,8 +29,8 @@ import android.graphics.drawable.BitmapDrawable;
import android.opengl.GLES20;
import android.opengl.GLUtils;
import android.util.Pair;
import androidx.media3.common.FrameProcessingException;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.transformer.FrameProcessingException;
import com.google.android.exoplayer2.transformer.SingleFrameGlTextureProcessor;
import com.google.android.exoplayer2.util.GlProgram;
import com.google.android.exoplayer2.util.GlUtil;

View File

@ -20,7 +20,7 @@ import static com.google.android.exoplayer2.util.Assertions.checkArgument;
import android.content.Context;
import android.opengl.GLES20;
import android.util.Pair;
import com.google.android.exoplayer2.transformer.FrameProcessingException;
import androidx.media3.common.FrameProcessingException;
import com.google.android.exoplayer2.transformer.SingleFrameGlTextureProcessor;
import com.google.android.exoplayer2.util.GlProgram;
import com.google.android.exoplayer2.util.GlUtil;

View File

@ -35,13 +35,13 @@ import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AppCompatActivity;
import androidx.media3.common.DebugViewProvider;
import androidx.media3.common.Effect;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.transformer.Contrast;
import com.google.android.exoplayer2.transformer.DebugViewProvider;
import com.google.android.exoplayer2.transformer.DefaultEncoderFactory;
import com.google.android.exoplayer2.transformer.Effect;
import com.google.android.exoplayer2.transformer.GlEffect;
import com.google.android.exoplayer2.transformer.GlTextureProcessor;
import com.google.android.exoplayer2.transformer.ProgressHolder;

View File

@ -24,8 +24,8 @@ import android.opengl.EGL14;
import android.os.Build;
import androidx.annotation.ChecksSdkIntAtLeast;
import androidx.annotation.Nullable;
import androidx.media3.common.FrameProcessingException;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.transformer.FrameProcessingException;
import com.google.android.exoplayer2.transformer.GlTextureProcessor;
import com.google.android.exoplayer2.transformer.TextureInfo;
import com.google.android.exoplayer2.util.LibraryLoader;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.exoplayer2.transformer;
package androidx.media3.common;
import android.view.SurfaceView;
import androidx.annotation.Nullable;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.google.android.exoplayer2.transformer;
package androidx.media3.common;
/** Marker interface for a video frame effect. */
public interface Effect {}

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.exoplayer2.transformer;
package androidx.media3.common;
import static com.google.android.exoplayer2.util.Assertions.checkArgument;

View File

@ -13,9 +13,7 @@
* 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.C;
package androidx.media3.common;
/** Thrown when an exception occurs while applying effects to video frames. */
public final class FrameProcessingException extends Exception {

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.exoplayer2.transformer;
package androidx.media3.common;
import android.content.Context;
import android.view.Surface;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.exoplayer2.transformer;
package androidx.media3.common;
import static com.google.android.exoplayer2.util.Assertions.checkArgument;

View File

@ -28,6 +28,7 @@ import android.opengl.EGLContext;
import android.opengl.EGLDisplay;
import android.opengl.EGLSurface;
import android.util.Pair;
import androidx.media3.common.FrameProcessingException;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.util.GlUtil;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;

View File

@ -26,6 +26,7 @@ import android.opengl.EGLContext;
import android.opengl.EGLDisplay;
import android.opengl.EGLSurface;
import android.util.Pair;
import androidx.media3.common.FrameProcessingException;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.util.GlUtil;
import java.io.IOException;

View File

@ -34,6 +34,12 @@ import android.media.MediaExtractor;
import android.media.MediaFormat;
import android.util.Pair;
import androidx.annotation.Nullable;
import androidx.media3.common.DebugViewProvider;
import androidx.media3.common.Effect;
import androidx.media3.common.FrameInfo;
import androidx.media3.common.FrameProcessingException;
import androidx.media3.common.FrameProcessor;
import androidx.media3.common.SurfaceInfo;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.util.MimeTypes;
import com.google.common.collect.ImmutableList;

View File

@ -25,6 +25,7 @@ import android.graphics.Matrix;
import android.opengl.EGLContext;
import android.opengl.EGLDisplay;
import android.opengl.EGLSurface;
import androidx.media3.common.FrameProcessingException;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.util.GlUtil;
import java.io.IOException;

View File

@ -26,6 +26,7 @@ import android.opengl.EGLContext;
import android.opengl.EGLDisplay;
import android.opengl.EGLSurface;
import android.util.Pair;
import androidx.media3.common.FrameProcessingException;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.util.GlUtil;

View File

@ -17,6 +17,8 @@ package com.google.android.exoplayer2.transformer;
import android.util.Pair;
import androidx.annotation.Nullable;
import androidx.media3.common.FrameProcessingException;
import androidx.media3.common.FrameProcessor;
import java.util.ArrayDeque;
import java.util.Queue;

View File

@ -19,6 +19,7 @@ package com.google.android.exoplayer2.transformer;
import static com.google.android.exoplayer2.util.Assertions.checkArgument;
import android.content.Context;
import androidx.media3.common.FrameProcessingException;
/** A {@link GlEffect} to control the contrast of video frames. */
public class Contrast implements GlEffect {

View File

@ -20,6 +20,7 @@ import android.content.Context;
import android.opengl.GLES20;
import android.opengl.Matrix;
import android.util.Pair;
import androidx.media3.common.FrameProcessingException;
import com.google.android.exoplayer2.util.GlProgram;
import com.google.android.exoplayer2.util.GlUtil;
import java.io.IOException;

View File

@ -32,6 +32,10 @@ import android.view.SurfaceView;
import androidx.annotation.GuardedBy;
import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;
import androidx.media3.common.DebugViewProvider;
import androidx.media3.common.FrameProcessingException;
import androidx.media3.common.FrameProcessor;
import androidx.media3.common.SurfaceInfo;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.util.GlUtil;
import com.google.android.exoplayer2.util.Log;

View File

@ -15,6 +15,7 @@
*/
package com.google.android.exoplayer2.transformer;
import androidx.media3.common.FrameProcessingException;
import com.google.android.exoplayer2.util.GlUtil;
/**

View File

@ -17,6 +17,8 @@ package com.google.android.exoplayer2.transformer;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import androidx.media3.common.FrameProcessingException;
import androidx.media3.common.FrameProcessor;
import com.google.android.exoplayer2.util.GlUtil;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ExecutionException;

View File

@ -16,6 +16,8 @@
package com.google.android.exoplayer2.transformer;
import android.content.Context;
import androidx.media3.common.Effect;
import androidx.media3.common.FrameProcessingException;
/**
* Interface for a video frame effect with a {@link GlTextureProcessor} implementation.

View File

@ -28,6 +28,12 @@ import android.opengl.EGLDisplay;
import android.view.Surface;
import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;
import androidx.media3.common.DebugViewProvider;
import androidx.media3.common.Effect;
import androidx.media3.common.FrameInfo;
import androidx.media3.common.FrameProcessingException;
import androidx.media3.common.FrameProcessor;
import androidx.media3.common.SurfaceInfo;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.util.GlUtil;
import com.google.android.exoplayer2.util.Util;

View File

@ -18,6 +18,7 @@ package com.google.android.exoplayer2.transformer;
import android.content.Context;
import android.opengl.Matrix;
import android.util.Pair;
import androidx.media3.common.FrameProcessingException;
/**
* Specifies a 4x4 transformation {@link Matrix} to apply in the vertex shader for each frame.

View File

@ -15,6 +15,8 @@
*/
package com.google.android.exoplayer2.transformer;
import androidx.media3.common.FrameProcessingException;
/**
* Processes frames from one OpenGL 2D texture to another.
*

View File

@ -21,6 +21,7 @@ import android.content.Context;
import android.opengl.GLES20;
import android.opengl.Matrix;
import android.util.Pair;
import androidx.media3.common.FrameProcessingException;
import com.google.android.exoplayer2.util.GlProgram;
import com.google.android.exoplayer2.util.GlUtil;
import com.google.common.collect.ImmutableList;

View File

@ -17,6 +17,7 @@ package com.google.android.exoplayer2.transformer;
import android.util.Pair;
import androidx.annotation.CallSuper;
import androidx.media3.common.FrameProcessingException;
import com.google.android.exoplayer2.util.GlUtil;
import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;

View File

@ -22,6 +22,7 @@ import android.media.MediaFormat;
import android.os.SystemClock;
import androidx.annotation.IntDef;
import androidx.annotation.Nullable;
import androidx.media3.common.FrameProcessingException;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.audio.AudioProcessor;

View File

@ -33,6 +33,9 @@ import androidx.annotation.IntDef;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.VisibleForTesting;
import androidx.media3.common.DebugViewProvider;
import androidx.media3.common.Effect;
import androidx.media3.common.FrameProcessor;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.DefaultLoadControl;
import com.google.android.exoplayer2.ExoPlayer;

View File

@ -21,6 +21,9 @@ import static com.google.android.exoplayer2.util.Assertions.checkNotNull;
import static com.google.android.exoplayer2.util.Util.SDK_INT;
import android.content.Context;
import androidx.media3.common.DebugViewProvider;
import androidx.media3.common.Effect;
import androidx.media3.common.FrameProcessor;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.FormatHolder;

View File

@ -23,6 +23,12 @@ import android.media.MediaCodec;
import android.view.Surface;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.media3.common.DebugViewProvider;
import androidx.media3.common.Effect;
import androidx.media3.common.FrameInfo;
import androidx.media3.common.FrameProcessingException;
import androidx.media3.common.FrameProcessor;
import androidx.media3.common.SurfaceInfo;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.decoder.DecoderInputBuffer;

View File

@ -20,6 +20,8 @@ import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import androidx.media3.common.FrameProcessingException;
import androidx.media3.common.FrameProcessor;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.util.Util;
import org.junit.After;

View File

@ -21,6 +21,7 @@ import static org.mockito.Mockito.when;
import android.net.Uri;
import android.os.Looper;
import androidx.media3.common.SurfaceInfo;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format;