Support changing input colorinfo for images
since we now can support taking in the inputColor upon registering the stream, there is no need to hardcode the image input color anymore. We should now be able to support switching between texture and image input which we couldn't before, but this is untested and not necessary. PiperOrigin-RevId: 601784149
This commit is contained in:
parent
b1c1c2a6dd
commit
7424cffce1
@ -28,7 +28,6 @@ import static androidx.media3.common.util.Util.contains;
|
||||
import android.content.Context;
|
||||
import android.util.SparseArray;
|
||||
import android.view.Surface;
|
||||
import androidx.media3.common.C;
|
||||
import androidx.media3.common.ColorInfo;
|
||||
import androidx.media3.common.FrameInfo;
|
||||
import androidx.media3.common.GlObjectsProvider;
|
||||
@ -99,16 +98,13 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
context, inputColorInfo, outputColorInfo, enableColorTransfers);
|
||||
break;
|
||||
case INPUT_TYPE_BITMAP:
|
||||
// HDR bitmap input is not supported. Bitmaps are always sRGB/Full range/BT.709.
|
||||
// HDR bitmap input is not supported.
|
||||
checkState(!ColorInfo.isTransferHdr(inputColorInfo));
|
||||
ColorInfo bitmapColorInfo = ColorInfo.SRGB_BT709_FULL;
|
||||
samplingShaderProgram =
|
||||
DefaultShaderProgram.createWithInternalSampler(
|
||||
context, bitmapColorInfo, outputColorInfo, enableColorTransfers, inputType);
|
||||
context, inputColorInfo, outputColorInfo, enableColorTransfers, inputType);
|
||||
break;
|
||||
case INPUT_TYPE_TEXTURE_ID:
|
||||
// Image and textureId concatenation not supported.
|
||||
checkState(inputColorInfo.colorTransfer != C.COLOR_TRANSFER_SRGB);
|
||||
samplingShaderProgram =
|
||||
DefaultShaderProgram.createWithInternalSampler(
|
||||
context, inputColorInfo, outputColorInfo, enableColorTransfers, inputType);
|
||||
|
@ -68,10 +68,14 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
boolean isLast) {
|
||||
if (trackFormat != null) {
|
||||
Size decodedSize = getDecodedSize(trackFormat);
|
||||
ColorInfo colorInfo =
|
||||
trackFormat.colorInfo == null || !trackFormat.colorInfo.isDataSpaceValid()
|
||||
? inputColorInfo
|
||||
: trackFormat.colorInfo;
|
||||
videoFrameProcessor.registerInputStream(
|
||||
getInputType(checkNotNull(trackFormat.sampleMimeType)),
|
||||
createEffectListWithPresentation(editedMediaItem.effects.videoEffects, presentation),
|
||||
new FrameInfo.Builder(inputColorInfo, decodedSize.getWidth(), decodedSize.getHeight())
|
||||
new FrameInfo.Builder(colorInfo, decodedSize.getWidth(), decodedSize.getHeight())
|
||||
.setPixelWidthHeightRatio(trackFormat.pixelWidthHeightRatio)
|
||||
.setOffsetToAddUs(initialTimestampOffsetUs + mediaItemOffsetUs.get())
|
||||
.build());
|
||||
|
Loading…
x
Reference in New Issue
Block a user