Move effect setters to VideoSink
PiperOrigin-RevId: 631011252
This commit is contained in:
parent
2c912aa697
commit
506944dcfd
@ -258,16 +258,6 @@ public final class CompositingVideoSinkProvider
|
|||||||
return videoFrameReleaseControl;
|
return videoFrameReleaseControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setVideoEffects(List<Effect> videoEffects) {
|
|
||||||
videoSinkImpl.setVideoEffects(videoEffects);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPendingVideoEffects(List<Effect> videoEffects) {
|
|
||||||
videoSinkImpl.setPendingVideoEffects(videoEffects);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VideoSink getSink() {
|
public VideoSink getSink() {
|
||||||
return videoSinkImpl;
|
return videoSinkImpl;
|
||||||
@ -679,6 +669,18 @@ public final class CompositingVideoSinkProvider
|
|||||||
CompositingVideoSinkProvider.this.setPlaybackSpeed(speed);
|
CompositingVideoSinkProvider.this.setPlaybackSpeed(speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setVideoEffects(List<Effect> videoEffects) {
|
||||||
|
setPendingVideoEffects(videoEffects);
|
||||||
|
maybeRegisterInputStream();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPendingVideoEffects(List<Effect> videoEffects) {
|
||||||
|
this.videoEffects.clear();
|
||||||
|
this.videoEffects.addAll(videoEffects);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setStreamOffsetUs(long streamOffsetUs) {
|
public void setStreamOffsetUs(long streamOffsetUs) {
|
||||||
pendingInputStreamOffsetChange = inputStreamOffsetUs != streamOffsetUs;
|
pendingInputStreamOffsetChange = inputStreamOffsetUs != streamOffsetUs;
|
||||||
@ -771,21 +773,6 @@ public final class CompositingVideoSinkProvider
|
|||||||
|
|
||||||
// Other methods
|
// Other methods
|
||||||
|
|
||||||
/** Sets the {@linkplain Effect video effects}. */
|
|
||||||
public void setVideoEffects(List<Effect> videoEffects) {
|
|
||||||
setPendingVideoEffects(videoEffects);
|
|
||||||
maybeRegisterInputStream();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the {@linkplain Effect video effects} to apply when the next stream is {@linkplain
|
|
||||||
* #registerInputStream(int, Format) registered}.
|
|
||||||
*/
|
|
||||||
public void setPendingVideoEffects(List<Effect> videoEffects) {
|
|
||||||
this.videoEffects.clear();
|
|
||||||
this.videoEffects.addAll(videoEffects);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void maybeSetStreamOffsetChange(long bufferPresentationTimeUs) {
|
private void maybeSetStreamOffsetChange(long bufferPresentationTimeUs) {
|
||||||
if (pendingInputStreamOffsetChange) {
|
if (pendingInputStreamOffsetChange) {
|
||||||
CompositingVideoSinkProvider.this.onStreamOffsetChange(
|
CompositingVideoSinkProvider.this.onStreamOffsetChange(
|
||||||
|
@ -1104,7 +1104,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
|||||||
|
|
||||||
/** Sets the {@linkplain Effect video effects} to apply. */
|
/** Sets the {@linkplain Effect video effects} to apply. */
|
||||||
public void setVideoEffects(List<Effect> effects) {
|
public void setVideoEffects(List<Effect> effects) {
|
||||||
videoSinkProvider.setVideoEffects(effects);
|
videoSink.setVideoEffects(effects);
|
||||||
hasEffects = true;
|
hasEffects = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ import android.view.Surface;
|
|||||||
import androidx.annotation.FloatRange;
|
import androidx.annotation.FloatRange;
|
||||||
import androidx.annotation.IntDef;
|
import androidx.annotation.IntDef;
|
||||||
import androidx.media3.common.C;
|
import androidx.media3.common.C;
|
||||||
|
import androidx.media3.common.Effect;
|
||||||
import androidx.media3.common.Format;
|
import androidx.media3.common.Format;
|
||||||
import androidx.media3.common.VideoSize;
|
import androidx.media3.common.VideoSize;
|
||||||
import androidx.media3.common.util.Clock;
|
import androidx.media3.common.util.Clock;
|
||||||
@ -31,6 +32,7 @@ import java.lang.annotation.Documented;
|
|||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
|
||||||
/** A sink that consumes decoded video frames. */
|
/** A sink that consumes decoded video frames. */
|
||||||
@ -158,6 +160,15 @@ public interface VideoSink {
|
|||||||
/** Sets the playback speed. */
|
/** Sets the playback speed. */
|
||||||
void setPlaybackSpeed(@FloatRange(from = 0, fromInclusive = false) float speed);
|
void setPlaybackSpeed(@FloatRange(from = 0, fromInclusive = false) float speed);
|
||||||
|
|
||||||
|
/** Sets {@linkplain Effect video effects} to apply immediately. */
|
||||||
|
void setVideoEffects(List<Effect> videoEffects);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets {@linkplain Effect video effects} to apply after the next stream is {@linkplain
|
||||||
|
* VideoSink#registerInputStream(int, Format) registered}.
|
||||||
|
*/
|
||||||
|
void setPendingVideoEffects(List<Effect> videoEffects);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the offset, in microseconds, that is added to the video frames presentation timestamps
|
* Sets the offset, in microseconds, that is added to the video frames presentation timestamps
|
||||||
* from the player.
|
* from the player.
|
||||||
|
@ -17,12 +17,10 @@
|
|||||||
package androidx.media3.exoplayer.video;
|
package androidx.media3.exoplayer.video;
|
||||||
|
|
||||||
import android.view.Surface;
|
import android.view.Surface;
|
||||||
import androidx.media3.common.Effect;
|
|
||||||
import androidx.media3.common.Format;
|
import androidx.media3.common.Format;
|
||||||
import androidx.media3.common.util.Clock;
|
import androidx.media3.common.util.Clock;
|
||||||
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 java.util.List;
|
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
/** A provider of {@link VideoSink VideoSinks}. */
|
/** A provider of {@link VideoSink VideoSinks}. */
|
||||||
@ -47,15 +45,6 @@ public interface VideoSinkProvider {
|
|||||||
*/
|
*/
|
||||||
@Nullable VideoFrameReleaseControl getVideoFrameReleaseControl();
|
@Nullable VideoFrameReleaseControl getVideoFrameReleaseControl();
|
||||||
|
|
||||||
/** Sets video effects on this provider to apply immediately. */
|
|
||||||
void setVideoEffects(List<Effect> videoEffects);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets video effects on this provider to apply when the next stream is {@linkplain
|
|
||||||
* VideoSink#registerInputStream(int, Format) registered} on the {@link #getSink() VideoSink}.
|
|
||||||
*/
|
|
||||||
void setPendingVideoEffects(List<Effect> videoEffects);
|
|
||||||
|
|
||||||
/** Returns a {@link VideoSink} to forward video frames for processing. */
|
/** Returns a {@link VideoSink} to forward video frames for processing. */
|
||||||
VideoSink getSink();
|
VideoSink getSink();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user